org.ourgrid.test.functionalunits
Class UserAgentUnit

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

public class UserAgentUnit
extends java.lang.Object
implements FunctionalTestUnit

UserAgentUnit will represents a peer that will be used to execute functional tests of OurGrid. A default creation of a UserAgentUnit 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 corepeer.


Method Summary
 void destroy()
          This method is used to delete enviroment files that the FunctionalTestUnit uses.
 java.lang.String getAddress()
          Gets the address that this corepeer is published.
 java.lang.String getDefaultPropertiesFile()
          Returns the default properties file that will be used by this FunctionalTestUnit.
 GumSpec getGumSpec()
          Get's the GumSpec representing this user agent unit.
 GumStatus getGumStatus()
          Get's the current status of this useragetunit.
 java.lang.String getHostname()
          Get the hostname of the core peer.
 java.lang.String getName()
          Returns the name of this FunctionalTestUnit.
 int getPort()
          Get the port of the core peer.
 boolean isRunning()
          Verify if this corepeer is running.
 void kill()
          Kills this unit by calling System.exit()
 void start()
          Starts this UserAgentUnit.
 boolean stillIdle()
          This method verifies if the functional test unit was not waken up since the last waitUntilWorkIsDone() call.
 void stop()
          Stops this UserAgentUnit.
 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

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 core peer.

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

getPort

public int getPort()
Get the port of the core peer.

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

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()

getAddress

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

Returns:
The address that this corepeer is published.

getGumSpec

public GumSpec getGumSpec()
Get's the GumSpec representing this user agent unit.

Returns:
GumSpec representing this user agent unit.

start

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

Specified by:
start in interface FunctionalTestUnit
Throws:
java.io.IOException - If cannot save properties file.
java.lang.Exception

stop

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

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

isRunning

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

Specified by:
isRunning in interface FunctionalTestUnit
Returns:
True if this corepeer is running.
Throws:
java.lang.Exception

getGumStatus

public GumStatus getGumStatus()
                       throws java.lang.Exception
Get's the current status of this useragetunit.

Returns:
Status of the unit represented by a GumStatus
Throws:
java.lang.Exception - If unable to acquire status.

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