|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectsir.mts.generators.XMLGenerator
public final class XMLGenerator
Generates an XML encoding of the contents of a STImpL file.
| Constructor Summary | |
|---|---|
XMLGenerator(Configuration config)
|
|
| Method Summary | |
|---|---|
int |
addComment(java.lang.String text)
Adds a comment to the generated script. |
int |
addExternalFinishScript(java.lang.String filename,
java.util.List params)
Adds a script invocation to be executed after invocation of the test case. |
int |
addExternalSetupScript(java.lang.String filename,
java.util.List params)
Adds a script invocation to be executed prior to invocation of the test case. |
int |
addInlineFinishScript(java.lang.String scriptName,
java.util.Map params)
Inlines a script to executed after invocation of the test case. |
int |
addInlineSetupScript(java.lang.String scriptName,
java.util.Map params)
Inlines a script to executed prior to invocation of the test case. |
int |
addInputFile(java.lang.String filename)
Adds a file redirection to the standard input stream of the current test case. |
int |
addMoveFile(java.lang.String source,
java.lang.String destination)
Adds a command to move an output file to another location after execution of the test case. |
int |
addOutputFile(java.lang.String filename)
Adds a redirection to file of the standard output and error streams of the current test case. |
int |
addParameter(java.lang.String text)
Adds a command line parameter to the current test case. |
int |
addTestDriver(java.lang.String command)
Adds a test driver to be used to invoke the test case. |
void |
addVariableAssign(java.lang.String name,
java.lang.String value,
boolean unsetFirst)
Inserts a statement in the script to assign a value to a named variable. |
void |
addVerbatim(java.lang.String text)
Copies text verbatim to the generated script. |
int |
endScript()
Indicates the end of the script. |
int |
endTest()
Indicates the end of the current test implementation specification. |
java.lang.String |
getEscapedQuote()
Gets the escape sequence to generate a single quote character ("). |
void |
newTest(int testID)
Indicates the start of a new test implementation specification. |
int |
setRunInBackground(boolean flagged)
Instructs the script generator to cause the test case to be executed as a background job. |
void |
startScript()
Indicates the start of a new script. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public XMLGenerator(Configuration config)
throws javax.xml.parsers.ParserConfigurationException
javax.xml.parsers.ParserConfigurationException| Method Detail |
|---|
public void startScript()
throws ScriptGenException
TestScriptGeneratorThis is most useful for inserting content at the start of the script.
startScript in interface TestScriptGeneratorScriptGenException - If the script generator fails to generate
content associated with this event.
public int endScript()
throws ScriptGenException
TestScriptGeneratorThis is most useful for inserting content at the end of the script.
endScript in interface TestScriptGeneratorScriptGenException - If the script generator fails to generate
content associated with this event.public void newTest(int testID)
TestScriptGenerator
newTest in interface TestScriptGeneratortestID - The test number of this test in the script.public int endTest()
TestScriptGenerator
endTest in interface TestScriptGeneratorpublic int addParameter(java.lang.String text)
TestScriptGenerator
addParameter in interface TestScriptGeneratortext - Command line parameter string to be added to the
invocation command for the current test case.
public int addMoveFile(java.lang.String source,
java.lang.String destination)
TestScriptGenerator
addMoveFile in interface TestScriptGeneratorsource - Name of the output file to be moved.destination - Path and file name to which the output file should
be moved.
public int addComment(java.lang.String text)
TestScriptGeneratorComment text is supplied verbatim, including unmodified whitespace.
addComment in interface TestScriptGeneratortext - Comment text to be added.
public int addInputFile(java.lang.String filename)
TestScriptGenerator
addInputFile in interface TestScriptGeneratorfilename - Name of the file that should be redirected to the test
case on the standard input stream.
public int addOutputFile(java.lang.String filename)
TestScriptGenerator
addOutputFile in interface TestScriptGeneratorfilename - Name of the file to which the standard output and error
streams of the test case should be redirected.
public int addExternalSetupScript(java.lang.String filename,
java.util.List params)
TestScriptGeneratorBy historical convention, script invocations should be added in the order received (that is, the order in which they are requested by calls to this method), and should be inserted before any inlined startup scripts.
addExternalSetupScript in interface TestScriptGeneratorfilename - Name of the script to be invoked prior to the test
case.params - List of parameters to be passed to the invoked script.
public int addExternalFinishScript(java.lang.String filename,
java.util.List params)
TestScriptGeneratorBy historical convention, script invocations should be added in the order received (that is, the order in which they are requested by calls to this method), and should be inserted after any inlined finishing scripts.
addExternalFinishScript in interface TestScriptGeneratorfilename - Name of the script to be invoked after the test case.params - List of parameters to be passed to the invoked script.
public int setRunInBackground(boolean flagged)
TestScriptGenerator
setRunInBackground in interface TestScriptGeneratorflagged - true if the test case should be run in the
background, false if it should be run as a normal process.
public void addVariableAssign(java.lang.String name,
java.lang.String value,
boolean unsetFirst)
TestScriptGeneratorVariables are considered to exist in the global scope. Thus all test cases subsequent to a variable assignment should have access to the variable value.
addVariableAssign in interface TestScriptGeneratorname - Name of the variable to be assigned.value - Value to be assigned to the variable.unsetFirst - boolean Flag indicating whether a statement to
explicitly unset the specified variable should be inserted before
the assignment statement, if such a capability exists in the
target language.
public int addInlineSetupScript(java.lang.String scriptName,
java.util.Map params)
TestScriptGeneratorBy historical convention, scripts should be inlined in the order received (that is, the order in which they are requested by calls to this method), and they should always appear after the invocations of non-inlined startup scripts.
The parameters argument can be used to request that the script generator insert appropriate variable assignment statements at the head of the inlined script to simulate parameters. Note however that these variables are not cleared at the end of the inlined script, and thus they may remain in scope and available to subsequent test cases. This may be useful for maintaining state in the script.
addInlineSetupScript in interface TestScriptGeneratorscriptName - Name of the script to be inlined into the generated
script prior to execution of the test case.params - Map A Map<String,String> that contains pairings of
variable names to values that should be assigned to those variables
at the beginning of the script, simulating parameters to the script.
public int addInlineFinishScript(java.lang.String scriptName,
java.util.Map params)
TestScriptGeneratorBy historical convention, scripts should be inlined in the order received (that is, the order in which they are requested by calls to this method), and they should always appear before the invocations of non-inlined finishing scripts.
The parameters argument can be used to request that the script generator insert appropriate variable assignment statements at the head of the inlined script to simulate parameters. Note however that these variables are not cleared at the end of the inlined script, and thus they may remain in scope and available to subsequent test cases. This may be useful for maintaining state in the script.
addInlineFinishScript in interface TestScriptGeneratorscriptName - Name of the script to be inlined into the generated
script after execution of the test case.params - Map A Map<String,String> that contains pairings of
variable names to values that should be assigned to those variables
at the beginning of the script, simulating parameters to the script.
public int addTestDriver(java.lang.String command)
TestScriptGenerator
addTestDriver in interface TestScriptGeneratorcommand - Name of the test driver program to be used to
invoke the program under test.
public void addVerbatim(java.lang.String text)
TestScriptGeneratorNote: There is currently no STImpL syntax associated with this event, and it is not called by the parser. It is reserved for future use.
addVerbatim in interface TestScriptGeneratortext - Text to be copied unchanged to the generated script.public java.lang.String getEscapedQuote()
TestScriptGenerator
getEscapedQuote in interface TestScriptGenerator
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||