org.jboss.dtf.testframework.testnode
Class TestNode

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.server.UnicastRemoteObject
              extended by org.jboss.dtf.testframework.testnode.TestNode
All Implemented Interfaces:
java.io.Serializable, java.rmi.Remote, TaskResultListener, TestNodeInterface, TimeoutListener

public class TestNode
extends java.rmi.server.UnicastRemoteObject
implements TestNodeInterface, TaskResultListener, TimeoutListener

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Fields inherited from interface org.jboss.dtf.testframework.testnode.TestNodeInterface
RESULT_READY, RESULT_TIMEOUT, WAIT_NONE, WAIT_READY
 
Constructor Summary
TestNode(java.net.URL configFile, java.lang.String nameServiceURI, java.lang.String nodeName)
           
 
Method Summary
 void dumpActiveTaskList()
           
 TaskId generateNewTaskId(java.lang.String taskName)
           
 TaskIdInterface generateTaskId(java.lang.String taskName)
          Generates a default task id.
 java.lang.String[] getActiveTaskList()
          THis method returns the list of tasks currently being run by this node.
 RemoteFileReaderInterface getDeployLogOutput(java.lang.String productName, boolean outOrErr)
          This method retrieves an InputStream for the log output for a deployment.
 java.lang.String getHostAddress()
           
 java.lang.String getName()
          Get the Name of the TestNode (specified in the XML configuration for that test node).
 TestNodeDescription getNodeDescription()
          This methods returns the description of this test node.
static java.lang.String getOSId()
           
 void initialise(java.lang.String collatorIp, int collatorPort)
           
static void initialiseRegistry()
           
 void initiateTest(java.lang.String currentTestId, TaskIdInterface taskId)
           
static void main(java.lang.String[] args)
           
 int performTask(java.lang.String taskType, java.util.Hashtable runnerParameters, java.lang.String className, java.lang.String classpathRef, java.lang.String taskName, java.lang.String[] parameters, java.lang.String[] jvmParameters, java.lang.String product, int timeoutValue, TaskIdInterface taskId, RunUID runId, java.lang.String taskPermutationCode, java.lang.String testPermutationCode)
          Instructs the TestNode to run a given Java class.
 boolean ping()
          This method is called by the service register to ensure this test node is responding.
 void runTask(java.lang.String taskType, java.util.Hashtable runnerParameters, java.lang.String className, java.lang.String classpathRef, java.lang.String taskName, java.lang.String[] parameters, java.lang.String[] jvmParameters, java.lang.String product, int testType, int timeoutValue, TaskResultListener listener, TaskIdInterface taskId, RunUID runId, java.lang.String taskPermutationCode, java.lang.String testPermutationCode)
          Instructs the TestNode to run a given Java class and report back using the listener any information returned by the task.
 void shutdown(boolean restart, boolean onComplete)
          Instructs the TestNode to deregister with the ServiceRegister and shutdown
 void taskFinished(TaskIdInterface taskId, TestNodeInterface testNode, java.lang.String testPermutation, boolean taskStartedSuccessfully)
          This method is invoked when the task finishes.
 void taskHasTimedout(TaskIdInterface taskId, TestNodeInterface testNode, java.lang.String testPermutation)
           
 void taskReturnedData(TaskIdInterface taskId, java.lang.String data)
          This method is invoked when a line of test is outputted from the task.
 void taskSignalledReady(TaskIdInterface taskId)
           
 void taskSignalledReady(TaskIdInterface taskId, TestNodeInterface testNode, java.lang.String testPermutation)
          This method is invoked when the task signals Ready.
 void taskTimedOut(TaskRunner runner)
          This method is called when a task which has been run times out
 boolean terminateAllTasks()
          Terminate all tasks currently being run by this testnode.
 void terminateTask(TaskIdInterface taskId, java.lang.String testPermutationCode)
           
 void testFinished(java.lang.String permutationCode, TaskIdInterface taskId, java.lang.String testId)
          Inform the test node that the test has finished and that it is now free to perform other tests.
 boolean updateSoftware()
          Instructs the testnode to update its software for all the products it supports.
 boolean updateSoftware(java.lang.String productName, boolean deploySoftware)
          Called to inform the testnode that the given product should be updated.
 void waitForTask(TaskIdInterface taskId)
          This method blocks until the task identified completes or until the timeoutValue elapses
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TestNode

