org.jboss.dtf.testframework.testnode
Class ShellScriptTaskRunner

java.lang.Object
  extended by org.jboss.dtf.testframework.testnode.TaskRunner
      extended by org.jboss.dtf.testframework.testnode.ShellScriptTaskRunner
All Implemented Interfaces:
java.lang.Runnable

public class ShellScriptTaskRunner
extends TaskRunner

This TaskRunner is intended to execute a shell script. From a java program, we execute a shell script using by calling Runtime.exec(cmd, env, work) where String[] cmd - a shell command line String[] env - a list of environment variables File - a working directory It appears that we need only specify the following host specific elements SHELL = shell command (e.g. /bin/bash) PATH = path of binary commands used in the script Both of these can be defined in the product as sets, and should be. As this is not a java program, and so the following elements are not processed: * JAVA_HOME really is not required for correct execution * product properties are ignored * any task or test JVM parameters. We assume that the working directory will be determined by the path component of the shell command. If there is no such path specified, we throw an exception.

Author:
nrla

Field Summary
 
Fields inherited from class org.jboss.dtf.testframework.testnode.TaskRunner
_associatedTestNode, _associatedTestNodeName, _className, _classpathRef, _finished, _finishedSyncObject, _jvmParameters, _listener, _loggingResource, _loggingService, _nodeConfig, _parameters, _productConfig, _ready, _resultListener, _runId, _runnerParameters, _running, _serviceUtils, _taskId, _taskIsRunning, _taskName, _taskPermutationCode, _testId, _testPermutationCode, _testType, _timedOut, _timeoutValue
 
Constructor Summary
ShellScriptTaskRunner()
           
 
Method Summary
 void runTask()
          This is the main body of the task runner.
 boolean terminate()
          Called by the framework when it wishes to terminate the task this runner is running.
 void waitFor()
          Called by the framework when it wishes to wait for the task to finish.
 
Methods inherited from class org.jboss.dtf.testframework.testnode.TaskRunner
getClasspathString, getJavaExe, getJavaHome, getLoggingService, getNodeConfiguration, getResultListener, getRunnerParameters, getRunningTaskId, getRunningTaskPermutationCode, getRunningTestPermutationCode, getServiceUtils, getTaskName, hasFinished, hasTimedOut, indicateTaskIsRunning, initialise, isReady, readySignalled, registerResultListener, run, start, toString, waitForFinished, waitForReadyOrFinished
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ShellScriptTaskRunner

public ShellScriptTaskRunner()
Method Detail

terminate

public final boolean terminate()
Description copied from class: TaskRunner
Called by the framework when it wishes to terminate the task this runner is running.

Specified by:
terminate in class TaskRunner
Returns:
True if the task was successfully terminated.

runTask

public final void runTask()
                   throws java.lang.Exception
Description copied from class: TaskRunner
This is the main body of the task runner. Within this method the task runner can start the task and monitor its state.

Specified by:
runTask in class TaskRunner
Throws:
java.lang.Exception

waitFor

public final void waitFor()
                   throws java.lang.InterruptedException
Description copied from class: TaskRunner
Called by the framework when it wishes to wait for the task to finish. This method MUST block until the task has finished. If a method is called which could throw an InterruptedException then let this be thrown by the method and it will be handled correctly by the test node.

Specified by:
waitFor in class TaskRunner
Throws:
java.lang.InterruptedException