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