Here you will find some tips to run the testcases under the "testsuite", especially the clustered testcases.
Clean the build generated files:
The "clean" target in build-test.xml ONLY cleans the class files generated in the $EJB3_HOME/testsuite/target/test-classes.
ant -f build-test.xml clean
The testsuite requires the classes under $EJB3_HOME/testsuite/target/test-classes and also some jar files (which are generated by one of the build-test.xml tasks) to function correctly. For example, the clusteredsession testcases require the .class files and $EJB3_HOME/testsuite/target/test-lib/clusteredsession-test.jar
To clean everything (including these jar files), use the Maven goal:
cd $EJB3_HOME/testsuite mvn clean
To regenerate the class files and the jar files afresh, run:
cd $EJB3_HOME/testsuite mvn install
How to run the clustering test cases in the testsuite:
We will be considering the clusteredsession testcases in this example. For these testcases, you need a clustered setup with more than 1 node. So the first step is to create a clustered JBossAS setup. In one of the earlier steps, you might already have installed JBoss AS (Trunk) and pointed the JBOSS_HOME to it. In this example we will be using a cluster with 2 nodes.
- The first node can be the "all" profile of the JBossAS. To create another node, create a copy of the "all" folder under %JBOSS_HOME%/server and name it "cluster" (can be named anything).
- The next step is to start each of these nodes and ensure that there are no port conflicts. While writing wiki, i used JBoss-5 CR2. To understand, how you can start multiple instances on the same system without running into port conflicts, in JBoss-5 CR2, see the reply by Peter Johnson in this forum thread Run multiple JBoss instances on JBoss-5 CR2
- So after doing any necessary changes in the xml files (for the ports related bug mentioned in the forum thread), lets start the servers:
Node1 (the "all" profile):
cd %JBOSS_HOME%/bin run -c all -b 0.0.0.0 -Djboss.service.binding.set=ports-01
After Node1 starts, start Node2 (the "cluster" profile):
cd %JBOSS_HOME%/bin run -c cluster -b 0.0.0.0 -Djboss.service.binding.set=ports-02
- So now we have created a cluster with 2 nodes. To confirm that both the systems are forming a cluster, check for a log message like:
INFO Org.jboss.ha.framework.server.DistributedReplicantManagerImpl I am (223.1.1.128:1199) received membershipChanged event: INFO Org.jboss.ha.framework.server.DistributedReplicantManagerImpl Dead members: 0 ({FOOTNOTE DEF }) INFO Org.jboss.ha.framework.server.DistributedReplicantManagerImpl New Members : 1 (223.1.1.1281299) INFO Org.jboss.ha.framework.server.DistributedReplicantManagerImpl All Members : 2 (223.1.1.1281199223.1.1.1281299)
You will see this message on the master of the cluster (the node which was started first).
- The next step is to configure the testsuite to point it to this cluster. Under $EJB3_HOME/testsuite you will find a local.properties file. Edit this file to point it to the cluster (DO NOT COMMIT THE CHANGES TO THIS FILE IN SVN). Here's an example:
node0=127.0.0.1 node0.jndi.url=jnp://127.0.0.1:1199 node1=10.77.222.50 node1.jndi.url=jnp://10.77.222.50:1299 jboss.startup.timeout=180
After these changes, we are now ready to run the clusteredsession testcases.
cd $EJB3_HOME/testsuite ant -f build-test.xml one-test -Dtest=clusteredsession
That's it!
Comments