org.ourgrid.test.functionalunits
Class FunctionalUnitsControl

java.lang.Object
  extended by org.ourgrid.test.functionalunits.FunctionalUnitsControl

public class FunctionalUnitsControl
extends java.lang.Object

FunctionalUnitsControl is a singleton to control any logic that will be used by functional tests like the scripts to be called or collections to be controlled.


Field Summary
static java.lang.String COREPEER_PROPERTIES
          CorePeer properties file.
static java.lang.String COREPEER_SCRIPT
          CorePeer script property.
static java.io.File EMPTY_SDF
          empty sdf
static java.io.File JOB_ECHO
          Simple job execution file.
static java.io.File JOB_ECHO_MANY_TASKS
          Simple job execution file.
static java.io.File JOB_MORE_SLEEP
          Simple job execution file.
static java.io.File JOB_REQUIREMENTS_WINDOWS
          Simple job execution file.
static java.io.File JOB_SLEEP
          Simple job execution file.
static java.io.File JOB_STORE
          Simple job execution file.
static java.lang.String MYGRID_PROPERTIES
          Mygrid properties file.
static java.lang.String MYGRID_SCRIPT
          Mygrid script property.
static java.lang.String PEER_PROPERTIES
          Peer properties file.
static java.lang.String PEER_SCRIPT
          Peer script property.
static java.lang.String STORAGE_DIRECTORY
          Where the storage really is.
static java.lang.String STORAGE_DIRECTORY_PROPERTY
          Storage directory property.
static java.lang.String UAADMIN_DEPLOYDIR
          Uaadmin deploy dir.
static java.lang.String UAADMIN_SCRIPT
          Uaadmin script property.
static java.lang.String USERAGENT_PROPERTIES
          UserAgent properties file.
 
Method Summary
 CorePeerUnit createANewCorePeerUnit(java.lang.String name)
          Calls the default CorePeerUnit constructor that will find an available port, address and configuration to this peer initialization.
 MyGridUnit createANewMyGridUnit(java.lang.String name)
          Calls the default MyGridUnit constructor that will find an available port, address and configuration to this peer initialization.
 PeerUnit createANewPeerUnit(java.lang.String name)
          Calls the default PeerUnit constructor that will find an available port, address and configuration to this peer initialization.
 UserAgentUnit[] createANumberOfUserAgentUnits(int numberOfUnits)
          Creates a number of UserAgentUnit by calling the defaultconstructor that will find an available port, address and configuration to this peer initialization.
 void destroyAllRemainingUnits()
          Stops and destroys any remaining test units.
static FunctionalUnitsControl getInstance()
          Method to obtain the unique instance of this class.
 void reset()
          Restores the previous state of this FunctionalTestControl by reseting it instance and also restoring the original control files.
 void waitUntilSystemIsIdle()
          Contacts every functional unit created and waits until they have blocked (stopped working).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COREPEER_SCRIPT

public static final java.lang.String COREPEER_SCRIPT
CorePeer script property.

See Also:
Constant Field Values

COREPEER_PROPERTIES

public static final java.lang.String COREPEER_PROPERTIES
CorePeer properties file.

See Also:
Constant Field Values

USERAGENT_PROPERTIES

public static final java.lang.String USERAGENT_PROPERTIES
UserAgent properties file.

See Also:
Constant Field Values

PEER_PROPERTIES

public static final java.lang.String PEER_PROPERTIES
Peer properties file.

See Also:
Constant Field Values

PEER_SCRIPT

public static final java.lang.String PEER_SCRIPT
Peer script property.

See Also:
Constant Field Values

MYGRID_PROPERTIES

public static final java.lang.String MYGRID_PROPERTIES
Mygrid properties file.


MYGRID_SCRIPT

public static final java.lang.String MYGRID_SCRIPT
Mygrid script property.

See Also:
Constant Field Values

UAADMIN_SCRIPT

public static final java.lang.String UAADMIN_SCRIPT
Uaadmin script property.

