Class Configuration

java.lang.Object
com.tibco.ep.testing.framework.Configuration

public final class Configuration extends Object

HOCON Configuration tools to support unit testing

HOCON configurations can be loaded and activated at any time :

      Map<String, String> substitutions = new HashMap<>();
      
      // example load / activate on this node
      //
      config = new Configuration("test1.conf").load().activate();
 

and subsequently deactivated and removed :

      // example deactive / remove on this node
      //
      config.deactivate().remove();
 

Substitution parameters can be specified :

      // example load / activate on this node
      //
      substitutions.put("param", "value");
      config = new Configuration("test1.conf", substitutions).load().activate();
 

By default, the configuration is loaded on the local node only - to load on a different node or on the cluster, the serviceName can be specified :

      // example load / activate on a specific node or cluster
      //
      config = new Configuration("A.test-framework", "test2.conf", substitutions).load().activate();
      config.deactivate().remove();
      config = new Configuration("test-framework", "test3.conf", substitutions).load().activate();
      config.deactivate().remove();
 

Test can call the deactiveRemoveAll function to automatically deactivate and remove configurations that are still loaded.

      // Deactivate configurations previous loaded
      //
      Configuration.deactiveAndRemoveAll();
 

Note that there is no support for auto loading configurations - any configuration that is required for a test case must load and activate it using this API. This includes configurations used be any dependent components.