public TestNode(java.net.URL configFile,
                java.lang.String nameServiceURI,
                java.lang.String nodeName)
         throws java.rmi.RemoteException
Parameters:
configFile -
nameServiceURI -
Throws:
java.rmi.RemoteException
Method Detail

initialise

public void initialise(java.lang.String collatorIp,
                       int collatorPort)

ping

public boolean ping()
             throws java.rmi.RemoteException
Description copied from interface: TestNodeInterface
This method is called by the service register to ensure this test node is responding. Always return true

Specified by:
ping in interface TestNodeInterface
Throws:
java.rmi.RemoteException

getDeployLogOutput

public RemoteFileReaderInterface getDeployLogOutput(java.lang.String productName,
                                                    boolean outOrErr)
                                             throws java.io.IOException,
                                                    java.rmi.RemoteException
This method retrieves an InputStream for the log output for a deployment.

Specified by:
getDeployLogOutput in interface TestNodeInterface
Parameters:
productName -
outOrErr - True indicates the output stream and False indicates the error stream
Returns:
An input stream to the data
Throws:
java.rmi.RemoteException
java.io.IOException

initiateTest

public void initiateTest(java.lang.String currentTestId,
                         TaskIdInterface taskId)
                  throws java.rmi.RemoteException,
                         TestNodeBusy
Specified by:
initiateTest in interface TestNodeInterface
Throws:
java.rmi.RemoteException
TestNodeBusy

performTask

public int performTask(java.lang.String taskType,
                       java.util.Hashtable runnerParameters,
                       java.lang.String className,
                       java.lang.String classpathRef,
                       java.lang.String taskName,
                       java.lang.String[] parameters,
                       java.lang.String[] jvmParameters,
                       java.lang.String product,
                       int timeoutValue,
                       TaskIdInterface taskId,
                       RunUID runId,
                       java.lang.String taskPermutationCode,
                       java.lang.String testPermutationCode)
                throws java.rmi.RemoteException,
                       UnsupportedProduct,
                       TestNodeBusy,
                       TaskRunnerNotSupported
Description copied from interface: TestNodeInterface
Instructs the TestNode to run a given Java class.

Specified by:
performTask in interface TestNodeInterface
Parameters:
taskType - The type of test to be run.
className - The fully qualified name of the class to be run.
parameters - The parameters to be passed to this class.
product - The string identifier for the product that this test should be run under.
timeoutValue - The amount of time the class is given to produce the expected output. If it doesn't then the value RESULT_TIMEOUT is returned.
Returns:
Returns the information that was returned from the server.
Throws:
java.rmi.RemoteException - Thrown by the RMI implementation.
UnsupportedProduct
TestNodeBusy
TaskRunnerNotSupported

taskSignalledReady

public void taskSignalledReady(TaskIdInterface taskId)
                        throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException

taskFinished

public void taskFinished(TaskIdInterface taskId,
                         TestNodeInterface testNode,
                         java.lang.String testPermutation,
                         boolean taskStartedSuccessfully)
                  throws java.rmi.RemoteException,
                         NoSuchTaskId
Description copied from interface: TaskResultListener
This method is invoked when the task finishes.

Specified by:
taskFinished in interface TaskResultListener
Parameters:
taskId - The task Id. of the task that finished.
Throws:
java.rmi.RemoteException
NoSuchTaskId

terminateTask

