[jboss-cvs] JBossAS SVN: r57685 - in trunk: build testsuite testsuite/imports testsuite/imports/sections testsuite/src/main/org/jboss/test testsuite/src/main/org/jboss/test/jbossmessaging testsuite/src/main/org/jboss/test/jbossmessaging/test testsuite/src/resources

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Oct 16 15:30:26 EDT 2006


Author: rachmatowicz at jboss.com
Date: 2006-10-16 15:30:25 -0400 (Mon, 16 Oct 2006)
New Revision: 57685

Added:
   trunk/testsuite/imports/sections/jbossmessaging.xml
   trunk/testsuite/src/main/org/jboss/test/jbossmessaging/
   trunk/testsuite/src/main/org/jboss/test/jbossmessaging/test/
   trunk/testsuite/src/main/org/jboss/test/jbossmessaging/test/ConcurrentDeliveryUnitTestCase.java
   trunk/testsuite/src/resources/jbossmessaging/
Modified:
   trunk/build/build-thirdparty.xml
   trunk/testsuite/build-thirdparty.xml
   trunk/testsuite/build.xml
   trunk/testsuite/imports/server-config.xml
   trunk/testsuite/imports/test-jars.xml
Log:
Allow execution of Messaging integration tests

Modified: trunk/build/build-thirdparty.xml
===================================================================
--- trunk/build/build-thirdparty.xml	2006-10-16 14:36:32 UTC (rev 57684)
+++ trunk/build/build-thirdparty.xml	2006-10-16 19:30:25 UTC (rev 57685)
@@ -94,7 +94,7 @@
       <componentref name="jboss/jbossxb" version="1.0.0.CR6"/>
       <componentref name="jboss/jbossws14" version="1.0.2.GA"/>
       <componentref name="jboss/jbossws" version="1.0.2.GA"/>
-      <componentref name="jboss/messaging" version="snapshot"/>
+      <componentref name="jboss/messaging" version="1.0.1.GA"/>
       <componentref name="jboss/microcontainer" version="snapshot"/>
       <componentref name="jboss/microcontainer14" version="snapshot"/>
       <componentref name="jboss/remoting" version="1.4.3.GA"/>

Modified: trunk/testsuite/build-thirdparty.xml
===================================================================
--- trunk/testsuite/build-thirdparty.xml	2006-10-16 14:36:32 UTC (rev 57684)
+++ trunk/testsuite/build-thirdparty.xml	2006-10-16 19:30:25 UTC (rev 57685)
@@ -42,7 +42,7 @@
         The repository is in CVS under the module repository.jboss.com whose contents
         are pushed to the http://repository.jboss.com site.
       -->
-      <componentref name="jboss/jboss-messaging" version="1.0.1.CR4"/> 
+      <!-- <componentref name="jboss/jboss-messaging" version="1.0.1.CR4"/> --> 
 
     </build>
 

Modified: trunk/testsuite/build.xml
===================================================================
--- trunk/testsuite/build.xml	2006-10-16 14:36:32 UTC (rev 57684)
+++ trunk/testsuite/build.xml	2006-10-16 19:30:25 UTC (rev 57685)
@@ -114,6 +114,7 @@
       <path refid="jboss.remoting.classpath"/>
       <path refid="jboss.serialization.classpath"/>
       <path refid="jboss.jbossxb.classpath"/>
+      <!-- needed for messaging JMS provider tests -->
       <path refid="jboss.messaging.classpath"/>
       <!-- needed for proxy tests -->
       <path refid="apache.bcel.classpath"/>
@@ -645,6 +646,10 @@
    <patternset id="jaxr.includes">
       <include name="org/jboss/test/jaxr/scout/**/*TestCase.class"/>
    </patternset>
+   <!-- jbossmessaging includes -->
+   <patternset id="jbossmessaging.includes">
+     <include name="org/jboss/test/jbossmessaging/test/*UnitTestCase.class"/>
+   </patternset>
    <!-- Tests needing xml binding setup -->
    <patternset id="jbossxb.includes">
       <include name="org/jboss/test/xml/*TestCase.class"/>
@@ -834,6 +839,7 @@
       <antcall target="tests-compatibility"/>
       <antcall target="tests-webservice-ssl"/>
       <antcall target="tests-aop-scoped"/>
+      <antcall target="tests-jbossmessaging"/>
       <antcall target="tests-report"/>
       <record name="${basedir}/build.log" action="stop"/>
    </target>
@@ -3177,6 +3183,72 @@
    </target>
 
    <!--
