com.bitmechanic.maxq.generator
Class JythonCodeGenerator

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

public class JythonCodeGenerator
extends AbstractCodeGenerator

Generates a Jython test case. Take a look at the IScriptGenerator Interface to see how to specify which one you want. The important information is that this class generates Jython code.

Author:
Robert Dawson robert@rojotek.com, Wayne Hearn wayne_hearn@dell.com
See Also:
IScriptGenerator

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
JythonCodeGenerator(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 doEndTransaction()
          Appends an EOL char to scriptAdapter
 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)
           
static java.lang.String getGeneratorDescription()
           
 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

JythonCodeGenerator

public JythonCodeGenerator(IScriptAdapter adapter)
Method Detail

getGeneratorDescription

public static java.lang.String getGeneratorDescription()

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.


doParameterList

public void doParameterList(Param[] params)
                     throws Utils.UserException
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.
Throws:
Utils.UserException

doCallUrl

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

doSetData

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

doAssertResponse

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

doTidyCode

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

doResponseForStdOut

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

doResponseForFile

public void doResponseForFile()
                       throws Utils.UserException
Specified by:
doResponseForFile in class AbstractCodeGenerator
Throws:
Utils.UserException

doTestUrlMessage

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

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

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.


doEndTransaction

public void doEndTransaction()
                      throws Utils.UserException
Appends an EOL char to scriptAdapter

Specified by:
doEndTransaction in class AbstractCodeGenerator
Throws:
Utils.UserException

doSetCharset

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

Specified by:
doSetCharset in class AbstractCodeGenerator
Throws:
Utils.UserException

doHeaders

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

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