org.ourgrid.test.functionalunits
Class MyGridUnit

java.lang.Object
  extended by org.ourgrid.test.functionalunits.MyGridUnit
All Implemented Interfaces:
FunctionalTestUnit

public class MyGridUnit
extends java.lang.Object
implements FunctionalTestUnit

MyGridUnit will represents a mygrid that will be used to execute functional tests of OurGrid. A default creation of a MyGridUnit will find and use a disponible port, address and any other detail that isn't needed to a test. Also is possible interact between functional tests unit to permit a easy way to create and mantain any test. This class will execute scripts to control the MyGrid.


Method Summary
 int addJob(java.io.File job)
          Add a job to this MyGrid.
 void destroy()
          This method is used to delete enviroment files that the FunctionalTestUnit uses.
 java.lang.String getAddress()
          Gets the address that this peer is published.
 java.lang.String getDefaultPropertiesFile()
          Returns the default properties file that will be used by this FunctionalTestUnit.
 java.lang.String getHostname()
          Get the hostname of the peer.
 ExecutionStatus getJobStatus(int jobId)
          Verify the status of an job.
 java.lang.String getName()
          Returns the name of this FunctionalTestUnit.
 int getPort()
          Get the port of the mygrid.
 java.util.Collection getRunningGums()
          This method will get the running gums at this MyGrid at a map that associates each jobId (if any that is running) with a collection of running gums.
 boolean isRunning()
          Verify if this mygrid is running.
 void kill()
          Kills this unit by calling System.exit()
 void setPeer(PeerUnit peer)
          Set the peer that this MyGrid will contact.
 void start()
          Starts this MyGridUnit.
 boolean stillIdle()
          This method verifies if the functional test unit was not waken up since the last waitUntilWorkIsDone() call.
 void stop()
          Stops this MyGridUnit.
 void waitForJob(int jobid)
          Waits for a job to finish.
 void waitUntilWorkIsDone()
          This method will block until this FunctionalTestUnit has stopped all work.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getAddress

public java.lang.String getAddress()
Gets the address that this peer is published.

Returns:
The address that this peer is published.

getName

public java.lang.String getName()
Description copied from interface: FunctionalTestUnit
Returns the name of this FunctionalTestUnit.

Specified by:
getName in interface FunctionalTestUnit
Returns:
The name of this FunctionalTestUnit.
See Also:
FunctionalTestUnit.getName()

getHostname

public java.lang.String getHostname()
Get the hostname of the peer.

Specified by:
getHostname in interface FunctionalTestUnit
Returns:
The hostname of the peer.

getPort

public int getPort()
Get the port of the mygrid.

Specified by:
getPort in interface FunctionalTestUnit
Returns:
The port of the mygrid.

getDefaultPropertiesFile

public java.lang.String getDefaultPropertiesFile()
Description copied from interface: FunctionalTestUnit
Returns the default properties file that will be used by this FunctionalTestUnit.

Specified by:
getDefaultPropertiesFile in interface FunctionalTestUnit
See Also:
FunctionalTestUnit.getDefaultPropertiesFile()

setPeer

public void setPeer(PeerUnit peer)
             throws java.lang.Exception
Set the peer that this MyGrid will contact.

Parameters:
peer - PeerUnit object to be used as test.
Throws:
java.lang.Exception

start

public void start()
           throws java.lang.Exception
Starts this MyGridUnit.

Specified by:
start in interface FunctionalTestUnit
Throws:
java.lang.Exception

stop

public void stop()
          throws java.lang.Exception
Stops this MyGridUnit.

Specified by:
stop in interface FunctionalTestUnit
Throws:
java.lang.Exception

isRunning

public boolean isRunning()
Verify if this mygrid is running.

Specified by:
isRunning in interface FunctionalTestUnit
Returns:
True if this mygrid is running.

addJob

public int addJob(java.io.File job)
           throws java.lang.Exception
Add a job to this MyGrid.

Parameters:
job - Job to be added to this MyGrid.
Returns:
Specified jobId of this job.
Throws:
java.lang.Exception

getJobStatus

public ExecutionStatus getJobStatus(int jobId)
                             throws java.lang.Exception
Verify the status of an job.

Parameters:
jobId - JobId to verify the status.
Returns:
The status of this job.
Throws:
java.lang.Exception

getRunningGums

public java.util.Collection getRunningGums()
                                    throws java.lang.Exception
This method will get the running gums at this MyGrid at a map that associates each jobId (if any that is running) with a collection of running gums.

Returns:
A map that associates each jobId (if any that is running) with a collection of running gums.
Throws:
java.lang.Exception

waitForJob

public void waitForJob(int jobid)
                throws java.lang.Exception
Waits for a job to finish.

Parameters:
jobid - Id of the job to wait.
Throws:
java.lang.Exception

destroy

public void destroy()
Description copied from interface: FunctionalTestUnit
This method is used to delete enviroment files that the FunctionalTestUnit uses.

Specified by:
destroy in interface FunctionalTestUnit

waitUntilWorkIsDone

public void waitUntilWorkIsDone()
                         throws java.lang.Exception
Description copied from interface: FunctionalTestUnit
This method will block until this FunctionalTestUnit has stopped all work.

Specified by:
waitUntilWorkIsDone in interface FunctionalTestUnit
Throws:
java.lang.Exception

stillIdle

public boolean stillIdle()
                  throws java.lang.Exception
Description copied from interface: FunctionalTestUnit
This method verifies if the functional test unit was not waken up since the last waitUntilWorkIsDone() call.

Specified by:
stillIdle in interface FunctionalTestUnit
Returns:
True if it hasnt.
Throws:
java.lang.Exception

kill

public void kill()
          throws java.lang.Exception
Description copied from interface: FunctionalTestUnit
Kills this unit by calling System.exit()

Specified by:
kill in interface FunctionalTestUnit
Throws:
java.lang.Exception