com.bitmechanic.maxq.generator
Class SampleGenerator

java.lang.Object
  extended by com.bitmechanic.maxq.generator.AbstractCodeGenerator
      extended by com.bitmechanic.maxq.generator.SampleGenerator
All Implemented Interfaces:
IScriptGenerator, ProxyServer.Observer, java.lang.Runnable

public class SampleGenerator
extends AbstractCodeGenerator

This class implements the generator interface and simply outputs the parameters of any calls that are made on it. This is useful as a base for new generator classes and for seeing what gets called when.


Field Summary
 
Fields inherited from class com.bitmechanic.maxq.generator.AbstractCodeGenerator
assertNumber, END_STATEMENT, headersExist, jtidyConfigFile
 
Fields inherited from interface com.bitmechanic.maxq.generator.IScriptGenerator
EOL
 
Constructor Summary
SampleGenerator(IScriptAdapter adapter)
           
 
Method Summary
 void doAssertResponse(java.lang.String respCode)
           
 void doBodyParameterList(Param[] params)
           
 void doCallUrl(java.lang.String url, java.lang.String method, java.lang.String data, java.lang.String contentLength)
           
 void doClose()
           
 void doEndTransaction()
          Called after all other calls for a particular transaction (request + response).
 void doHeaders(HeaderValue[] headers)
           
 void doNew()
          Called when a new script needs to be begun.
 void doParameterList(Param[] params)
          Implementer must add script code for the parameters provided.
 void doQueryStringParameterList(Param[] params)
           
 void doResponseForFile()
           
 void doResponseForStdOut(java.lang.String url)
           
 void doSetCharset(java.lang.String cs)
          Called when the character set for POST requests changes.
 void doSetData(java.lang.String data)
           
 void doStartRecording()
          Called before any processRequest() calls.
 void doStopRecording()
          Called after the last processResponse() call, but may be followed by another doStartRecording() to start the process over again.
 void doTestUrlMessage(java.lang.String url)
           
 void doTidyCode(java.lang.String url)
           
 java.lang.String[] getValidFileExtensions()
          Returns an array of valid file extensions for the type of code generator in use.
 void setStruts(boolean struts)
          Called if the processResponse find that the response contains the Struts token
 
Methods inherited from class com.bitmechanic.maxq.generator.AbstractCodeGenerator
close, doLoad, doSave, getDefaultTestName, getScript, getScriptAdapter, getTestName, getTestPath, getTimeElapsedSinceLastestRequest, insert, isCpRspToFile, isCpRspToStdout, isFirstRequest, parseTestName, processRequest, processResponse, run, setDefaultTestName, setTestName, setTestPath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SampleGenerator

public SampleGenerator(IScriptAdapter adapter)
Method Detail

setStruts

public void setStruts(boolean struts)
Description copied from class: AbstractCodeGenerator
Called if the processResponse find that the response contains the Struts token

Specified by:
setStruts in class AbstractCodeGenerator

doNew

public void doNew()
Description copied from interface: IScriptGenerator
Called when a new script needs to be begun. This will not be called when an existing script is loaded from file.

The script should output its full class name during this call to ensure that its generator can be recognised if it is saved and reloaded.


getValidFileExtensions

public java.lang.String[] getValidFileExtensions()
Description copied from interface: IScriptGenerator
Returns an array of valid file extensions for the type of code generator in use.

Returns:
array of valid file extentions

doParameterList

public void doParameterList(Param[] params)
Description copied from class: AbstractCodeGenerator
Implementer must add script code for the parameters provided. This will only be called if there is at least one parameter.

Specified by:
doParameterList in class AbstractCodeGenerator
Parameters:
params - Query string and body parameters, without distinction.

doTestUrlMessage

public void doTestUrlMessage(java.lang.String url)
Specified by:
doTestUrlMessage in class AbstractCodeGenerator

doSetData

public void doSetData(java.lang.String data)
Specified by:
doSetData in class AbstractCodeGenerator

doCallUrl

public void doCallUrl(java.lang.String url,
                      java.lang.String method,
                      java.lang.String data,
                      java.lang.String contentLength)
Specified by:
doCallUrl in class AbstractCodeGenerator

doAssertResponse

public void doAssertResponse(java.lang.String respCode)
Specified by:
doAssertResponse in class AbstractCodeGenerator

doTidyCode

public void doTidyCode(java.lang.String url)
Specified by:
doTidyCode in class AbstractCodeGenerator

doResponseForStdOut

public void doResponseForStdOut(java.lang.String url)
Specified by:
doResponseForStdOut in class AbstractCodeGenerator

doResponseForFile

public void doResponseForFile()
Specified by:
doResponseForFile in class AbstractCodeGenerator

doEndTransaction

public void doEndTransaction()
Description copied from class: AbstractCodeGenerator
Called after all other calls for a particular transaction (request + response).

Specified by:
doEndTransaction in class AbstractCodeGenerator

doSetCharset

public void doSetCharset(java.lang.String cs)
Description copied from class: AbstractCodeGenerator
Called when the character set for POST requests changes.

Specified by:
doSetCharset in class AbstractCodeGenerator

doHeaders

public void doHeaders(HeaderValue[] headers)
Specified by:
doHeaders in class AbstractCodeGenerator

doStartRecording

public void doStartRecording()
Description copied from interface: IScriptGenerator
Called before any processRequest() calls.


doStopRecording

public void doStopRecording()
Description copied from interface: IScriptGenerator
Called after the last processResponse() call, but may be followed by another doStartRecording() to start the process over again.


doClose

public void doClose()

doQueryStringParameterList

public void doQueryStringParameterList(Param[] params)
                                throws Utils.UserException
Specified by:
doQueryStringParameterList in class AbstractCodeGenerator
Parameters:
params - Query string parameters.
Throws:
Utils.UserException

doBodyParameterList

public void doBodyParameterList(Param[] params)
                         throws Utils.UserException
Specified by:
doBodyParameterList in class AbstractCodeGenerator
Parameters:
params - Body parameters.
Throws:
Utils.UserException