Skip navigation links

Package com.kabira.test.management

Management Test Support classes

See: Description

Package com.kabira.test.management Description

Management Test Support classes

This package contains the classes to test management interfaces.

Administration Test Client

The administration test client provides a mechanism to call administration targets from test code. All administration targets are supported. Results are always returned in a String array. To get tabular results in a delimited format, a delimiter should be specified in the parameters, as shown in the example below.

Example usage of the administration client


    String command = "examplecommand";
    String target = "exampletarget";
 
    HashMap parameters = new HashMap();
    parameters.put("version", "1.0");
    parameters.put("count", "100");
    parameters.put("enum123", "Three");
    parameters.put("aBool", "true");
    parameters.put("aFloat", "3.75");
    parameters.put("delimiter", "|");


    Client client = new Client("guest", "guest");

    String results[] = client.runCommand(command, target, parameters);
    String columnNames[] = results[0].split("\\|");
    String row1[] = results[1].split("\\|");
 

Configuration file loading

To load configuration data, use the nested Configuration class. The Configuration class keeps track of the loaded configuration and allows the user to operate on the loaded configuration without knowing the name, type, and version of the loaded data.

Example usage of the nested Configuration class

    URL url = getClass().getResource("foo.kcs");
    Configuration configuration = client.new Configuration(url);
    configuration.load();
    configuration.activate();
 

Transactional considerations

Client and Client.Configuration implicitly start transactions to invoke administration target commands. For this reason, any methods called from a transactional context will throw com.kabira.platform.Transaction.InvalidTransactionState.

Skip navigation links
Copyright 2008-2015 Cloud Software Group, Inc.