+     | Run JMS tests against the Messaging JMS provider
+   -->
+   <target name="tests-jbossmessaging"
+      description="Run JMS tests against the Messaging JMS provider">
+
+      <!-- Create a scoped Messaging server config -->
+      <ant antfile="${jboss.messaging.resources}/release-admin.xml"
+           target="create-server-config">
+        <property name="jboss.home" value="${jboss.dist}"/>
+        <property name="messaging.artifact.name" value="jboss-messaging-scoped.sar"/>
+        <property name="relative.artifact.location" value="${jboss.messaging.lib}"/>
+      </ant>
+
+      <!-- run the tests by calling a target - this target was defined in order to -->
+      <!-- allow modification of the test classpath                                -->
+      <server:start name="jbossmessaging"/>
+        <antcall target="tests-jbossmessaging-unit" />
+      <server:stop name="jbossmessaging"/>
+   </target>
+
+  <!-- Test the Messaging JMS provider -->
+  <target name="tests-jbossmessaging-unit">
+    <mkdir dir="${build.reports}"/>
+    <mkdir dir="${build.testlog}"/>
+    <junit dir="${module.output}"
+      printsummary="${junit.printsummary}"
+      haltonerror="${junit.haltonerror}"
+      haltonfailure="${junit.haltonfailure}"
+      fork="${junit.fork}"
+      timeout="${junit.timeout}"
+      jvm="${junit.jvm}">
+
+      <jvmarg value="${junit.jvm.options}"/>
+      <sysproperty key="jbosstest.deploy.dir" file="${build.lib}"/>
+      <sysproperty key="build.testlog" value="${build.testlog}"/>
+      <sysproperty key="log4j.configuration" value="file:${build.resources}/log4j.xml"/>
+      <sysproperty key="java.naming.provider.url" value="${node0.jndi.url}"/>
+      <sysproperty key="jbosstest.server.host" value="${node0}"/> 
+        <!-- Pass along any jbosstest.* system properties -->
+         <syspropertyset>
+            <propertyref prefix="jbosstest."/>
+         </syspropertyset>
+
+      <classpath>
+        <pathelement location="${build.classes}"/>
+        <pathelement location="${build.resources}"/>
+        <!-- need to prefix classpath to pick up correct versions of scoped client libs -->
+        <pathelement location="${jboss.messaging.lib}/jboss-messaging-client.jar"/>
+        <path refid="tests.classpath"/>
+      </classpath>
+
+      <formatter type="xml" usefile="${junit.formatter.usefile}"/>
+
+      <batchtest todir="${build.reports}"
+        haltonerror="${junit.batchtest.haltonerror}"
+        haltonfailure="${junit.batchtest.haltonfailure}"
+        fork="${junit.batchtest.fork}">
+         <fileset dir="${build.classes}">
+            <patternset refid="jbossmessaging.includes"/>
+         </fileset>
+      </batchtest>
+    </junit>
+   </target>
+
+
+   <!--
       | Run all database related tests
     -->
    <target name="tests-db" depends="run-db-tests, tests-report-html"/>

Added: trunk/testsuite/imports/sections/jbossmessaging.xml
===================================================================
--- trunk/testsuite/imports/sections/jbossmessaging.xml	2006-10-16 14:36:32 UTC (rev 57684)
+++ trunk/testsuite/imports/sections/jbossmessaging.xml	2006-10-16 19:30:25 UTC (rev 57685)
@@ -0,0 +1,19 @@
+<project name="tests-jbossmessaging-jars">
+   <!-- jbossmessaging tests -->
+   <target name="_jars-jbossmessaging">
+      <mkdir dir="${build.lib}"/>
+      
+      <!-- build jbossmessagingtest.jar -->
+      <jar destfile="${build.lib}/jbossmessagingtest.jar">
+         <fileset dir="${build.classes}">
+            <include name="org/jboss/test/jbossmessaging/**"/>
+         </fileset>
+      </jar>
+      
+      <!-- copy any required configuration files
+      <copy tofile="${build.lib}/jbossmessaging-recovery-service.xml"
+         file="${build.resources}/jbossmessaging/jbossmessaging-recovery-service.xml"/>
+      -->
+
+   </target>
+</project>

Modified: trunk/testsuite/imports/server-config.xml
===================================================================
--- trunk/testsuite/imports/server-config.xml	2006-10-16 14:36:32 UTC (rev 57684)
+++ trunk/testsuite/imports/server-config.xml	2006-10-16 19:30:25 UTC (rev 57685)
@@ -310,6 +310,7 @@
       <server name="jbpm-bpel" host="${node0}">
          <sysproperty key="java.endorsed.dirs" value="${jboss.dist}/lib/endorsed" />
       </server>
+      <server name="jbossmessaging" host="${node0}" config="messaging"/>
    </server:config>
 
     <!-- A macro for printing sleep before going into sleep

