net.grinder.plugin.http.tcpproxyfilter
Class HTTPRecordingImplementation

java.lang.Object
  extended by net.grinder.plugin.http.tcpproxyfilter.HTTPRecordingImplementation
All Implemented Interfaces:
HTTPRecording, org.picocontainer.Disposable

public class HTTPRecordingImplementation
extends Object
implements HTTPRecording, org.picocontainer.Disposable

Contains common state for HTTP recording.

Author:
Philip Aston

Constructor Summary
HTTPRecordingImplementation(HTTPRecordingParameters parameters, HTTPRecordingResultProcessor resultProcessor, org.slf4j.Logger logger, RegularExpressions regularExpressions, URIParser uriParser)
          Constructor.
 
Method Summary
 RequestType addRequest(ConnectionDetails connectionDetails, String method, String relativeURI)
          Add a new request to the recording.
 File createBodyDataFileName()
          Create a new file name for body data.
 void dispose()
          Called after the component has been stopped.
 String getLastValueForToken(String name)
          Return the last value recorded for the given token.
 HTTPRecordingParameters getParameters()
          Return the parameters to use for the recording.
 void markLastResponseTime()
          Called when a response message starts.
 void setTokenReference(String name, String value, TokenReferenceType tokenReference)
          Fill in token reference details, creating the token if necessary.
 boolean tokenReferenceExists(String name, String source)
          Check for existence of token.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTTPRecordingImplementation

public HTTPRecordingImplementation(HTTPRecordingParameters parameters,
                                   HTTPRecordingResultProcessor resultProcessor,
                                   org.slf4j.Logger logger,
                                   RegularExpressions regularExpressions,
                                   URIParser uriParser)
Constructor.

Parameters:
parameters - Recording parameters.
resultProcessor - Component which handles result.
logger - A logger.
regularExpressions - Compiled regular expressions.
uriParser - A URI parser.
Method Detail

getParameters

public HTTPRecordingParameters getParameters()
Return the parameters to use for the recording.

Specified by:
getParameters in interface HTTPRecording
Returns:
The parameters.

addRequest

public RequestType addRequest(ConnectionDetails connectionDetails,
                              String method,
                              String relativeURI)
Add a new request to the recording.

The request is returned to allow the caller to add things it doesn't know yet, e.g. headers, body, response.

Specified by:
addRequest in interface HTTPRecording
Parameters:
connectionDetails - The connection used to make the request.
method - The HTTP method.
relativeURI - The URI.
Returns:
The request.

markLastResponseTime

public void markLastResponseTime()
Called when a response message starts. Because the test script represents a single thread of control we need to calculate the sleep deltas using the last time any response was received on any connection.

Specified by:
markLastResponseTime in interface HTTPRecording

setTokenReference

public void setTokenReference(String name,
                              String value,
                              TokenReferenceType tokenReference)
Fill in token reference details, creating the token if necessary.

The reference source is cached for use by HTTPRecording.tokenReferenceExists(String, String), so it should be set before this method is called.

Specified by:
setTokenReference in interface HTTPRecording
Parameters:
name - The name.
value - The value.
tokenReference - This reference is set with the appropriate token ID, and the new value is set if appropriate.

getLastValueForToken

public String getLastValueForToken(String name)
Return the last value recorded for the given token.

Specified by:
getLastValueForToken in interface HTTPRecording
Parameters:
name - The token name.
Returns:
The last value, or null if no token reference for this token has been seen.

tokenReferenceExists

public boolean tokenReferenceExists(String name,
                                    String source)
Check for existence of token. The token must have at least one previous reference with a source type of source.

Specified by:
tokenReferenceExists in interface HTTPRecording
Parameters:
name - Token name.
source - Token source.
Returns:
true if a token with name name exists, and has at least one reference with a source type of source.

createBodyDataFileName

public File createBodyDataFileName()
Create a new file name for body data.

Specified by:
createBodyDataFileName in interface HTTPRecording
Returns:
The file name.

dispose

public void dispose()
Called after the component has been stopped.

Specified by:
dispose in interface org.picocontainer.Disposable


Copyright © 2000-2013. All Rights Reserved.