|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectsir.mts.generators.BourneShellScriptGenerator
public class BourneShellScriptGenerator
Generates a Bourne shell script from the contents of a STImpL file.
| Constructor Summary | |
|---|---|
BourneShellScriptGenerator(Configuration config)
|
|
| Method Summary | |
|---|---|
int |
addComment(java.lang.String comment)
Adds a comment to the generated script. |
int |
addExternalFinishScript(java.lang.String scriptName,
java.util.List params)
Adds a script invocation to be executed after invocation of the test case. |
int |
addExternalSetupScript(java.lang.String scriptName,
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 file)
Adds a file redirection to the standard input stream of the current test case. |
int |
addMoveFile(java.lang.String srcFile,
java.lang.String destFile)
Adds a command to move an output file to another location after execution of the test case. |
int |
addOutputFile(java.lang.String file)
Adds a redirection to file of the standard output and error streams of the current test case. |
int |
addParameter(java.lang.String param)
Adds a command line parameter to the current test case. |
int |
addTestDriver(java.lang.String testDriver)
Adds a test driver to be used to invoke the test case. |
void |
addVariableAssign(java.lang.String var,
java.lang.String val,
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 testNum)
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 BourneShellScriptGenerator(Configuration config)
| 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 addVerbatim(java.lang.String text)
throws ScriptGenException
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.
ScriptGenException - If the script generator fails to copy the
specified text to the script.
public void addVariableAssign(java.lang.String var,
java.lang.String val,
boolean unsetFirst)
throws ScriptGenException
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 TestScriptGeneratorvar - Name of the variable to be assigned.val - 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.
ScriptGenException - If the script generator is unable to
insert a variable assignment statement.
public void newTest(int testNum)
throws ScriptGenException
TestScriptGenerator
newTest in interface TestScriptGeneratortestNum - The test number of this test in the script.
ScriptGenException - If the script generator is unable to
generate a new test.
public int endTest()
throws ScriptGenException
TestScriptGenerator
endTest in interface TestScriptGeneratorScriptGenException - If the script generator fails to generate
content associated with this event.
public int addParameter(java.lang.String param)
throws ScriptGenException
TestScriptGenerator
addParameter in interface TestScriptGeneratorparam - Command line parameter string to be added to the
invocation command for the current test case.
ScriptGenException - If the script generator is unable to add
the parameter string to the test case invocation.
public int addInputFile(java.lang.String file)
throws ScriptGenException
TestScriptGenerator
addInputFile in interface TestScriptGeneratorfile - Name of the file that should be redirected to the test
case on the standard input stream.
ScriptGenException - If the script generator is unable to add
the input file redirection to the test case invocation.
public int addOutputFile(java.lang.String file)
throws ScriptGenException
TestScriptGenerator
addOutputFile in interface TestScriptGeneratorfile - Name of the file to which the standard output and error
streams of the test case should be redirected.
ScriptGenException - If the script generator is unable to add
the output redirection to the test case invocation.
public int addMoveFile(java.lang.String srcFile,
java.lang.String destFile)
throws ScriptGenException
TestScriptGenerator
addMoveFile in interface TestScriptGeneratorsrcFile - Name of the output file to be moved.destFile - Path and file name to which the output file should
be moved.
ScriptGenException - If the script generator is unable to add
a command to move the specified output file.
public int addExternalSetupScript(java.lang.String scriptName,
java.util.List params)
throws ScriptGenException
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 TestScriptGeneratorscriptName - Name of the script to be invoked prior to the test
case.params - List of parameters to be passed to the invoked script.
ScriptGenException - If the script generator is unable to add
the invocation of a startup script.
public int addInlineSetupScript(java.lang.String scriptName,
java.util.Map params)
throws ScriptGenException
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.
ScriptGenException - If the script generator is unable to inline
the requested startup script.
public int addExternalFinishScript(java.lang.String scriptName,
java.util.List params)
throws ScriptGenException
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 TestScriptGeneratorscriptName - Name of the script to be invoked after the test case.params - List of parameters to be passed to the invoked script.
ScriptGenException - If the script generator is unable to add
the invocation of a finishing script.
public int addInlineFinishScript(java.lang.String scriptName,
java.util.Map params)
throws ScriptGenException
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.
ScriptGenException - If the script generator is unable to inline
the requested finishing script.
public int addComment(java.lang.String comment)
throws ScriptGenException
TestScriptGeneratorComment text is supplied verbatim, including unmodified whitespace.
addComment in interface TestScriptGeneratorcomment - Comment text to be added.
ScriptGenException - If the script generator is unable to add
the comment text.
public int addTestDriver(java.lang.String testDriver)
throws ScriptGenException
TestScriptGenerator
addTestDriver in interface TestScriptGeneratortestDriver - Name of the test driver program to be used to
invoke the program under test.
ScriptGenException - If the script generator is unable to insert
the use of a test driver to invoke the test case.
public int setRunInBackground(boolean flagged)
throws ScriptGenException
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.
ScriptGenException - If the script generator cannot cause the
test case to be executed as a background job.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 | ||||||||