The distributed test case framework for JMS using jgroups has been 
implemented(Based on remoting  DTF source base)

Scenario covered
1.One producer
2.One synchronous consumer

Its based on the distributed test framework developed by Tom for remoting 
org/jboss/dtf/**
I copied it into jboss-head/jms/tests directory.

Result

Testsuite: 
org.jboss.test.messaging.jms.dist.DistributedProducerSynchConsumerTestCase
Tests run: 1, Failures: 1, Errors: 0, Time elapsed: 35.441 sec
------------- Standard Output ---------------

-------------------------------------------------------
GMS: address is localhost:1821
-------------------------------------------------------
------------- ---------------- ---------------

Testcase: testInvokers took 30.113 sec
        FAILED
expected: but was:<ID:3j001-4n2l02-e7k0983a-1-e7k09gkq-3>
junit.framework.ComparisonFailure: expected: but 
was:<ID:3j001-4n2l02-e7k0983a-1-e7k09gkq-3>
        at 
org.jboss.test.messaging.jms.dist.DistributedProducerSynchConsumerTestCase.testInvokers(DistributedProducerSynchConsumerTestCase.java:125)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at org.jboss.dtf.DistributedTestCase.run(DistributedTestCase.java:509)

The Test Fails, producer is setting the msg id to null,
(similar scenario in a local call passes)
With last weeks' CVS co this was passing, when i did the update yesterday the 
test started failing.

Issues faced

1.Had to change the {}/jboss-head/jms/src/resources/jgroups-core.jar with the 
one from thirdparty module
Problem with RPCDispatcher of jgroups-core, not able to make remote calls to 
methods of super class if they are not overridden in the sub class.

2.Added following property to jgroups props in 
org.jboss.dtf.DistributedTestCase to make jgroups work on my m/c
        bind_addr=127.0.0.1;
        please remove this if tests give an error.
Design

The test case has the following java files

 org.jboss.test.messaging.jms.dist.DistributedProducerSynchConsumerTestCase
  |  org.jboss.test.messaging.jms.dist.ProducerClientTest
  |  org.jboss.test.messaging.jms.dist.SynchConsumerClientTest
  | 
DistributedProducerSynchConsumerTestCase is the main TestCase (extends 
org.jboss.dtf.DistributedTestCase).
It configures the Topics/Queues using ServerManagement utility.
It launches Producers and Consumers in their own VMs (each producer and 
consumer extend  org.jboss.dtf.DistributedTestCase.)
during setUp.

All the VMs wait for each other to come up and then the actual execution of the 
test cases happen.(each VM must know what are the total number of parties 
coming up)

In this test case producer and consumers update 
DistributedProducerSynchConsumerTestCase for the messageID sent and received , 
the assert call happens in DistributedProducerSynchConsumerTestCase.

New Features added to org.jboss.dtf.DistributedTestCase
Call back method  : 
  public void sendMessage(String type,String message)
  |    {
  |         MethodCall call = new MethodCall("receiveMessage",
  |                                               new Object[]{type,message}, 
new Class[]{String.class,String.class});
  |              disp.callRemoteMethods(null, call, GroupRequest.GET_NONE, 0);
  |             log.debug("sent Message :" + call);
  |    }
  | 
  |    public void receiveMessage(String type,String message)
  |    {
  |        log.debug("Received Msg:" + type + "::" + message);
  |    } 
  |  
for sending receiving the messageIDs between VMs.

Logging initializer : 
        public Logger setLogging(String level, String fileName, Class classObj) 
  |     {
  |             ...
  |     }
  | 
Each VM has its own log file named named after fully qualified class name and 
an ID given as a command line agreement.


Changes to build.xml in jboss-head/jms/tests

Added the following lines in

  | <path id="library.classpath">
  | 
  |       <!--<pathelement 
path="${module.root}/../src/resources/jgroups-core.jar"/>-->
  |       <pathelement path="${module.root}/../src/resources/jgroups.jar"/>
  |       <pathelement 
path="${module.root}/../../j2ee/output/lib/jboss-j2ee.jar"/>
  | 
  | Added new component
  |  <path id="jms.classes">
  |             <pathelement path="./../output/etc"/>
  |             <pathelement path="./../output/classes"/>
  |             <pathelement 
path="${module.root}/../../aspects/output/lib/jboss-aspect-library.jar"/>
  |             <pathelement 
path="${module.root}/../../common/output/lib/jboss-common.jar"/>
  |             <pathelement 
path="${module.root}/../../remoting/output/lib/jboss-remoting.jar"/>
  |             <pathelement 
path="${module.root}/../../j2se/output/lib/jboss-j2se.jar"/>
  |             <pathelement 
path="${module.root}/../../naming/output/lib/jnp-client.jar"/>
  |             <pathelement 
path="${module.root}/../../thirdparty/javassist/lib/javassist.jar"/>
  |             <pathelement 
path="${module.root}/../../thirdparty/oswego-concurrent/lib/concurrent.jar"/>
  |             <pathelement 
path="${module.root}/../../thirdparty/apache-commons/lib/commons-httpclient.jar"/>
  |             <pathelement 
path="${module.root}/../../thirdparty/trove/lib/trove.jar"/>
  |    </path>
  | 
  |  <path id="dependentmodule.classpath">
  |       <path refid="jboss.common.classpath"/>
  |       <path refid="jboss.jms.classpath"/>
  |       <path refid="jboss.j2ee.classpath"/>
  |       <path refid="jboss.j2se.classpath"/>
  |       <path refid="jms.classes"/>
  |       <path refid="jboss.remoting.classpath"/>
  |       <path refid="jboss.aop.classpath"/>
  |    </path>
  | 
  | <target name="tests-jar"
  |            depends="compile-test-classes"
  |            description="Creates the jar file with all the tests">
  | 
  |       <mkdir dir="${build.tests.lib}"/>
  | 
  |       <!-- Build the tests jar -->
  |       <jar jarfile="${build.tests.lib}/${build.tests.archive}">
  |          <fileset dir="${build.tests.classes}">
  |             <include name="org/jboss/test/messaging/**"/>
  |             <include name="org/jboss/dtf/**"/>
  |             <include name="org/jboss/dummy/**"/>
  |          </fileset>
  |       </jar>
  |    </target>
  | 
Changes made to org.jboss.jms.ServerManagement
        Added the following methods

  |      public synchronized static void startRemoteServer(Hashtable ht) throws 
Exception
  | 
  |      public synchronized static void stopRemoteServer() throws Exception
  | 
  |      public static InitialContext getRemoteInitialContext() throws 
Exception 
  | 

Ovidiu,Earlier tests i had written were based on my design in this forum.
Now those utility classes are doing what ServerManagement does.

ServerManagement has to be abstracted into an interface so that our test cases 
run with any jms impl.







View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3874050#3874050

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3874050


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
JBoss-Development mailing list
JBoss-Development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to