Class Administration
- java.lang.Object
-
- com.tibco.ep.testing.framework.Administration
-
public final class Administration extends Object
Administration tools to support unit testing
Administration commands can be run in several ways depending on the requirements for the test case:
Map<String, String> parameters = new HashMap<String, String>(); Administration admin = new Administration(); // example command with no checks // admin.execute("display", "node"); // example command just validating it worked // assertTrue(admin.execute("display", "node").returnCode() == DtmCommand.COMMAND_SUCCEEDED); // example bad command just validating it failed // assertFalse(admin.execute("display", "junk").returnCode() == DtmCommand.COMMAND_SUCCEEDED); // example bad command validating error message // assertTrue(admin.execute("display", "junk").getErrorMessages().get(0).getMessage().contains("Target 'junk' does not exist")); // example command validating data via getCommandResults // parameters.clear(); List<DtmResults> resultsList = admin.execute("display", "node", parameters).getCommandResults(); assertEquals("Node is started", resultsList.get(0).getResultSet().getRow(0).getColumn(3), "Started"); // example command validating data via string // parameters.clear(); String results = admin.execute("display", "node", parameters).toString(); assertTrue("Node is started", results.contains("Started"));
By default, commands are run to the local node ( using the local node serviceName and discovery port). However commands can also be issued to other nodes in the cluster by specifying the serviceName :
// example command with servicename // parameters.clear(); admin.execute("test-framework", "display", "node", parameters);
Parameters are defined with a Map :
// example enable debugging // parameters.clear(); parameters.put("loggername", "ROOT"); parameters.put("level", "DEBUG"); admin.execute("set", "logging", parameters);
-
-
Constructor Summary
Constructors Constructor Description Administration()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Results
execute(String command, String target)
Run an administration command to particular service name and return resultsResults
execute(String serviceName, String command, String target)
Run an administration command to particular service name and return resultsResults
execute(String serviceName, String command, String target, Map<String,String> parameters)
Run an administration command to particular service name and return resultsResults
execute(String command, String target, Map<String,String> parameters)
Run an administration command to particular service name and return results
-
-
-
Method Detail
-
execute
public Results execute(String serviceName, String command, String target, Map<String,String> parameters)
Run an administration command to particular service name and return results
This method can be run within or outside a transaction
- Parameters:
serviceName
- Service name, can not be nullcommand
- Command, can not be nulltarget
- Target, can not be nullparameters
- Command parameters, can not be null- Returns:
- results
-
execute
public Results execute(String command, String target, Map<String,String> parameters)
Run an administration command to particular service name and return results
This method can be run within or outside a transaction
- Parameters:
command
- Command, can not be nulltarget
- Target, can not be nullparameters
- Command parameters, can not be null- Returns:
- results
-
execute
public Results execute(String serviceName, String command, String target)
Run an administration command to particular service name and return results
This method can be run within or outside a transaction
- Parameters:
serviceName
- Service name, can not be nullcommand
- Command, can not be nulltarget
- Target, can not be null- Returns:
- results
-
-