public void terminateTask(TaskIdInterface taskId,
                          java.lang.String testPermutationCode)
                   throws java.rmi.RemoteException,
                          NoSuchTaskId
Specified by:
terminateTask in interface TestNodeInterface
Throws:
java.rmi.RemoteException
NoSuchTaskId

terminateAllTasks

public boolean terminateAllTasks()
                          throws java.rmi.RemoteException
Terminate all tasks currently being run by this testnode.

Specified by:
terminateAllTasks in interface TestNodeInterface
Throws:
java.rmi.RemoteException

taskReturnedData

public void taskReturnedData(TaskIdInterface taskId,
                             java.lang.String data)
                      throws java.rmi.RemoteException
Description copied from interface: TaskResultListener
This method is invoked when a line of test is outputted from the task.

Specified by:
taskReturnedData in interface TaskResultListener
Parameters:
taskId - The task id. of the task that returned data.
data - The information outputted from the task.
Throws:
java.rmi.RemoteException

getName

public java.lang.String getName()
                         throws java.rmi.RemoteException
Description copied from interface: TestNodeInterface
Get the Name of the TestNode (specified in the XML configuration for that test node).

Specified by:
getName in interface TestNodeInterface
Returns:
Returns the name of the TestNode as a string.
Throws:
java.rmi.RemoteException - Thrown by the RMI implementation.

getHostAddress

public java.lang.String getHostAddress()
                                throws java.rmi.RemoteException
Specified by:
getHostAddress in interface TestNodeInterface
Throws:
java.rmi.RemoteException

testFinished

public void testFinished(java.lang.String permutationCode,
                         TaskIdInterface taskId,
                         java.lang.String testId)
                  throws java.rmi.RemoteException,
                         TasksStillRunning
Description copied from interface: TestNodeInterface
Inform the test node that the test has finished and that it is now free to perform other tests. This also initiates the upload of results generated by the tasks to the coordinator.

Specified by:
testFinished in interface TestNodeInterface
taskId - The taskId indentifying the test which has finished.
testId - A string identifier for this test used to report back the results to the Coordinator
Throws:
java.rmi.RemoteException
TasksStillRunning

generateTaskId

public TaskIdInterface generateTaskId(java.lang.String taskName)
                               throws java.rmi.RemoteException,
                                      TestNodeBusy
Description copied from interface: TestNodeInterface
Generates a default task id.

Specified by:
generateTaskId in interface TestNodeInterface
Parameters:
taskName - A name given to this task.
Returns:
The TaskId
Throws:
java.rmi.RemoteException
TestNodeBusy

generateNewTaskId

public TaskId generateNewTaskId(java.lang.String taskName)
                         throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException

waitForTask

public void waitForTask(TaskIdInterface taskId)
                 throws java.rmi.RemoteException,
                        NoSuchTaskId,
                        java.lang.InterruptedException
Description copied from interface: TestNodeInterface
This method blocks until the task identified completes or until the timeoutValue elapses

Specified by:
waitForTask in interface TestNodeInterface
Parameters:
taskId - The taskId identifying the task which must complete.
Throws:
NoSuchTaskId - This is thrown if a task isn't running with this task id.
java.rmi.RemoteException
java.lang.InterruptedException

runTask

public void runTask(java.lang.String taskType,
                    java.util.Hashtable runnerParameters,
                    java.lang.String className,
                    java.lang.String classpathRef,
                    java.lang.String taskName,
                    java.lang.String[] parameters,
                    java.lang.String[] jvmParameters,
                    java.lang.String product,
                    int testType,
                    int timeoutValue,
                    TaskResultListener listener,
                    TaskIdInterface taskId,
                    RunUID runId,
                    java.lang.String taskPermutationCode,
                    java.lang.String testPermutationCode)
             throws java.rmi.RemoteException,
                    TestNodeBusy,
                    UnsupportedProduct,
                    TaskRunnerNotSupported
