qat.agent
Class ExecProcess

java.lang.Object
  extended byqat.agent.ExecProcess

public class ExecProcess
extends java.lang.Object

This class is responsible for executing a single TestObject, and starting new threads to read it's standard output and error output streams. It allows for killing of the started TestObject at anytime by calling the cancel() method.


Field Summary
static int TIMEDOUT_STATE
           
 
Constructor Summary
ExecProcess(TestObject t, java.io.PrintStream so, int level, boolean mode, java.lang.String parentDetails)
          This constructs a new ExecProcess with the specified TestObject
 
Method Summary
 int checkExitValue()
          This function returns the exit value of the running process if it has finished else it returns a negative value.
 void destroy()
           
 int getExitValue()
          This function returns the exit value of the running process.
 TestObject getTestObject()
          This method returns the TestObject associated with this Object.
 void interrupt()
          This will kill the TestObject execution and free all the resource associated with this TestObject execution.
 boolean isDaemon()
           
 void setDaemon(boolean isDaemon)
           
 void start()
          This method should not be called directly, but rather via ObjectName.start() to ensure the thread is started correctly.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TIMEDOUT_STATE

public static final int TIMEDOUT_STATE
See Also:
Constant Field Values
Constructor Detail

ExecProcess

public ExecProcess(TestObject t,
                   java.io.PrintStream so,
                   int level,
                   boolean mode,
                   java.lang.String parentDetails)
This constructs a new ExecProcess with the specified TestObject

Parameters:
t - - the TestObject that will be executed when the start() method is called.
so - - the PrintWriter to use for output.
level - - the detail of debug message we want.
mode - - if true, the output is displayed to stdout
parentDetails - - some details about the parent so we can print it to the trace files.
Method Detail

getTestObject

public TestObject getTestObject()
This method returns the TestObject associated with this Object.

Returns:
the TestObject associated with this object.

start

public void start()
This method should not be called directly, but rather via ObjectName.start() to ensure the thread is started correctly.


checkExitValue

public int checkExitValue()
This function returns the exit value of the running process if it has finished else it returns a negative value. This method will not block if the process is still running.

Returns:
the absolute value of the exit value of the process, or a negative int to indicate other thread states (ILLEGAL_THREAD_STATE, NULL_POINTER, OTHER_EXCEPTION)

getExitValue

public int getExitValue()
This function returns the exit value of the running process. If the process is not finished, this method will block until it finishes, or the TestObject timeout value is reached. If the test times-out, it is explicitly killed, as if a ACTION_TESTOBJECT_KILL message was sent by the harness.

Returns:
the exit value of the process.

interrupt

public void interrupt()
This will kill the TestObject execution and free all the resource associated with this TestObject execution.


isDaemon

public boolean isDaemon()

setDaemon

public void setDaemon(boolean isDaemon)

destroy

public void destroy()


See QAT project for licensing details