See Also:
Constant Field Values

UAADMIN_DEPLOYDIR

public static final java.lang.String UAADMIN_DEPLOYDIR
Uaadmin deploy dir.


STORAGE_DIRECTORY_PROPERTY

public static final java.lang.String STORAGE_DIRECTORY_PROPERTY
Storage directory property.

See Also:
Constant Field Values

STORAGE_DIRECTORY

public static final java.lang.String STORAGE_DIRECTORY
Where the storage really is.


JOB_ECHO

public static final java.io.File JOB_ECHO
Simple job execution file. It performs an echo


JOB_ECHO_MANY_TASKS

public static final java.io.File JOB_ECHO_MANY_TASKS
Simple job execution file. It performs many many echos


JOB_SLEEP

public static final java.io.File JOB_SLEEP
Simple job execution file. It performs sleeps


JOB_MORE_SLEEP

public static final java.io.File JOB_MORE_SLEEP
Simple job execution file. It performs sleeps more times


JOB_REQUIREMENTS_WINDOWS

public static final java.io.File JOB_REQUIREMENTS_WINDOWS
Simple job execution file. It performs sleeps more times


JOB_STORE

public static final java.io.File JOB_STORE
Simple job execution file. It stores a file


EMPTY_SDF

public static final java.io.File EMPTY_SDF
empty sdf

Method Detail

getInstance

public static FunctionalUnitsControl getInstance()
Method to obtain the unique instance of this class.

Returns:
The unique instance of this class.

createANewCorePeerUnit

public CorePeerUnit createANewCorePeerUnit(java.lang.String name)
                                    throws java.lang.Exception
Calls the default CorePeerUnit constructor that will find an available port, address and configuration to this peer initialization.

Parameters:
name - This CorePeer name. Its only used to identify this CorePeerUnit.
Throws:
java.lang.Exception - Its not possible to create this test control file.

createANewPeerUnit

public PeerUnit createANewPeerUnit(java.lang.String name)
                            throws java.lang.Exception
Calls the default PeerUnit constructor that will find an available port, address and configuration to this peer initialization.

Parameters:
name - This Peer name. Its only used to identify this PeerUnit.
Throws:
java.lang.Exception - Its not possible to create this test control file.

createANewMyGridUnit

public MyGridUnit createANewMyGridUnit(java.lang.String name)
                                throws java.lang.Exception
Calls the default MyGridUnit constructor that will find an available port, address and configuration to this peer initialization.

Parameters:
name - This MyGrid name. Its only used to identify this MyGridUnit.
Throws:
java.lang.Exception - Its not possible to create this test control file.

createANumberOfUserAgentUnits

public UserAgentUnit[] createANumberOfUserAgentUnits(int numberOfUnits)
                                              throws java.lang.Exception
Creates a number of UserAgentUnit by calling the defaultconstructor that will find an available port, address and configuration to this peer initialization.

Parameters:
numberOfUnits - Number of units to be created.
Returns:
The units created
Throws:
java.lang.Exception - Its not possible to create this test control file.

destroyAllRemainingUnits

public void destroyAllRemainingUnits()
                              throws java.lang.Exception
Stops and destroys any remaining test units.

Throws:
java.lang.Exception - If any of the units cannot be destroyed.

reset

public void reset()
Restores the previous state of this FunctionalTestControl by reseting it instance and also restoring the original control files.


waitUntilSystemIsIdle

public void waitUntilSystemIsIdle()
                           throws java.lang.Exception
Contacts every functional unit created and waits until they have blocked (stopped working). What this method does is it goes around all the units waiting until they have blocked. When a unit blocks only a external event may wake up, so it is waiting for this event, After all units have blocked, we go around them asking if they are still blocked meaning that no other woke it up since it blocked. When all units block and confirm that they are still blocked no external event can wake any of them up (since they are all blocked), meaning that the system is idle.

Throws:
java.lang.Exception