back to index     prev     next  

0.5 Configuration File

How many configuration files you need ?

A simple Java Properties file

With this file you can configure Manager's properties and Tests properties. You can have just one file for the Manager and all Tests or just one for the Manager and one file for each Tests.

By default the name of this file is the class name of the Manager or the Test which it is associated with .prop as file extention. For example :

ManagerToto.class <-> ManagerToto.prop

How to use it ?

It is very simple to use it. Just do like this example :

You have a private variable in your Manager or Test :

private int packetSize = 1024;

First add a setter of which it take a String in input :


	public void setPacketSize(String value){
	  this.packetSize = Integer.parseInt(value);
	}
    

Next, int the prop file :


	PacketSize=2048
     

Warning : the key in the prop file must be the same of the setter name without the prefix set.

Now, to load the prop file :


	// Level : Manager

	// At the execution load properties
	manager.execute(yes);

	// To load properties from differents  types of sources
	manager.loadAttributes();
	manager.loadAttributes(java.io.File propFile);
	manager.loadAttributes(java.util.Properties javaProp);

	// Level : Test
	
	// To load properties from differents  types of sources
	test.loadAttributes();
	test.loadAttributes(java.io.File propFile);
	test.loadAttributes(java.util.Properties javaProp);
      

A XML properties file

To configure all from just one file.

Like a simple prop file this one must be have the same name of the Manager class :


	YourManager <-> YourManager.xml
     

The structure of the XML document


            <Manager>
	   <name>A Manager </name>
	   <description>Try XML descriptor file. </description>
	   <!-- by default nbRuns is 1, but for benchmarks you can
	  change it -->
	   <nbRuns>100 </nbRuns>
            </Manager>
      

Add a simple group of tests


	 <simpleGroup name="A simple Group" description="just for test.">
	     <unitTest class="test.objectcreation.TestNewActive"/>
	     <unitTest class="test.groupmigration.TestGroupCreation"/>
	     <unitTest class="test.groupmigration.TestGroupCreation"/>
	     <unitTest class="test.objectcreation.TestNewActive"/>
             </simpleGroup>
    

You have created a group with 4 tests.

Add a group from a Java package


  <packageGroup name="A Package Group" description="Construct Group from  package." 
		dir="/net/home/adicosta/workspace/ProActive/classes" 
		packageName="nonregressiontest" >
 </packageGroup>
      

You have created a group with all Tests was found in the package nonregressiontest

With this method you don't have any order on Tests, but you can specify some order :


 <packageGroup name="A Package Group" description="Construct Group from  package." 
		dir="/net/home/adicosta/workspace/ProActive/classes" 
		packageName="nonregressiontest" >
 <unitTest class="nonregressiontest.runtime.defaultruntime.Test" />
			 <unitTest class="nonregressiontest.node.nodefactory.Test" />
			 <unitTest class="nonregressiontest.stub.stubgeneration.Test" />
			 <unitTest class="nonregressiontest.stub.stubinterface.Test" />
			 <unitTest class="nonregressiontest.activeobject.creation.local.newactive.Test" />
			 <unitTest class="nonregressiontest.activeobject.creation.local.turnactive.Test" />
			 <unitTest class="nonregressiontest.activeobject.creation.remote.newactive.Test" />
			 <unitTest class="nonregressiontest.activeobject.creation.remote.turnactive.Test" />
 </packageGroup>
      

All classes in package nonregressiontest are added, only the specified tests are sorted.

Add a group of InterLinked Tests


 <interLinkedGroup name="Group with interlinked tests" description="Construct a Group with interlinked tests">
	 <!-- Declare the tests in the execution order -->
 <idTest class="test.groupmigration.TestGroupCreation" id="1"/>
 <idTest class="test.groupmigration.TestGroupMigration" id="2"/>
 <idTest class="test.groupmigration.TestGroupMessage" id="3"/>
	 <interLinks>
		 <link id="3">
		   <parent id="1"/>
		   <parent id="2"/>
		 </link>
	   </interLinks>
 </interLinkedGroup>

TestGroupMessage depends from TestGroupCreation and TestGroupMigration.

How to configure log4j


 <log4j>
/net/home/adicosta/log4j/config/file/path/log4j-file-config
 </log4j>

How to configure results output ?

Results in a text file :


 <result type="text" file="/net/home/adicosta/tmp/results.txt" />

Results in a HTML file :


 <result type="html" file="/net/home/adicosta/tmp/results.html" />

Results in the console :


 <result type="console" />

Results in a XML file :


 <result type="xml" file="/net/home/adicosta/tmp/results.xml"/>

To execute all with the XML file configuration:


Manager manager = new Manager(java.io.File xmlConfigFile);
manager.execute();

Configure properties

Like in simple prop file :


	 <properties>
	   <prop key="RemoteHostname" value="nahuel"/>
        </properties>