|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectprotoj.lang.ScriptSession
public final class ScriptSession
Provides the ability to programmatically issue commands to a project script, which is useful in writing tests for example.
Simply create an instance with the location of the project shell script and
load the session up with commands to be executed by repeated calls to
addCommand(String, ArgRunnable, String).
The listener arguments also supplied get called back at the end of each
command execution, providing an opportunity to test proper behavior with
assertions. Where the same listener is added for different commands, they can
be distinguished with a provided tag. Therefore the listener body can
distinguish between the different commands that cause their invocation.
Calling the execute() method kicks this off.
| Constructor Summary | |
|---|---|
ScriptSession(java.io.File shellScript)
See ScriptSession. |
|
| Method Summary | |
|---|---|
void |
addCommand(java.lang.String command)
Convenience call when not interested in receiving a call to a listener when the command has completed. |
void |
addCommand(java.lang.String command,
ArgRunnable<ScriptSession> listener,
java.lang.String tag)
Queue the given command ready to be executed. |
void |
execute()
This method executes all of the accumulated commands, calling back the listener after each one. |
java.lang.String |
getCurrentCommand()
The name of the most recently executed command. |
CommandTask |
getCurrentExec()
The command object resulting from the most recent command execution, containing useful information such as stdout. |
java.lang.String |
getCurrentTag()
The tag associated with the most recently executed command. |
java.io.File |
getShellScript()
The script that the commands are sent to. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ScriptSession(java.io.File shellScript)
ScriptSession.
shellScript - | Method Detail |
|---|
public void addCommand(java.lang.String command)
command -
public void addCommand(java.lang.String command,
ArgRunnable<ScriptSession> listener,
java.lang.String tag)
command - the command to be executedlistener - the listener to call when the command has completed, can be
nulltag - the tag to be associated with the command when it executes,
can be nullpublic void execute()
public java.io.File getShellScript()
public CommandTask getCurrentExec()
public java.lang.String getCurrentCommand()
public java.lang.String getCurrentTag()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||