|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ourgrid.test.TestUtils
public class TestUtils
This class provides several methods to help during the test/development phase of the software. It eases the customization of the unit tests.
Field Summary | |
---|---|
static java.lang.String |
CORE_PEER_COMMAND
|
static java.lang.String |
COREPEER_PORT
|
static java.lang.String |
FAKE_FILE
|
static java.lang.String |
FAKE_MACHINE_NAME
|
static java.lang.String |
FAKE_PORT
|
static java.lang.String |
GUI_PORT
|
static java.lang.String |
INVALID_TRUSTSTORE_FILENAME
|
static java.lang.String |
INVALID_TRUSTSTORE_PASSWORD
|
static java.lang.String |
KEYSTORE_FILENAME
|
static java.lang.String |
KEYSTORE_PASSWORD
|
static java.lang.String |
MG_HOMEMACHINE
|
static java.lang.String |
MG_PORT
|
static java.lang.String |
MYGRID_COMMAND
|
static java.lang.String |
MYGUMP_DEFAULT_COPYFROM
|
static java.lang.String |
MYGUMP_DEFAULT_COPYTO
|
static java.lang.String |
MYGUMP_DEFAULT_PLAYPENROOT
|
static java.lang.String |
MYGUMP_DEFAULT_PORT
|
static java.lang.String |
MYGUMP_DEFAULT_REMEXEC
|
static java.lang.String |
MYGUMP_DEFAULT_STORAGEDIR
|
static java.lang.String |
MYGUMP_MACHINE
|
static java.lang.String |
NONEXISTENT_MACHINE
|
static java.lang.String |
NOT_WRITABLE_FILE
|
static java.lang.String |
OG_PORT
|
static java.lang.String |
OG_PORT_II
|
static java.lang.String |
PEER_COMMAND
|
static java.lang.String |
PROTECTED_DIR
|
static java.lang.String |
REMOTE_FAKE_FILE
|
static java.lang.String |
REMOTE_FILE
|
static java.lang.String |
REMOTE_PROTECTED_DIR
|
static java.lang.String |
REMOTE_PROTECTED_FILE
|
static java.lang.String |
REMOTE_TEMP_DIR
|
static java.lang.String |
RMI_PORT
|
static java.lang.String |
SYSTEM_TEMP_DIR
|
static java.lang.String |
TRUSTSTORE_FILENAME
|
static java.lang.String |
TRUSTSTORE_PASSWORD
|
static java.lang.String |
TYPE_LOCALHOST
|
static java.lang.String |
TYPE_SWAN
|
static java.lang.String |
TYPE_UALINUX
|
static java.lang.String |
TYPE_UAWINDOWS
|
Constructor Summary | |
---|---|
TestUtils()
|
Method Summary | |
---|---|
boolean |
checkFileContent(java.lang.String expectedContent,
java.io.File file)
|
void |
createCorepeerProperties()
Creates an corepeer.properties file in the getCorepeerPropertiesFileName() location. |
java.lang.String |
createLocalPeerGDF()
|
void |
createMGProperties()
Creates a MG.properties file in the getMGPropertiesFileName() location. |
void |
createOGProperties()
Creates an peer.properties file in the getOGPropertiesFileName() location. |
java.lang.String |
createSDF(java.util.List guMSpecs)
Generates a GDF and returns the full path to it. |
static void |
executeCommand(java.lang.String command,
java.lang.String[] args)
Executes a command with its arguments. |
java.lang.String |
getCorepeerPropertiesFileName()
Returns the path to the corepeer.properties file. |
java.util.List<GumSpec> |
getGumSpecs(int numberOfGums,
java.lang.String type)
Returns a List containing GuMSpecs that were defined as usable in the test.properties file. |
GumSpec |
getLocalGuMSpec(java.lang.String type)
Generates a GuMSpec for LocalMachine. |
java.lang.String |
getMGPropertiesFileName()
Returns the path to the MG.properties file. |
int |
getNumberOfGuMSpecsAvailable(java.lang.String type)
Returns the number of GuMSpecs available according to the test.properties file. |
java.lang.String |
getOGPropertiesFileName()
Returns the path to the peer.properties file. |
java.lang.String |
getProperty(java.lang.String propertyKey)
Returns the property specified. |
int |
getRMIPort()
|
JobSpec |
getSimpleJobSpec()
|
int |
guiPort()
|
void |
load()
Loads the tests properties from the default file. |
void |
load(java.lang.String fileName)
Loads the tests properties from the specified file. |
void |
reset()
Resets all data. |
void |
restartMygrid()
|
static void |
runCommand(java.lang.String[] commands,
long timeWaiting)
Runs a command. |
void |
setProperty(java.lang.String propertyKey,
java.lang.String propertyValue)
Sets a property. |
void |
stopMygrid()
|
boolean |
testUA(java.util.List GuMSpecsList)
Tests if all UA in a GUM are alive. |
boolean |
testUA(java.util.List GuMSpecsList,
long timeout)
Tests if all UA in a GUM are alive. |
void |
waitUntilMyGridIsDown()
Wait until mygrid is down with a busy-wait call. |
void |
waitUntilMyGridIsUp()
Wait until mygrid is up with a busy-wait call. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String NONEXISTENT_MACHINE
public static final java.lang.String SYSTEM_TEMP_DIR
public static final java.lang.String MG_HOMEMACHINE
public static final java.lang.String MG_PORT
public static final java.lang.String MYGUMP_MACHINE
public static final java.lang.String KEYSTORE_FILENAME
public static final java.lang.String KEYSTORE_PASSWORD
public static final java.lang.String TYPE_UALINUX
public static final java.lang.String TYPE_UAWINDOWS
public static final java.lang.String TYPE_SWAN
public static final java.lang.String TYPE_LOCALHOST
public static final java.lang.String MYGUMP_DEFAULT_PLAYPENROOT
public static final java.lang.String MYGUMP_DEFAULT_PORT
public static final java.lang.String TRUSTSTORE_FILENAME
public static final java.lang.String TRUSTSTORE_PASSWORD
public static final java.lang.String INVALID_TRUSTSTORE_FILENAME
public static final java.lang.String INVALID_TRUSTSTORE_PASSWORD
public static final java.lang.String MYGUMP_DEFAULT_STORAGEDIR
public static final java.lang.String MYGUMP_DEFAULT_REMEXEC
public static final java.lang.String MYGUMP_DEFAULT_COPYFROM
public static final java.lang.String MYGUMP_DEFAULT_COPYTO
public static final java.lang.String OG_PORT
public static final java.lang.String OG_PORT_II
public static final java.lang.String RMI_PORT
public static final java.lang.String GUI_PORT
public static final java.lang.String FAKE_PORT
public static final java.lang.String FAKE_MACHINE_NAME
public static final java.lang.String FAKE_FILE
public static final java.lang.String NOT_WRITABLE_FILE
public static final java.lang.String REMOTE_PROTECTED_FILE
public static final java.lang.String REMOTE_FAKE_FILE
public static final java.lang.String REMOTE_TEMP_DIR
public static final java.lang.String PROTECTED_DIR
public static final java.lang.String REMOTE_PROTECTED_DIR
public static final java.lang.String REMOTE_FILE
public static final java.lang.String MYGRID_COMMAND
public static final java.lang.String PEER_COMMAND
public static final java.lang.String CORE_PEER_COMMAND
public static final java.lang.String COREPEER_PORT
Constructor Detail |
---|
public TestUtils()
Method Detail |
---|
public void load()
public void load(java.lang.String fileName)
fileName
- The file name.public void reset()
public java.lang.String getProperty(java.lang.String propertyKey)
propertyKey
- The property key.
null
case the
property was not previously specified.public void setProperty(java.lang.String propertyKey, java.lang.String propertyValue)
propertyKey
- The property key.propertyValue
- The property value.public java.util.List<GumSpec> getGumSpecs(int numberOfGums, java.lang.String type) throws NotEnoughGumSpecsException
numberOfGums
- The number of GuMSpecs desired.type
- The type of the GuMSpecs (if they will be UALinux, UAWindows,
etc.)
NotEnoughGumSpecsException
- Case the number of GuMSpecs available
is less than the number of GuMSpecs required.public boolean testUA(java.util.List GuMSpecsList)
GuMSpecsList
- List of GuMs
public boolean testUA(java.util.List GuMSpecsList, long timeout)
GuMSpecsList
- List of GuMs
public GumSpec getLocalGuMSpec(java.lang.String type)
type
- The GuM type.
public int getNumberOfGuMSpecsAvailable(java.lang.String type)
type
- The type of the GuMSpecs.
public java.lang.String createSDF(java.util.List guMSpecs) throws java.io.IOException
guMSpecs
- A list of GuMSpecs that will compose the Grid Description
File.
java.io.IOException
- Case file cannot be created (disk full or wrong
setted temp directory)public java.lang.String getMGPropertiesFileName()
public void createMGProperties()
getMGPropertiesFileName()
location. It will backup the old
MG.properties file to be restored when this.reset()
is
invoked.
public java.lang.String getOGPropertiesFileName()
public void createOGProperties()
getOGPropertiesFileName()
location. It will backup the old
peer.properties file to be restored when this.reset()
is
invoked.
public java.lang.String getCorepeerPropertiesFileName()
public void createCorepeerProperties()
getCorepeerPropertiesFileName()
location. It will backup
the old corepeer.properties file to be restored when
this.reset()
is invoked.
public java.lang.String createLocalPeerGDF() throws java.io.IOException
java.io.IOException
public static void runCommand(java.lang.String[] commands, long timeWaiting) throws java.lang.Exception
commands
- The command.timeWaiting
- The time to sleep after the command was performed -
not recommended to use.
java.lang.Exception
- Case there's any problem.public boolean checkFileContent(java.lang.String expectedContent, java.io.File file) throws java.lang.Exception
java.lang.Exception
public static void executeCommand(java.lang.String command, java.lang.String[] args) throws java.lang.Exception
command
- The command to be executed.args
- Its arguments.
java.lang.Exception
- Case the command cannot be executed.public void waitUntilMyGridIsUp()
public void waitUntilMyGridIsDown()
public JobSpec getSimpleJobSpec() throws CompilerException
CompilerException
public void restartMygrid() throws java.lang.Exception
java.lang.Exception
public void stopMygrid() throws java.lang.Exception
java.lang.Exception
public int getRMIPort()
public int guiPort()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |