MicroTAPAS
Class ScriptHandler

java.lang.Object
  |
  +--MicroTAPAS.ScriptHandler
All Implemented Interfaces:
java.lang.Runnable, java.io.Serializable

public class ScriptHandler
extends java.lang.Object
implements java.io.Serializable, java.lang.Runnable

Handles the execution of a script and logs the result for each executed command.

See Also:
Serialized Form

Field Summary
 java.util.Vector log
          The log that contains all the results from executed commands.
 
Constructor Summary
ScriptHandler(ControlInterface pParent, java.lang.String pScriptFile, boolean pStopOnError)
          Constructor
 
Method Summary
 void clearLog()
          Clears all test results from the action log.
 TestResult executeCommand(java.lang.String cmd, java.lang.String[] args, boolean expectSuccess, long delay)
          Executes one single command after a delay of 'delay' milliseconds.
 java.lang.String log2StringLong()
          Converts the stored test results to a string.
 java.lang.String log2StringShort()
          Converts the stored test results to a string, short format (one liners).
 TestResult logAction(java.lang.String cmd, java.lang.String[] args, boolean expectSuccess, RequestResult rr, long timeUsed)
          Adds a TestResult to the action log
 void run()
          Starts the thread that executes a script
 void startScript()
          Starts the execution of the script.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

public java.util.Vector log
The log that contains all the results from executed commands.

Constructor Detail

ScriptHandler

public ScriptHandler(ControlInterface pParent,
                     java.lang.String pScriptFile,
                     boolean pStopOnError)
Constructor

Method Detail

startScript

public void startScript()
Starts the execution of the script.


executeCommand

public TestResult executeCommand(java.lang.String cmd,
                                 java.lang.String[] args,
                                 boolean expectSuccess,
                                 long delay)
Executes one single command after a delay of 'delay' milliseconds.

Parameters:
cmd - The TAPAS command to be executed.
args - Any arguments to the command.
expectSuccess - True if one expect the command to be executed successfully.
delay - Delays the execution of the command by 'delay' milliseconds.
Returns:
A TestResult object containing the result of the executed command.

run

public void run()
Starts the thread that executes a script

Specified by:
run in interface java.lang.Runnable

logAction

public TestResult logAction(java.lang.String cmd,
                            java.lang.String[] args,
                            boolean expectSuccess,
                            RequestResult rr,
                            long timeUsed)
Adds a TestResult to the action log

Parameters:
cmd - The command that was executed
args - The command arguments
expectSuccess - Indicates if the command was expected to be successful
rr - The RequestResult of the executed command
timeUsed - The time used to executed the command (in milliseconds)

clearLog

public void clearLog()
Clears all test results from the action log.


log2StringLong

public java.lang.String log2StringLong()
Converts the stored test results to a string.

Returns:
A string representation of all stored test results.

log2StringShort

public java.lang.String log2StringShort()
Converts the stored test results to a string, short format (one liners).

Returns:
A string representation of all stored test results.