com.pushtotest.testmaker.XSTest.client
Class TestNode

java.lang.Object
  extended by com.pushtotest.testmaker.XSTest.client.TestNode

public class TestNode
extends java.lang.Object


Constructor Summary
TestNode(java.lang.String theURL, java.lang.String theName, java.lang.String theXMLFile, java.util.Properties prop)
           
 
Method Summary
 boolean abandonScenario()
          Abandon the previously loaded scenario on the TestNode
 int abortExecution()
          Abort execution on the TestNode
 boolean active()
           
 int commitWarFile()
          Commit the previously loaded warfile to the server.
 void createUseCase(int UC)
           
 void doFlagSync()
          Sets the Sync Flag in the node
 boolean doRelease()
          Release the TestNode.
 boolean getFileFromNodeAndSaveIt(java.lang.String file, java.lang.String savedir)
           
 java.lang.Object getFileList(java.lang.String sTopdir)
          Get the list of files on the TestNode in the execution directory.
 java.lang.Object getFiles(java.lang.String sDir, java.lang.String[] asFiles)
          Get the files indicated from the TestNode.
 boolean getLogFromNodeAndSaveIt(java.lang.String file, java.lang.String savedir)
           
 java.lang.String getMasterVersion()
          Get the version number of the master.
 java.lang.String getName()
           
 java.util.Hashtable getNodeStatus(boolean bTestMode, boolean bMandatoryMode, boolean bCachedOk)
          Get the node status from the TestNode.
 java.util.HashMap getSystemStatus()
          Get the system status from the TestNode.
 java.lang.String getURL()
           
 boolean loadScenario(java.lang.String sName, java.util.Hashtable dictFiles, java.lang.String fileXML)
          Load the indicated scenario to the TestNode.
 java.lang.String loadWarFile(java.lang.String sWarfile)
          Load the indicated WarFile to the TestNode.
 java.lang.Object masterWrapper(java.lang.String methodName, java.lang.Object[] args, java.lang.String behavior, int retries, int delay)
          Wrap calls to the master so that we can handle XML exceptions better.
 void ReinstallWar(java.lang.String sUser, java.lang.String sPass, java.lang.String sWarPath)
           
 java.lang.Object sendXML(java.lang.String sTopdir)
           
 boolean setSyncFlag()
           
 void validate(boolean requireVsn)
          Validate the associated URL works properly.
 boolean validity()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestNode

public TestNode(java.lang.String theURL,
                java.lang.String theName,
                java.lang.String theXMLFile,
                java.util.Properties prop)
         throws TestNetworkException
Throws:
TestNetworkException
Method Detail

validity

public boolean validity()

active

public boolean active()

getName

public java.lang.String getName()

getURL

public java.lang.String getURL()

validate

public void validate(boolean requireVsn)
              throws TestNetworkException
Validate the associated URL works properly.

Throws:
TestNetworkException

loadWarFile

public java.lang.String loadWarFile(java.lang.String sWarfile)
                             throws TestNetworkException
Load the indicated WarFile to the TestNode.

Throws:
TestNetworkException

commitWarFile

public int commitWarFile()
                  throws TestNetworkException
Commit the previously loaded warfile to the server. This process writes the warfile so that it will take effect on the next reboot. Note that the TestNode administrator may configure their system where the TestNode War file update can occur at runtime, and/or they can configure the file to take effect upon the next reboot. Or they may configure the TestNode so that neither form is acceptable. Watch the return status!

Throws:
TestNetworkException

loadScenario

public boolean loadScenario(java.lang.String sName,
                            java.util.Hashtable dictFiles,
                            java.lang.String fileXML)
                     throws java.lang.Exception
Load the indicated scenario to the TestNode. The name of the scenario the files (file, path) the name of the xml file return true if the system was able to load the scenario and false when the system was unable to load the scenario

Throws:
java.lang.Exception

getFileFromNodeAndSaveIt

public boolean getFileFromNodeAndSaveIt(java.lang.String file,
                                        java.lang.String savedir)

getLogFromNodeAndSaveIt

public boolean getLogFromNodeAndSaveIt(java.lang.String file,
                                       java.lang.String savedir)

doRelease

public boolean doRelease()
Release the TestNode. Must be called after the TestNode has completed.


doFlagSync

public void doFlagSync()
                throws TestNetworkException
Sets the Sync Flag in the node

Throws:
TestNetworkException

getSystemStatus

public java.util.HashMap getSystemStatus()
                                  throws TestNetworkException
Get the system status from the TestNode.

Throws:
TestNetworkException

setSyncFlag

public boolean setSyncFlag()
                    throws TestNetworkException
Throws:
TestNetworkException

getNodeStatus

public java.util.Hashtable getNodeStatus(boolean bTestMode,
                                         boolean bMandatoryMode,
                                         boolean bCachedOk)
                                  throws TestNetworkException
Get the node status from the TestNode. If bTestMode is set, then the call may throw an exception if the message is not sent properly. This allows the caller to handle its own exceptions. If bMandatoryMode is set, then the caller requires a response. So it will try up to 20 times to get a response. If not, it will System.out.println(the error and return 0. This would be used during execution to decide if a node is done or not. If bCachedOk is set, then we can just return the cached information.

Throws:
TestNetworkException

getFileList

public java.lang.Object getFileList(java.lang.String sTopdir)
                             throws TestNetworkException
Get the list of files on the TestNode in the execution directory. The returned list is a list of hashes. Where the hash contains keys: name, canRead, etc.

Throws:
TestNetworkException

sendXML

public java.lang.Object sendXML(java.lang.String sTopdir)
                         throws TestNetworkException
Throws:
TestNetworkException

createUseCase

public void createUseCase(int UC)
                   throws TestNetworkException
Throws:
TestNetworkException

getFiles

public java.lang.Object getFiles(java.lang.String sDir,
                                 java.lang.String[] asFiles)
                          throws TestNetworkException
Get the files indicated from the TestNode. If the list of files is empty, it will be inferred from the files that are on the remote minus those of the original scenario.

Throws:
TestNetworkException

abortExecution

public int abortExecution()
                   throws TestNetworkException
Abort execution on the TestNode

Throws:
TestNetworkException

abandonScenario

public boolean abandonScenario()
                        throws TestNetworkException
Abandon the previously loaded scenario on the TestNode

Throws:
TestNetworkException

getMasterVersion

public java.lang.String getMasterVersion()
Get the version number of the master.


ReinstallWar

public void ReinstallWar(java.lang.String sUser,
                         java.lang.String sPass,
                         java.lang.String sWarPath)

masterWrapper

public java.lang.Object masterWrapper(java.lang.String methodName,
                                      java.lang.Object[] args,
                                      java.lang.String behavior,
                                      int retries,
                                      int delay)
                               throws TestNetworkException
Wrap calls to the master so that we can handle XML exceptions better. method - the method to call args - an array of arguments to that method retries - number of times to retry delay - seconds between retry attempts behavior - If retries is exhausted and there's still an error, ignore="throw" will throw the error ignore="print" will System.out.println(the error, and return "None" ignore="ignore" will return "None"

Throws:
TestNetworkException