Modified: trunk/testsuite/imports/test-jars.xml
===================================================================
--- trunk/testsuite/imports/test-jars.xml	2006-10-16 14:36:32 UTC (rev 57684)
+++ trunk/testsuite/imports/test-jars.xml	2006-10-16 19:30:25 UTC (rev 57685)
@@ -31,6 +31,7 @@
    <import file="sections/iiop.xml"/>
    <import file="sections/invokers.xml"/>
    <import file="sections/isolation.xml"/>
+   <import file="sections/jbossmessaging.xml"/>
    <import file="sections/jbossmq.xml"/>
    <import file="sections/jbossmx.xml"/>
    <import file="sections/jbpm.xml"/>
@@ -111,6 +112,7 @@
         _jars-iiopperf,
         _jars-invokers,
         _jars-isolation,
+        _jars-jbossmessaging,
         _jars-jbossmq,
         _jars-jbossmx,
         _jars-jbpm,

Added: trunk/testsuite/src/main/org/jboss/test/jbossmessaging/test/ConcurrentDeliveryUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/jbossmessaging/test/ConcurrentDeliveryUnitTestCase.java	2006-10-16 14:36:32 UTC (rev 57684)
+++ trunk/testsuite/src/main/org/jboss/test/jbossmessaging/test/ConcurrentDeliveryUnitTestCase.java	2006-10-16 19:30:25 UTC (rev 57685)
@@ -0,0 +1,154 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+package org.jboss.test.jbossmessaging.test;
+
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueReceiver;
+import javax.jms.QueueSender;
+import javax.jms.QueueSession;
+import javax.jms.Session;
+import javax.jms.TemporaryQueue;
+import javax.naming.Context;
+
+import org.jboss.test.JBossTestCase;
+
+/**
+ * Concurrent delivery tests
+ *
+ * @author <a href="mailto:adrian at jboss.org>Adrian Brock</a>
+ * @version <tt>$Revision: 37406 $</tt>
+ */
+public class ConcurrentDeliveryUnitTestCase extends JBossTestCase
+{
+   static String QUEUE_FACTORY = "ConnectionFactory";
+
+   QueueConnection queueConnection;
+
+   int completed = 0;
+   boolean inDelivery = false;
+   boolean concurrent = false;
+   
+   public ConcurrentDeliveryUnitTestCase(String name) throws Exception
+   {
+      super(name);
+   }
+
+   public void testConcurrentDelivery() throws Exception
+   {
+      connect();
+      try
+      {
+         MyMessageListener messageListener = new MyMessageListener(); 
+         
+         QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+         TemporaryQueue queue1 = session.createTemporaryQueue();
+         QueueSender sender1 = session.createSender(queue1);
+         QueueReceiver receiver1 = session.createReceiver(queue1);
+         receiver1.setMessageListener(messageListener);
+         TemporaryQueue queue2 = session.createTemporaryQueue();
+         QueueSender sender2 = session.createSender(queue2);
+         QueueReceiver receiver2 = session.createReceiver(queue2);
+         receiver2.setMessageListener(messageListener);
+         Message message = session.createMessage();
+         queueConnection.start();
+
+         sender1.send(message);
+         sender2.send(message);
+
+         synchronized (messageListener)
+         {
+            while (completed < 2)
+            {
+               getLog().debug("Waiting for completion " + completed);
+               messageListener.wait();
+            }
+         }
+         getLog().debug("Completed");
+         
+         if (concurrent)
+            fail("Concurrent delivery");
+      }
+      finally
+      {
+         disconnect();
+      }
+   }
+
+   protected void connect() throws Exception
+   {
+      Context context = getInitialContext();
+      QueueConnectionFactory queueFactory = (QueueConnectionFactory) context.lookup(QUEUE_FACTORY);
+      queueConnection = queueFactory.createQueueConnection();
+
+      getLog().debug("Connection established.");
+   }
+
+   protected void disconnect()
+   {
+      try
+      {
+         if (queueConnection != null)
+            queueConnection.close();
+      }
+      catch (Throwable ignored)
+      {
+         getLog().warn("Ignored", ignored);
+      }
+
+      getLog().debug("Connection closed.");
+   }
+
+   public class MyMessageListener implements MessageListener
+   {
+      public void onMessage(Message message)
+      {
+         synchronized (this)
+         {
+            if (inDelivery)
+               concurrent = true;
+            inDelivery = true;
+            getLog().debug("In delivery " + message);
+         }
+         
+         try
+         {
+            Thread.sleep(10000);
+         }
+         catch (Throwable ignored)
+         {
+            getLog().warn("Ignored ", ignored);
+         }
+         
+         synchronized (this)
+         {
+            inDelivery = false;
+            ++completed;
+            notifyAll();
+            getLog().debug("Completed " + message);
+         }
+      }
+   }
+}
+




More information about the jboss-cvs-commits mailing list