Description copied from interface: TestNodeInterface
Instructs the TestNode to run a given Java class and report back using the listener any information returned by the task.

Specified by:
runTask in interface TestNodeInterface
className - The fully qualified name of the class to be run.
parameters - The parameters to be passed to this class.
timeoutValue - The amount of time the class is given to produce the expected output. If it doesn't then the value RESULT_TIMEOUT is returned.
listener - A class which should be informed when the task returns information.
Throws:
java.rmi.RemoteException - Thrown by the RMI implementation.
TestNodeBusy
UnsupportedProduct
TaskRunnerNotSupported

getActiveTaskList

public java.lang.String[] getActiveTaskList()
                                     throws java.rmi.RemoteException
THis method returns the list of tasks currently being run by this node.

Specified by:
getActiveTaskList in interface TestNodeInterface
Returns:
An array of task names currently being run.
Throws:
java.rmi.RemoteException

dumpActiveTaskList

public void dumpActiveTaskList()

taskTimedOut

public void taskTimedOut(TaskRunner runner)
This method is called when a task which has been run times out

Specified by:
taskTimedOut in interface TimeoutListener
Parameters:
runner - The runner which is running this task.

taskSignalledReady

public void taskSignalledReady(TaskIdInterface taskId,
                               TestNodeInterface testNode,
                               java.lang.String testPermutation)
                        throws java.rmi.RemoteException
This method is invoked when the task signals Ready.

Specified by:
taskSignalledReady in interface TaskResultListener
Parameters:
taskId - The task Id. of the task that signals Ready.
Throws:
java.rmi.RemoteException

updateSoftware

public boolean updateSoftware(java.lang.String productName,
                              boolean deploySoftware)
                       throws java.rmi.RemoteException
Called to inform the testnode that the given product should be updated. This should not be called directly - the product repository calls this method and is responsible for ensuring all testnodes are up-to-date. If the test node is busy (i.e. in the midst of running tasks) it will throw a testnodebusy exception.

Specified by:
updateSoftware in interface TestNodeInterface
Parameters:
productName - The name of the product to update.
deploySoftware - Should the node deploy the software
Returns:
True - if the update was successful.
Throws:
java.rmi.RemoteException

updateSoftware

public boolean updateSoftware()
                       throws java.rmi.RemoteException,
                              TestNodeBusy
Description copied from interface: TestNodeInterface
Instructs the testnode to update its software for all the products it supports. Using the ProductRepository it can check to ensure it has the latest versions of any product it supports.

Specified by:
updateSoftware in interface TestNodeInterface
Returns:
True if the software update was successfull, otherwise false.
Throws:
java.rmi.RemoteException
TestNodeBusy

taskHasTimedout

public void taskHasTimedout(TaskIdInterface taskId,
                            TestNodeInterface testNode,
                            java.lang.String testPermutation)
                     throws java.rmi.RemoteException
Specified by:
taskHasTimedout in interface TaskResultListener
Throws:
java.rmi.RemoteException

getNodeDescription

public TestNodeDescription getNodeDescription()
                                       throws java.rmi.RemoteException
This methods returns the description of this test node.

Specified by:
getNodeDescription in interface TestNodeInterface
Returns:
Throws:
java.rmi.RemoteException

shutdown

public void shutdown(boolean restart,
                     boolean onComplete)
              throws java.rmi.RemoteException
Description copied from interface: TestNodeInterface
Instructs the TestNode to deregister with the ServiceRegister and shutdown

Specified by:
shutdown in interface TestNodeInterface
Parameters:
restart - If true the testnode will request to be restarted once it has shutdown this will be used after a software update.
onComplete - If true the testnode will wait until it has completed it's current test before shutting down.
Throws:
java.rmi.RemoteException

initialiseRegistry

public static void initialiseRegistry()

main

public static void main(java.lang.String[] args)

getOSId

public static java.lang.String getOSId()