|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.bitmechanic.maxq.generator.AbstractCodeGenerator
public abstract class AbstractCodeGenerator
Abstract class providing general useful utility methods for code generation.
Field Summary | |
---|---|
protected long |
assertNumber
|
protected static java.lang.String |
END_STATEMENT
|
protected boolean |
headersExist
|
protected static java.lang.String |
jtidyConfigFile
jtidyConfigFile variable serves two purpose: one as a flag indicating we need spit out jtidy integration code, and as a variable indicating the location of jtidy.cfg file. |
Fields inherited from interface com.bitmechanic.maxq.generator.IScriptGenerator |
---|
EOL |
Constructor Summary | |
---|---|
AbstractCodeGenerator(IScriptAdapter adapter,
java.lang.String[] nameRegExps)
|
Method Summary | |
---|---|
void |
close()
Necessary because the thread started in the constructor will otherwise never exit. |
abstract void |
doAssertResponse(java.lang.String respCode)
|
abstract void |
doBodyParameterList(Param[] params)
|
abstract void |
doCallUrl(java.lang.String url,
java.lang.String method,
java.lang.String data,
java.lang.String contentLength)
|
abstract void |
doEndTransaction()
Called after all other calls for a particular transaction (request + response). |
abstract void |
doHeaders(HeaderValue[] headers)
|
void |
doLoad()
Called after a new script has been loaded from file. |
abstract void |
doParameterList(Param[] params)
Implementer must add script code for the parameters provided. |
abstract void |
doQueryStringParameterList(Param[] params)
|
abstract void |
doResponseForFile()
|
abstract void |
doResponseForStdOut(java.lang.String url)
|
void |
doSave(java.lang.String path,
java.lang.String fileName)
When a script is saved we update the name of the script embedded within it. |
abstract void |
doSetCharset(java.lang.String cs)
Called when the character set for POST requests changes. |
abstract void |
doSetData(java.lang.String data)
|
abstract void |
doTestUrlMessage(java.lang.String url)
|
abstract void |
doTidyCode(java.lang.String url)
|
java.lang.String |
getDefaultTestName()
|
protected java.lang.String |
getScript()
Returns the full script from the ScriptAdapter. |
IScriptAdapter |
getScriptAdapter()
|
java.lang.String |
getTestName()
Returns the name of the test. |
java.lang.String |
getTestPath()
Returns the file path of the test. |
long |
getTimeElapsedSinceLastestRequest()
Returns time elapsed since the latest request. |
protected void |
insert(java.lang.String s)
Inserts new lines into the script. |
static boolean |
isCpRspToFile()
|
static boolean |
isCpRspToStdout()
|
boolean |
isFirstRequest()
|
java.lang.String |
parseTestName()
Parses the name of the test out of the script. |
void |
processRequest(HttpRequestHeader header,
byte[] requestBody)
|
void |
processResponse(HttpRequestHeader header,
byte[] response)
Processes the response and generates test events for the code generator implementation class. |
void |
run()
A thread for performing insertions. |
void |
setDefaultTestName(java.lang.String defaultTestName)
|
abstract void |
setStruts(boolean struts)
Called if the processResponse find that the response contains the Struts token |
void |
setTestName(java.lang.String testName)
Sets the name of the test class. |
void |
setTestPath(java.lang.String testPath)
Sets the file path of the test |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.bitmechanic.maxq.generator.IScriptGenerator |
---|
doNew, doStartRecording, doStopRecording, getValidFileExtensions |
Field Detail |
---|
protected static final java.lang.String END_STATEMENT
protected static java.lang.String jtidyConfigFile
protected long assertNumber
protected boolean headersExist
Constructor Detail |
---|
public AbstractCodeGenerator(IScriptAdapter adapter, java.lang.String[] nameRegExps)
nameRegExps
- A list of regular expressions. Each finds an
instance of the script's name embedded in the
script. This class will use the regular expressions
to keep these names up-to-date when the user saves.Method Detail |
---|
public static boolean isCpRspToStdout()
public static boolean isCpRspToFile()
public java.lang.String getDefaultTestName()
public void setDefaultTestName(java.lang.String defaultTestName)
public IScriptAdapter getScriptAdapter()
public java.lang.String getTestName()
public void setTestName(java.lang.String testName)
testName
- public java.lang.String getTestPath()
public void setTestPath(java.lang.String testPath)
testPath
- public long getTimeElapsedSinceLastestRequest()
public boolean isFirstRequest()
public java.lang.String parseTestName()
IScriptGenerator
parseTestName
in interface IScriptGenerator
public void doSave(java.lang.String path, java.lang.String fileName)
doSave
in interface IScriptGenerator
public void doLoad()
IScriptGenerator
doLoad
in interface IScriptGenerator
public void close()
close
in interface IScriptGenerator
public void processRequest(HttpRequestHeader header, byte[] requestBody) throws java.lang.Exception
processRequest
in interface ProxyServer.Observer
header
- requestBody
-
java.lang.Exception
public void processResponse(HttpRequestHeader header, byte[] response) throws java.lang.Exception
processResponse
in interface ProxyServer.Observer
header
- response
-
java.lang.Exception
public void run()
run
in interface java.lang.Runnable
public abstract void doAssertResponse(java.lang.String respCode) throws Utils.UserException
Utils.UserException
public abstract void doCallUrl(java.lang.String url, java.lang.String method, java.lang.String data, java.lang.String contentLength) throws Utils.UserException
Utils.UserException
public abstract void doEndTransaction() throws Utils.UserException
Utils.UserException
public abstract void setStruts(boolean struts)
public abstract void doSetCharset(java.lang.String cs) throws Utils.UserException
Utils.UserException
public abstract void doParameterList(Param[] params) throws Utils.UserException
params
- Query string and body parameters, without distinction.
Utils.UserException
public abstract void doQueryStringParameterList(Param[] params) throws Utils.UserException
params
- Query string parameters.
Utils.UserException
public abstract void doBodyParameterList(Param[] params) throws Utils.UserException
params
- Body parameters.
Utils.UserException
public abstract void doResponseForFile() throws Utils.UserException
Utils.UserException
public abstract void doResponseForStdOut(java.lang.String url) throws Utils.UserException
Utils.UserException
public abstract void doSetData(java.lang.String data) throws Utils.UserException
Utils.UserException
public abstract void doTestUrlMessage(java.lang.String url) throws Utils.UserException
Utils.UserException
public abstract void doTidyCode(java.lang.String url) throws Utils.UserException
Utils.UserException
public abstract void doHeaders(HeaderValue[] headers)
protected java.lang.String getScript()
protected void insert(java.lang.String s) throws Utils.UserException
Utils.UserException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |