[jboss-cvs] JBossAS SVN: r65777 - in branches/JBPAPP_4_2_0_GA_CP: build and 41 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Oct 2 18:26:18 EDT 2007


Author: fnasser at redhat.com
Date: 2007-10-02 18:26:17 -0400 (Tue, 02 Oct 2007)
New Revision: 65777

Added:
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test-configs/localfromremote2/conf/jndi.properties
   branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/
   branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/
   branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/
   branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/
   branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/META-INF/
   branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/META-INF/MANIFEST.MF
   branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/META-INF/jboss-service.xml
   branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/connection-factories-service.xml
   branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/destinations-service.xml
   branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/hsqldb-persistence-service.xml
   branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/messaging-service.xml
   branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/remoting-bisocket-service.xml
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/JBossMessagingAdmin.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/JMSBase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/JMSTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/MockServerSessionPool.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/perf/
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/perf/JMSPerfStressTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/perf/JMSReconnectStressTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/perf/ReceiveNackClientStressTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/perf/SendReplyPerfStressTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra/
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaJMSSessionUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaQueueUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaSyncRecUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaTest.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaTopicUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/ConcurrentDeliveryUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/ConnectionConsumerUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/JBossJMSUnitTest.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/JBossMessagingJoramUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/JBossSessionRecoverUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/Jms11UnitTest.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/MessageBodyUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/MessageTypesUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/RollBackUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/SecurityUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/SessionCloseStressTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/TemporarySessionConnectionUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/UnackedUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/XAResourceUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/jbossmessaging/
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/jbossmessaging/provider.properties
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/jbossmessaging/test-destinations-full-service.xml
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/mdb4jbm/
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/mdb4jbm/META-INF/
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/mdb4jbm/META-INF/ejb-jar.xml
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/mdb4jbm/META-INF/jboss.xml
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/mdb4jbm/client.policy
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/mdb4jbm/jboss-service.xml
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security-spec/service-inf-jbm/
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security-spec/service-inf-jbm/jboss-service.xml
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security-spec/service-inf-jbm/spec-test-config.xml
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security/custom-secmgr/queues-jbm-service.xml
Removed:
   branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/
   branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/
   branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/
   branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/META-INF/
   branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/META-INF/MANIFEST.MF
   branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/META-INF/jboss-service.xml
   branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/connection-factories-service.xml
   branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/destinations-service.xml
   branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/hsqldb-persistence-service.xml
   branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/messaging-service.xml
   branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/remoting-bisocket-service.xml
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/JBossMessagingAdmin.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/JMSBase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/JMSTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/MockServerSessionPool.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/perf/
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/perf/JMSPerfStressTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/perf/JMSReconnectStressTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/perf/ReceiveNackClientStressTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/perf/SendReplyPerfStressTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra/
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaJMSSessionUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaQueueUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaSyncRecUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaTest.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaTopicUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/ConcurrentDeliveryUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/ConnectionConsumerUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/JBossJMSUnitTest.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/JBossMessagingJoramUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/JBossSessionRecoverUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/Jms11UnitTest.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/MessageBodyUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/MessageTypesUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/RollBackUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/SecurityUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/SessionCloseStressTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/TemporarySessionConnectionUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/UnackedUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/XAResourceUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/jbossmessaging/provider.properties
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/jbossmessaging/test-destinations-full-service.xml
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/mdb4jbm/META-INF/
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/mdb4jbm/META-INF/ejb-jar.xml
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/mdb4jbm/META-INF/jboss.xml
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/mdb4jbm/client.policy
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/mdb4jbm/jboss-service.xml
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security-spec/service-inf-jbm/jboss-service.xml
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security-spec/service-inf-jbm/spec-test-config.xml
Modified:
   branches/JBPAPP_4_2_0_GA_CP/aspects/build-test50.xml
   branches/JBPAPP_4_2_0_GA_CP/build/build-distr.xml
   branches/JBPAPP_4_2_0_GA_CP/build/build-release.xml
   branches/JBPAPP_4_2_0_GA_CP/build/build-thirdparty.xml
   branches/JBPAPP_4_2_0_GA_CP/build/build.xml
   branches/JBPAPP_4_2_0_GA_CP/cluster/build.xml
   branches/JBPAPP_4_2_0_GA_CP/console/build.xml
   branches/JBPAPP_4_2_0_GA_CP/ejb3/build-from-5.xml
   branches/JBPAPP_4_2_0_GA_CP/ejb3/build-test.xml
   branches/JBPAPP_4_2_0_GA_CP/ejb3/build.xml
   branches/JBPAPP_4_2_0_GA_CP/ejb3/deprecated-build-test.xml
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/stateful/unit/RemoteUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/server/src/etc/conf/default/login-config.xml
   branches/JBPAPP_4_2_0_GA_CP/server/src/etc/conf/default/standardjboss.xml
   branches/JBPAPP_4_2_0_GA_CP/server/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/build.xml
   branches/JBPAPP_4_2_0_GA_CP/testsuite/deprecated-build.xml
   branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/config/tests-jacc.xml
   branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/sections/mdb.xml
   branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/sections/security.xml
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cts/test/MDBUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jacc/test/EJBSpecUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jacc/test/WebIntegrationUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jmsra/test/RaQueueUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jmsra/test/RaSyncRecUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jmsra/test/RaTopicUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/mdb/test/MDBUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/messagedriven/mbeans/TestMessageDrivenManagement.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/messagedriven/support/BasicMessageDrivenUnitTest.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/messagedriven/support/CheckJMSDestinationOperation.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/messagedriven/support/SendMessageOperation.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/messagedriven/support/SimpleMessageDrivenUnitTest.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/messagedriven/test/JMSContainerInvokerDurableTopicMessageDrivenUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/messagedriven/test/JMSContainerInvokerQueueMessageDrivenUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/messagedriven/test/JMSContainerInvokerTopicMessageDrivenUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/test/CustomSecurityManager.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/test/CustomSecurityManagerTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/test/EJBSpecUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/web/test/WebIntegrationUnitTestCase.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/securitymgr/server.policy
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/test-configs/jacc/conf/login-config.xml
   branches/JBPAPP_4_2_0_GA_CP/tools/etc/buildmagic/modules.ent
   branches/JBPAPP_4_2_0_GA_CP/tools/etc/buildmagic/modules.xml
   branches/JBPAPP_4_2_0_GA_CP/varia/build.xml
Log:
Merged JBM (Messaging) integration changes in JBPAPP_4_2 from r64604 to r:65765 into JBPAPP_4_2_0_GA_CP, the official CP line code (now for both EAP 4.2 and EAP 4.3)

Modified: branches/JBPAPP_4_2_0_GA_CP/aspects/build-test50.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/aspects/build-test50.xml	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/aspects/build-test50.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -115,7 +115,7 @@
          <path refid="jboss.security.classpath"/>
          <!-- this is for the NonSerializableFactory -->
          <path refid="jboss.server.classpath"/>
-         <path refid="jboss.messaging.classpath"/>
+         <path refid="jboss.messaging-mq.classpath"/>
          <path refid="jboss.test.classpath"/>
       </path>
 

Modified: branches/JBPAPP_4_2_0_GA_CP/build/build-distr.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/build/build-distr.xml	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/build/build-distr.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -526,8 +526,50 @@
       </fileset>
     </copy>
   </target>
+	
+  <target name="replace-messaging" description = "Replace JBossMQ by JBoss Messaging on a given installation">
+  	
+  	<property name="target" value="default"/>
+  	
+	
+  	<echo message="target = ${target} ${jboss.messaging.lib}"/>
+  	<move todir="${install.server}/${target}/deploy" failonerror="no">
+  	  <fileset dir="${install.server}/${target}/deploy/jms">
+ 	     <include name="hajndi-jms-ds.xml"/>
+ 	     <include name="jms-ds.xml"/>
+  	     <include name="jms-ra.rar"/>
+  	  </fileset>
+  	</move>
+    <copy todir="${install.server}/${target}/lib" filtering="no">
+      <fileset dir="${jboss.messaging.lib}">
+        <include name="jboss-messaging.jar"/>
+        <include name="jboss-messaging-client.jar"/>
+      </fileset>
+    </copy>
 
+    <copy todir="${install.server}/${target}/deploy/jboss-messaging.sar" filtering="no">
+      <fileset dir="${project.root}/messaging/output/etc/server-jbm/default/deploy/jboss-messaging.sar">
+        <include name="**"/>
+      </fileset>
+    </copy>
+  	
+  	<replace file="${install.server}/${target}/conf/standardjboss.xml">
+	  	<replacefilter token="jboss.mq:service=DestinationManager" value="jboss.messaging:service=ServerPeer"/>
+	  	<replacefilter token="&gt;createTopic&lt;" value="&gt;deployTopic&lt;"/>
+	  	<replacefilter token="&gt;createQueue&lt;" value="&gt;deployQueue&lt;"/>
+  	</replace>
 
+  	
+  	<delete dir="${install.server}/${target}/deploy/jms"/>
+  	<delete dir="${install.server}/${target}/deploy-hasingleton/jms"/>
+
+    <!-- Removing jbossmq libraries -->
+    <delete file="${install.server}/${target}/lib/jbossmq.jar"/>
+    <delete file="${install.client}/jbossmq-client.jar"/> 
+
+  </target>
+	
+
   <!-- === -->
   <!-- JMX -->
   <!-- === -->

Modified: branches/JBPAPP_4_2_0_GA_CP/build/build-release.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/build/build-release.xml	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/build/build-release.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -70,7 +70,7 @@
    <!-- Include the environment properties -->
    <property environment="env"/>
    <!-- The cvs top level module name -->
-   <property name="cvs.module" value="jboss-4.2.x"/>
+   <property name="cvs.module" value="jboss-${release.version.major}.${release.version.minor}.x"/>
    <!-- Set the cvs.tag based on the release.version.* properties -->
    <!-- Set the cvs.tag based on the release.version.* properties -->
    <condition property="cvs.tag" value="JBoss_${release.version.major}_${release.version.minor}_${release.version.revision}_${release.version.tag}">

Modified: branches/JBPAPP_4_2_0_GA_CP/build/build-thirdparty.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/build/build-thirdparty.xml	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/build/build-thirdparty.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -28,6 +28,11 @@
   <setproxy proxyhost="<your.proxy.host>" proxyport="<your.proxy.port>"/>
   -->
 
+  <!-- set jbossws version -->
+  <condition property="jbws.version" value="1.2.1.GA_CP01" else="1.2.1.GA_CP01">
+    <isset property="build.soa"/>
+  </condition>
+
   <!-- Main Definition of dependencies -->
   <build
     id="jbossas-thirdparty"
@@ -85,11 +90,11 @@
     <componentref name="jboss/dom4j-jarjar" version="1.6.1"/>
     <componentref name="jboss/jaxr" version="1.2.0.GA"/>
     <componentref name="jboss/jbossts14" version="4.2.3.SP5-brew"/>
-    <componentref name="jboss/jbossws-jboss42" version="1.2.1.GA_CP01"/>
+    <componentref name="jboss/jbossws-jboss42" version="${jbws.version}"/>
     <componentref name="jboss/jbossxb" version="1.0.0.GA_CP01-brew"/>
     <componentref name="jboss/microcontainer" version="1.0.2"/>
     <componentref name="jboss/profiler/jvmti" version="1.0.0.CR5-brew"/>
-    <componentref name="jboss/remoting" version="2.2.2.GA-brew"/>
+    <componentref name="jboss/remoting" version="2.2.2.SP1.patch01-brew"/>
     <componentref name="jboss/serialization" version="1.0.3.GA-brew"/>
     <componentref name="jboss/jboss-vfs" version="1.0.0.GA"/>
     <componentref name="jboss/web" version="2.0.0.GA_CP01-brew"/>
@@ -98,7 +103,7 @@
     <componentref name="joesnmp" version="0.3.4-brew"/>
     <componentref name="juddi" version="0.9RC4-brew"/>
     <componentref name="junit" version="3.8.2-brew"/>
-    <componentref name="objectweb-joramtests" version="1.1"/>
+    <componentref name="objectweb-joramtests" version="1.5"/>
     <componentref name="odmg" version="3.0-brew"/>
     <componentref name="oswego-concurrent" version="1.3.4-brew"/>
     <componentref name="quartz" version="1.5.2-brew"/>
@@ -113,6 +118,7 @@
     <componentref name="trove" version="1.0.2-brew"/>
     <componentref name="woodstox" version="3.1.1-brew"/>
     <componentref name="xdoclet" version="1.2.3-brew"/>
+    <componentref name="jboss/messaging" version="snapshot"/>
   </build>
 
   <synchronizeinfo/>

Modified: branches/JBPAPP_4_2_0_GA_CP/build/build.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/build/build.xml	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/build/build.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -383,11 +383,25 @@
   <target name="_module-messaging-most">
      <ant antfile="build-distr.xml" target="_module-messaging-most"/>
   </target>
-
+	
   <target name="_module-messaging-all" depends="_module-messaging-most">
      <ant antfile="build-distr.xml" target="_module-messaging-all"/>
   </target>
 
+  <!-- Parameter target - The target which will be replaced by jboss-messaging -->
+  <target name="replace-messaging" description = "Replace JBossMQ by JBoss Messaging on a given installation" depends="init" if="build.soa">
+  	
+  	 <ant antfile="build-distr.xml" target="replace-messaging">
+ 	 	 <property name="target" value="default" />
+  	 </ant>
+ 	 <ant antfile="build-distr.xml" target="replace-messaging">
+	 	 <property name="target" value="all" />
+ 	 </ant>
+ 	 <ant antfile="build-distr.xml" target="replace-messaging">
+	 	 <property name="target" value="production" />
+ 	 </ant>
+  	
+  </target>
 
   <!-- === -->
   <!-- JMX -->
@@ -577,7 +591,9 @@
 
   <target name="install"
     description="Install the structure for a release."
-    depends="partition-build"/>
+    depends="partition-build">
+   	 <antcall target="replace-messaging"/>
+  </target>
 
   <target name="release"
     description="Builds the default release structure."
@@ -804,7 +820,7 @@
 
    <target name="main" depends="most"
      description="Executes the default target (most)."/>
-
+	
    <target name="all" depends="createthirdparty, modules-all, install"
      description="Executes all modules and builds everything."/>
 
@@ -1294,3 +1310,4 @@
   </target>
 
 </project>
+

Modified: branches/JBPAPP_4_2_0_GA_CP/cluster/build.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/cluster/build.xml	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/cluster/build.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -90,7 +90,7 @@
       <path refid="jboss.common.classpath"/>
       <path refid="jboss.system.classpath"/>
       <path refid="jboss.naming.classpath"/>
-      <path refid="jboss.messaging.classpath"/>
+      <path refid="jboss.messaging-mq.classpath"/>
       <path refid="jboss.server.classpath"/>
       <path refid="jboss.security.classpath"/>
       <path refid="jboss.jmx.classpath"/>

Modified: branches/JBPAPP_4_2_0_GA_CP/console/build.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/console/build.xml	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/console/build.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -93,7 +93,7 @@
       <path refid="jboss.jmx.classpath"/>
       <path refid="jboss.management.classpath"/>
       <path refid="jboss.server.classpath"/>
-      <path refid="jboss.messaging.classpath"/>
+      <path refid="jboss.messaging-mq.classpath"/>
       <path refid="jboss.system.classpath"/>
       <path refid="jboss.varia.classpath"/>
       <path refid="jboss.aop.classpath"/>

Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/build-from-5.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/build-from-5.xml	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/build-from-5.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -139,7 +139,7 @@
          <path refid="jboss.transaction.classpath"/>
          <path refid="jboss.security.classpath"/>
          <path refid="jboss.server.classpath"/>
-         <path refid="jboss.messaging.classpath"/>
+         <path refid="jboss.messaging-mq.classpath"/>
          <path refid="jboss.jca.classpath"/>
          <path refid="jboss.iiop.classpath"/>
       </path>

Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/build-test.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/build-test.xml	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/build-test.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -189,7 +189,7 @@
       <path refid="jboss.security.classpath"/>
       <!-- this is for the NonSerializableFactory -->
       <path refid="jboss.server.classpath"/>
-      <path refid="jboss.messaging.classpath"/>
+      <path refid="jboss.messaging-mq.classpath"/>
       <path refid="jboss.test.classpath"/>
       <path refid="jboss.ejb3.classpath"/>
       <!--path refid="jboss.webservice.classpath"/-->

Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/build.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/build.xml	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/build.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -135,7 +135,7 @@
          <path refid="jboss.transaction.classpath"/>
          <path refid="jboss.security.classpath"/>
          <path refid="jboss.server.classpath"/>
-         <path refid="jboss.messaging.classpath"/>
+         <path refid="jboss.messaging-mq.classpath"/>
          <path refid="jboss.jca.classpath"/>
          <path refid="jboss.iiop.classpath"/>
       </path>

Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/deprecated-build-test.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/deprecated-build-test.xml	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/deprecated-build-test.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -115,7 +115,7 @@
          <path refid="jboss.security.classpath"/>
          <!-- this is for the NonSerializableFactory -->
          <path refid="jboss.server.classpath"/>
-         <path refid="jboss.messaging.classpath"/>
+         <path refid="jboss.messaging-mq.classpath"/>
          <path refid="jboss.test.classpath"/>
          <path refid="jboss.container.classpath"/>
          <path refid="jboss.kernel.classpath"/>

Added: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test-configs/localfromremote2/conf/jndi.properties
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test-configs/localfromremote2/conf/jndi.properties	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test-configs/localfromremote2/conf/jndi.properties	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,5 @@
+# DO NOT EDIT THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING
+#
+java.naming.provider.url=localhost:1199
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/stateful/unit/RemoteUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/stateful/unit/RemoteUnitTestCase.java	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/stateful/unit/RemoteUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -270,7 +270,7 @@
       catch (Exception e)
       {
          if (e.getCause() == null || !(e.getCause() instanceof javax.ejb.EJBException))
-            fail("EJBException should be thrown as cause");
+            fail("EJBException should be thrown as cause " + e);
       }
    }
    

Copied: branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm (from rev 64641, branches/JBPAPP_4_2/messaging/src/etc/server-jbm)

Copied: branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default (from rev 64641, branches/JBPAPP_4_2/messaging/src/etc/server-jbm/default)

Copied: branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy (from rev 64641, branches/JBPAPP_4_2/messaging/src/etc/server-jbm/default/deploy)

Copied: branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar (from rev 64641, branches/JBPAPP_4_2/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar)

Copied: branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/META-INF (from rev 64641, branches/JBPAPP_4_2/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/META-INF)

Deleted: branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/META-INF/MANIFEST.MF
===================================================================
--- branches/JBPAPP_4_2/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/META-INF/MANIFEST.MF	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/META-INF/MANIFEST.MF	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,13 +0,0 @@
-Manifest-Version: 1.0
-Ant-Version: Apache Ant 1.6.2
-Created-By: 1.5.0_07-b03 (Sun Microsystems Inc.)
-Specification-Title: JBoss Messaging
-Specification-Version: 1.3.0.GA
-Specification-Vendor: JBoss Inc. (http://www.jboss.org/)
-Implementation-Title: JBoss Messaging
-Implementation-URL: http://www.jboss.org/
-Implementation-Version: 1.3.0.GA (build: CVSTag=JBossMessaging_1_3_0_G
- A date=200706111737)
-Implementation-Vendor: JBoss Inc. (http://www.jboss.org/)
-Implementation-Vendor-Id: http://www.jboss.org/
-

Copied: branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/META-INF/MANIFEST.MF (from rev 64641, branches/JBPAPP_4_2/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/META-INF/MANIFEST.MF)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/META-INF/MANIFEST.MF	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/META-INF/MANIFEST.MF	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Ant-Version: Apache Ant 1.6.2
+Created-By: 1.5.0_07-b03 (Sun Microsystems Inc.)
+Specification-Title: JBoss Messaging
+Specification-Version: 1.3.0.GA
+Specification-Vendor: JBoss Inc. (http://www.jboss.org/)
+Implementation-Title: JBoss Messaging
+Implementation-URL: http://www.jboss.org/
+Implementation-Version: 1.3.0.GA (build: CVSTag=JBossMessaging_1_3_0_G
+ A date=200706111737)
+Implementation-Vendor: JBoss Inc. (http://www.jboss.org/)
+Implementation-Vendor-Id: http://www.jboss.org/
+

Deleted: branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/META-INF/jboss-service.xml
===================================================================
--- branches/JBPAPP_4_2/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/META-INF/jboss-service.xml	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/META-INF/jboss-service.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-     Bootstrap - starts the messaging server peer
-
-     $Id$
- -->
-
-<server>
-
-   <mbean code="org.jboss.jms.server.Bootstrap"
-      name="jboss.messaging:service=Bootstrap"
-      xmbean-dd="xmdesc/Bootstrap-xmbean.xml">
-      <depends>jboss.messaging:service=ServerPeer</depends>
-   </mbean>
-
-</server>
\ No newline at end of file

Copied: branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/META-INF/jboss-service.xml (from rev 64641, branches/JBPAPP_4_2/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/META-INF/jboss-service.xml)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/META-INF/jboss-service.xml	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/META-INF/jboss-service.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+     Bootstrap - starts the messaging server peer
+
+     $Id$
+ -->
+
+<server>
+
+   <mbean code="org.jboss.jms.server.Bootstrap"
+      name="jboss.messaging:service=Bootstrap"
+      xmbean-dd="xmdesc/Bootstrap-xmbean.xml">
+      <depends>jboss.messaging:service=ServerPeer</depends>
+   </mbean>
+
+</server>
\ No newline at end of file

Deleted: branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/connection-factories-service.xml
===================================================================
--- branches/JBPAPP_4_2/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/connection-factories-service.xml	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/connection-factories-service.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,141 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-     Messaging Connection Factories deployment descriptor.
-
-     $Id$
- -->
-
-<server>
-
-   <!-- The default connection factory does not support automatic failover or load balancing-
-        this is so we can maintain compatiblity with applications written for JBoss MQ which use this
-        connection factory.
-   -->     
-   <mbean code="org.jboss.jms.server.connectionfactory.ConnectionFactory"
-      name="jboss.messaging.connectionfactory:service=ConnectionFactory"
-      xmbean-dd="xmdesc/ConnectionFactory-xmbean.xml">
-      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-      <depends optional-attribute-name="Connector">jboss.messaging:service=Connector,transport=bisocket</depends>
-      <depends>jboss.messaging:service=PostOffice</depends>
-
-      <attribute name="JNDIBindings">
-         <bindings>
-            <binding>/ConnectionFactory</binding>
-            <binding>/XAConnectionFactory</binding>
-            <binding>java:/ConnectionFactory</binding>
-            <binding>java:/XAConnectionFactory</binding>
-         </bindings>
-      </attribute>
-   </mbean>
-
-   <!-- A clustered connection factory that supports automatic failover and load balancing of created
-        connections.
-        This factory is not suitable to be used by MDBs.
-   -->
-   <mbean code="org.jboss.jms.server.connectionfactory.ConnectionFactory"
-      name="jboss.messaging.connectionfactory:service=ClusteredConnectionFactory"
-      xmbean-dd="xmdesc/ConnectionFactory-xmbean.xml">
-      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-      <depends optional-attribute-name="Connector">jboss.messaging:service=Connector,transport=bisocket</depends>
-      <depends>jboss.messaging:service=PostOffice</depends>
-
-      <attribute name="JNDIBindings">
-         <bindings>
-            <binding>/ClusteredConnectionFactory</binding>
-            <binding>/ClusteredXAConnectionFactory</binding>
-            <binding>java:/ClusteredConnectionFactory</binding>
-            <binding>java:/ClusteredXAConnectionFactory</binding>
-         </bindings>
-      </attribute>
-
-      <attribute name="SupportsFailover">true</attribute>
-      <attribute name="SupportsLoadBalancing">true</attribute>      
-   </mbean>
-   
-   <!-- A connection factory with no JNDI bindings that is used in clustering to create the connections that
-        pull messages from one node to another
-   -->
-   <mbean code="org.jboss.jms.server.connectionfactory.ConnectionFactory"
-      name="jboss.messaging.connectionfactory:service=ClusterPullConnectionFactory"
-      xmbean-dd="xmdesc/ConnectionFactory-xmbean.xml">
-      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-      <depends optional-attribute-name="Connector">jboss.messaging:service=Connector,transport=bisocket</depends>
-      <depends>jboss.messaging:service=PostOffice</depends>
-      <attribute name="SupportsFailover">false</attribute>
-      <attribute name="SupportsLoadBalancing">false</attribute>      
-   </mbean>
-   
-   <!-- An example connection factory with all attributes shown 
-   
-   <mbean code="org.jboss.jms.server.connectionfactory.ConnectionFactory"
-      name="jboss.messaging.connectionfactory:service=MyExampleConnectionFactory"
-      xmbean-dd="xmdesc/ConnectionFactory-xmbean.xml">
-      
-      <constructor>
-      
-         <!- - You can specify the default Client ID to use for connections created using this factory - -> 
-         
-         <arg type="java.lang.String" value="MyClientID"/>
-         
-      </constructor>
-      
-      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-      
-      <!- - The transport to use - can be bisocket, sslbisocket or http - ->
-      
-      <depends optional-attribute-name="Connector">jboss.messaging:service=Connector,transport=http</depends>
-      
-      <depends>jboss.messaging:service=PostOffice</depends>
-      
-      <!- - PrefetchSize determines the approximate maximum number of messages the client consumer will buffer locally - ->
-      
-      <attribute name="PrefetchSize">150</attribute>
-      
-      <!- - Paging params to be used for temporary queues - ->
-      
-      <attribute name="DefaultTempQueueFullSize">200000</attribute>
-      
-      <attribute name="DefaultTempQueuePageSizeSize">2000</attribute>
-      
-      <attribute name="DefaultTempQueueDownCacheSize">2000</attribute>
-      
-      <!- - The batch size to use when using the DUPS_OK_ACKNOWLEDGE acknowledgement mode - ->
-      
-      <attribute name="DupsOKBatchSize">5000</attribute>
-      
-      <!- - Does this connection factory support automatic failover? - ->
-      
-      <attribute name="SupportsFailover">false</attribute>
-      
-      <!- - Does this connection factory support automatic client side load balancing? - ->
-      
-      <attribute name="SupportsLoadBalancing">false</attribute>  
-            
-      <!- - The class name of the factory used to create the load balancing policy to use on the client side - ->
-      
-      <attribute name="LoadBalancingFactory">org.jboss.jms.client.plugin.RoundRobinLoadBalancingFactory</attribute>  
-      
-      <!- - The connection factory will be bound in the following places in JNDI - ->
-
-      <attribute name="JNDIBindings">
-      
-         <bindings>
-         
-            <binding>/acme/MyExampleConnectionFactory</binding>
-            
-            <binding>/acme/MyExampleConnectionFactoryDupe</binding>
-            
-            <binding>java:/xyz/CF1</binding>
-            
-            <binding>java:/connectionfactories/acme/connection_factory</binding>
-            
-         </bindings>
-         
-      </attribute>   
-       
-   </mbean>
-   
-   -->
-
-</server>
\ No newline at end of file

Copied: branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/connection-factories-service.xml (from rev 64641, branches/JBPAPP_4_2/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/connection-factories-service.xml)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/connection-factories-service.xml	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/connection-factories-service.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+     Messaging Connection Factories deployment descriptor.
+
+     $Id$
+ -->
+
+<server>
+
+   <!-- The default connection factory does not support automatic failover or load balancing-
+        this is so we can maintain compatiblity with applications written for JBoss MQ which use this
+        connection factory.
+   -->     
+   <mbean code="org.jboss.jms.server.connectionfactory.ConnectionFactory"
+      name="jboss.messaging.connectionfactory:service=ConnectionFactory"
+      xmbean-dd="xmdesc/ConnectionFactory-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends optional-attribute-name="Connector">jboss.messaging:service=Connector,transport=bisocket</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+
+      <attribute name="JNDIBindings">
+         <bindings>
+            <binding>/ConnectionFactory</binding>
+            <binding>/XAConnectionFactory</binding>
+            <binding>java:/ConnectionFactory</binding>
+            <binding>java:/XAConnectionFactory</binding>
+         </bindings>
+      </attribute>
+   </mbean>
+
+   <!-- A clustered connection factory that supports automatic failover and load balancing of created
+        connections.
+        This factory is not suitable to be used by MDBs.
+   -->
+   <mbean code="org.jboss.jms.server.connectionfactory.ConnectionFactory"
+      name="jboss.messaging.connectionfactory:service=ClusteredConnectionFactory"
+      xmbean-dd="xmdesc/ConnectionFactory-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends optional-attribute-name="Connector">jboss.messaging:service=Connector,transport=bisocket</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+
+      <attribute name="JNDIBindings">
+         <bindings>
+            <binding>/ClusteredConnectionFactory</binding>
+            <binding>/ClusteredXAConnectionFactory</binding>
+            <binding>java:/ClusteredConnectionFactory</binding>
+            <binding>java:/ClusteredXAConnectionFactory</binding>
+         </bindings>
+      </attribute>
+
+      <attribute name="SupportsFailover">true</attribute>
+      <attribute name="SupportsLoadBalancing">true</attribute>      
+   </mbean>
+   
+   <!-- A connection factory with no JNDI bindings that is used in clustering to create the connections that
+        pull messages from one node to another
+   -->
+   <mbean code="org.jboss.jms.server.connectionfactory.ConnectionFactory"
+      name="jboss.messaging.connectionfactory:service=ClusterPullConnectionFactory"
+      xmbean-dd="xmdesc/ConnectionFactory-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends optional-attribute-name="Connector">jboss.messaging:service=Connector,transport=bisocket</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+      <attribute name="SupportsFailover">false</attribute>
+      <attribute name="SupportsLoadBalancing">false</attribute>      
+   </mbean>
+   
+   <!-- An example connection factory with all attributes shown 
+   
+   <mbean code="org.jboss.jms.server.connectionfactory.ConnectionFactory"
+      name="jboss.messaging.connectionfactory:service=MyExampleConnectionFactory"
+      xmbean-dd="xmdesc/ConnectionFactory-xmbean.xml">
+      
+      <constructor>
+      
+         <!- - You can specify the default Client ID to use for connections created using this factory - -> 
+         
+         <arg type="java.lang.String" value="MyClientID"/>
+         
+      </constructor>
+      
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      
+      <!- - The transport to use - can be bisocket, sslbisocket or http - ->
+      
+      <depends optional-attribute-name="Connector">jboss.messaging:service=Connector,transport=http</depends>
+      
+      <depends>jboss.messaging:service=PostOffice</depends>
+      
+      <!- - PrefetchSize determines the approximate maximum number of messages the client consumer will buffer locally - ->
+      
+      <attribute name="PrefetchSize">150</attribute>
+      
+      <!- - Paging params to be used for temporary queues - ->
+      
+      <attribute name="DefaultTempQueueFullSize">200000</attribute>
+      
+      <attribute name="DefaultTempQueuePageSizeSize">2000</attribute>
+      
+      <attribute name="DefaultTempQueueDownCacheSize">2000</attribute>
+      
+      <!- - The batch size to use when using the DUPS_OK_ACKNOWLEDGE acknowledgement mode - ->
+      
+      <attribute name="DupsOKBatchSize">5000</attribute>
+      
+      <!- - Does this connection factory support automatic failover? - ->
+      
+      <attribute name="SupportsFailover">false</attribute>
+      
+      <!- - Does this connection factory support automatic client side load balancing? - ->
+      
+      <attribute name="SupportsLoadBalancing">false</attribute>  
+            
+      <!- - The class name of the factory used to create the load balancing policy to use on the client side - ->
+      
+      <attribute name="LoadBalancingFactory">org.jboss.jms.client.plugin.RoundRobinLoadBalancingFactory</attribute>  
+      
+      <!- - The connection factory will be bound in the following places in JNDI - ->
+
+      <attribute name="JNDIBindings">
+      
+         <bindings>
+         
+            <binding>/acme/MyExampleConnectionFactory</binding>
+            
+            <binding>/acme/MyExampleConnectionFactoryDupe</binding>
+            
+            <binding>java:/xyz/CF1</binding>
+            
+            <binding>java:/connectionfactories/acme/connection_factory</binding>
+            
+         </bindings>
+         
+      </attribute>   
+       
+   </mbean>
+   
+   -->
+
+</server>
\ No newline at end of file

Deleted: branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/destinations-service.xml
===================================================================
--- branches/JBPAPP_4_2/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/destinations-service.xml	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/destinations-service.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,199 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-     Messaging Destinations deployment descriptor.
-
-     $Id$
- -->
-
-<server>
-
-   <!--
-      The Default Dead Letter Queue. This destination is a dependency of an EJB MDB container.
-   -->
-
-   <mbean code="org.jboss.jms.server.destination.QueueService"
-      name="jboss.messaging.destination:service=Queue,name=DLQ"
-      xmbean-dd="xmdesc/Queue-xmbean.xml">
-      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-      <depends>jboss.messaging:service=PostOffice</depends>
-   </mbean>
-   
-   <!--
-      The Default Expiry Queue.
-   -->
-
-   <mbean code="org.jboss.jms.server.destination.QueueService"
-      name="jboss.messaging.destination:service=Queue,name=ExpiryQueue"
-      xmbean-dd="xmdesc/Queue-xmbean.xml">
-      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-      <depends>jboss.messaging:service=PostOffice</depends>
-   </mbean>   
-
-   <!--
-        Example destinations.
-   -->
-
-   <mbean code="org.jboss.jms.server.destination.TopicService"
-      name="jboss.messaging.destination:service=Topic,name=testTopic"
-      xmbean-dd="xmdesc/Topic-xmbean.xml">
-      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-      <depends>jboss.messaging:service=PostOffice</depends>
-      <attribute name="SecurityConfig">
-         <security>
-            <role name="guest" read="true" write="true"/>
-            <role name="publisher" read="true" write="true" create="false"/>
-            <role name="durpublisher" read="true" write="true" create="true"/>
-         </security>
-      </attribute>
-   </mbean>
-
-   <mbean code="org.jboss.jms.server.destination.TopicService"
-      name="jboss.messaging.destination:service=Topic,name=securedTopic"
-      xmbean-dd="xmdesc/Topic-xmbean.xml">
-      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-      <depends>jboss.messaging:service=PostOffice</depends>
-      <attribute name="SecurityConfig">
-         <security>
-            <role name="publisher" read="true" write="true" create="false"/>
-         </security>
-      </attribute>
-   </mbean>
-
-   <mbean code="org.jboss.jms.server.destination.TopicService"
-      name="jboss.messaging.destination:service=Topic,name=testDurableTopic"
-      xmbean-dd="xmdesc/Topic-xmbean.xml">
-      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-      <depends>jboss.messaging:service=PostOffice</depends>
-      <attribute name="SecurityConfig">
-         <security>
-            <role name="guest" read="true" write="true"/>
-            <role name="publisher" read="true" write="true" create="false"/>
-            <role name="durpublisher" read="true" write="true" create="true"/>
-         </security>
-      </attribute>
-   </mbean>
-
-   <mbean code="org.jboss.jms.server.destination.QueueService"
-      name="jboss.messaging.destination:service=Queue,name=testQueue"
-      xmbean-dd="xmdesc/Queue-xmbean.xml">
-      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-      <depends>jboss.messaging:service=PostOffice</depends>
-      <attribute name="SecurityConfig">
-         <security>
-            <role name="guest" read="true" write="true"/>
-            <role name="publisher" read="true" write="true" create="false"/>
-            <role name="noacc" read="false" write="false" create="false"/>
-         </security>
-      </attribute>
-   </mbean>
-
-   <mbean code="org.jboss.jms.server.destination.QueueService"
-      name="jboss.messaging.destination:service=Queue,name=A"
-      xmbean-dd="xmdesc/Queue-xmbean.xml">
-      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-      <depends>jboss.messaging:service=PostOffice</depends>
-   </mbean>
-
-   <mbean code="org.jboss.jms.server.destination.QueueService"
-      name="jboss.messaging.destination:service=Queue,name=B"
-      xmbean-dd="xmdesc/Queue-xmbean.xml">
-      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-      <depends>jboss.messaging:service=PostOffice</depends>
-   </mbean>
-
-   <mbean code="org.jboss.jms.server.destination.QueueService"
-      name="jboss.messaging.destination:service=Queue,name=C"
-      xmbean-dd="xmdesc/Queue-xmbean.xml">
-      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-      <depends>jboss.messaging:service=PostOffice</depends>
-   </mbean>
-
-   <mbean code="org.jboss.jms.server.destination.QueueService"
-      name="jboss.messaging.destination:service=Queue,name=D"
-      xmbean-dd="xmdesc/Queue-xmbean.xml">
-      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-      <depends>jboss.messaging:service=PostOffice</depends>
-   </mbean>
-
-   <mbean code="org.jboss.jms.server.destination.QueueService"
-      name="jboss.messaging.destination:service=Queue,name=ex"
-      xmbean-dd="xmdesc/Queue-xmbean.xml">
-      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-      <depends>jboss.messaging:service=PostOffice</depends>
-   </mbean>
-   
-   <!-- It's possible for indiviual queues and topics to use a specific queue for
-   an expiry or DLQ -->
-   
-   <mbean code="org.jboss.jms.server.destination.QueueService"
-      name="jboss.messaging.destination:service=Queue,name=PrivateDLQ"
-      xmbean-dd="xmdesc/Queue-xmbean.xml">
-      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-      <depends>jboss.messaging:service=PostOffice</depends>
-   </mbean>
-   
-   <mbean code="org.jboss.jms.server.destination.QueueService"
-      name="jboss.messaging.destination:service=Queue,name=PrivateExpiryQueue"
-      xmbean-dd="xmdesc/Queue-xmbean.xml">
-      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-      <depends>jboss.messaging:service=PostOffice</depends>
-   </mbean>      
-   
-   <mbean code="org.jboss.jms.server.destination.QueueService"
-      name="jboss.messaging.destination:service=Queue,name=QueueWithOwnDLQAndExpiryQueue"
-      xmbean-dd="xmdesc/Queue-xmbean.xml">
-      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-      <depends>jboss.messaging:service=PostOffice</depends>
-      <attribute name="DLQ">jboss.messaging.destination:service=Queue,name=PrivateDLQ</attribute>
-      <attribute name="ExpiryQueue">jboss.messaging.destination:service=Queue,name=PrivateExpiryQueue</attribute>
-   </mbean> 
-   
-   <mbean code="org.jboss.jms.server.destination.TopicService"
-      name="jboss.messaging.destination:service=Topic,name=TopicWithOwnDLQAndExpiryQueue"
-      xmbean-dd="xmdesc/Topic-xmbean.xml">
-      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-      <depends>jboss.messaging:service=PostOffice</depends>
-      <attribute name="DLQ">jboss.messaging.destination:service=Queue,name=PrivateDLQ</attribute>
-      <attribute name="ExpiryQueue">jboss.messaging.destination:service=Queue,name=PrivateExpiryQueue</attribute>
-   </mbean>       
-   
-   <!-- Queues and Topics can also specify their own redelivery delay -->
-   
-   <mbean code="org.jboss.jms.server.destination.QueueService"
-      name="jboss.messaging.destination:service=Queue,name=QueueWithOwnRedeliveryDelay"
-      xmbean-dd="xmdesc/Queue-xmbean.xml">
-      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-      <depends>jboss.messaging:service=PostOffice</depends>
-      <attribute name="RedeliveryDelay">5000</attribute>
-   </mbean>
-   
-   <mbean code="org.jboss.jms.server.destination.TopicService"
-      name="jboss.messaging.destination:service=Topic,name=TopicWithOwnRedeliveryDelay"
-      xmbean-dd="xmdesc/Topic-xmbean.xml">
-      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-      <depends>jboss.messaging:service=PostOffice</depends>
-      <attribute name="RedeliveryDelay">5000</attribute>
-   </mbean>     
-   
-   <!--
-        Example clustered destinations.
-   -->
-   
-   <mbean code="org.jboss.jms.server.destination.QueueService"
-      name="jboss.messaging.destination:service=Queue,name=testDistributedQueue"
-      xmbean-dd="xmdesc/Queue-xmbean.xml">
-      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-      <depends>jboss.messaging:service=PostOffice</depends>
-      <attribute name="Clustered">true</attribute>
-   </mbean>   
-   
-   <mbean code="org.jboss.jms.server.destination.TopicService"
-      name="jboss.messaging.destination:service=Topic,name=testDistributedTopic"
-      xmbean-dd="xmdesc/Topic-xmbean.xml">
-      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-      <depends>jboss.messaging:service=PostOffice</depends>
-      <attribute name="Clustered">true</attribute>
-   </mbean>   
-
-</server>
\ No newline at end of file

Copied: branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/destinations-service.xml (from rev 64641, branches/JBPAPP_4_2/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/destinations-service.xml)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/destinations-service.xml	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/destinations-service.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,199 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+     Messaging Destinations deployment descriptor.
+
+     $Id$
+ -->
+
+<server>
+
+   <!--
+      The Default Dead Letter Queue. This destination is a dependency of an EJB MDB container.
+   -->
+
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=DLQ"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+   </mbean>
+   
+   <!--
+      The Default Expiry Queue.
+   -->
+
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=ExpiryQueue"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+   </mbean>   
+
+   <!--
+        Example destinations.
+   -->
+
+   <mbean code="org.jboss.jms.server.destination.TopicService"
+      name="jboss.messaging.destination:service=Topic,name=testTopic"
+      xmbean-dd="xmdesc/Topic-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+      <attribute name="SecurityConfig">
+         <security>
+            <role name="guest" read="true" write="true"/>
+            <role name="publisher" read="true" write="true" create="false"/>
+            <role name="durpublisher" read="true" write="true" create="true"/>
+         </security>
+      </attribute>
+   </mbean>
+
+   <mbean code="org.jboss.jms.server.destination.TopicService"
+      name="jboss.messaging.destination:service=Topic,name=securedTopic"
+      xmbean-dd="xmdesc/Topic-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+      <attribute name="SecurityConfig">
+         <security>
+            <role name="publisher" read="true" write="true" create="false"/>
+         </security>
+      </attribute>
+   </mbean>
+
+   <mbean code="org.jboss.jms.server.destination.TopicService"
+      name="jboss.messaging.destination:service=Topic,name=testDurableTopic"
+      xmbean-dd="xmdesc/Topic-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+      <attribute name="SecurityConfig">
+         <security>
+            <role name="guest" read="true" write="true"/>
+            <role name="publisher" read="true" write="true" create="false"/>
+            <role name="durpublisher" read="true" write="true" create="true"/>
+         </security>
+      </attribute>
+   </mbean>
+
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=testQueue"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+      <attribute name="SecurityConfig">
+         <security>
+            <role name="guest" read="true" write="true"/>
+            <role name="publisher" read="true" write="true" create="false"/>
+            <role name="noacc" read="false" write="false" create="false"/>
+         </security>
+      </attribute>
+   </mbean>
+
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=A"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+   </mbean>
+
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=B"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+   </mbean>
+
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=C"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+   </mbean>
+
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=D"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+   </mbean>
+
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=ex"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+   </mbean>
+   
+   <!-- It's possible for indiviual queues and topics to use a specific queue for
+   an expiry or DLQ -->
+   
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=PrivateDLQ"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+   </mbean>
+   
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=PrivateExpiryQueue"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+   </mbean>      
+   
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=QueueWithOwnDLQAndExpiryQueue"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+      <attribute name="DLQ">jboss.messaging.destination:service=Queue,name=PrivateDLQ</attribute>
+      <attribute name="ExpiryQueue">jboss.messaging.destination:service=Queue,name=PrivateExpiryQueue</attribute>
+   </mbean> 
+   
+   <mbean code="org.jboss.jms.server.destination.TopicService"
+      name="jboss.messaging.destination:service=Topic,name=TopicWithOwnDLQAndExpiryQueue"
+      xmbean-dd="xmdesc/Topic-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+      <attribute name="DLQ">jboss.messaging.destination:service=Queue,name=PrivateDLQ</attribute>
+      <attribute name="ExpiryQueue">jboss.messaging.destination:service=Queue,name=PrivateExpiryQueue</attribute>
+   </mbean>       
+   
+   <!-- Queues and Topics can also specify their own redelivery delay -->
+   
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=QueueWithOwnRedeliveryDelay"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+      <attribute name="RedeliveryDelay">5000</attribute>
+   </mbean>
+   
+   <mbean code="org.jboss.jms.server.destination.TopicService"
+      name="jboss.messaging.destination:service=Topic,name=TopicWithOwnRedeliveryDelay"
+      xmbean-dd="xmdesc/Topic-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+      <attribute name="RedeliveryDelay">5000</attribute>
+   </mbean>     
+   
+   <!--
+        Example clustered destinations.
+   -->
+   
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=testDistributedQueue"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+      <attribute name="Clustered">true</attribute>
+   </mbean>   
+   
+   <mbean code="org.jboss.jms.server.destination.TopicService"
+      name="jboss.messaging.destination:service=Topic,name=testDistributedTopic"
+      xmbean-dd="xmdesc/Topic-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+      <attribute name="Clustered">true</attribute>
+   </mbean>   
+
+</server>
\ No newline at end of file

Deleted: branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/hsqldb-persistence-service.xml
===================================================================
--- branches/JBPAPP_4_2/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/hsqldb-persistence-service.xml	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/hsqldb-persistence-service.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,104 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-     Hypersonic persistence deployment descriptor.
-     
-     DO NOT USE HYPERSONIC IN PRODUCTION or in a clustered environment- Hypersonic does not have transaction isolation
-
-     $Id$
- -->
-
-<server>
-
-   <!-- Persistence Manager MBean configuration
-       ======================================= -->
-   
-   <mbean code="org.jboss.messaging.core.jmx.JDBCPersistenceManagerService"
-      name="jboss.messaging:service=PersistenceManager"
-      xmbean-dd="xmdesc/JDBCPersistenceManager-xmbean.xml">
-      
-      <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
-      
-      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
-            
-      <!-- The datasource to use for the persistence manager -->
-                                
-      <attribute name="DataSource">java:/DefaultDS</attribute>
-      
-      <!-- If true will attempt to create tables and indexes on every start-up -->
-                  
-      <attribute name="CreateTablesOnStartup">true</attribute>
-      
-      <!-- If true then will use JDBC batch updates -->
-                 
-      <attribute name="UsingBatchUpdates">false</attribute>
-      
-      <!-- The maximum number of parameters to include in a prepared statement -->            
-      
-      <attribute name="MaxParams">500</attribute>
-   </mbean>
-
-   <!-- Messaging Post Office MBean configuration
-        ========================================= -->
-   
-   <mbean code="org.jboss.messaging.core.jmx.MessagingPostOfficeService"
-      name="jboss.messaging:service=PostOffice"      
-      xmbean-dd="xmdesc/MessagingPostOffice-xmbean.xml">
-            
-      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-      
-      <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
-      
-      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
-      
-      <!-- The name of the post office -->      
-                 
-      <attribute name="PostOfficeName">JMS post office</attribute>
-      
-      <!-- The datasource used by the post office to access it's binding information -->                       
-      
-      <attribute name="DataSource">java:/DefaultDS</attribute>
-      
-      <!-- If true will attempt to create tables and indexes on every start-up -->
-                        
-      <attribute name="CreateTablesOnStartup">true</attribute>
-      
-      <!-- This post office is NON CLUSTERED - do not use clustering with Hypersonic!! -->
-      
-      <attribute name="Clustered">false</attribute>
-   </mbean>
-
-   <!-- Messaging JMS User Manager MBean config
-        ======================================= -->
-   
-   <mbean code="org.jboss.jms.server.plugin.JDBCJMSUserManagerService"
-      name="jboss.messaging:service=JMSUserManager"
-      xmbean-dd="xmdesc/JMSUserManager-xmbean.xml">
-      
-      <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
-      
-      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
-      
-      <attribute name="DataSource">java:/DefaultDS</attribute>
-      
-      <attribute name="CreateTablesOnStartup">true</attribute>
-      
-      <attribute name="SqlProperties"><![CDATA[
-POPULATE.TABLES.1  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('guest', 'guest')
-POPULATE.TABLES.2  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('j2ee', 'j2ee')
-POPULATE.TABLES.3  = INSERT INTO JBM_USER (USER_ID, PASSWD, CLIENTID) VALUES ('john', 'needle', 'DurableSubscriberExample')
-POPULATE.TABLES.4  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('nobody', 'nobody')
-POPULATE.TABLES.5  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('dynsub', 'dynsub')
-POPULATE.TABLES.6  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('guest','guest')
-POPULATE.TABLES.7  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('j2ee','guest')
-POPULATE.TABLES.8  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('john','guest')
-POPULATE.TABLES.9  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('subscriber','john')
-POPULATE.TABLES.10 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('publisher','john')
-POPULATE.TABLES.11 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('publisher','dynsub')
-POPULATE.TABLES.12 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('durpublisher','john')
-POPULATE.TABLES.13 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('durpublisher','dynsub')
-POPULATE.TABLES.14 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('noacc','nobody')
-      ]]></attribute>
-   </mbean>
-
-</server>
\ No newline at end of file

Copied: branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/hsqldb-persistence-service.xml (from rev 64641, branches/JBPAPP_4_2/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/hsqldb-persistence-service.xml)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/hsqldb-persistence-service.xml	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/hsqldb-persistence-service.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+     Hypersonic persistence deployment descriptor.
+     
+     DO NOT USE HYPERSONIC IN PRODUCTION or in a clustered environment- Hypersonic does not have transaction isolation
+
+     $Id$
+ -->
+
+<server>
+
+   <!-- Persistence Manager MBean configuration
+       ======================================= -->
+   
+   <mbean code="org.jboss.messaging.core.jmx.JDBCPersistenceManagerService"
+      name="jboss.messaging:service=PersistenceManager"
+      xmbean-dd="xmdesc/JDBCPersistenceManager-xmbean.xml">
+      
+      <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
+      
+      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
+            
+      <!-- The datasource to use for the persistence manager -->
+                                
+      <attribute name="DataSource">java:/DefaultDS</attribute>
+      
+      <!-- If true will attempt to create tables and indexes on every start-up -->
+                  
+      <attribute name="CreateTablesOnStartup">true</attribute>
+      
+      <!-- If true then will use JDBC batch updates -->
+                 
+      <attribute name="UsingBatchUpdates">false</attribute>
+      
+      <!-- The maximum number of parameters to include in a prepared statement -->            
+      
+      <attribute name="MaxParams">500</attribute>
+   </mbean>
+
+   <!-- Messaging Post Office MBean configuration
+        ========================================= -->
+   
+   <mbean code="org.jboss.messaging.core.jmx.MessagingPostOfficeService"
+      name="jboss.messaging:service=PostOffice"      
+      xmbean-dd="xmdesc/MessagingPostOffice-xmbean.xml">
+            
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      
+      <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
+      
+      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
+      
+      <!-- The name of the post office -->      
+                 
+      <attribute name="PostOfficeName">JMS post office</attribute>
+      
+      <!-- The datasource used by the post office to access it's binding information -->                       
+      
+      <attribute name="DataSource">java:/DefaultDS</attribute>
+      
+      <!-- If true will attempt to create tables and indexes on every start-up -->
+                        
+      <attribute name="CreateTablesOnStartup">true</attribute>
+      
+      <!-- This post office is NON CLUSTERED - do not use clustering with Hypersonic!! -->
+      
+      <attribute name="Clustered">false</attribute>
+   </mbean>
+
+   <!-- Messaging JMS User Manager MBean config
+        ======================================= -->
+   
+   <mbean code="org.jboss.jms.server.plugin.JDBCJMSUserManagerService"
+      name="jboss.messaging:service=JMSUserManager"
+      xmbean-dd="xmdesc/JMSUserManager-xmbean.xml">
+      
+      <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
+      
+      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
+      
+      <attribute name="DataSource">java:/DefaultDS</attribute>
+      
+      <attribute name="CreateTablesOnStartup">true</attribute>
+      
+      <attribute name="SqlProperties"><![CDATA[
+POPULATE.TABLES.1  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('guest', 'guest')
+POPULATE.TABLES.2  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('j2ee', 'j2ee')
+POPULATE.TABLES.3  = INSERT INTO JBM_USER (USER_ID, PASSWD, CLIENTID) VALUES ('john', 'needle', 'DurableSubscriberExample')
+POPULATE.TABLES.4  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('nobody', 'nobody')
+POPULATE.TABLES.5  = INSERT INTO JBM_USER (USER_ID, PASSWD) VALUES ('dynsub', 'dynsub')
+POPULATE.TABLES.6  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('guest','guest')
+POPULATE.TABLES.7  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('j2ee','guest')
+POPULATE.TABLES.8  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('john','guest')
+POPULATE.TABLES.9  = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('subscriber','john')
+POPULATE.TABLES.10 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('publisher','john')
+POPULATE.TABLES.11 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('publisher','dynsub')
+POPULATE.TABLES.12 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('durpublisher','john')
+POPULATE.TABLES.13 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('durpublisher','dynsub')
+POPULATE.TABLES.14 = INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('noacc','nobody')
+      ]]></attribute>
+   </mbean>
+
+</server>
\ No newline at end of file

Deleted: branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/messaging-service.xml
===================================================================
--- branches/JBPAPP_4_2/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/messaging-service.xml	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/messaging-service.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,105 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-     The JBoss Messaging service deployment descriptor.
-
-     $Id$
- -->
-
-<server>
-
-   <!-- ServerPeer MBean configuration
-        ============================== -->
-
-   <mbean code="org.jboss.jms.server.ServerPeer"
-      name="jboss.messaging:service=ServerPeer"
-      xmbean-dd="xmdesc/ServerPeer-xmbean.xml">
-
-      <!-- The unique id of the server peer - in a cluster each node MUST have a unique value - must be an integer -->
-
-      <attribute name="ServerPeerID">0</attribute>
-      
-      <!-- The default JNDI context to use for queues when they are deployed without specifying one --> 
-      
-      <attribute name="DefaultQueueJNDIContext">/queue</attribute>
-      
-      <!-- The default JNDI context to use for topics when they are deployed without specifying one --> 
-      
-      <attribute name="DefaultTopicJNDIContext">/topic</attribute>
-
-	  <attribute name="PostOffice">jboss.messaging:service=PostOffice</attribute>
-	  
-	  <!-- The JAAS security domain to use for JBoss Messaging -->
-	  
-      <attribute name="SecurityDomain">java:/jaas/messaging</attribute>
-      
-      <!-- The default security configuration to apply to destinations - this can be overridden on a per destination basis -->
-      
-      <attribute name="DefaultSecurityConfig">
-        <security>
-            <role name="guest" read="true" write="true" create="true"/>
-        </security>
-      </attribute>
-      
-      <!-- The default Dead Letter Queue (DLQ) to use for destinations.
-           This can be overridden on a per destinatin basis -->
-      
-      <attribute name="DefaultDLQ">jboss.messaging.destination:service=Queue,name=DLQ</attribute>
-      
-      <!-- The default maximum number of times to attempt delivery of a message before sending to the DLQ (if configured).
-           This can be overridden on a per destinatin basis -->
-      
-      <attribute name="DefaultMaxDeliveryAttempts">10</attribute>
-      
-      <!-- The default Expiry Queue to use for destinations. This can be overridden on a per destinatin basis -->
-      
-      <attribute name="DefaultExpiryQueue">jboss.messaging.destination:service=Queue,name=ExpiryQueue</attribute>
-      
-      <!-- The default redelivery delay to impose. This can be overridden on a per destination basis -->
-      
-      <attribute name="DefaultRedeliveryDelay">0</attribute>
-      
-      <!-- The periodicity of the message counter manager enquiring on queues for statistics -->
-      
-      <attribute name="MessageCounterSamplePeriod">5000</attribute>
-      
-      <!-- The maximum amount of time for a client to wait for failover to start on the server side after
-           it has detected failure -->
-      
-      <attribute name="FailoverStartTimeout">60000</attribute>
-      
-      <!-- The maximum amount of time for a client to wait for failover to complete on the server side after
-           it has detected failure -->
-      
-      <attribute name="FailoverCompleteTimeout">300000</attribute>
-      
-      <!-- The maximum number of days results to maintain in the message counter history -->
-      
-      <attribute name="DefaultMessageCounterHistoryDayLimit">-1</attribute>
-      
-      <!-- The name of the connection factory to use for creating connections between nodes to pull messages -->
-      
-      <attribute name="ClusterPullConnectionFactoryName">jboss.messaging.connectionfactory:service=ClusterPullConnectionFactory</attribute>
-      
-      <!-- Use XA when pulling persistent messages from a remote node to this one. -->
-      
-      <attribute name="UseXAForMessagePull">true</attribute>
-      
-      <!-- When redistributing messages in the cluster. Do we need to preserve the order of messages received
-            by a particular consumer from a particular producer? -->
-            
-      <attribute name="DefaultPreserveOrdering">false</attribute>
-      
-      <!-- Max. time to hold previously delivered messages back waiting for clients to reconnect after failover -->
-      
-      <attribute name="RecoverDeliveriesTimeout">300000</attribute>
-
-      <depends optional-attribute-name="PersistenceManager">jboss.messaging:service=PersistenceManager</depends>
-      
-      <depends optional-attribute-name="JMSUserManager">jboss.messaging:service=JMSUserManager</depends>
-      
-      <depends>jboss.messaging:service=Connector,transport=bisocket</depends>
-
-   </mbean>
-
-</server>

Copied: branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/messaging-service.xml (from rev 64641, branches/JBPAPP_4_2/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/messaging-service.xml)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/messaging-service.xml	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/messaging-service.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+     The JBoss Messaging service deployment descriptor.
+
+     $Id$
+ -->
+
+<server>
+
+   <!-- ServerPeer MBean configuration
+        ============================== -->
+
+   <mbean code="org.jboss.jms.server.ServerPeer"
+      name="jboss.messaging:service=ServerPeer"
+      xmbean-dd="xmdesc/ServerPeer-xmbean.xml">
+
+      <!-- The unique id of the server peer - in a cluster each node MUST have a unique value - must be an integer -->
+
+      <attribute name="ServerPeerID">0</attribute>
+      
+      <!-- The default JNDI context to use for queues when they are deployed without specifying one --> 
+      
+      <attribute name="DefaultQueueJNDIContext">/queue</attribute>
+      
+      <!-- The default JNDI context to use for topics when they are deployed without specifying one --> 
+      
+      <attribute name="DefaultTopicJNDIContext">/topic</attribute>
+
+	  <attribute name="PostOffice">jboss.messaging:service=PostOffice</attribute>
+	  
+	  <!-- The JAAS security domain to use for JBoss Messaging -->
+	  
+      <attribute name="SecurityDomain">java:/jaas/messaging</attribute>
+      
+      <!-- The default security configuration to apply to destinations - this can be overridden on a per destination basis -->
+      
+      <attribute name="DefaultSecurityConfig">
+        <security>
+            <role name="guest" read="true" write="true" create="true"/>
+        </security>
+      </attribute>
+      
+      <!-- The default Dead Letter Queue (DLQ) to use for destinations.
+           This can be overridden on a per destinatin basis -->
+      
+      <attribute name="DefaultDLQ">jboss.messaging.destination:service=Queue,name=DLQ</attribute>
+      
+      <!-- The default maximum number of times to attempt delivery of a message before sending to the DLQ (if configured).
+           This can be overridden on a per destinatin basis -->
+      
+      <attribute name="DefaultMaxDeliveryAttempts">10</attribute>
+      
+      <!-- The default Expiry Queue to use for destinations. This can be overridden on a per destinatin basis -->
+      
+      <attribute name="DefaultExpiryQueue">jboss.messaging.destination:service=Queue,name=ExpiryQueue</attribute>
+      
+      <!-- The default redelivery delay to impose. This can be overridden on a per destination basis -->
+      
+      <attribute name="DefaultRedeliveryDelay">0</attribute>
+      
+      <!-- The periodicity of the message counter manager enquiring on queues for statistics -->
+      
+      <attribute name="MessageCounterSamplePeriod">5000</attribute>
+      
+      <!-- The maximum amount of time for a client to wait for failover to start on the server side after
+           it has detected failure -->
+      
+      <attribute name="FailoverStartTimeout">60000</attribute>
+      
+      <!-- The maximum amount of time for a client to wait for failover to complete on the server side after
+           it has detected failure -->
+      
+      <attribute name="FailoverCompleteTimeout">300000</attribute>
+      
+      <!-- The maximum number of days results to maintain in the message counter history -->
+      
+      <attribute name="DefaultMessageCounterHistoryDayLimit">-1</attribute>
+      
+      <!-- The name of the connection factory to use for creating connections between nodes to pull messages -->
+      
+      <attribute name="ClusterPullConnectionFactoryName">jboss.messaging.connectionfactory:service=ClusterPullConnectionFactory</attribute>
+      
+      <!-- Use XA when pulling persistent messages from a remote node to this one. -->
+      
+      <attribute name="UseXAForMessagePull">true</attribute>
+      
+      <!-- When redistributing messages in the cluster. Do we need to preserve the order of messages received
+            by a particular consumer from a particular producer? -->
+            
+      <attribute name="DefaultPreserveOrdering">false</attribute>
+      
+      <!-- Max. time to hold previously delivered messages back waiting for clients to reconnect after failover -->
+      
+      <attribute name="RecoverDeliveriesTimeout">300000</attribute>
+
+      <depends optional-attribute-name="PersistenceManager">jboss.messaging:service=PersistenceManager</depends>
+      
+      <depends optional-attribute-name="JMSUserManager">jboss.messaging:service=JMSUserManager</depends>
+      
+      <depends>jboss.messaging:service=Connector,transport=bisocket</depends>
+
+   </mbean>
+
+</server>

Deleted: branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/remoting-bisocket-service.xml
===================================================================
--- branches/JBPAPP_4_2/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/remoting-bisocket-service.xml	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/remoting-bisocket-service.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-     Standard bisocket-based Remoting service deployment descriptor.
-
-     $Id$
- -->
-
-<server>
-
-   <!-- Standard bisocket connector - the bisocket transport only opens connection from client->server
-        so can be used with firewalls where only outgoing connections are allowed.
-        For examples of HTTP and SSL transports see docs/examples -->
-   <mbean code="org.jboss.remoting.transport.Connector"
-          name="jboss.messaging:service=Connector,transport=bisocket"
-          display-name="Bisocket Transport Connector">
-      <attribute name="Configuration">
-         <config>
-            <invoker transport="bisocket">
-               <attribute name="marshaller" isParam="true">org.jboss.jms.wireformat.JMSWireFormat</attribute>
-               <attribute name="unmarshaller" isParam="true">org.jboss.jms.wireformat.JMSWireFormat</attribute>
-               <attribute name="dataType" isParam="true">jms</attribute>
-               <attribute name="socket.check_connection" isParam="true">false</attribute>
-               <attribute name="timeout" isParam="true">0</attribute>
-               <attribute name="serverBindAddress">${jboss.bind.address}</attribute>
-               <attribute name="serverBindPort">4457</attribute>
-               <attribute name="leasePeriod">10000</attribute>
-               <attribute name="clientSocketClass" isParam="true">org.jboss.jms.client.remoting.ClientSocketWrapper</attribute>
-               <attribute name="serverSocketClass" isParam="true">org.jboss.jms.server.remoting.ServerSocketWrapper</attribute>
-               <attribute name="numberOfRetries" isParam="true">1</attribute>
-               <attribute name="numberOfCallRetries" isParam="true">1</attribute>
-               <attribute name="clientMaxPoolSize" isParam="true">50</attribute>
-            </invoker>
-            <handlers>
-               <handler subsystem="JMS">org.jboss.jms.server.remoting.JMSServerInvocationHandler</handler>
-            </handlers>
-         </config>
-      </attribute>
-   </mbean>
-
-</server>

Copied: branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/remoting-bisocket-service.xml (from rev 64641, branches/JBPAPP_4_2/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/remoting-bisocket-service.xml)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/remoting-bisocket-service.xml	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/messaging/src/etc/server-jbm/default/deploy/jboss-messaging.sar/remoting-bisocket-service.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+     Standard bisocket-based Remoting service deployment descriptor.
+
+     $Id$
+ -->
+
+<server>
+
+   <!-- Standard bisocket connector - the bisocket transport only opens connection from client->server
+        so can be used with firewalls where only outgoing connections are allowed.
+        For examples of HTTP and SSL transports see docs/examples -->
+   <mbean code="org.jboss.remoting.transport.Connector"
+          name="jboss.messaging:service=Connector,transport=bisocket"
+          display-name="Bisocket Transport Connector">
+      <attribute name="Configuration">
+         <config>
+            <invoker transport="bisocket">
+               <attribute name="marshaller" isParam="true">org.jboss.jms.wireformat.JMSWireFormat</attribute>
+               <attribute name="unmarshaller" isParam="true">org.jboss.jms.wireformat.JMSWireFormat</attribute>
+               <attribute name="dataType" isParam="true">jms</attribute>
+               <attribute name="socket.check_connection" isParam="true">false</attribute>
+               <attribute name="timeout" isParam="true">0</attribute>
+               <attribute name="serverBindAddress">${jboss.bind.address}</attribute>
+               <attribute name="serverBindPort">4457</attribute>
+               <attribute name="leasePeriod">10000</attribute>
+               <attribute name="clientSocketClass" isParam="true">org.jboss.jms.client.remoting.ClientSocketWrapper</attribute>
+               <attribute name="serverSocketClass" isParam="true">org.jboss.jms.server.remoting.ServerSocketWrapper</attribute>
+               <attribute name="numberOfRetries" isParam="true">1</attribute>
+               <attribute name="numberOfCallRetries" isParam="true">1</attribute>
+               <attribute name="clientMaxPoolSize" isParam="true">50</attribute>
+            </invoker>
+            <handlers>
+               <handler subsystem="JMS">org.jboss.jms.server.remoting.JMSServerInvocationHandler</handler>
+            </handlers>
+         </config>
+      </attribute>
+   </mbean>
+
+</server>

Modified: branches/JBPAPP_4_2_0_GA_CP/server/src/etc/conf/default/login-config.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/server/src/etc/conf/default/login-config.xml	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/server/src/etc/conf/default/login-config.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -134,6 +134,18 @@
       </authentication>
     </application-policy>
 
+    <application-policy name="messaging">
+       <authentication>
+          <login-module code = "org.jboss.security.auth.spi.DatabaseServerLoginModule"
+             flag = "required">
+             <module-option name = "unauthenticatedIdentity">guest</module-option>
+             <module-option name = "dsJndiName">java:/DefaultDS</module-option>
+             <module-option name = "principalsQuery">SELECT PASSWD FROM JBM_USER WHERE USER_ID=?</module-option>
+             <module-option name = "rolesQuery">SELECT ROLE_ID, 'Roles' FROM JBM_ROLE WHERE USER_ID=?</module-option>
+          </login-module>
+       </authentication>
+    </application-policy>
+
     <!-- The default login configuration used by any security domain that
     does not have a application-policy entry with a matching name
     -->

Modified: branches/JBPAPP_4_2_0_GA_CP/server/src/etc/conf/default/standardjboss.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/server/src/etc/conf/default/standardjboss.xml	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/server/src/etc/conf/default/standardjboss.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
 <!DOCTYPE jboss PUBLIC
-   "-//JBoss//DTD JBOSS 4.0//EN"
-   "http://www.jboss.org/j2ee/dtd/jboss_4_0.dtd">
+   "-//JBoss//DTD JBOSS 4.2//EN"
+   "http://www.jboss.org/j2ee/dtd/jboss_4_2.dtd">
 
 <!-- ===================================================================== -->
 <!--  Standard JBoss EJB Configurations                                    -->
@@ -358,7 +358,12 @@
       <proxy-factory-config>
         <JMSProviderAdapterJNDI>DefaultJMSProvider</JMSProviderAdapterJNDI>
         <ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI>
-        <CreateJBossMQDestination>true</CreateJBossMQDestination>
+        <!--   Deprecated parameter (still supported for backward compatibility)
+        <CreateJBossMQDestination>true</CreateJBossMQDestination> -->
+        <CreateDestination>true</CreateDestination>
+        <DestinationManager>jboss.mq:service=DestinationManager</DestinationManager>
+        <CreateTopicMethod>createTopic</CreateTopicMethod>
+        <CreateQueueMethod>createQueue</CreateQueueMethod>
         <!-- WARN: Don't set this to zero until a bug in the pooled executor is fixed -->
         <MinimumSize>1</MinimumSize>
         <MaximumSize>15</MaximumSize>
@@ -440,7 +445,12 @@
       <proxy-factory-config>
         <JMSProviderAdapterJNDI>DefaultJMSProvider</JMSProviderAdapterJNDI>
         <ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI>
-        <CreateJBossMQDestination>true</CreateJBossMQDestination>
+        <!--   Deprecated parameter (still supported for backward compatibility)
+        <CreateJBossMQDestination>true</CreateJBossMQDestination> -->
+        <CreateDestination>true</CreateDestination>
+        <DestinationManager>jboss.mq:service=DestinationManager</DestinationManager>
+        <CreateTopicMethod>createTopic</CreateTopicMethod>
+        <CreateQueueMethod>createQueue</CreateQueueMethod>
         <!-- WARN: Don't set this to zero until a bug in the pooled executor is fixed -->
         <MinimumSize>1</MinimumSize>
         <MaximumSize>1</MaximumSize>

Modified: branches/JBPAPP_4_2_0_GA_CP/server/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/server/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/server/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -190,7 +190,13 @@
 
    protected boolean deliveryActive = true;
 
-   protected boolean createJBossMQDestination = true;
+   protected boolean createDestination = true;
+   
+   protected String destinationManager = "jboss.mq:service=DestinationManager";
+   
+   protected String createTopicMethod = "createTopic";
+   
+   protected String createQueueMethod = "createQueue";
 
    /**
     * Set the invoker meta data so that the ProxyFactory can initialize
@@ -273,7 +279,7 @@
 
    public boolean getCreateJBossMQDestination()
    {
-      return createJBossMQDestination;
+      return createDestination;
    }
 
    public void startDelivery()
@@ -363,15 +369,45 @@
       {
          if ("false".equalsIgnoreCase(MetaData.getElementContent(MetaData.getUniqueChild(element, "CreateJBossMQDestination"))))
          {
-            createJBossMQDestination = false;
+            createDestination = false;
          }
       }
       catch (Exception ignore)
       {
       }
       
+      
       try
       {
+         if ("false".equalsIgnoreCase(MetaData.getElementContent(MetaData.getUniqueChild(element, "CreateDestination"))))
+         {
+            createDestination = false;
+         }
+      }
+      catch (Exception ignore)
+      {
+      }
+      
+	  String localDestination = getValue(element, "DestinationManager");
+	  if (localDestination!=null)
+	  {
+		  destinationManager = localDestination;
+	  }  	  
+      
+	  String localMethod = getValue(element, "CreateTopicMethod");
+	  if (localMethod!=null)
+	  {
+		  createTopicMethod = localMethod;
+	  }  	  
+
+	  localMethod = getValue(element, "CreateQueueMethod");
+	  if (localMethod!=null)
+	  {
+		  createQueueMethod = localMethod;
+	  }  	  
+      
+      try
+      {
          String maxMessages = MetaData.getElementContent
             (MetaData.getUniqueChild(element, "MaxMessages"));
          maxMessagesNr = Integer.parseInt(maxMessages);
@@ -463,6 +499,27 @@
          serverSessionPoolFactoryJNDI = "java:/" + serverSessionPoolFactoryJNDI;
       }
    }
+   
+   private String getValue(Element element, String name)
+   {
+	  try
+	  {
+	 	  Element elementValue = MetaData.getUniqueChild(element, name);
+	 	  
+	 	  if (elementValue!=null)
+	 	  {
+	 		 return MetaData.getElementContent(elementValue);
+	 	  }
+	 	  else
+	 	  {
+	 	 	  return null;
+	 	  }
+	  }
+	  catch (Exception ignored)
+	  {
+		  return null;
+	  }
+   }
 
    /**
     * Initialize the container invoker. Sets up a connection, a server session
@@ -639,13 +696,13 @@
                // First we try the specified topic
                if (destinationJNDI != null)
                   topic = (Topic) context.lookup(destinationJNDI);
-               else if (createJBossMQDestination == false)
+               else if (createDestination == false)
                   throw new DeploymentException("Unable to determine destination for '" + container.getBeanMetaData().getEjbName()
                         + "' use destination-jndi-name in jboss.xml, an activation config property or a message-destination-link");
             }
             catch (NamingException e)
             {
-               if (createJBossMQDestination == false)
+               if (createDestination == false)
                   throw new DeploymentException("Could not find the topic destination-jndi-name=" + destinationJNDI, e);
                log.warn("Could not find the topic destination-jndi-name=" + destinationJNDI, e);
             }
@@ -654,7 +711,6 @@
                throw new DeploymentException("Expected a Topic destination-jndi-name=" + destinationJNDI, e);
             }
 
-            // FIXME: This is not portable, only works for JBossMQ
             if (topic == null)
                topic = (Topic) createDestination(Topic.class,
                   context,
@@ -757,13 +813,13 @@
                // First we try the specified queue
                if (destinationJNDI != null)
                   queue = (Queue) context.lookup(destinationJNDI);
-               else if (createJBossMQDestination == false)
+               else if (createDestination == false)
                   throw new DeploymentException("Unable to determine destination for '" + container.getBeanMetaData().getEjbName()
                         + "' use destination-jndi-name in jboss.xml, an activation config property or a message-destination-link");
             }
             catch (NamingException e)
             {
-               if (createJBossMQDestination == false)
+               if (createDestination == false)
                   throw new DeploymentException("Could not find the queue destination-jndi-name=" + destinationJNDI, e);
                log.warn("Could not find the queue destination-jndi-name=" + destinationJNDI);
             }
@@ -772,7 +828,6 @@
                throw new DeploymentException("Expected a Queue destination-jndi-name=" + destinationJNDI);
             }
 
-            // FIXME: This is not portable, only works for JBossMQ
             if (queue == null)
                queue = (Queue) createDestination(Queue.class,
                   context,
@@ -1096,11 +1151,11 @@
          String methodName;
          if (type == Topic.class)
          {
-            methodName = "createTopic";
+            methodName = createTopicMethod;
          }
          else if (type == Queue.class)
          {
-            methodName = "createQueue";
+            methodName = createQueueMethod;
          }
          else
          {
@@ -1109,11 +1164,24 @@
                ("Expected javax.jms.Queue or javax.jms.Topic: " + type);
          }
 
-         // invoke the server to create the destination
-         server.invoke(new ObjectName("jboss.mq:service=DestinationManager"),
-            methodName,
-            new Object[]{jndiSuffix},
-            new String[]{"java.lang.String"});
+         try
+         {
+	         // invoke the server to create the destination
+	         server.invoke(new ObjectName(destinationManager),
+	            methodName,
+	            new Object[]{jndiSuffix},
+	            new String[]{"java.lang.String"});
+         }
+         catch (javax.management.ReflectionException exRefl)
+         {
+        	 log.debug("Using alternate signature (name, jndiName)");
+        	 // invoke the server to create the destination
+	         server.invoke(new ObjectName(destinationManager),
+	            methodName,
+	            new Object[]{jndiSuffix, jndiName},
+	            new String[]{"java.lang.String", "java.lang.String"});
+        	 
+         }
          
          // try to look it up again
          return (Destination) ctx.lookup(jndiName);

Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/build.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/build.xml	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/build.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -167,6 +167,7 @@
     <path refid="jboss.jca.classpath"/>
     <path refid="jboss.jmx.classpath"/>
     <path refid="jboss.management.classpath"/>
+    <path refid="jboss.messaging-mq.classpath"/>
     <path refid="jboss.messaging.classpath"/>
     <path refid="jboss.naming.classpath"/>
     <path refid="jboss.security.classpath"/>
@@ -700,7 +701,27 @@
   <patternset id="classloader-leak.excludes">
     <exclude name="org/jboss/test/classloader/leak/test/*TestCase.class"/>
   </patternset>
+  <!-- jbossmessaging.includes -->
+  <patternset id="jbossmessaging.includes">
+     <include name="org/jboss/test/jbossmessaging/test/*UnitTestCase.class"/>
+     <include name="org/jboss/test/jbossmessaging/perf/*StressTestCase.class"/>
+     <include name="org/jboss/test/jbossmessaging/ra/*UnitTestCase.class"/>
+     <include name="org/jboss/test/jbossmessaging/**/*TestCase.class"/>
+     <exclude name="org/jboss/test/jbossmq/**"/> 
+     <include name="**/*UnitTestCase.class"/>
+     <patternset refid="all.excludes-jbossmessaging"/>
+     <exclude name="**/test/xa/test/XAUnitTestCase.class"/>
+  </patternset>
 
+  <patternset id="jbossmessaging.excludes">
+     <exclude name="org/jboss/test/jbossmessaging/**/*TestCase.class"/>
+     <exclude name="org/jboss/test/jms/integration/**/*Test.class"/>
+  </patternset>
+
+  <patternset id="jbossmq.excludes">
+     <exclude name="org/jboss/test/jbossmq/**/*TestCase.class"/>
+  </patternset>
+
   <!-- Tests that are currently broken -->
   <patternset id="badtest.excludes">
     <exclude name="org/jboss/test/aop/test/RemotingUnitTestCase"/>
@@ -745,8 +766,29 @@
     <patternset refid="tc-sso.excludes"/>
     <patternset refid="tc-ssl.excludes"/>
     <patternset refid="webservice.excludes"/>
+    <patternset refid="jbossmessaging.excludes"/>
   </patternset>
 
+  <!--  The union of the excludes (except jbossmessaging) -->
+  <patternset id="all.excludes-jbossmessaging">
+    <patternset refid="aop-with-classloader.excludes"/>
+    <patternset refid="badtest.excludes"/>
+    <patternset refid="binding-manager.excludes"/>
+    <patternset refid="classloader-leak.excludes"/>
+    <patternset refid="cluster.excludes"/>
+    <patternset refid="compatibility.excludes"/>
+    <patternset refid="deployment-service.excludes"/>
+    <patternset refid="iiop.excludes"/>
+    <patternset refid="jacc.excludes"/>
+    <patternset refid="jbossxb.excludes"/>
+    <patternset refid="security.excludes"/>
+    <patternset refid="securitymgr.excludes"/>
+    <patternset refid="tc-sso-clustered.excludes"/>
+    <patternset refid="tc-sso.excludes"/>
+    <patternset refid="tc-ssl.excludes"/>
+    <patternset refid="webservice.excludes"/>
+  </patternset>
+
   <!-- A target that allows for conditional dependency on the compilation and
 
   -->
@@ -1392,9 +1434,10 @@
   | server distribution build.
   -->
 
-  <target name="tests-standard-unit">
+  <target name="tests-standard-unit-soa" if="jbosstest.useJBM">
     <echo>
       <![CDATA[
+   *** tests-standard-unit-soa ***    	
    junit.timeout:              ${junit.timeout}
    jbosstest.iterationcount:   ${jbosstest.iterationcount}
    jbosstest.threadcount:      ${jbosstest.threadcount}
@@ -1430,6 +1473,52 @@
       <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>
+  
+
+  <target name="tests-standard-unit-standard" unless="jbosstest.useJBM">
+    <echo>
+      <![CDATA[
+   **** tests-standard-unit-standard ****
+   junit.timeout:              ${junit.timeout}
+   jbosstest.iterationcount:   ${jbosstest.iterationcount}
+   jbosstest.threadcount:      ${jbosstest.threadcount}
+   jbosstest.beancount:        ${jbosstest.beancount}
+       ]]>
+    </echo>
+    <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}"/>
+      <!-- Used for JGroups -->
+      <jvmarg value="-Dbind.address=${node0}"/>
+      <sysproperty key="jboss.dist" value="${jboss.dist}"/>
+      <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}"/>
+        <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}">
           <include name="**/*UnitTestCase.class"/>
           <patternset refid="all.excludes"/>
           <exclude name="**/test/xa/test/XAUnitTestCase.class"/>
@@ -1437,6 +1526,10 @@
       </batchtest>
     </junit>
   </target>
+	
+	
+  <target name="tests-standard-unit" depends="init,tests-standard-unit-soa,tests-standard-unit-standard">
+  </target>
 
   <target name="tests-standard-stress">
     <mkdir dir="${build.reports}"/>
@@ -1465,13 +1558,25 @@
        <sysproperty key="jboss-junit-configuration" value="tests-standard-stress"/>
        <formatter classname="org.jboss.ant.taskdefs.XMLJUnitMultipleResultFormatter" usefile="${junit.formatter.usefile}" extension="-tests-standard-stress.xml"/>
 
-      <batchtest todir="${build.reports}" haltonerror="${junit.batchtest.haltonerror}" haltonfailure="${junit.batchtest.haltonfailure}" fork="${junit.batchtest.fork}">
+      <!-- Normal stress tests (including mq tests) -->
 
+      <batchtest todir="${build.reports}" haltonerror="${junit.batchtest.haltonerror}" haltonfailure="${junit.batchtest.haltonfailure}" fork="${junit.batchtest.fork}" unless="jbosstest.useJBM">
         <fileset dir="${build.classes}">
           <include name="**/*StressTestCase.class"/>
           <patternset refid="all.excludes"/>
         </fileset>
       </batchtest>
+
+      <!-- Normal stress tests (excluding mq tests) -->
+
+      <batchtest todir="${build.reports}" haltonerror="${junit.batchtest.haltonerror}" haltonfailure="${junit.batchtest.haltonfailure}" fork="${junit.batchtest.fork}" if="jbosstest.useJBM">
+        <fileset dir="${build.classes}">
+          <include name="**/*StressTestCase.class"/>
+          <patternset refid="all.excludes"/>
+          <patternset refid="jbossmq.excludes"/>
+        </fileset>
+      </batchtest>
+
     </junit>
   </target>
 
@@ -1679,6 +1784,8 @@
         <include name="deploy/jms/**"/>
         <include name="deploy/jboss-aop.deployer/**"/>
         <include name="deploy/jboss-aop-jdk50.deployer/**"/>
+        <include name="deploy/jboss-messaging.sar/**"/>
+        <include name="deploy/jms-ds.xml"/>
         <include name="lib/**"/>
       </patternset>
     </create-config>
@@ -1725,6 +1832,7 @@
         <include name="deploy/jboss-local-jdbc.rar"/>
         <include name="deploy/mail-service.xml"/>
         <include name="deploy/jms/*"/>
+        <include name="deploy/jboss-messaging.sar/**"/>
         <include name="lib/**"/>
       </patternset>
     </create-config>

Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/deprecated-build.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/deprecated-build.xml	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/deprecated-build.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -153,7 +153,7 @@
       <path refid="jboss.jmx.classpath"/>
       <path refid="jboss.management.classpath"/>
       <path refid="jboss.media.classpath"/>
-      <path refid="jboss.messaging.classpath"/>
+      <path refid="jboss.messaging-mq.classpath"/>
       <path refid="jboss.naming.classpath"/>
       <path refid="jboss.security.classpath"/>
       <path refid="jboss.server.classpath"/>

Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/config/tests-jacc.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/config/tests-jacc.xml	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/config/tests-jacc.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -58,7 +58,9 @@
         <include name="deploy/jboss-bean.deployer/**"/>
         <include name="deploy/ejb3-interceptors-aop.xml"/>
         <include name="deploy/ejb3.deployer/**"/>
-        <include name="lib/**"/>
+        <include name="lib/**"/>
+        <include name="deploy/jboss-messaging.sar/**"/>
+        <include name="deploy/jms-ds.xml"/>
       </patternset>
     </create-config>
     <server:start name="jacc"/>
@@ -101,6 +103,8 @@
         <include name="deploy/jboss-bean.deployer/**"/>
         <include name="deploy/ejb3-interceptors-aop.xml"/>
         <include name="deploy/ejb3.deployer/**"/>
+        <include name="deploy/jboss-messaging.sar/**"/>
+        <include name="deploy/jms-ds.xml"/>
       </patternset>
     </create-config>
     <!-- -->
@@ -158,6 +162,8 @@
         <include name="deploy/jboss-aop-jdk50.deployer/**"/>
         <include name="deploy/ejb3-interceptors-aop.xml"/>
         <include name="deploy/ejb3.deployer/**"/>
+        <include name="deploy/jboss-messaging.sar/**"/>
+        <include name="deploy/jms-ds.xml"/>
       </patternset>
     </create-config>
     <!-- -->
@@ -229,6 +235,8 @@
         <include name="deploy/jboss-aop-jdk50.deployer/**"/>
         <include name="deploy/ejb3-interceptors-aop.xml"/>
         <include name="deploy/ejb3.deployer/**"/>
+        <include name="deploy/jboss-messaging.sar/**"/>
+        <include name="deploy/jms-ds.xml"/>
       </patternset>
     </create-config>
     <!-- -->

Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/sections/mdb.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/sections/mdb.xml	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/sections/mdb.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -25,6 +25,15 @@
             <include name="**/*.xml"/>
          </fileset>
       </jar>
+	  <jar destfile="${build.lib}/mdb4jbm.jar">
+	       <fileset dir="${build.classes}">
+	          <patternset refid="jboss.test.util.ejb.set"/>
+	          <include name="org/jboss/test/mdb/bean/**"/>
+	       </fileset>
+	       <fileset dir="${build.resources}/mdb4jbm">
+	          <include name="**/*.xml"/>
+	       </fileset>
+	  </jar>
    </target>
    
    <!-- messagedriven test -->

Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/sections/security.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/sections/security.xml	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/sections/security.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -91,7 +91,34 @@
          </fileset>
       </jar>
       
-      <!-- build security-srp.jar and security-srp.sar -->
+    <!-- build security-spec-jbm.jar -->
+    <jar destfile="${build.lib}/security-spec-jbm.sar">
+       <metainf dir="${build.resources}/security-spec/service-inf-jbm"/>
+       <fileset dir="${build.resources}/security">
+          <include name="tst.keystore"/>
+       </fileset>
+    </jar>
+    <jar destfile="${build.lib}/security-spec-jbm.jar">
+       <fileset dir="${build.classes}">
+          <include name="org/jboss/test/security/interfaces/**"/>
+          <include name="org/jboss/test/security/ejb/**"/>
+          <include name="org/jboss/test/security/test/Namespace*"/>
+          <include name="org/jboss/test/security/test/PermissionName*"/>
+       </fileset>
+       <fileset dir="${build.resources}/security-spec">
+          <include name="META-INF/ejb-jar.xml"/>
+          <include name="META-INF/jboss.xml"/>
+          <include name="users.properties"/>
+          <include name="roles.properties"/>
+       </fileset>
+       <fileset dir="${build.lib}">
+          <include name="security-spec-jbm.sar"/>
+       </fileset>
+    </jar>
+    
+
+   	
+   	  <!-- build security-srp.jar and security-srp.sar -->
       <jar destfile="${build.lib}/security-srp.sar">
          <metainf dir="${build.resources}/security-srp/service-inf"/>
          <fileset dir="${build.classes}">

Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cts/test/MDBUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cts/test/MDBUnitTestCase.java	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cts/test/MDBUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -54,19 +54,18 @@
       InitialContext ctx = new InitialContext();
       QueueConnectionFactory factory = (QueueConnectionFactory) ctx.lookup(QUEUE_FACTORY);
       QueueConnection queConn = factory.createQueueConnection();
-      QueueSession session = queConn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
       Queue queueA = (Queue) ctx.lookup("queue/A");
       Queue queueB = (Queue) ctx.lookup("queue/B");
       queConn.start();
       MDBInvoker[] threads = new MDBInvoker[MAX_SIZE];
       for(int n = 0; n < MAX_SIZE; n ++)
       {
+         QueueSession session = queConn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
          MDBInvoker t = new MDBInvoker(session, queueA, queueB, n, done, getLog());
          threads[n] = t;
          t.start();
       }
       assertTrue("Acquired done", done.attempt(1500 * MAX_SIZE));
-      session.close();
       queConn.close();
 
       for(int n = 0; n < MAX_SIZE; n ++)

Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jacc/test/EJBSpecUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jacc/test/EJBSpecUnitTestCase.java	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jacc/test/EJBSpecUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -91,6 +91,8 @@
       // Create an initializer for the test suite
       TestSetup wrapper = new JBossTestSetup(suite)
       {
+         boolean useJBM = System.getProperty("jbosstest.useJBM") != null;
+
          protected void setUp() throws Exception
          {
             super.setUp();
@@ -99,12 +101,14 @@
             */
             super.initDefaultLoginConfig();
             Configuration.setConfiguration(new XMLLoginConfigImpl());
-            redeploy("security-spec.jar");
+            
+            redeploy(useJBM?"security-spec-jbm.jar":"security-spec.jar");
             flushAuthCache();
          }
          protected void tearDown() throws Exception
          {
-            undeploy("security-spec.jar");
+             
+            undeploy(useJBM?"security-spec-jbm.jar":"security-spec.jar");
             super.tearDown();
          
          }

Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jacc/test/WebIntegrationUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jacc/test/WebIntegrationUnitTestCase.java	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jacc/test/WebIntegrationUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -79,13 +79,15 @@
          }
          protected void tearDown() throws Exception
          {
+        	boolean useJBM = System.getProperty("jbosstest.useJBM") != null;
+        	
             undeploy("jbosstest-web.ear");
             super.tearDown();
 
             // Remove all the messages created during this test
             getServer().invoke
             (
-               new ObjectName("jboss.mq.destination:service=Queue,name=testQueue"),
+               new ObjectName(useJBM?"jboss.messaging.destination:service=Topic,name=testTopic":"jboss.mq.destination:service=Queue,name=testQueue"),
                "removeAllMessages",
                new Object[0],
                new String[0]

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging (from rev 64641, branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging)

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/JBossMessagingAdmin.java
===================================================================
--- branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/JBossMessagingAdmin.java	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/JBossMessagingAdmin.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,220 +0,0 @@
-/*
-* 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;
-
-import javax.management.MBeanServerConnection;
-import javax.management.ObjectName;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-import org.jboss.logging.Logger;
-import org.jboss.util.NestedRuntimeException;
-
-import org.objectweb.jtests.jms.admin.Admin;
-
-/**
- * JBossMessagingAdmin.
- * 
- * @author <a href="richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 64152 $
- */
-public class JBossMessagingAdmin implements Admin
-{
-   private Logger log = Logger.getLogger(JBossMessagingAdmin.class);
-
-   private InitialContext initialContext ;
-   private MBeanServerConnection server ;
-
-   protected static final String name ;
-   protected static final ObjectName serverPeer;
-   protected static final ObjectName namingService;
-   
-   static
-   {
-      try
-      {
-	 name =  JBossMessagingAdmin.class.getName() ;
-         serverPeer = new ObjectName("jboss.messaging:service=ServerPeer");
-         namingService = new ObjectName("jboss:service=Naming");
-      }
-      catch (Exception e)
-      {
-         throw new NestedRuntimeException(e);
-      }
-   }
-   
-   public JBossMessagingAdmin(Class clazz) throws Exception
-   {
-	   this();
-   }
-   public JBossMessagingAdmin() throws Exception
-   {
-      try {
-	  log.info("Initializing...") ;
-
-          // set up the initial naming service context
-          initialContext = new InitialContext() ;
-
-          // set up the MBean server connection
-          String adaptorName = System.getProperty("jbosstest.server.name","jmx/invoker/RMIAdaptor") ;
-          server = (MBeanServerConnection) initialContext.lookup(adaptorName) ;
-	   
-      } catch (Exception e) {
-         throw new NestedRuntimeException(e);
-      }
-   }
-
-   public String getName() {
-      return name ;
-   }
-
-   private MBeanServerConnection getServer() {
-       return server ;
-   }
-
-   public InitialContext createInitialContext() throws NamingException {
-      return initialContext ;
-   }
-
-   public void createQueue(String name)
-   {
-      try
-      {
-         MBeanServerConnection server = getServer();
-         try
-         {
-            server.invoke(serverPeer, "deployQueue", new Object[] { name, name },  new String[] { String.class.getName(), String.class.getName() } );
-         }
-         catch (Exception ignored)
-         {
-            log.trace("Ignored", ignored);
-         }
-         ObjectName queueName = new ObjectName("jboss.messaging.destination:service=Queue,name=" + name);
-         server.invoke(queueName, "removeAllMessages", null, null);
-      }
-      catch (Exception e)
-      {
-         throw new NestedRuntimeException(e);
-      }
-   }
-
-   public void deleteQueue(String name)
-   {
-      try
-      {
-         MBeanServerConnection server = getServer();
-         ObjectName queueName = new ObjectName("jboss.messaging.destination:service=Queue,name=" + name);
-         server.invoke(queueName, "removeAllMessages", null, null);
-         server.invoke(serverPeer, "destroyQueue", new Object[] { name },  new String[] { String.class.getName() } );
-      }
-      catch (Exception e)
-      {
-         throw new NestedRuntimeException(e);
-      }
-   }
-
-   public void createTopic(String name)
-   {
-      try
-      {
-         MBeanServerConnection server = getServer();
-         try
-         {
-            server.invoke(serverPeer, "deployTopic", new Object[] { name, name },  new String[] { String.class.getName(), String.class.getName() } );
-         }
-         catch (Exception ignored)
-         {
-        	 ignored.printStackTrace();
-         }
-         ObjectName topicName = new ObjectName("jboss.messaging.destination:service=Topic,name=" + name);
-         server.invoke(topicName, "removeAllMessages", null, null);
-      }
-      catch (Exception e)
-      {
-    	 e.printStackTrace();
-         throw new NestedRuntimeException(e);
-      }
-   }
-
-   public void deleteTopic(String name)
-   {
-      try
-      {
-         MBeanServerConnection server = getServer();
-         ObjectName topicName = new ObjectName("jboss.messaging.destination:service=Topic,name=" + name);
-         server.invoke(topicName, "removeAllMessages", null, null);
-         server.invoke(serverPeer, "destroyTopic", new Object[] { name },  new String[] { String.class.getName() } );
-      }
-      catch (Exception e)
-      {
-         throw new NestedRuntimeException(e);
-      }
-   }
-
-   public void createConnectionFactory(String name)
-   {
-      try
-      {
-         MBeanServerConnection server = getServer();
-         server.invoke(namingService, "createAlias", new Object[] { name, "ConnectionFactory" },  new String[] { String.class.getName(), String.class.getName() } );
-      }
-      catch (Exception e)
-      {
-         throw new NestedRuntimeException(e);
-      }
-   }
-
-   public void deleteConnectionFactory(String name)
-   {
-      try
-      {
-         MBeanServerConnection server = getServer();
-         server.invoke(namingService, "removeAlias", new Object[] { name },  new String[] { String.class.getName() } );
-      }
-      catch (Exception e)
-      {
-         throw new NestedRuntimeException(e);
-      }
-   }
-
-   public void createQueueConnectionFactory(String name)
-   {
-       createConnectionFactory(name) ;
-   }
-
-   public void deleteQueueConnectionFactory(String name)
-   {
-       deleteConnectionFactory(name) ;
-   }
-
-   public void createTopicConnectionFactory(String name)
-   {
-       createConnectionFactory(name) ;
-   }
-
-   public void deleteTopicConnectionFactory(String name)
-   {
-       deleteConnectionFactory(name) ;
-   }
-
-}

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/JBossMessagingAdmin.java (from rev 64641, branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/JBossMessagingAdmin.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/JBossMessagingAdmin.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/JBossMessagingAdmin.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,220 @@
+/*
+* 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;
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.logging.Logger;
+import org.jboss.util.NestedRuntimeException;
+
+import org.objectweb.jtests.jms.admin.Admin;
+
+/**
+ * JBossMessagingAdmin.
+ * 
+ * @author <a href="richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 64152 $
+ */
+public class JBossMessagingAdmin implements Admin
+{
+   private Logger log = Logger.getLogger(JBossMessagingAdmin.class);
+
+   private InitialContext initialContext ;
+   private MBeanServerConnection server ;
+
+   protected static final String name ;
+   protected static final ObjectName serverPeer;
+   protected static final ObjectName namingService;
+   
+   static
+   {
+      try
+      {
+	 name =  JBossMessagingAdmin.class.getName() ;
+         serverPeer = new ObjectName("jboss.messaging:service=ServerPeer");
+         namingService = new ObjectName("jboss:service=Naming");
+      }
+      catch (Exception e)
+      {
+         throw new NestedRuntimeException(e);
+      }
+   }
+   
+   public JBossMessagingAdmin(Class clazz) throws Exception
+   {
+	   this();
+   }
+   public JBossMessagingAdmin() throws Exception
+   {
+      try {
+	  log.info("Initializing...") ;
+
+          // set up the initial naming service context
+          initialContext = new InitialContext() ;
+
+          // set up the MBean server connection
+          String adaptorName = System.getProperty("jbosstest.server.name","jmx/invoker/RMIAdaptor") ;
+          server = (MBeanServerConnection) initialContext.lookup(adaptorName) ;
+	   
+      } catch (Exception e) {
+         throw new NestedRuntimeException(e);
+      }
+   }
+
+   public String getName() {
+      return name ;
+   }
+
+   private MBeanServerConnection getServer() {
+       return server ;
+   }
+
+   public InitialContext createInitialContext() throws NamingException {
+      return initialContext ;
+   }
+
+   public void createQueue(String name)
+   {
+      try
+      {
+         MBeanServerConnection server = getServer();
+         try
+         {
+            server.invoke(serverPeer, "deployQueue", new Object[] { name, name },  new String[] { String.class.getName(), String.class.getName() } );
+         }
+         catch (Exception ignored)
+         {
+            log.trace("Ignored", ignored);
+         }
+         ObjectName queueName = new ObjectName("jboss.messaging.destination:service=Queue,name=" + name);
+         server.invoke(queueName, "removeAllMessages", null, null);
+      }
+      catch (Exception e)
+      {
+         throw new NestedRuntimeException(e);
+      }
+   }
+
+   public void deleteQueue(String name)
+   {
+      try
+      {
+         MBeanServerConnection server = getServer();
+         ObjectName queueName = new ObjectName("jboss.messaging.destination:service=Queue,name=" + name);
+         server.invoke(queueName, "removeAllMessages", null, null);
+         server.invoke(serverPeer, "destroyQueue", new Object[] { name },  new String[] { String.class.getName() } );
+      }
+      catch (Exception e)
+      {
+         throw new NestedRuntimeException(e);
+      }
+   }
+
+   public void createTopic(String name)
+   {
+      try
+      {
+         MBeanServerConnection server = getServer();
+         try
+         {
+            server.invoke(serverPeer, "deployTopic", new Object[] { name, name },  new String[] { String.class.getName(), String.class.getName() } );
+         }
+         catch (Exception ignored)
+         {
+        	 ignored.printStackTrace();
+         }
+         ObjectName topicName = new ObjectName("jboss.messaging.destination:service=Topic,name=" + name);
+         server.invoke(topicName, "removeAllMessages", null, null);
+      }
+      catch (Exception e)
+      {
+    	 e.printStackTrace();
+         throw new NestedRuntimeException(e);
+      }
+   }
+
+   public void deleteTopic(String name)
+   {
+      try
+      {
+         MBeanServerConnection server = getServer();
+         ObjectName topicName = new ObjectName("jboss.messaging.destination:service=Topic,name=" + name);
+         server.invoke(topicName, "removeAllMessages", null, null);
+         server.invoke(serverPeer, "destroyTopic", new Object[] { name },  new String[] { String.class.getName() } );
+      }
+      catch (Exception e)
+      {
+         throw new NestedRuntimeException(e);
+      }
+   }
+
+   public void createConnectionFactory(String name)
+   {
+      try
+      {
+         MBeanServerConnection server = getServer();
+         server.invoke(namingService, "createAlias", new Object[] { name, "ConnectionFactory" },  new String[] { String.class.getName(), String.class.getName() } );
+      }
+      catch (Exception e)
+      {
+         throw new NestedRuntimeException(e);
+      }
+   }
+
+   public void deleteConnectionFactory(String name)
+   {
+      try
+      {
+         MBeanServerConnection server = getServer();
+         server.invoke(namingService, "removeAlias", new Object[] { name },  new String[] { String.class.getName() } );
+      }
+      catch (Exception e)
+      {
+         throw new NestedRuntimeException(e);
+      }
+   }
+
+   public void createQueueConnectionFactory(String name)
+   {
+       createConnectionFactory(name) ;
+   }
+
+   public void deleteQueueConnectionFactory(String name)
+   {
+       deleteConnectionFactory(name) ;
+   }
+
+   public void createTopicConnectionFactory(String name)
+   {
+       createConnectionFactory(name) ;
+   }
+
+   public void deleteTopicConnectionFactory(String name)
+   {
+       deleteConnectionFactory(name) ;
+   }
+
+}

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/JMSBase.java
===================================================================
--- branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/JMSBase.java	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/JMSBase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,894 +0,0 @@
-/*
-  * 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;
-
-import java.util.Enumeration;
-
-import javax.jms.Connection;
-import javax.jms.DeliveryMode;
-import javax.jms.Destination;
-import javax.jms.ExceptionListener;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.QueueBrowser;
-import javax.jms.QueueConnection;
-import javax.jms.QueueConnectionFactory;
-import javax.jms.QueueSender;
-import javax.jms.QueueSession;
-import javax.jms.Session;
-import javax.jms.Topic;
-import javax.jms.TopicConnection;
-import javax.jms.TopicConnectionFactory;
-import javax.jms.TopicPublisher;
-import javax.jms.TopicSession;
-import javax.naming.Context;
-import javax.naming.NamingException;
-
-import org.jboss.test.jbossmessaging.JMSTestCase;
-import org.apache.log4j.Logger;
-
-/**
- * JMS tests base class.
- *
- * Your test extends this class, and can then use common methods. To do
- * the tests you use TopicWorker or QueueWorker and the MessageCreator,
- * MessageFilter and perhaps MessageQos classes, directly or by extending
- * them.
- *
- * You can change the connection factories and destinations used by the
- * properties:   jbosstest.queuefactory, jbosstest.topicfactory, 
- * jbosstest.queue or jbosstest.topic.
- *
- * @author <a href="mailto:richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
- * @author    <a href="pra at tim.se">Peter Antman</a>
- * @version $Revision: 64261 $
- */
-public class JMSBase extends JMSTestCase
-{
-   public static final int PUBLISHER = 0;
-   public static final int SUBSCRIBER = 1;
-   public static final int GETTER = 2;
-   public static final int CONNECTOR = 3;
-   public static final int FAILSAFE_SUBSCRIBER = 4;
-   public static final int TRANS_NONE = 0;
-   public static final int TRANS_INDIVIDUAL = 1;
-   public static final int TRANS_TOTAL = 2;
-   public static final String[] TRANS_DESC = {"NOT", "individually", "totally"};
-   public static final int DEFAULT_RUNSLEEP = 50;
-   public final Logger log = getLog();
-
-   // Provider specific
-   public String TOPIC_FACTORY = "ConnectionFactory";
-   public String QUEUE_FACTORY = "ConnectionFactory";
-
-   public String TEST_QUEUE = "queue/testQueue";
-   public String TEST_TOPIC = "topic/testTopic";
-
-   public Context context;
-   public QueueConnectionFactory queueFactory;
-   public TopicConnectionFactory topicFactory;
-
-   public JMSBase(String name)
-   {
-      super(name);
-   }
-
-   public long getRunSleep()
-   {
-      log.info("run.sleep: " + System.getProperty("run.sleep"));
-      return 1000L * Integer.getInteger("run.sleep", DEFAULT_RUNSLEEP).intValue();
-   }
-
-   public void sleep(long sleep)
-   {
-      try
-      {
-         Thread.sleep(sleep);
-      }
-      catch (InterruptedException e)
-      {
-      }
-   }
-
-   public void drainTopic() throws JMSException
-   {
-      TopicWorker sub1 = new TopicWorker(GETTER,
-         TRANS_NONE,
-         null
-      );
-      sub1.connect();
-      sub1.get();
-      sub1.close();
-   }
-
-   public void drainQueue() throws JMSException
-   {
-      QueueWorker sub1 = new QueueWorker(GETTER,
-         TRANS_NONE,
-         null
-      );
-      sub1.connect();
-      sub1.get();
-      sub1.close();
-   }
-
-   /**
-    * The JUnit setup method
-    *
-    * @exception Exception  Description of Exception
-    */
-   protected void setUp() throws Exception
-   {
-       // call setUp() method of the superclass
-       super.setUp() ;
-
-      // Reconfigure acording to props
-      QUEUE_FACTORY = System.getProperty("jbosstest.queuefactory", QUEUE_FACTORY);
-      TOPIC_FACTORY = System.getProperty("jbosstest.topicfactory", TOPIC_FACTORY);
-      TEST_QUEUE = System.getProperty("jbosstest.queue", TEST_QUEUE);
-      TEST_TOPIC = System.getProperty("jbosstest.topic", TEST_TOPIC);
-
-      if (context == null)
-      {
-
-         context = getInitialContext();
-
-         queueFactory = (QueueConnectionFactory) context.lookup(QUEUE_FACTORY);
-         topicFactory = (TopicConnectionFactory) context.lookup(TOPIC_FACTORY);
-
-         getLog().debug("Connection to JMS provider established.");
-      }
-
-   }
-
-
-   public static void main(String[] args)
-   {
-
-   }
-
-   public abstract class JMSWorker implements Runnable, MessageListener, ExceptionListener
-   {
-
-      protected boolean stopRequested = false;
-      protected int messageHandled = 0;
-      protected Exception runEx = null;
-      protected MessageFilter filter;
-      protected MessageCreator creator;
-      protected int number = 1;
-      protected int type = -1;
-      protected int transacted;
-      protected QosConfig qosConfig = new QosConfig();
-      protected String userName;
-      protected String password;
-      protected String clientID;
-
-      // Generic ones, should be set by sublcasses
-      public Connection connection;
-      public Destination destination;
-      public Session session;
-      public MessageProducer producer;
-      public MessageConsumer consumer;
-
-      /**
-       * Create one without any settings, use mutators instead. Makes it easier to owerride.
-       */
-      public JMSWorker()
-      {
-      }
-
-      public JMSWorker(int type, int transacted, MessageFilter filter)
-      {
-         this.type = type;
-         this.transacted = transacted;
-         this.filter = filter;
-      }
-
-      public JMSWorker(int type,
-         int transacted,
-         MessageCreator creator,
-         int number
-         )
-      {
-         this.type = type;
-         this.transacted = transacted;
-         this.creator = creator;
-         this.number = number;
-      }
-
-      public void setSubscriberAttrs(int type, int transacted, MessageFilter filter)
-      {
-         this.type = type;
-         this.transacted = transacted;
-         this.filter = filter;
-      }
-
-      public void setPublisherAttrs(int type,
-         int transacted,
-         MessageCreator creator,
-         int number)
-      {
-         this.type = type;
-         this.transacted = transacted;
-         this.creator = creator;
-         this.number = number;
-      }
-
-      public void setUser(String userName, String password)
-      {
-         this.userName = userName;
-         this.password = password;
-      }
-
-      public void setClientID(String ID)
-      {
-         this.clientID = ID;
-      }
-
-      abstract public void publish() throws JMSException;
-
-      abstract public void publish(int nr) throws JMSException;
-
-      /**
-       * Subsribes, collects, checking any set filters. A messageComsumer must be created before calling this.
-       */
-      public void subscribe() throws JMSException
-      {
-         subscribe(false);
-      }
-
-      /**
-       * Subsribes, collects, checking any set filters. A messageComsumer must be created before calling this. If arg set to true, do a failsafe sub
-       */
-      public void subscribe(boolean failsafe) throws JMSException
-      {
-         if (consumer == null)
-            throw new JMSException("No messageConsumer created");
-
-         if (failsafe)
-            connection.setExceptionListener(this);
-
-         consumer.setMessageListener(this);
-
-      }
-
-      public void get() throws JMSException
-      {
-         Message msg = consumer.receive(2000);
-         while (msg != null)
-         {
-            if (filter != null)
-            {
-               if (filter.ok(msg))
-                  messageHandled++;
-            }
-            else
-            {
-               messageHandled++;
-            }
-            msg = consumer.receive(2000);
-         }
-      }
-
-      abstract public void connect() throws JMSException;
-
-      public void setQosConfig(QosConfig qosConfig)
-      {
-         this.qosConfig = qosConfig;
-      }
-
-      public void setStoped() throws JMSException
-      {
-         stopRequested = true;
-      }
-
-      public int getMessageHandled()
-      {
-         return messageHandled;
-      }
-
-      public Exception getException()
-      {
-         return runEx;
-      }
-
-      public void reset()
-      {
-         messageHandled = 0;
-         stopRequested = false;
-         runEx = null;
-      }
-
-      public void close()
-      {
-         try
-         {
-            if (consumer != null)
-               consumer.close();
-            if (producer != null)
-               producer.close();
-            if (session != null)
-               session.close();
-         }
-         catch (JMSException ex)
-         {
-         }
-         finally
-         {
-            if (connection != null)
-            {
-               try
-               {
-                  connection.close();
-               }
-               catch (JMSException ex)
-               {
-               }
-            }
-         }
-      }
-
-      public void onMessage(Message msg)
-      {
-         try
-         {
-            if (filter != null)
-            {
-               if (filter.ok(msg))
-                  messageHandled++;
-            }
-            else
-            {
-               messageHandled++;
-            }
-            if (session.getTransacted())
-               session.commit();
-         }
-         catch (Exception ex)
-         {
-            log.warn("Exception in on message: " + ex, ex);
-            runEx = ex;
-         }
-      }
-
-      /**
-       * onException handling is only for subscriber. Will try to to
-       * a connect followed by a subscribe
-       */
-      public void onException(JMSException ex)
-      {
-         log.error("Ex in connection: " + ex);
-
-         try
-         {
-            connection.setExceptionListener(null);
-            close();
-         }
-         catch (JMSException c)
-         {
-         }
-         
-         // Try reconnect, loops until success or shut down
-         try
-         {
-            boolean tryIt = true;
-            while (tryIt && !stopRequested)
-            {
-               log.info("Trying reconnect...");
-               try
-               {
-                  Thread.sleep(10000);
-               }
-               catch (InterruptedException ie)
-               {
-               }
-               try
-               {
-                  connect();
-                  subscribe(true);
-                  tryIt = false;
-                  log.info("Reconnect OK");
-                  //return;
-               }
-               catch (JMSException e)
-               {
-                  log.error("Error in reconnect: " + e);
-               }
-            }
-
-         }
-         catch (Exception je)
-         {
-            log.error("Strange error in failsafe handling" + je, je);
-         }
-      }
-
-      public void run()
-      {
-         try
-         {
-            switch (type)
-            {
-               case -1:
-                  log.info("Nothing to do for type " + type);
-                  break;
-               case PUBLISHER:
-                  connect();
-                  publish();
-                  break;
-               case SUBSCRIBER:
-                  connect();
-                  subscribe();
-                  break;
-               case GETTER:
-                  connect();
-                  get();
-                  break;
-               case CONNECTOR:
-                  connect();
-                  break;
-               case FAILSAFE_SUBSCRIBER:
-                  connect();
-                  subscribe(true);
-                  break;
-            }
-
-            //if the method does not hold an own thread, we do it here
-            while (!stopRequested)
-            {
-               try
-               {
-                  Thread.sleep(1000);
-               }
-               catch (InterruptedException ex)
-               {
-
-               }
-            }
-         }
-         catch (JMSException ex)
-         {
-            runEx = ex;
-            log.error("Could not run: " + ex, ex);
-         }
-      }
-   }
-
-   public interface MessageCreator
-   {
-      public void setSession(Session session);
-
-      public Message createMessage(int nr) throws JMSException;
-   }
-
-   public abstract class BaseMessageCreator implements MessageCreator
-   {
-      protected Session session;
-      protected String property;
-
-      public BaseMessageCreator(String property)
-      {
-         this.property = property;
-      }
-
-      public void setSession(Session session)
-      {
-         this.session = session;
-      }
-
-      abstract public Message createMessage(int nr) throws JMSException;
-   }
-
-
-   public class IntRangeMessageCreator extends BaseMessageCreator
-   {
-      int start = 0;
-
-      public IntRangeMessageCreator(String property)
-      {
-         super(property);
-      }
-
-      public IntRangeMessageCreator(String property, int start)
-      {
-         super(property);
-         this.start = start;
-      }
-
-      public Message createMessage(int nr) throws JMSException
-      {
-         if (session == null)
-            throw new JMSException("Session not allowed to be null");
-
-         Message msg = session.createMessage();
-         msg.setStringProperty(property, String.valueOf(start + nr));
-         return msg;
-      }
-   }
-
-   public interface MessageFilter
-   {
-      public boolean ok(Message msg) throws JMSException;
-   }
-
-   public class IntRangeMessageFilter implements MessageFilter
-   {
-      Class messageClass;
-      String className;
-      String property;
-      int low;
-      int max;
-      int counter = 0;
-      int report = 1000;
-
-      public IntRangeMessageFilter(Class messageClass, String property, int low, int max)
-      {
-         this.messageClass = messageClass;
-         this.property = property;
-         className = messageClass.getName();
-         this.low = low;
-         this.max = max;
-      }
-
-      private boolean validateClass(Message msg)
-      {
-         Class clazz = null;
-         if (msg instanceof javax.jms.TextMessage)
-            clazz = javax.jms.TextMessage.class;
-         else if (msg instanceof javax.jms.BytesMessage)
-            clazz = javax.jms.BytesMessage.class;
-         else if (msg instanceof javax.jms.MapMessage)
-            clazz = javax.jms.MapMessage.class;
-         else if (msg instanceof javax.jms.ObjectMessage)
-            clazz = javax.jms.ObjectMessage.class;
-         else if (msg instanceof javax.jms.StreamMessage)
-            clazz = javax.jms.StreamMessage.class;
-         else
-            clazz = javax.jms.Message.class;
-
-         return clazz.equals(messageClass);
-      }
-
-      public boolean ok(Message msg) throws JMSException
-      {
-         boolean res = false;
-         if (validateClass(msg))
-         {
-            if (msg.propertyExists(property))
-            {
-               String p = msg.getStringProperty(property);
-               try
-               {
-                  int i = Integer.parseInt(p);
-                  //log.debug("Received message " + property +"=" +i);
-                  if (i >= low && i < max)
-                     res = true;
-               }
-               catch (NumberFormatException ex)
-               {
-                  throw new JMSException("Property " + property + " was not int: " + p);
-               }
-            }
-         }
-         counter++;
-         int mod = counter % report;
-         if (mod == 0)
-            log.debug("Have received " + counter + " messages");
-         return res;
-      }
-
-   }
-
-   /*  
-   public class REMessageFilter implements MessageFilter {
-      Class messageClass;
-      String className;
-      String property;
-      RE re = null;
-      public REMessageFilter(Class messageClass, String property, String regexp) throws REException{
-         this.messageClass = messageClass;
-         this.property = property;
-         re = new RE(regexp);
-         className = messageClass.getName();
-      }
-      
-      public boolean ok(Message msg) throws JMSException{
-         boolean res = false;
-         if (className.equals(msg.getClass().getName())) {
-            if (msg.propertyExists(property)) {
-               String p = msg.getStringProperty(property);
-               if (re.getMatch(p)!=null)
-                  res = true;
-            } 
-         }
-         return true;
-      }
-   }
-   */
-   /**
-    * Defines quality of service for message publishing. Defaults are the same
-    * ase defined in SpyMessage.
-    */
-   public class QosConfig
-   {
-      int deliveryMode = DeliveryMode.PERSISTENT;
-      int priority = 4;
-      long ttl = 0;
-   }
-
-   public class TopicWorker extends JMSWorker
-   {
-      String durableHandle;
-
-      /**
-       * If using this, use mutators to add attrs.
-       */
-      public TopicWorker()
-      {
-         super();
-      }
-
-      public TopicWorker(int type, int transacted, MessageFilter filter)
-      {
-         super(type, transacted, filter);
-      }
-
-      public TopicWorker(int type,
-         int transacted,
-         MessageCreator creator,
-         int number
-         )
-      {
-         super(type, transacted, creator, number);
-      }
-
-
-      public void publish() throws JMSException
-      {
-         publish(number);
-      }
-
-      public void publish(int nr) throws JMSException
-      {
-         if (producer == null)
-            producer = ((TopicSession) session).createPublisher((Topic) destination);
-         if (creator == null)
-            throw new JMSException("Publish must have a MessageCreator set");
-
-         creator.setSession(session);
-         System.out.println("Publishing " + nr + " messages");
-         for (int i = 0; i < nr; i++)
-         {
-        	System.out.println("Sending Message");
-            if (qosConfig != null)
-            {
-            	System.out.println("Sending Message(a)");
-               ((TopicPublisher) producer).publish(creator.createMessage(i),
-                  qosConfig.deliveryMode,
-                  qosConfig.priority,
-                  qosConfig.ttl);
-            }
-            else
-            {
-            	System.out.println("Sending Message(b)");
-               ((TopicPublisher) producer).publish(creator.createMessage(i));
-            }
-
-            messageHandled++;
-         }
-         if (session.getTransacted())
-            session.commit();
-         log.debug("Finished publishing");
-      }
-
-      public void subscribe() throws JMSException
-      {
-         subscribe(false);
-      }
-
-      public void subscribe(boolean failsafe) throws JMSException
-      {
-         if (durableHandle != null)
-            consumer = ((TopicSession) session).createDurableSubscriber((Topic) destination, durableHandle);
-         else
-            consumer = ((TopicSession) session).createSubscriber((Topic) destination);
-         super.subscribe(failsafe);
-         connection.start();
-      }
-
-      public void get() throws JMSException
-      {
-         consumer = ((TopicSession) session).createSubscriber((Topic) destination);
-         super.subscribe();
-         connection.start();
-      }
-
-      public void connect() throws JMSException
-      {
-         log.debug("Connecting: " + this.toString());
-         if (userName != null)
-            connection = topicFactory.createTopicConnection(userName, password);
-         else
-            connection = topicFactory.createTopicConnection();
-
-         if (clientID != null)
-         {
-            log.debug("Setting clientID" + clientID);
-            connection.setClientID(clientID);
-         }
-
-         session = ((TopicConnection) connection).createTopicSession(transacted != TRANS_NONE, Session.AUTO_ACKNOWLEDGE);
-         try
-         {
-            destination = (Destination) context.lookup(TEST_TOPIC);
-         }
-         catch (NamingException ex)
-         {
-            throw new JMSException("Could not lookup topic " + ex);
-         }
-      }
-
-      // Topic specific stuff
-      public void setDurable(String userId, String pwd, String handle)
-      {
-         this.userName = userId;
-         this.password = pwd;
-         this.durableHandle = handle;
-      }
-
-      public void setDurable(String handle)
-      {
-         this.durableHandle = handle;
-      }
-
-      public void unsubscribe() throws JMSException
-      {
-         if (durableHandle != null)
-            ((TopicSession) session).unsubscribe(durableHandle);
-      }
-
-      public String toString()
-      {
-         return "(userId=" + userName + " pwd=" + password + " handle=" + durableHandle + ")";
-      }
-
-   }
-
-   public class QueueWorker extends JMSWorker
-   {
-      String userId;
-      String pwd;
-      String handle;
-
-      /**
-       * If using this, use mutators to add attrs.
-       */
-      public QueueWorker()
-      {
-         super();
-      }
-
-      public QueueWorker(int type, int transacted, MessageFilter filter)
-      {
-         super(type, transacted, filter);
-      }
-
-      public QueueWorker(int type,
-         int transacted,
-         MessageCreator creator,
-         int number
-         )
-      {
-         super(type, transacted, creator, number);
-      }
-
-
-      public void publish() throws JMSException
-      {
-         publish(number);
-      }
-
-      public void publish(int nr) throws JMSException
-      {
-         if (producer == null)
-            producer = ((QueueSession) session).createSender((Queue) destination);
-         if (creator == null)
-            throw new JMSException("Publish must have a MessageCreator set");
-
-         creator.setSession(session);
-         log.debug("Publishing " + nr + " messages");
-         for (int i = 0; i < nr; i++)
-         {
-            if (qosConfig != null)
-            {
-               ((QueueSender) producer).send(creator.createMessage(i),
-                  qosConfig.deliveryMode,
-                  qosConfig.priority,
-                  qosConfig.ttl);
-            }
-            else
-            {
-               ((QueueSender) producer).send(creator.createMessage(i));
-            }
-
-            messageHandled++;
-         }
-         if (session.getTransacted())
-            session.commit();
-         log.debug("Finished publishing");
-      }
-
-      public void subscribe() throws JMSException
-      {
-         subscribe(false);
-      }
-
-      public void subscribe(boolean failsafe) throws JMSException
-      {
-
-         consumer = ((QueueSession) session).createReceiver((Queue) destination);
-         super.subscribe(failsafe);
-         connection.start();
-      }
-
-      public void get() throws JMSException
-      {
-         consumer = ((QueueSession) session).createReceiver((Queue) destination);
-         super.subscribe();
-         connection.start();
-      }
-
-      public void connect() throws JMSException
-      {
-         log.debug("Connecting: " + this.toString());
-         if (userName != null)
-            connection = queueFactory.createQueueConnection(userName, password);
-         else
-            connection = queueFactory.createQueueConnection();
-
-         if (clientID != null)
-            connection.setClientID(clientID);
-
-         session = ((QueueConnection) connection).createQueueSession(transacted != TRANS_NONE, Session.AUTO_ACKNOWLEDGE);
-         try
-         {
-            destination = (Destination) context.lookup(TEST_QUEUE);
-         }
-         catch (NamingException ex)
-         {
-            throw new JMSException("Could not lookup topic " + ex);
-         }
-      }
-
-
-      // Queue specific
-      public Enumeration browse() throws JMSException
-      {
-         QueueBrowser b = ((QueueSession) session).createBrowser((Queue) destination);
-         return b.getEnumeration();
-      }
-   }
-} // JMSBase

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/JMSBase.java (from rev 64641, branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/JMSBase.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/JMSBase.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/JMSBase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,894 @@
+/*
+  * 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;
+
+import java.util.Enumeration;
+
+import javax.jms.Connection;
+import javax.jms.DeliveryMode;
+import javax.jms.Destination;
+import javax.jms.ExceptionListener;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.QueueBrowser;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueSender;
+import javax.jms.QueueSession;
+import javax.jms.Session;
+import javax.jms.Topic;
+import javax.jms.TopicConnection;
+import javax.jms.TopicConnectionFactory;
+import javax.jms.TopicPublisher;
+import javax.jms.TopicSession;
+import javax.naming.Context;
+import javax.naming.NamingException;
+
+import org.jboss.test.jbossmessaging.JMSTestCase;
+import org.apache.log4j.Logger;
+
+/**
+ * JMS tests base class.
+ *
+ * Your test extends this class, and can then use common methods. To do
+ * the tests you use TopicWorker or QueueWorker and the MessageCreator,
+ * MessageFilter and perhaps MessageQos classes, directly or by extending
+ * them.
+ *
+ * You can change the connection factories and destinations used by the
+ * properties:   jbosstest.queuefactory, jbosstest.topicfactory, 
+ * jbosstest.queue or jbosstest.topic.
+ *
+ * @author <a href="mailto:richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
+ * @author    <a href="pra at tim.se">Peter Antman</a>
+ * @version $Revision: 64261 $
+ */
+public class JMSBase extends JMSTestCase
+{
+   public static final int PUBLISHER = 0;
+   public static final int SUBSCRIBER = 1;
+   public static final int GETTER = 2;
+   public static final int CONNECTOR = 3;
+   public static final int FAILSAFE_SUBSCRIBER = 4;
+   public static final int TRANS_NONE = 0;
+   public static final int TRANS_INDIVIDUAL = 1;
+   public static final int TRANS_TOTAL = 2;
+   public static final String[] TRANS_DESC = {"NOT", "individually", "totally"};
+   public static final int DEFAULT_RUNSLEEP = 50;
+   public final Logger log = getLog();
+
+   // Provider specific
+   public String TOPIC_FACTORY = "ConnectionFactory";
+   public String QUEUE_FACTORY = "ConnectionFactory";
+
+   public String TEST_QUEUE = "queue/testQueue";
+   public String TEST_TOPIC = "topic/testTopic";
+
+   public Context context;
+   public QueueConnectionFactory queueFactory;
+   public TopicConnectionFactory topicFactory;
+
+   public JMSBase(String name)
+   {
+      super(name);
+   }
+
+   public long getRunSleep()
+   {
+      log.info("run.sleep: " + System.getProperty("run.sleep"));
+      return 1000L * Integer.getInteger("run.sleep", DEFAULT_RUNSLEEP).intValue();
+   }
+
+   public void sleep(long sleep)
+   {
+      try
+      {
+         Thread.sleep(sleep);
+      }
+      catch (InterruptedException e)
+      {
+      }
+   }
+
+   public void drainTopic() throws JMSException
+   {
+      TopicWorker sub1 = new TopicWorker(GETTER,
+         TRANS_NONE,
+         null
+      );
+      sub1.connect();
+      sub1.get();
+      sub1.close();
+   }
+
+   public void drainQueue() throws JMSException
+   {
+      QueueWorker sub1 = new QueueWorker(GETTER,
+         TRANS_NONE,
+         null
+      );
+      sub1.connect();
+      sub1.get();
+      sub1.close();
+   }
+
+   /**
+    * The JUnit setup method
+    *
+    * @exception Exception  Description of Exception
+    */
+   protected void setUp() throws Exception
+   {
+       // call setUp() method of the superclass
+       super.setUp() ;
+
+      // Reconfigure acording to props
+      QUEUE_FACTORY = System.getProperty("jbosstest.queuefactory", QUEUE_FACTORY);
+      TOPIC_FACTORY = System.getProperty("jbosstest.topicfactory", TOPIC_FACTORY);
+      TEST_QUEUE = System.getProperty("jbosstest.queue", TEST_QUEUE);
+      TEST_TOPIC = System.getProperty("jbosstest.topic", TEST_TOPIC);
+
+      if (context == null)
+      {
+
+         context = getInitialContext();
+
+         queueFactory = (QueueConnectionFactory) context.lookup(QUEUE_FACTORY);
+         topicFactory = (TopicConnectionFactory) context.lookup(TOPIC_FACTORY);
+
+         getLog().debug("Connection to JMS provider established.");
+      }
+
+   }
+
+
+   public static void main(String[] args)
+   {
+
+   }
+
+   public abstract class JMSWorker implements Runnable, MessageListener, ExceptionListener
+   {
+
+      protected boolean stopRequested = false;
+      protected int messageHandled = 0;
+      protected Exception runEx = null;
+      protected MessageFilter filter;
+      protected MessageCreator creator;
+      protected int number = 1;
+      protected int type = -1;
+      protected int transacted;
+      protected QosConfig qosConfig = new QosConfig();
+      protected String userName;
+      protected String password;
+      protected String clientID;
+
+      // Generic ones, should be set by sublcasses
+      public Connection connection;
+      public Destination destination;
+      public Session session;
+      public MessageProducer producer;
+      public MessageConsumer consumer;
+
+      /**
+       * Create one without any settings, use mutators instead. Makes it easier to owerride.
+       */
+      public JMSWorker()
+      {
+      }
+
+      public JMSWorker(int type, int transacted, MessageFilter filter)
+      {
+         this.type = type;
+         this.transacted = transacted;
+         this.filter = filter;
+      }
+
+      public JMSWorker(int type,
+         int transacted,
+         MessageCreator creator,
+         int number
+         )
+      {
+         this.type = type;
+         this.transacted = transacted;
+         this.creator = creator;
+         this.number = number;
+      }
+
+      public void setSubscriberAttrs(int type, int transacted, MessageFilter filter)
+      {
+         this.type = type;
+         this.transacted = transacted;
+         this.filter = filter;
+      }
+
+      public void setPublisherAttrs(int type,
+         int transacted,
+         MessageCreator creator,
+         int number)
+      {
+         this.type = type;
+         this.transacted = transacted;
+         this.creator = creator;
+         this.number = number;
+      }
+
+      public void setUser(String userName, String password)
+      {
+         this.userName = userName;
+         this.password = password;
+      }
+
+      public void setClientID(String ID)
+      {
+         this.clientID = ID;
+      }
+
+      abstract public void publish() throws JMSException;
+
+      abstract public void publish(int nr) throws JMSException;
+
+      /**
+       * Subsribes, collects, checking any set filters. A messageComsumer must be created before calling this.
+       */
+      public void subscribe() throws JMSException
+      {
+         subscribe(false);
+      }
+
+      /**
+       * Subsribes, collects, checking any set filters. A messageComsumer must be created before calling this. If arg set to true, do a failsafe sub
+       */
+      public void subscribe(boolean failsafe) throws JMSException
+      {
+         if (consumer == null)
+            throw new JMSException("No messageConsumer created");
+
+         if (failsafe)
+            connection.setExceptionListener(this);
+
+         consumer.setMessageListener(this);
+
+      }
+
+      public void get() throws JMSException
+      {
+         Message msg = consumer.receive(2000);
+         while (msg != null)
+         {
+            if (filter != null)
+            {
+               if (filter.ok(msg))
+                  messageHandled++;
+            }
+            else
+            {
+               messageHandled++;
+            }
+            msg = consumer.receive(2000);
+         }
+      }
+
+      abstract public void connect() throws JMSException;
+
+      public void setQosConfig(QosConfig qosConfig)
+      {
+         this.qosConfig = qosConfig;
+      }
+
+      public void setStoped() throws JMSException
+      {
+         stopRequested = true;
+      }
+
+      public int getMessageHandled()
+      {
+         return messageHandled;
+      }
+
+      public Exception getException()
+      {
+         return runEx;
+      }
+
+      public void reset()
+      {
+         messageHandled = 0;
+         stopRequested = false;
+         runEx = null;
+      }
+
+      public void close()
+      {
+         try
+         {
+            if (consumer != null)
+               consumer.close();
+            if (producer != null)
+               producer.close();
+            if (session != null)
+               session.close();
+         }
+         catch (JMSException ex)
+         {
+         }
+         finally
+         {
+            if (connection != null)
+            {
+               try
+               {
+                  connection.close();
+               }
+               catch (JMSException ex)
+               {
+               }
+            }
+         }
+      }
+
+      public void onMessage(Message msg)
+      {
+         try
+         {
+            if (filter != null)
+            {
+               if (filter.ok(msg))
+                  messageHandled++;
+            }
+            else
+            {
+               messageHandled++;
+            }
+            if (session.getTransacted())
+               session.commit();
+         }
+         catch (Exception ex)
+         {
+            log.warn("Exception in on message: " + ex, ex);
+            runEx = ex;
+         }
+      }
+
+      /**
+       * onException handling is only for subscriber. Will try to to
+       * a connect followed by a subscribe
+       */
+      public void onException(JMSException ex)
+      {
+         log.error("Ex in connection: " + ex);
+
+         try
+         {
+            connection.setExceptionListener(null);
+            close();
+         }
+         catch (JMSException c)
+         {
+         }
+         
+         // Try reconnect, loops until success or shut down
+         try
+         {
+            boolean tryIt = true;
+            while (tryIt && !stopRequested)
+            {
+               log.info("Trying reconnect...");
+               try
+               {
+                  Thread.sleep(10000);
+               }
+               catch (InterruptedException ie)
+               {
+               }
+               try
+               {
+                  connect();
+                  subscribe(true);
+                  tryIt = false;
+                  log.info("Reconnect OK");
+                  //return;
+               }
+               catch (JMSException e)
+               {
+                  log.error("Error in reconnect: " + e);
+               }
+            }
+
+         }
+         catch (Exception je)
+         {
+            log.error("Strange error in failsafe handling" + je, je);
+         }
+      }
+
+      public void run()
+      {
+         try
+         {
+            switch (type)
+            {
+               case -1:
+                  log.info("Nothing to do for type " + type);
+                  break;
+               case PUBLISHER:
+                  connect();
+                  publish();
+                  break;
+               case SUBSCRIBER:
+                  connect();
+                  subscribe();
+                  break;
+               case GETTER:
+                  connect();
+                  get();
+                  break;
+               case CONNECTOR:
+                  connect();
+                  break;
+               case FAILSAFE_SUBSCRIBER:
+                  connect();
+                  subscribe(true);
+                  break;
+            }
+
+            //if the method does not hold an own thread, we do it here
+            while (!stopRequested)
+            {
+               try
+               {
+                  Thread.sleep(1000);
+               }
+               catch (InterruptedException ex)
+               {
+
+               }
+            }
+         }
+         catch (JMSException ex)
+         {
+            runEx = ex;
+            log.error("Could not run: " + ex, ex);
+         }
+      }
+   }
+
+   public interface MessageCreator
+   {
+      public void setSession(Session session);
+
+      public Message createMessage(int nr) throws JMSException;
+   }
+
+   public abstract class BaseMessageCreator implements MessageCreator
+   {
+      protected Session session;
+      protected String property;
+
+      public BaseMessageCreator(String property)
+      {
+         this.property = property;
+      }
+
+      public void setSession(Session session)
+      {
+         this.session = session;
+      }
+
+      abstract public Message createMessage(int nr) throws JMSException;
+   }
+
+
+   public class IntRangeMessageCreator extends BaseMessageCreator
+   {
+      int start = 0;
+
+      public IntRangeMessageCreator(String property)
+      {
+         super(property);
+      }
+
+      public IntRangeMessageCreator(String property, int start)
+      {
+         super(property);
+         this.start = start;
+      }
+
+      public Message createMessage(int nr) throws JMSException
+      {
+         if (session == null)
+            throw new JMSException("Session not allowed to be null");
+
+         Message msg = session.createMessage();
+         msg.setStringProperty(property, String.valueOf(start + nr));
+         return msg;
+      }
+   }
+
+   public interface MessageFilter
+   {
+      public boolean ok(Message msg) throws JMSException;
+   }
+
+   public class IntRangeMessageFilter implements MessageFilter
+   {
+      Class messageClass;
+      String className;
+      String property;
+      int low;
+      int max;
+      int counter = 0;
+      int report = 1000;
+
+      public IntRangeMessageFilter(Class messageClass, String property, int low, int max)
+      {
+         this.messageClass = messageClass;
+         this.property = property;
+         className = messageClass.getName();
+         this.low = low;
+         this.max = max;
+      }
+
+      private boolean validateClass(Message msg)
+      {
+         Class clazz = null;
+         if (msg instanceof javax.jms.TextMessage)
+            clazz = javax.jms.TextMessage.class;
+         else if (msg instanceof javax.jms.BytesMessage)
+            clazz = javax.jms.BytesMessage.class;
+         else if (msg instanceof javax.jms.MapMessage)
+            clazz = javax.jms.MapMessage.class;
+         else if (msg instanceof javax.jms.ObjectMessage)
+            clazz = javax.jms.ObjectMessage.class;
+         else if (msg instanceof javax.jms.StreamMessage)
+            clazz = javax.jms.StreamMessage.class;
+         else
+            clazz = javax.jms.Message.class;
+
+         return clazz.equals(messageClass);
+      }
+
+      public boolean ok(Message msg) throws JMSException
+      {
+         boolean res = false;
+         if (validateClass(msg))
+         {
+            if (msg.propertyExists(property))
+            {
+               String p = msg.getStringProperty(property);
+               try
+               {
+                  int i = Integer.parseInt(p);
+                  //log.debug("Received message " + property +"=" +i);
+                  if (i >= low && i < max)
+                     res = true;
+               }
+               catch (NumberFormatException ex)
+               {
+                  throw new JMSException("Property " + property + " was not int: " + p);
+               }
+            }
+         }
+         counter++;
+         int mod = counter % report;
+         if (mod == 0)
+            log.debug("Have received " + counter + " messages");
+         return res;
+      }
+
+   }
+
+   /*  
+   public class REMessageFilter implements MessageFilter {
+      Class messageClass;
+      String className;
+      String property;
+      RE re = null;
+      public REMessageFilter(Class messageClass, String property, String regexp) throws REException{
+         this.messageClass = messageClass;
+         this.property = property;
+         re = new RE(regexp);
+         className = messageClass.getName();
+      }
+      
+      public boolean ok(Message msg) throws JMSException{
+         boolean res = false;
+         if (className.equals(msg.getClass().getName())) {
+            if (msg.propertyExists(property)) {
+               String p = msg.getStringProperty(property);
+               if (re.getMatch(p)!=null)
+                  res = true;
+            } 
+         }
+         return true;
+      }
+   }
+   */
+   /**
+    * Defines quality of service for message publishing. Defaults are the same
+    * ase defined in SpyMessage.
+    */
+   public class QosConfig
+   {
+      int deliveryMode = DeliveryMode.PERSISTENT;
+      int priority = 4;
+      long ttl = 0;
+   }
+
+   public class TopicWorker extends JMSWorker
+   {
+      String durableHandle;
+
+      /**
+       * If using this, use mutators to add attrs.
+       */
+      public TopicWorker()
+      {
+         super();
+      }
+
+      public TopicWorker(int type, int transacted, MessageFilter filter)
+      {
+         super(type, transacted, filter);
+      }
+
+      public TopicWorker(int type,
+         int transacted,
+         MessageCreator creator,
+         int number
+         )
+      {
+         super(type, transacted, creator, number);
+      }
+
+
+      public void publish() throws JMSException
+      {
+         publish(number);
+      }
+
+      public void publish(int nr) throws JMSException
+      {
+         if (producer == null)
+            producer = ((TopicSession) session).createPublisher((Topic) destination);
+         if (creator == null)
+            throw new JMSException("Publish must have a MessageCreator set");
+
+         creator.setSession(session);
+         System.out.println("Publishing " + nr + " messages");
+         for (int i = 0; i < nr; i++)
+         {
+        	System.out.println("Sending Message");
+            if (qosConfig != null)
+            {
+            	System.out.println("Sending Message(a)");
+               ((TopicPublisher) producer).publish(creator.createMessage(i),
+                  qosConfig.deliveryMode,
+                  qosConfig.priority,
+                  qosConfig.ttl);
+            }
+            else
+            {
+            	System.out.println("Sending Message(b)");
+               ((TopicPublisher) producer).publish(creator.createMessage(i));
+            }
+
+            messageHandled++;
+         }
+         if (session.getTransacted())
+            session.commit();
+         log.debug("Finished publishing");
+      }
+
+      public void subscribe() throws JMSException
+      {
+         subscribe(false);
+      }
+
+      public void subscribe(boolean failsafe) throws JMSException
+      {
+         if (durableHandle != null)
+            consumer = ((TopicSession) session).createDurableSubscriber((Topic) destination, durableHandle);
+         else
+            consumer = ((TopicSession) session).createSubscriber((Topic) destination);
+         super.subscribe(failsafe);
+         connection.start();
+      }
+
+      public void get() throws JMSException
+      {
+         consumer = ((TopicSession) session).createSubscriber((Topic) destination);
+         super.subscribe();
+         connection.start();
+      }
+
+      public void connect() throws JMSException
+      {
+         log.debug("Connecting: " + this.toString());
+         if (userName != null)
+            connection = topicFactory.createTopicConnection(userName, password);
+         else
+            connection = topicFactory.createTopicConnection();
+
+         if (clientID != null)
+         {
+            log.debug("Setting clientID" + clientID);
+            connection.setClientID(clientID);
+         }
+
+         session = ((TopicConnection) connection).createTopicSession(transacted != TRANS_NONE, Session.AUTO_ACKNOWLEDGE);
+         try
+         {
+            destination = (Destination) context.lookup(TEST_TOPIC);
+         }
+         catch (NamingException ex)
+         {
+            throw new JMSException("Could not lookup topic " + ex);
+         }
+      }
+
+      // Topic specific stuff
+      public void setDurable(String userId, String pwd, String handle)
+      {
+         this.userName = userId;
+         this.password = pwd;
+         this.durableHandle = handle;
+      }
+
+      public void setDurable(String handle)
+      {
+         this.durableHandle = handle;
+      }
+
+      public void unsubscribe() throws JMSException
+      {
+         if (durableHandle != null)
+            ((TopicSession) session).unsubscribe(durableHandle);
+      }
+
+      public String toString()
+      {
+         return "(userId=" + userName + " pwd=" + password + " handle=" + durableHandle + ")";
+      }
+
+   }
+
+   public class QueueWorker extends JMSWorker
+   {
+      String userId;
+      String pwd;
+      String handle;
+
+      /**
+       * If using this, use mutators to add attrs.
+       */
+      public QueueWorker()
+      {
+         super();
+      }
+
+      public QueueWorker(int type, int transacted, MessageFilter filter)
+      {
+         super(type, transacted, filter);
+      }
+
+      public QueueWorker(int type,
+         int transacted,
+         MessageCreator creator,
+         int number
+         )
+      {
+         super(type, transacted, creator, number);
+      }
+
+
+      public void publish() throws JMSException
+      {
+         publish(number);
+      }
+
+      public void publish(int nr) throws JMSException
+      {
+         if (producer == null)
+            producer = ((QueueSession) session).createSender((Queue) destination);
+         if (creator == null)
+            throw new JMSException("Publish must have a MessageCreator set");
+
+         creator.setSession(session);
+         log.debug("Publishing " + nr + " messages");
+         for (int i = 0; i < nr; i++)
+         {
+            if (qosConfig != null)
+            {
+               ((QueueSender) producer).send(creator.createMessage(i),
+                  qosConfig.deliveryMode,
+                  qosConfig.priority,
+                  qosConfig.ttl);
+            }
+            else
+            {
+               ((QueueSender) producer).send(creator.createMessage(i));
+            }
+
+            messageHandled++;
+         }
+         if (session.getTransacted())
+            session.commit();
+         log.debug("Finished publishing");
+      }
+
+      public void subscribe() throws JMSException
+      {
+         subscribe(false);
+      }
+
+      public void subscribe(boolean failsafe) throws JMSException
+      {
+
+         consumer = ((QueueSession) session).createReceiver((Queue) destination);
+         super.subscribe(failsafe);
+         connection.start();
+      }
+
+      public void get() throws JMSException
+      {
+         consumer = ((QueueSession) session).createReceiver((Queue) destination);
+         super.subscribe();
+         connection.start();
+      }
+
+      public void connect() throws JMSException
+      {
+         log.debug("Connecting: " + this.toString());
+         if (userName != null)
+            connection = queueFactory.createQueueConnection(userName, password);
+         else
+            connection = queueFactory.createQueueConnection();
+
+         if (clientID != null)
+            connection.setClientID(clientID);
+
+         session = ((QueueConnection) connection).createQueueSession(transacted != TRANS_NONE, Session.AUTO_ACKNOWLEDGE);
+         try
+         {
+            destination = (Destination) context.lookup(TEST_QUEUE);
+         }
+         catch (NamingException ex)
+         {
+            throw new JMSException("Could not lookup topic " + ex);
+         }
+      }
+
+
+      // Queue specific
+      public Enumeration browse() throws JMSException
+      {
+         QueueBrowser b = ((QueueSession) session).createBrowser((Queue) destination);
+         return b.getEnumeration();
+      }
+   }
+} // JMSBase

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/JMSTestCase.java
===================================================================
--- branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/JMSTestCase.java	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/JMSTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,267 +0,0 @@
-/*
- * 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;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.Properties;
-import javax.naming.InitialContext;
-import javax.naming.NamingEnumeration;
-import javax.naming.NameClassPair;
-
-import org.objectweb.jtests.jms.admin.Admin;
-import org.objectweb.jtests.jms.admin.AdminFactory;
-
-import org.jboss.util.NestedRuntimeException;
-import org.jboss.test.JBossTestCase;
-
-/**
- * JMSTestCase. A base test case for all JMS generic test cases.
- * 
- * Warning: If you override setUp() or tearDown(), rememeber to call the
- * superclass versions of these methods within your overriding methods.
- * AbstractTestCase uses setUp() and tearDown() to initialise logging.
- * 
- * @author <a href="richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
- * @version $Revision: 64130 $
- */
-public class JMSTestCase extends JBossTestCase
-{
-   /** JBM provider properties resource name */
-   private static String PROP_FILE_NAME = "jbossmessaging/provider.properties";
-
-   private static String PROP_NAME = "jms.provider.resources.dir";
-
-   protected Admin admin;
-
-   /**
-    * Constructor for JMSTestCase object
-    * 
-    * @param name
-    *           test case name
-    */
-   public JMSTestCase(String name)
-   {
-      super(name);
-   }
-
-   /**
-    * Create the Admin object to perform all JMS adminsitrative functions in a
-    * JMS provider-independent manner
-    */
-   protected void setUp() throws Exception
-   {
-      // perform any setUp required in the superclass
-      super.setUp();
-
-      try
-      {
-         log.info("setting up Admin");
-         // get the Admin implementation for the current JMS provider
-         // specified in provider.properties
-         Properties props = getProviderProperties();
-         admin = AdminFactory.getAdmin(props);
-      }
-      catch (Exception e)
-      {
-         throw new NestedRuntimeException("getAdmin() operation failed", e);
-      }
-   }
-
-   /**
-    * Create a JMS Queue.
-    * 
-    * The Queue is created dynamically, in a JMS provider-specific manner,
-    * according to the instance of the Admin interface currently in use.
-    * 
-    * @param name
-    *           The name of the Queue to be created.
-    */
-   public void createQueue(String name)
-   {
-      try
-      {
-         admin.createQueue(name);
-      }
-      catch (Exception e)
-      {
-         throw new NestedRuntimeException("createQueue() operation failed", e);
-      }
-   }
-
-   /**
-    * Delete a JMS Queue.
-    * 
-    * The Queue is deleted dynamically, in a JMS provider-specific manner,
-    * according to the instance of the Admin interface currently in use.
-    * 
-    * @param name
-    *           The name of the Queue to be deleted.
-    */
-   public void deleteQueue(String name)
-   {
-      try
-      {
-         admin.deleteQueue(name);
-      }
-      catch (Exception e)
-      {
-         throw new NestedRuntimeException("deleteQueue() operation failed", e);
-      }
-   }
-
-   /**
-    * Create a JMS Topic.
-    * 
-    * The Topic is created dynamically, in a JMS provider-specific manner,
-    * according to the instance of the Admin interface currently in use.
-    * 
-    * @param name
-    *           The name of the Topic to be created.
-    */
-   public void createTopic(String name)
-   {
-      try
-      {
-         admin.createTopic(name);
-      }
-      catch (Exception e)
-      {
-         throw new NestedRuntimeException("createTopic() operation failed", e);
-      }
-   }
-
-   /**
-    * Delete a JMS Topic.
-    * 
-    * The Topic is deleted dynamically, in a JMS provider-specific manner,
-    * according to the instance of the Admin interface currently in use.
-    * 
-    * @param name
-    *           The name of the Topic to be deleted.
-    */
-   public void deleteTopic(String name)
-   {
-      try
-      {
-         admin.deleteTopic(name);
-      }
-      catch (Exception e)
-      {
-         throw new NestedRuntimeException("deleteTopic() operation failed", e);
-      }
-   }
-
-   /**
-    * Create a JMS ConnectionFactory.
-    * 
-    * The ConnectionFactory is created dynamically, in a JMS provider-specific
-    * manner, according to the instance of the Admin interface currently in use.
-    * 
-    * @param name
-    *           The name of the ConnectionFactory to be created.
-    */
-   public void createConnectionFactory(String name)
-   {
-      try
-      {
-         admin.createConnectionFactory(name);
-      }
-      catch (Exception e)
-      {
-         throw new NestedRuntimeException(
-               "createConnectionFactory() operation failed", e);
-      }
-   }
-
-   /**
-    * Delete a JMS ConnectionFactory.
-    * 
-    * The ConnectionFactory is deleted dynamically, in a JMS provider-specific
-    * manner, according to the instance of the Admin interface currently in use.
-    * 
-    * @param name
-    *           The name of the ConnectionFactory to be deleted.
-    */
-   public void deleteConnectionFactory(String name)
-   {
-      try
-      {
-         admin.deleteConnectionFactory(name);
-      }
-      catch (Exception e)
-      {
-         throw new NestedRuntimeException(
-               "deleteConnectionFactory() operation failed", e);
-      }
-   }
-
-   protected void dumpJNDIContext(String context)
-   {
-      try
-      {
-         log.info("Dumping JNDI context:" + context);
-
-         // dump out the context name-value bindings
-         InitialContext ic = getInitialContext();
-         NamingEnumeration list = ic.list(context);
-
-         while (list.hasMore())
-         {
-            NameClassPair nc = (NameClassPair) list.next();
-            log.info(nc.toString());
-         }
-         log.info("Dumped JNDI context");
-      }
-      catch (Exception e)
-      {
-         throw new NestedRuntimeException("error dumping JNDI context", e);
-      }
-   }
-
-   public static Properties getProviderProperties()
-      throws IOException
-   {
-      Properties props = new Properties();
-      ClassLoader loader = Thread.currentThread().getContextClassLoader();
-      URL propsURL = loader.getResource(PROP_FILE_NAME);
-      System.err.println("using provider.properties: " + propsURL);
-      props.load(propsURL.openStream());
-      return props;      
-   }
-
-   /**
-    * Given a resource file name, prepend a directory qualifier to that name,
-    * according to the instance of the JMS provider currently in use.
-    * 
-    * The directory name prepended is determined by the value of the property
-    * jms.provider.resources.dir in the provider.properties resources file.
-    * 
-    * @param name
-    *           The name of the resources file.
-    */
-   public static String getJMSResourceRelativePathname(String name)
-   {
-      // return the resource name with directory prepended
-      return "jbossmessaging/" + name;
-   }
-}

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/JMSTestCase.java (from rev 64641, branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/JMSTestCase.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/JMSTestCase.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/JMSTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,267 @@
+/*
+ * 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;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Properties;
+import javax.naming.InitialContext;
+import javax.naming.NamingEnumeration;
+import javax.naming.NameClassPair;
+
+import org.objectweb.jtests.jms.admin.Admin;
+import org.objectweb.jtests.jms.admin.AdminFactory;
+
+import org.jboss.util.NestedRuntimeException;
+import org.jboss.test.JBossTestCase;
+
+/**
+ * JMSTestCase. A base test case for all JMS generic test cases.
+ * 
+ * Warning: If you override setUp() or tearDown(), rememeber to call the
+ * superclass versions of these methods within your overriding methods.
+ * AbstractTestCase uses setUp() and tearDown() to initialise logging.
+ * 
+ * @author <a href="richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
+ * @version $Revision: 64130 $
+ */
+public class JMSTestCase extends JBossTestCase
+{
+   /** JBM provider properties resource name */
+   private static String PROP_FILE_NAME = "jbossmessaging/provider.properties";
+
+   private static String PROP_NAME = "jms.provider.resources.dir";
+
+   protected Admin admin;
+
+   /**
+    * Constructor for JMSTestCase object
+    * 
+    * @param name
+    *           test case name
+    */
+   public JMSTestCase(String name)
+   {
+      super(name);
+   }
+
+   /**
+    * Create the Admin object to perform all JMS adminsitrative functions in a
+    * JMS provider-independent manner
+    */
+   protected void setUp() throws Exception
+   {
+      // perform any setUp required in the superclass
+      super.setUp();
+
+      try
+      {
+         log.info("setting up Admin");
+         // get the Admin implementation for the current JMS provider
+         // specified in provider.properties
+         Properties props = getProviderProperties();
+         admin = AdminFactory.getAdmin(props);
+      }
+      catch (Exception e)
+      {
+         throw new NestedRuntimeException("getAdmin() operation failed", e);
+      }
+   }
+
+   /**
+    * Create a JMS Queue.
+    * 
+    * The Queue is created dynamically, in a JMS provider-specific manner,
+    * according to the instance of the Admin interface currently in use.
+    * 
+    * @param name
+    *           The name of the Queue to be created.
+    */
+   public void createQueue(String name)
+   {
+      try
+      {
+         admin.createQueue(name);
+      }
+      catch (Exception e)
+      {
+         throw new NestedRuntimeException("createQueue() operation failed", e);
+      }
+   }
+
+   /**
+    * Delete a JMS Queue.
+    * 
+    * The Queue is deleted dynamically, in a JMS provider-specific manner,
+    * according to the instance of the Admin interface currently in use.
+    * 
+    * @param name
+    *           The name of the Queue to be deleted.
+    */
+   public void deleteQueue(String name)
+   {
+      try
+      {
+         admin.deleteQueue(name);
+      }
+      catch (Exception e)
+      {
+         throw new NestedRuntimeException("deleteQueue() operation failed", e);
+      }
+   }
+
+   /**
+    * Create a JMS Topic.
+    * 
+    * The Topic is created dynamically, in a JMS provider-specific manner,
+    * according to the instance of the Admin interface currently in use.
+    * 
+    * @param name
+    *           The name of the Topic to be created.
+    */
+   public void createTopic(String name)
+   {
+      try
+      {
+         admin.createTopic(name);
+      }
+      catch (Exception e)
+      {
+         throw new NestedRuntimeException("createTopic() operation failed", e);
+      }
+   }
+
+   /**
+    * Delete a JMS Topic.
+    * 
+    * The Topic is deleted dynamically, in a JMS provider-specific manner,
+    * according to the instance of the Admin interface currently in use.
+    * 
+    * @param name
+    *           The name of the Topic to be deleted.
+    */
+   public void deleteTopic(String name)
+   {
+      try
+      {
+         admin.deleteTopic(name);
+      }
+      catch (Exception e)
+      {
+         throw new NestedRuntimeException("deleteTopic() operation failed", e);
+      }
+   }
+
+   /**
+    * Create a JMS ConnectionFactory.
+    * 
+    * The ConnectionFactory is created dynamically, in a JMS provider-specific
+    * manner, according to the instance of the Admin interface currently in use.
+    * 
+    * @param name
+    *           The name of the ConnectionFactory to be created.
+    */
+   public void createConnectionFactory(String name)
+   {
+      try
+      {
+         admin.createConnectionFactory(name);
+      }
+      catch (Exception e)
+      {
+         throw new NestedRuntimeException(
+               "createConnectionFactory() operation failed", e);
+      }
+   }
+
+   /**
+    * Delete a JMS ConnectionFactory.
+    * 
+    * The ConnectionFactory is deleted dynamically, in a JMS provider-specific
+    * manner, according to the instance of the Admin interface currently in use.
+    * 
+    * @param name
+    *           The name of the ConnectionFactory to be deleted.
+    */
+   public void deleteConnectionFactory(String name)
+   {
+      try
+      {
+         admin.deleteConnectionFactory(name);
+      }
+      catch (Exception e)
+      {
+         throw new NestedRuntimeException(
+               "deleteConnectionFactory() operation failed", e);
+      }
+   }
+
+   protected void dumpJNDIContext(String context)
+   {
+      try
+      {
+         log.info("Dumping JNDI context:" + context);
+
+         // dump out the context name-value bindings
+         InitialContext ic = getInitialContext();
+         NamingEnumeration list = ic.list(context);
+
+         while (list.hasMore())
+         {
+            NameClassPair nc = (NameClassPair) list.next();
+            log.info(nc.toString());
+         }
+         log.info("Dumped JNDI context");
+      }
+      catch (Exception e)
+      {
+         throw new NestedRuntimeException("error dumping JNDI context", e);
+      }
+   }
+
+   public static Properties getProviderProperties()
+      throws IOException
+   {
+      Properties props = new Properties();
+      ClassLoader loader = Thread.currentThread().getContextClassLoader();
+      URL propsURL = loader.getResource(PROP_FILE_NAME);
+      System.err.println("using provider.properties: " + propsURL);
+      props.load(propsURL.openStream());
+      return props;      
+   }
+
+   /**
+    * Given a resource file name, prepend a directory qualifier to that name,
+    * according to the instance of the JMS provider currently in use.
+    * 
+    * The directory name prepended is determined by the value of the property
+    * jms.provider.resources.dir in the provider.properties resources file.
+    * 
+    * @param name
+    *           The name of the resources file.
+    */
+   public static String getJMSResourceRelativePathname(String name)
+   {
+      // return the resource name with directory prepended
+      return "jbossmessaging/" + name;
+   }
+}

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/MockServerSessionPool.java
===================================================================
--- branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/MockServerSessionPool.java	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/MockServerSessionPool.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,50 +0,0 @@
-/*
-* 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;
-
-import javax.jms.JMSException;
-import javax.jms.ServerSession;
-import javax.jms.ServerSessionPool;
-
-/**
- * MockServerSessionPool.
- * 
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 64130 $
- */
-public class MockServerSessionPool implements ServerSessionPool
-{
-   /**
-    * Get a new instance of the mock
-    * 
-    * @return the instance
-    */
-   public static ServerSessionPool getServerSessionPool()
-   {
-      return new MockServerSessionPool();
-   }
-   
-   public ServerSession getServerSession() throws JMSException
-   {
-      throw new org.jboss.util.NotImplementedException("FIXME NYI getServerSession");
-   }
-}

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/MockServerSessionPool.java (from rev 64641, branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/MockServerSessionPool.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/MockServerSessionPool.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/MockServerSessionPool.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,50 @@
+/*
+* 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;
+
+import javax.jms.JMSException;
+import javax.jms.ServerSession;
+import javax.jms.ServerSessionPool;
+
+/**
+ * MockServerSessionPool.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 64130 $
+ */
+public class MockServerSessionPool implements ServerSessionPool
+{
+   /**
+    * Get a new instance of the mock
+    * 
+    * @return the instance
+    */
+   public static ServerSessionPool getServerSessionPool()
+   {
+      return new MockServerSessionPool();
+   }
+   
+   public ServerSession getServerSession() throws JMSException
+   {
+      throw new org.jboss.util.NotImplementedException("FIXME NYI getServerSession");
+   }
+}

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/perf (from rev 64641, branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/perf)

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/perf/JMSPerfStressTestCase.java
===================================================================
--- branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/perf/JMSPerfStressTestCase.java	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/perf/JMSPerfStressTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,790 +0,0 @@
-/*
-  * 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.perf;
-
-import javax.jms.BytesMessage;
-import javax.jms.DeliveryMode;
-import javax.jms.JMSException;
-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.Topic;
-import javax.jms.TopicConnection;
-import javax.jms.TopicConnectionFactory;
-import javax.jms.TopicPublisher;
-import javax.jms.TopicSession;
-import javax.jms.TopicSubscriber;
-import javax.jms.Queue;
-import javax.naming.Context;
-
-import org.apache.log4j.Logger;
-import org.jboss.test.jbossmessaging.JMSTestCase;
-/**
- * JMSPerfStressTestCase.java Some simple tests of JMS provider
- *
- * @author <a href="mailto:richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
- * @author
- * @version
- */
-
-public class JMSPerfStressTestCase extends JMSTestCase
-{
-
-   // Provider specific
-   static String TOPIC_FACTORY = "ConnectionFactory";
-   static String QUEUE_FACTORY = "ConnectionFactory";
-
-   static String TEST_QUEUE = "queue/testQueue";
-   static String TEST_TOPIC = "topic/testTopic";
-
-   //   static int PERFORMANCE_TEST_ITERATIONS = 1000;
-   static byte[] PERFORMANCE_TEST_DATA_PAYLOAD = new byte[10 * 1024];
-
-   static int TRANS_NONE = 0;
-   static int TRANS_INDIVIDUAL = 1;
-   static int TRANS_TOTAL = 2;
-   static String[] TRANS_DESC = {"NOT", "individually", "totally"};
-
-   //JMSProviderAdapter providerAdapter;
-   static Context context;
-   static QueueConnection queueConnection;
-   static TopicConnection topicConnection;
-
-   /**
-    * Constructor for the JMSPerfStressTestCase object
-    *
-    * @param name           Description of Parameter
-    * @exception Exception  Description of Exception
-    */
-   public JMSPerfStressTestCase(String name) throws Exception
-   {
-      super(name);
-   }
-
-
-   /**
-    * #Description of the Method
-    *
-    * @param transacted     Description of Parameter
-    * @param persistence    Description of Parameter
-    * @exception Exception  Description of Exception
-    */
-   public void runAsynchQueuePerformance(final int transacted, final int persistence) throws Exception
-   {
-      {
-         queueConnection.start();
-         drainQueue();
-         queueConnection.stop();
-      }
-      final int iterationCount = getIterationCount();
-      final Logger log = getLog();
-
-      Thread sendThread =
-         new Thread()
-         {
-            /**
-             * Main processing method for the JBossMQPerfStressTestCase object
-             */
-            public void run()
-            {
-               try
-               {
-                  QueueSession session = queueConnection.createQueueSession(transacted != TRANS_NONE, Session.AUTO_ACKNOWLEDGE);
-                  Queue queue = (Queue)context.lookup(TEST_QUEUE);
-
-                  QueueSender sender = session.createSender(queue);
-
-                  BytesMessage message = session.createBytesMessage();
-                  message.writeBytes(PERFORMANCE_TEST_DATA_PAYLOAD);
-
-                  long startTime = System.currentTimeMillis();
-                  for (int i = 0; i < iterationCount; i++)
-                  {
-                     //sender.send(queue, message, persistence, 4, 0);
-                     sender.send(message, persistence, 4, 0);
-                     //getLog().debug("  Sent #"+i);
-                     if (transacted == TRANS_INDIVIDUAL)
-                     {
-                        session.commit();
-                     }
-                  }
-
-                  if (transacted == TRANS_TOTAL)
-                  {
-                     session.commit();
-                  }
-
-                  long endTime = System.currentTimeMillis();
-
-                  session.close();
-
-                  long pTime = endTime - startTime;
-                  log.debug("  sent all messages in " + ((double)pTime / 1000) + " seconds. ");
-               }
-               catch (Exception e)
-               {
-                  log.error("error", e);
-               }
-            }
-         };
-
-      final QueueSession session = queueConnection.createQueueSession(transacted != TRANS_NONE, Session.AUTO_ACKNOWLEDGE);
-      Queue queue = (Queue)context.lookup(TEST_QUEUE);
-      QueueReceiver receiver = session.createReceiver(queue);
-
-      MessageListener listener =
-         new MessageListener()
-         {
-            long startTime = System.currentTimeMillis();
-            int i = 0;
-
-            /**
-             * #Description of the Method
-             *
-             * @param message  Description of Parameter
-             */
-            public void onMessage(Message message)
-            {
-               try
-               {
-				if( transacted == TRANS_INDIVIDUAL )
-					session.commit();
-                  i++;
-               }
-               catch (JMSException e)
-               {
-                  getLog().error("Unable to commit", e);
-                  synchronized (this)
-                  {
-                     this.notify();
-                  }
-               }
-               if (i >= iterationCount)
-               {
-                  long endTime = System.currentTimeMillis();
-                  long pTime = endTime - startTime;
-                  log.debug("  received all messages in " + ((double)pTime / 1000) + " seconds. ");
-
-                  synchronized (this)
-                  {
-                     this.notify();
-                  }
-               }
-            }
-         };
-
-      getLog().debug("  Asynch Queue: This test will send " + getIterationCount() + " "
-             + (persistence == DeliveryMode.PERSISTENT ? "persistent" : "non-persistent") + " messages. Each with a payload of "
-             + ((double)PERFORMANCE_TEST_DATA_PAYLOAD.length / 1024) + "Kb"
-             + " Session is " + TRANS_DESC[transacted] + " transacted");
-      long startTime = System.currentTimeMillis();
-      sendThread.start();
-      receiver.setMessageListener(listener);
-      synchronized (listener)
-      {
-         queueConnection.start();
-         listener.wait();
-      }
-
-      if (transacted == TRANS_TOTAL)
-      {
-         session.commit();
-      }
-
-      session.close();
-      sendThread.join();
-      long endTime = System.currentTimeMillis();
-      long pTime = endTime - startTime;
-      getLog().debug("  All threads finished after: " + ((double)pTime / 1000) + " seconds. ");
-
-   }
-
-   /**
-    * #Description of the Method
-    *
-    * @param transacted     Description of Parameter
-    * @param persistence    Description of Parameter
-    * @exception Exception  Description of Exception
-    */
-   public void runAsynchTopicPerformance(final int transacted, final int persistence) throws Exception
-   {
-      {
-         queueConnection.start();
-         drainQueue();
-      }
-
-      final int iterationCount = getIterationCount();
-      final Logger log = getLog();
-
-      Thread sendThread =
-         new Thread()
-         {
-            /**
-             * Main processing method for the JMSPerfStressTestCase object
-             */
-            public void run()
-            {
-               try
-               {
-
-                  TopicSession session = topicConnection.createTopicSession(transacted != TRANS_NONE, Session.AUTO_ACKNOWLEDGE);
-                  Topic topic = (Topic)context.lookup(TEST_TOPIC);
-
-                  TopicPublisher publisher = session.createPublisher(topic);
-
-                  waitForSynchMessage();
-
-                  BytesMessage message = session.createBytesMessage();
-                  message.writeBytes(PERFORMANCE_TEST_DATA_PAYLOAD);
-
-                  long startTime = System.currentTimeMillis();
-                  for (int i = 0; i < iterationCount; i++)
-                  {
-                     publisher.publish(message, persistence, 4, 0);
-                     //publisher.publish(topic, message, persistence, 4, 0);
-                     //getLog().debug("  Sent #"+i);
-                     if (transacted == TRANS_INDIVIDUAL)
-                     {
-                        session.commit();
-                     }
-                  }
-
-                  if (transacted == TRANS_TOTAL)
-                  {
-                     session.commit();
-                  }
-
-                  long endTime = System.currentTimeMillis();
-                  session.close();
-
-                  long pTime = endTime - startTime;
-                  log.debug("  sent all messages in " + ((double)pTime / 1000) + " seconds. ");
-               }
-               catch (Exception e)
-               {
-                  log.error("error", e);
-               }
-            }
-         };
-
-      final TopicSession session = topicConnection.createTopicSession(transacted != TRANS_NONE, Session.AUTO_ACKNOWLEDGE);
-      Topic topic = (Topic)context.lookup(TEST_TOPIC);
-      TopicSubscriber subscriber = session.createSubscriber(topic);
-
-      MessageListener listener =
-         new MessageListener()
-         {
-            long startTime = System.currentTimeMillis();
-            int i = 0;
-
-            /**
-             * #Description of the Method
-             *
-             * @param message  Description of Parameter
-             */
-            public void onMessage(Message message)
-            {
-               try
-               {
-				if( transacted == TRANS_INDIVIDUAL )
-					session.commit();
-                  i++;
-               }
-               catch (JMSException e)
-               {
-                  getLog().error("Unable to commit", e);
-                  synchronized (this)
-                  {
-                     this.notify();
-                  }
-               }
-               if (i >= iterationCount)
-               {
-                  long endTime = System.currentTimeMillis();
-                  long pTime = endTime - startTime;
-                  log.debug("  received all messages in " + ((double)pTime / 1000) + " seconds. ");
-
-                  synchronized (this)
-                  {
-                     this.notify();
-                  }
-               }
-            }
-         };
-
-      getLog().debug("  Asynch Topic: This test will send " + getIterationCount() + " "
-             + (persistence == DeliveryMode.PERSISTENT ? "persistent" : "non-persistent") + " messages. Each with a payload of "
-             + ((double)PERFORMANCE_TEST_DATA_PAYLOAD.length / 1024) + "Kb"
-             + " Session is " + TRANS_DESC[transacted] + " transacted");
-      long startTime = System.currentTimeMillis();
-      sendThread.start();
-      subscriber.setMessageListener(listener);
-      sendSynchMessage();
-      synchronized (listener)
-      {
-         topicConnection.start();
-         listener.wait();
-      }
-
-      if (transacted == TRANS_TOTAL)
-      {
-         session.commit();
-      }
-
-      session.close();
-      sendThread.join();
-      long endTime = System.currentTimeMillis();
-      long pTime = endTime - startTime;
-      getLog().debug("  All threads finished after: " + ((double)pTime / 1000) + " seconds. ");
-
-   }
-
-   /**
-    * #Description of the Method
-    *
-    * @param transacted     Description of Parameter
-    * @param persistence    Description of Parameter
-    * @exception Exception  Description of Exception
-    */
-   public void runSynchQueuePerformance(final int transacted, final int persistence) throws Exception
-   {
-      {
-         queueConnection.start();
-         drainQueue();
-      }
-      final int iterationCount = getIterationCount();
-      final Logger log = getLog();
-
-      Thread sendThread =
-         new Thread()
-         {
-            /**
-             * Main processing method for the JMSPerfStressTestCase object
-             */
-            public void run()
-            {
-               try
-               {
-                  QueueSession session = queueConnection.createQueueSession(transacted != TRANS_NONE, Session.AUTO_ACKNOWLEDGE);
-                  Queue queue = (Queue)context.lookup(TEST_QUEUE);
-
-                  QueueSender sender = session.createSender(queue);
-
-                  BytesMessage message = session.createBytesMessage();
-                  message.writeBytes(PERFORMANCE_TEST_DATA_PAYLOAD);
-
-                  long startTime = System.currentTimeMillis();
-                  for (int i = 0; i < iterationCount; i++)
-                  {
-                     sender.send( message, persistence, 4, 0);
-                     //sender.send(queue, message, persistence, 4, 0);
-                     //getLog().debug("  Sent #"+i);
-                     if (transacted == TRANS_INDIVIDUAL)
-                     {
-                        session.commit();
-                     }
-                  }
-
-                  if (transacted == TRANS_TOTAL)
-                  {
-                     session.commit();
-                  }
-
-                  session.close();
-
-                  long endTime = System.currentTimeMillis();
-
-                  long pTime = endTime - startTime;
-                  log.debug("  sent all messages in " + ((double)pTime / 1000) + " seconds. ");
-               }
-               catch (Exception e)
-               {
-                  log.error("error", e);
-               }
-            }
-         };
-
-      Thread recvThread =
-         new Thread()
-         {
-            /**
-             * Main processing method for the JMSPerfStressTestCase object
-             */
-            public void run()
-            {
-               try
-               {
-
-                  QueueSession session = queueConnection.createQueueSession(transacted != TRANS_NONE, Session.AUTO_ACKNOWLEDGE);
-                  Queue queue = (Queue)context.lookup(TEST_QUEUE);
-
-                  QueueReceiver receiver = session.createReceiver(queue);
-                  long startTime = System.currentTimeMillis();
-                  for (int i = 0; i < iterationCount; i++)
-                  {
-                     receiver.receive();
-                     //getLog().debug("  Received #"+i);
-                     if (transacted == TRANS_INDIVIDUAL)
-                     {
-                        session.commit();
-                     }
-                  }
-
-                  if (transacted == TRANS_TOTAL)
-                  {
-                     session.commit();
-                  }
-
-                  long endTime = System.currentTimeMillis();
-
-                  session.close();
-
-                  long pTime = endTime - startTime;
-                  log.debug("  received all messages in " + ((double)pTime / 1000) + " seconds. ");
-
-               }
-               catch (Exception e)
-               {
-                  log.error("error", e);
-               }
-            }
-         };
-
-      getLog().debug("  Synch Queue: This test will send " + getIterationCount() + " "
-             + (persistence == DeliveryMode.PERSISTENT ? "persistent" : "non-persistent") + " messages. Each with a payload of "
-             + ((double)PERFORMANCE_TEST_DATA_PAYLOAD.length / 1024) + "Kb"
-             + " Session is " + TRANS_DESC[transacted] + " transacted");
-      long startTime = System.currentTimeMillis();
-      sendThread.start();
-      recvThread.start();
-      sendThread.join();
-      recvThread.join();
-      long endTime = System.currentTimeMillis();
-      long pTime = endTime - startTime;
-      getLog().debug("  All threads finished after: " + ((double)pTime / 1000) + " seconds. ");
-
-   }
-
-   /**
-    * #Description of the Method
-    *
-    * @param transacted     Description of Parameter
-    * @param persistence    Description of Parameter
-    * @exception Exception  Description of Exception
-    */
-   public void runSynchTopicPerformance(final int transacted, final int persistence) throws Exception
-   {
-      {
-         queueConnection.start();
-         topicConnection.start();
-         drainQueue();
-      }
-      final int iterationCount = getIterationCount();
-      final Logger log = getLog();
-
-      Thread sendThread =
-         new Thread()
-         {
-            /**
-             * Main processing method for the JBossMQPerfStressTestCase object
-             */
-            public void run()
-            {
-               try
-               {
-
-                  TopicSession session = topicConnection.createTopicSession(transacted != TRANS_NONE, Session.AUTO_ACKNOWLEDGE);
-                  Topic topic = (Topic)context.lookup(TEST_TOPIC);
-
-                  TopicPublisher publisher = session.createPublisher(topic);
-
-                  waitForSynchMessage();
-
-                  BytesMessage message = session.createBytesMessage();
-                  message.writeBytes(PERFORMANCE_TEST_DATA_PAYLOAD);
-
-                  long startTime = System.currentTimeMillis();
-                  for (int i = 0; i < iterationCount; i++)
-                  {
-                     publisher.publish(message, persistence, 4, 0);
-                     //publisher.publish(topic, message, persistence, 4, 0);
-                     //getLog().debug("  Sent #"+i);
-                     if (transacted == TRANS_INDIVIDUAL)
-                     {
-                        session.commit();
-                     }
-                  }
-
-                  if (transacted == TRANS_TOTAL)
-                  {
-                     session.commit();
-                  }
-
-                  long endTime = System.currentTimeMillis();
-
-                  session.close();
-
-                  long pTime = endTime - startTime;
-                  log.debug("  sent all messages in " + ((double)pTime / 1000) + " seconds. ");
-               }
-               catch (Exception e)
-               {
-                  log.error("error", e);
-               }
-            }
-         };
-
-      Thread recvThread =
-         new Thread()
-         {
-            /**
-             * Main processing method for the JBossMQPerfStressTestCase object
-             */
-            public void run()
-            {
-               try
-               {
-
-                  TopicSession session = topicConnection.createTopicSession(transacted != TRANS_NONE, Session.AUTO_ACKNOWLEDGE);
-                  Topic topic = (Topic)context.lookup(TEST_TOPIC);
-                  TopicSubscriber subscriber = session.createSubscriber(topic);
-
-                  sendSynchMessage();
-
-                  long startTime = System.currentTimeMillis();
-                  for (int i = 0; i < iterationCount; i++)
-                  {
-                     subscriber.receive();
-                     //getLog().debug("  Received #"+i);
-                     if (transacted == TRANS_INDIVIDUAL)
-                     {
-                        session.commit();
-                     }
-                  }
-
-                  if (transacted == TRANS_TOTAL)
-                  {
-                     session.commit();
-                  }
-
-                  long endTime = System.currentTimeMillis();
-
-                  session.close();
-
-                  long pTime = endTime - startTime;
-                  log.debug("  received all messages in " + ((double)pTime / 1000) + " seconds. ");
-
-               }
-               catch (Exception e)
-               {
-                  log.error("error", e);
-               }
-            }
-         };
-
-      getLog().debug("  Synch Topic: This test will send " + getIterationCount() + " "
-             + (persistence == DeliveryMode.PERSISTENT ? "persistent" : "non-persistent") + " messages. Each with a payload of "
-             + ((double)PERFORMANCE_TEST_DATA_PAYLOAD.length / 1024) + "Kb"
-             + " Session is " + TRANS_DESC[transacted] + " transacted");
-      long startTime = System.currentTimeMillis();
-      sendThread.start();
-      recvThread.start();
-      sendThread.join();
-      recvThread.join();
-      long endTime = System.currentTimeMillis();
-      long pTime = endTime - startTime;
-      getLog().debug("  All threads finished after: " + ((double)pTime / 1000) + " seconds. ");
-
-   }
-
-   /**
-    * A unit test for JUnit
-    *
-    * @exception Exception  Description of Exception
-    */
-   public void testAsynchQueuePerformance() throws Exception
-   {
-
-      getLog().debug("Starting AsynchQueuePerformance test");
-
-      runAsynchQueuePerformance(TRANS_NONE, DeliveryMode.NON_PERSISTENT);
-      runAsynchQueuePerformance(TRANS_NONE, DeliveryMode.PERSISTENT);
-      runAsynchQueuePerformance(TRANS_INDIVIDUAL, DeliveryMode.NON_PERSISTENT);
-      runAsynchQueuePerformance(TRANS_INDIVIDUAL, DeliveryMode.PERSISTENT);
-      runAsynchQueuePerformance(TRANS_TOTAL, DeliveryMode.NON_PERSISTENT);
-      runAsynchQueuePerformance(TRANS_TOTAL, DeliveryMode.PERSISTENT);
-
-      getLog().debug("AsynchQueuePerformance passed");
-   }
-
-   /**
-    * A unit test for JUnit
-    *
-    * @exception Exception  Description of Exception
-    */
-   public void testAsynchTopicPerformance() throws Exception
-   {
-
-      getLog().debug("Starting AsynchTopicPerformance test");
-
-      runAsynchTopicPerformance(TRANS_NONE, DeliveryMode.NON_PERSISTENT);
-      runAsynchTopicPerformance(TRANS_NONE, DeliveryMode.PERSISTENT);
-      runAsynchTopicPerformance(TRANS_INDIVIDUAL, DeliveryMode.NON_PERSISTENT);
-      runAsynchTopicPerformance(TRANS_INDIVIDUAL, DeliveryMode.PERSISTENT);
-      runAsynchTopicPerformance(TRANS_TOTAL, DeliveryMode.NON_PERSISTENT);
-      runAsynchTopicPerformance(TRANS_TOTAL, DeliveryMode.PERSISTENT);
-
-      getLog().debug("AsynchTopicPerformance passed");
-   }
-
-   /**
-    * A unit test for JUnit
-    *
-    * @exception Exception  Description of Exception
-    */
-   public void testSynchQueuePerformance() throws Exception
-   {
-
-      getLog().debug("Starting SynchQueuePerformance test");
-
-      runSynchQueuePerformance(TRANS_NONE, DeliveryMode.NON_PERSISTENT);
-      runSynchQueuePerformance(TRANS_NONE, DeliveryMode.PERSISTENT);
-      runSynchQueuePerformance(TRANS_INDIVIDUAL, DeliveryMode.NON_PERSISTENT);
-      runSynchQueuePerformance(TRANS_INDIVIDUAL, DeliveryMode.PERSISTENT);
-      runSynchQueuePerformance(TRANS_TOTAL, DeliveryMode.NON_PERSISTENT);
-      runSynchQueuePerformance(TRANS_TOTAL, DeliveryMode.PERSISTENT);
-
-      getLog().debug("SynchQueuePerformance passed");
-   }
-
-   /**
-    * A unit test for JUnit
-    *
-    * @exception Exception  Description of Exception
-    */
-   public void testSynchTopicPerformance() throws Exception
-   {
-
-      getLog().debug("Starting SynchTopicPerformance test");
-
-      runSynchTopicPerformance(TRANS_NONE, DeliveryMode.NON_PERSISTENT);
-      runSynchTopicPerformance(TRANS_NONE, DeliveryMode.PERSISTENT);
-      runSynchTopicPerformance(TRANS_INDIVIDUAL, DeliveryMode.NON_PERSISTENT);
-      runSynchTopicPerformance(TRANS_INDIVIDUAL, DeliveryMode.PERSISTENT);
-      runSynchTopicPerformance(TRANS_TOTAL, DeliveryMode.NON_PERSISTENT);
-      runSynchTopicPerformance(TRANS_TOTAL, DeliveryMode.PERSISTENT);
-
-      getLog().debug("SynchTopicPerformance passed");
-   }
-
-   /**
-    * The JUnit setup method
-    *
-    * @exception Exception  Description of Exception
-    */
-   protected void setUp() throws Exception
-   {
-	   // perform any setUp() required by the base class
-	   super.setUp() ;
-
-	   if (context == null)
-	   {
-		   Logger log = getLog() ;
-		   if (log == null)
-			   System.out.println("JMSPerfStressTestCase: getLog() returned null") ;
-
-		   getLog().debug("JMSPerfStresTestCase - setUp") ;
-
-		   context = getInitialContext();
-	   }
-
-	   QueueConnectionFactory queueFactory = (QueueConnectionFactory)context.lookup(QUEUE_FACTORY);
-	   queueConnection = queueFactory.createQueueConnection();
-
-	   TopicConnectionFactory topicFactory = (TopicConnectionFactory)context.lookup(TOPIC_FACTORY);
-	   topicConnection = topicFactory.createTopicConnection();
-
-	   getLog().debug("Connection to JMS provider established.");
-
-   }
-   
-   protected void tearDown() throws Exception
-   {
-	   try {queueConnection.close();} catch (Throwable ignored){}
-	   try {topicConnection.close();} catch (Throwable ignored){}
-   }
-
-
-   // Emptys out all the messages in a queue
-   private void drainQueue() throws Exception
-   {
-
-      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-      Queue queue = (Queue)context.lookup(TEST_QUEUE);
-
-      QueueReceiver receiver = session.createReceiver(queue);
-      Message message = receiver.receive(50);
-      int c = 0;
-      while (message != null)
-      {
-         message = receiver.receive(50);
-         c++;
-      }
-
-      if (c != 0)
-      {
-         getLog().debug("  Drained " + c + " messages from the queue");
-      }
-
-      session.close();
-
-   }
-
-   private void waitForSynchMessage() throws Exception
-   {
-      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-      Queue queue = (Queue)context.lookup(TEST_QUEUE);
-
-      QueueReceiver receiver = session.createReceiver(queue);
-      receiver.receive();
-      session.close();
-   }
-
-   private void sendSynchMessage() throws Exception
-   {
-      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-      Queue queue = (Queue)context.lookup(TEST_QUEUE);
-
-      QueueSender sender = session.createSender(queue);
-
-      Message message = session.createMessage();
-      sender.send(message);
-
-      session.close();
-   }
-
-}

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/perf/JMSPerfStressTestCase.java (from rev 64641, branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/perf/JMSPerfStressTestCase.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/perf/JMSPerfStressTestCase.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/perf/JMSPerfStressTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,790 @@
+/*
+  * 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.perf;
+
+import javax.jms.BytesMessage;
+import javax.jms.DeliveryMode;
+import javax.jms.JMSException;
+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.Topic;
+import javax.jms.TopicConnection;
+import javax.jms.TopicConnectionFactory;
+import javax.jms.TopicPublisher;
+import javax.jms.TopicSession;
+import javax.jms.TopicSubscriber;
+import javax.jms.Queue;
+import javax.naming.Context;
+
+import org.apache.log4j.Logger;
+import org.jboss.test.jbossmessaging.JMSTestCase;
+/**
+ * JMSPerfStressTestCase.java Some simple tests of JMS provider
+ *
+ * @author <a href="mailto:richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
+ * @author
+ * @version
+ */
+
+public class JMSPerfStressTestCase extends JMSTestCase
+{
+
+   // Provider specific
+   static String TOPIC_FACTORY = "ConnectionFactory";
+   static String QUEUE_FACTORY = "ConnectionFactory";
+
+   static String TEST_QUEUE = "queue/testQueue";
+   static String TEST_TOPIC = "topic/testTopic";
+
+   //   static int PERFORMANCE_TEST_ITERATIONS = 1000;
+   static byte[] PERFORMANCE_TEST_DATA_PAYLOAD = new byte[10 * 1024];
+
+   static int TRANS_NONE = 0;
+   static int TRANS_INDIVIDUAL = 1;
+   static int TRANS_TOTAL = 2;
+   static String[] TRANS_DESC = {"NOT", "individually", "totally"};
+
+   //JMSProviderAdapter providerAdapter;
+   static Context context;
+   static QueueConnection queueConnection;
+   static TopicConnection topicConnection;
+
+   /**
+    * Constructor for the JMSPerfStressTestCase object
+    *
+    * @param name           Description of Parameter
+    * @exception Exception  Description of Exception
+    */
+   public JMSPerfStressTestCase(String name) throws Exception
+   {
+      super(name);
+   }
+
+
+   /**
+    * #Description of the Method
+    *
+    * @param transacted     Description of Parameter
+    * @param persistence    Description of Parameter
+    * @exception Exception  Description of Exception
+    */
+   public void runAsynchQueuePerformance(final int transacted, final int persistence) throws Exception
+   {
+      {
+         queueConnection.start();
+         drainQueue();
+         queueConnection.stop();
+      }
+      final int iterationCount = getIterationCount();
+      final Logger log = getLog();
+
+      Thread sendThread =
+         new Thread()
+         {
+            /**
+             * Main processing method for the JBossMQPerfStressTestCase object
+             */
+            public void run()
+            {
+               try
+               {
+                  QueueSession session = queueConnection.createQueueSession(transacted != TRANS_NONE, Session.AUTO_ACKNOWLEDGE);
+                  Queue queue = (Queue)context.lookup(TEST_QUEUE);
+
+                  QueueSender sender = session.createSender(queue);
+
+                  BytesMessage message = session.createBytesMessage();
+                  message.writeBytes(PERFORMANCE_TEST_DATA_PAYLOAD);
+
+                  long startTime = System.currentTimeMillis();
+                  for (int i = 0; i < iterationCount; i++)
+                  {
+                     //sender.send(queue, message, persistence, 4, 0);
+                     sender.send(message, persistence, 4, 0);
+                     //getLog().debug("  Sent #"+i);
+                     if (transacted == TRANS_INDIVIDUAL)
+                     {
+                        session.commit();
+                     }
+                  }
+
+                  if (transacted == TRANS_TOTAL)
+                  {
+                     session.commit();
+                  }
+
+                  long endTime = System.currentTimeMillis();
+
+                  session.close();
+
+                  long pTime = endTime - startTime;
+                  log.debug("  sent all messages in " + ((double)pTime / 1000) + " seconds. ");
+               }
+               catch (Exception e)
+               {
+                  log.error("error", e);
+               }
+            }
+         };
+
+      final QueueSession session = queueConnection.createQueueSession(transacted != TRANS_NONE, Session.AUTO_ACKNOWLEDGE);
+      Queue queue = (Queue)context.lookup(TEST_QUEUE);
+      QueueReceiver receiver = session.createReceiver(queue);
+
+      MessageListener listener =
+         new MessageListener()
+         {
+            long startTime = System.currentTimeMillis();
+            int i = 0;
+
+            /**
+             * #Description of the Method
+             *
+             * @param message  Description of Parameter
+             */
+            public void onMessage(Message message)
+            {
+               try
+               {
+				if( transacted == TRANS_INDIVIDUAL )
+					session.commit();
+                  i++;
+               }
+               catch (JMSException e)
+               {
+                  getLog().error("Unable to commit", e);
+                  synchronized (this)
+                  {
+                     this.notify();
+                  }
+               }
+               if (i >= iterationCount)
+               {
+                  long endTime = System.currentTimeMillis();
+                  long pTime = endTime - startTime;
+                  log.debug("  received all messages in " + ((double)pTime / 1000) + " seconds. ");
+
+                  synchronized (this)
+                  {
+                     this.notify();
+                  }
+               }
+            }
+         };
+
+      getLog().debug("  Asynch Queue: This test will send " + getIterationCount() + " "
+             + (persistence == DeliveryMode.PERSISTENT ? "persistent" : "non-persistent") + " messages. Each with a payload of "
+             + ((double)PERFORMANCE_TEST_DATA_PAYLOAD.length / 1024) + "Kb"
+             + " Session is " + TRANS_DESC[transacted] + " transacted");
+      long startTime = System.currentTimeMillis();
+      sendThread.start();
+      receiver.setMessageListener(listener);
+      synchronized (listener)
+      {
+         queueConnection.start();
+         listener.wait();
+      }
+
+      if (transacted == TRANS_TOTAL)
+      {
+         session.commit();
+      }
+
+      session.close();
+      sendThread.join();
+      long endTime = System.currentTimeMillis();
+      long pTime = endTime - startTime;
+      getLog().debug("  All threads finished after: " + ((double)pTime / 1000) + " seconds. ");
+
+   }
+
+   /**
+    * #Description of the Method
+    *
+    * @param transacted     Description of Parameter
+    * @param persistence    Description of Parameter
+    * @exception Exception  Description of Exception
+    */
+   public void runAsynchTopicPerformance(final int transacted, final int persistence) throws Exception
+   {
+      {
+         queueConnection.start();
+         drainQueue();
+      }
+
+      final int iterationCount = getIterationCount();
+      final Logger log = getLog();
+
+      Thread sendThread =
+         new Thread()
+         {
+            /**
+             * Main processing method for the JMSPerfStressTestCase object
+             */
+            public void run()
+            {
+               try
+               {
+
+                  TopicSession session = topicConnection.createTopicSession(transacted != TRANS_NONE, Session.AUTO_ACKNOWLEDGE);
+                  Topic topic = (Topic)context.lookup(TEST_TOPIC);
+
+                  TopicPublisher publisher = session.createPublisher(topic);
+
+                  waitForSynchMessage();
+
+                  BytesMessage message = session.createBytesMessage();
+                  message.writeBytes(PERFORMANCE_TEST_DATA_PAYLOAD);
+
+                  long startTime = System.currentTimeMillis();
+                  for (int i = 0; i < iterationCount; i++)
+                  {
+                     publisher.publish(message, persistence, 4, 0);
+                     //publisher.publish(topic, message, persistence, 4, 0);
+                     //getLog().debug("  Sent #"+i);
+                     if (transacted == TRANS_INDIVIDUAL)
+                     {
+                        session.commit();
+                     }
+                  }
+
+                  if (transacted == TRANS_TOTAL)
+                  {
+                     session.commit();
+                  }
+
+                  long endTime = System.currentTimeMillis();
+                  session.close();
+
+                  long pTime = endTime - startTime;
+                  log.debug("  sent all messages in " + ((double)pTime / 1000) + " seconds. ");
+               }
+               catch (Exception e)
+               {
+                  log.error("error", e);
+               }
+            }
+         };
+
+      final TopicSession session = topicConnection.createTopicSession(transacted != TRANS_NONE, Session.AUTO_ACKNOWLEDGE);
+      Topic topic = (Topic)context.lookup(TEST_TOPIC);
+      TopicSubscriber subscriber = session.createSubscriber(topic);
+
+      MessageListener listener =
+         new MessageListener()
+         {
+            long startTime = System.currentTimeMillis();
+            int i = 0;
+
+            /**
+             * #Description of the Method
+             *
+             * @param message  Description of Parameter
+             */
+            public void onMessage(Message message)
+            {
+               try
+               {
+				if( transacted == TRANS_INDIVIDUAL )
+					session.commit();
+                  i++;
+               }
+               catch (JMSException e)
+               {
+                  getLog().error("Unable to commit", e);
+                  synchronized (this)
+                  {
+                     this.notify();
+                  }
+               }
+               if (i >= iterationCount)
+               {
+                  long endTime = System.currentTimeMillis();
+                  long pTime = endTime - startTime;
+                  log.debug("  received all messages in " + ((double)pTime / 1000) + " seconds. ");
+
+                  synchronized (this)
+                  {
+                     this.notify();
+                  }
+               }
+            }
+         };
+
+      getLog().debug("  Asynch Topic: This test will send " + getIterationCount() + " "
+             + (persistence == DeliveryMode.PERSISTENT ? "persistent" : "non-persistent") + " messages. Each with a payload of "
+             + ((double)PERFORMANCE_TEST_DATA_PAYLOAD.length / 1024) + "Kb"
+             + " Session is " + TRANS_DESC[transacted] + " transacted");
+      long startTime = System.currentTimeMillis();
+      sendThread.start();
+      subscriber.setMessageListener(listener);
+      sendSynchMessage();
+      synchronized (listener)
+      {
+         topicConnection.start();
+         listener.wait();
+      }
+
+      if (transacted == TRANS_TOTAL)
+      {
+         session.commit();
+      }
+
+      session.close();
+      sendThread.join();
+      long endTime = System.currentTimeMillis();
+      long pTime = endTime - startTime;
+      getLog().debug("  All threads finished after: " + ((double)pTime / 1000) + " seconds. ");
+
+   }
+
+   /**
+    * #Description of the Method
+    *
+    * @param transacted     Description of Parameter
+    * @param persistence    Description of Parameter
+    * @exception Exception  Description of Exception
+    */
+   public void runSynchQueuePerformance(final int transacted, final int persistence) throws Exception
+   {
+      {
+         queueConnection.start();
+         drainQueue();
+      }
+      final int iterationCount = getIterationCount();
+      final Logger log = getLog();
+
+      Thread sendThread =
+         new Thread()
+         {
+            /**
+             * Main processing method for the JMSPerfStressTestCase object
+             */
+            public void run()
+            {
+               try
+               {
+                  QueueSession session = queueConnection.createQueueSession(transacted != TRANS_NONE, Session.AUTO_ACKNOWLEDGE);
+                  Queue queue = (Queue)context.lookup(TEST_QUEUE);
+
+                  QueueSender sender = session.createSender(queue);
+
+                  BytesMessage message = session.createBytesMessage();
+                  message.writeBytes(PERFORMANCE_TEST_DATA_PAYLOAD);
+
+                  long startTime = System.currentTimeMillis();
+                  for (int i = 0; i < iterationCount; i++)
+                  {
+                     sender.send( message, persistence, 4, 0);
+                     //sender.send(queue, message, persistence, 4, 0);
+                     //getLog().debug("  Sent #"+i);
+                     if (transacted == TRANS_INDIVIDUAL)
+                     {
+                        session.commit();
+                     }
+                  }
+
+                  if (transacted == TRANS_TOTAL)
+                  {
+                     session.commit();
+                  }
+
+                  session.close();
+
+                  long endTime = System.currentTimeMillis();
+
+                  long pTime = endTime - startTime;
+                  log.debug("  sent all messages in " + ((double)pTime / 1000) + " seconds. ");
+               }
+               catch (Exception e)
+               {
+                  log.error("error", e);
+               }
+            }
+         };
+
+      Thread recvThread =
+         new Thread()
+         {
+            /**
+             * Main processing method for the JMSPerfStressTestCase object
+             */
+            public void run()
+            {
+               try
+               {
+
+                  QueueSession session = queueConnection.createQueueSession(transacted != TRANS_NONE, Session.AUTO_ACKNOWLEDGE);
+                  Queue queue = (Queue)context.lookup(TEST_QUEUE);
+
+                  QueueReceiver receiver = session.createReceiver(queue);
+                  long startTime = System.currentTimeMillis();
+                  for (int i = 0; i < iterationCount; i++)
+                  {
+                     receiver.receive();
+                     //getLog().debug("  Received #"+i);
+                     if (transacted == TRANS_INDIVIDUAL)
+                     {
+                        session.commit();
+                     }
+                  }
+
+                  if (transacted == TRANS_TOTAL)
+                  {
+                     session.commit();
+                  }
+
+                  long endTime = System.currentTimeMillis();
+
+                  session.close();
+
+                  long pTime = endTime - startTime;
+                  log.debug("  received all messages in " + ((double)pTime / 1000) + " seconds. ");
+
+               }
+               catch (Exception e)
+               {
+                  log.error("error", e);
+               }
+            }
+         };
+
+      getLog().debug("  Synch Queue: This test will send " + getIterationCount() + " "
+             + (persistence == DeliveryMode.PERSISTENT ? "persistent" : "non-persistent") + " messages. Each with a payload of "
+             + ((double)PERFORMANCE_TEST_DATA_PAYLOAD.length / 1024) + "Kb"
+             + " Session is " + TRANS_DESC[transacted] + " transacted");
+      long startTime = System.currentTimeMillis();
+      sendThread.start();
+      recvThread.start();
+      sendThread.join();
+      recvThread.join();
+      long endTime = System.currentTimeMillis();
+      long pTime = endTime - startTime;
+      getLog().debug("  All threads finished after: " + ((double)pTime / 1000) + " seconds. ");
+
+   }
+
+   /**
+    * #Description of the Method
+    *
+    * @param transacted     Description of Parameter
+    * @param persistence    Description of Parameter
+    * @exception Exception  Description of Exception
+    */
+   public void runSynchTopicPerformance(final int transacted, final int persistence) throws Exception
+   {
+      {
+         queueConnection.start();
+         topicConnection.start();
+         drainQueue();
+      }
+      final int iterationCount = getIterationCount();
+      final Logger log = getLog();
+
+      Thread sendThread =
+         new Thread()
+         {
+            /**
+             * Main processing method for the JBossMQPerfStressTestCase object
+             */
+            public void run()
+            {
+               try
+               {
+
+                  TopicSession session = topicConnection.createTopicSession(transacted != TRANS_NONE, Session.AUTO_ACKNOWLEDGE);
+                  Topic topic = (Topic)context.lookup(TEST_TOPIC);
+
+                  TopicPublisher publisher = session.createPublisher(topic);
+
+                  waitForSynchMessage();
+
+                  BytesMessage message = session.createBytesMessage();
+                  message.writeBytes(PERFORMANCE_TEST_DATA_PAYLOAD);
+
+                  long startTime = System.currentTimeMillis();
+                  for (int i = 0; i < iterationCount; i++)
+                  {
+                     publisher.publish(message, persistence, 4, 0);
+                     //publisher.publish(topic, message, persistence, 4, 0);
+                     //getLog().debug("  Sent #"+i);
+                     if (transacted == TRANS_INDIVIDUAL)
+                     {
+                        session.commit();
+                     }
+                  }
+
+                  if (transacted == TRANS_TOTAL)
+                  {
+                     session.commit();
+                  }
+
+                  long endTime = System.currentTimeMillis();
+
+                  session.close();
+
+                  long pTime = endTime - startTime;
+                  log.debug("  sent all messages in " + ((double)pTime / 1000) + " seconds. ");
+               }
+               catch (Exception e)
+               {
+                  log.error("error", e);
+               }
+            }
+         };
+
+      Thread recvThread =
+         new Thread()
+         {
+            /**
+             * Main processing method for the JBossMQPerfStressTestCase object
+             */
+            public void run()
+            {
+               try
+               {
+
+                  TopicSession session = topicConnection.createTopicSession(transacted != TRANS_NONE, Session.AUTO_ACKNOWLEDGE);
+                  Topic topic = (Topic)context.lookup(TEST_TOPIC);
+                  TopicSubscriber subscriber = session.createSubscriber(topic);
+
+                  sendSynchMessage();
+
+                  long startTime = System.currentTimeMillis();
+                  for (int i = 0; i < iterationCount; i++)
+                  {
+                     subscriber.receive();
+                     //getLog().debug("  Received #"+i);
+                     if (transacted == TRANS_INDIVIDUAL)
+                     {
+                        session.commit();
+                     }
+                  }
+
+                  if (transacted == TRANS_TOTAL)
+                  {
+                     session.commit();
+                  }
+
+                  long endTime = System.currentTimeMillis();
+
+                  session.close();
+
+                  long pTime = endTime - startTime;
+                  log.debug("  received all messages in " + ((double)pTime / 1000) + " seconds. ");
+
+               }
+               catch (Exception e)
+               {
+                  log.error("error", e);
+               }
+            }
+         };
+
+      getLog().debug("  Synch Topic: This test will send " + getIterationCount() + " "
+             + (persistence == DeliveryMode.PERSISTENT ? "persistent" : "non-persistent") + " messages. Each with a payload of "
+             + ((double)PERFORMANCE_TEST_DATA_PAYLOAD.length / 1024) + "Kb"
+             + " Session is " + TRANS_DESC[transacted] + " transacted");
+      long startTime = System.currentTimeMillis();
+      sendThread.start();
+      recvThread.start();
+      sendThread.join();
+      recvThread.join();
+      long endTime = System.currentTimeMillis();
+      long pTime = endTime - startTime;
+      getLog().debug("  All threads finished after: " + ((double)pTime / 1000) + " seconds. ");
+
+   }
+
+   /**
+    * A unit test for JUnit
+    *
+    * @exception Exception  Description of Exception
+    */
+   public void testAsynchQueuePerformance() throws Exception
+   {
+
+      getLog().debug("Starting AsynchQueuePerformance test");
+
+      runAsynchQueuePerformance(TRANS_NONE, DeliveryMode.NON_PERSISTENT);
+      runAsynchQueuePerformance(TRANS_NONE, DeliveryMode.PERSISTENT);
+      runAsynchQueuePerformance(TRANS_INDIVIDUAL, DeliveryMode.NON_PERSISTENT);
+      runAsynchQueuePerformance(TRANS_INDIVIDUAL, DeliveryMode.PERSISTENT);
+      runAsynchQueuePerformance(TRANS_TOTAL, DeliveryMode.NON_PERSISTENT);
+      runAsynchQueuePerformance(TRANS_TOTAL, DeliveryMode.PERSISTENT);
+
+      getLog().debug("AsynchQueuePerformance passed");
+   }
+
+   /**
+    * A unit test for JUnit
+    *
+    * @exception Exception  Description of Exception
+    */
+   public void testAsynchTopicPerformance() throws Exception
+   {
+
+      getLog().debug("Starting AsynchTopicPerformance test");
+
+      runAsynchTopicPerformance(TRANS_NONE, DeliveryMode.NON_PERSISTENT);
+      runAsynchTopicPerformance(TRANS_NONE, DeliveryMode.PERSISTENT);
+      runAsynchTopicPerformance(TRANS_INDIVIDUAL, DeliveryMode.NON_PERSISTENT);
+      runAsynchTopicPerformance(TRANS_INDIVIDUAL, DeliveryMode.PERSISTENT);
+      runAsynchTopicPerformance(TRANS_TOTAL, DeliveryMode.NON_PERSISTENT);
+      runAsynchTopicPerformance(TRANS_TOTAL, DeliveryMode.PERSISTENT);
+
+      getLog().debug("AsynchTopicPerformance passed");
+   }
+
+   /**
+    * A unit test for JUnit
+    *
+    * @exception Exception  Description of Exception
+    */
+   public void testSynchQueuePerformance() throws Exception
+   {
+
+      getLog().debug("Starting SynchQueuePerformance test");
+
+      runSynchQueuePerformance(TRANS_NONE, DeliveryMode.NON_PERSISTENT);
+      runSynchQueuePerformance(TRANS_NONE, DeliveryMode.PERSISTENT);
+      runSynchQueuePerformance(TRANS_INDIVIDUAL, DeliveryMode.NON_PERSISTENT);
+      runSynchQueuePerformance(TRANS_INDIVIDUAL, DeliveryMode.PERSISTENT);
+      runSynchQueuePerformance(TRANS_TOTAL, DeliveryMode.NON_PERSISTENT);
+      runSynchQueuePerformance(TRANS_TOTAL, DeliveryMode.PERSISTENT);
+
+      getLog().debug("SynchQueuePerformance passed");
+   }
+
+   /**
+    * A unit test for JUnit
+    *
+    * @exception Exception  Description of Exception
+    */
+   public void testSynchTopicPerformance() throws Exception
+   {
+
+      getLog().debug("Starting SynchTopicPerformance test");
+
+      runSynchTopicPerformance(TRANS_NONE, DeliveryMode.NON_PERSISTENT);
+      runSynchTopicPerformance(TRANS_NONE, DeliveryMode.PERSISTENT);
+      runSynchTopicPerformance(TRANS_INDIVIDUAL, DeliveryMode.NON_PERSISTENT);
+      runSynchTopicPerformance(TRANS_INDIVIDUAL, DeliveryMode.PERSISTENT);
+      runSynchTopicPerformance(TRANS_TOTAL, DeliveryMode.NON_PERSISTENT);
+      runSynchTopicPerformance(TRANS_TOTAL, DeliveryMode.PERSISTENT);
+
+      getLog().debug("SynchTopicPerformance passed");
+   }
+
+   /**
+    * The JUnit setup method
+    *
+    * @exception Exception  Description of Exception
+    */
+   protected void setUp() throws Exception
+   {
+	   // perform any setUp() required by the base class
+	   super.setUp() ;
+
+	   if (context == null)
+	   {
+		   Logger log = getLog() ;
+		   if (log == null)
+			   System.out.println("JMSPerfStressTestCase: getLog() returned null") ;
+
+		   getLog().debug("JMSPerfStresTestCase - setUp") ;
+
+		   context = getInitialContext();
+	   }
+
+	   QueueConnectionFactory queueFactory = (QueueConnectionFactory)context.lookup(QUEUE_FACTORY);
+	   queueConnection = queueFactory.createQueueConnection();
+
+	   TopicConnectionFactory topicFactory = (TopicConnectionFactory)context.lookup(TOPIC_FACTORY);
+	   topicConnection = topicFactory.createTopicConnection();
+
+	   getLog().debug("Connection to JMS provider established.");
+
+   }
+   
+   protected void tearDown() throws Exception
+   {
+	   try {queueConnection.close();} catch (Throwable ignored){}
+	   try {topicConnection.close();} catch (Throwable ignored){}
+   }
+
+
+   // Emptys out all the messages in a queue
+   private void drainQueue() throws Exception
+   {
+
+      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+      Queue queue = (Queue)context.lookup(TEST_QUEUE);
+
+      QueueReceiver receiver = session.createReceiver(queue);
+      Message message = receiver.receive(50);
+      int c = 0;
+      while (message != null)
+      {
+         message = receiver.receive(50);
+         c++;
+      }
+
+      if (c != 0)
+      {
+         getLog().debug("  Drained " + c + " messages from the queue");
+      }
+
+      session.close();
+
+   }
+
+   private void waitForSynchMessage() throws Exception
+   {
+      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+      Queue queue = (Queue)context.lookup(TEST_QUEUE);
+
+      QueueReceiver receiver = session.createReceiver(queue);
+      receiver.receive();
+      session.close();
+   }
+
+   private void sendSynchMessage() throws Exception
+   {
+      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+      Queue queue = (Queue)context.lookup(TEST_QUEUE);
+
+      QueueSender sender = session.createSender(queue);
+
+      Message message = session.createMessage();
+      sender.send(message);
+
+      session.close();
+   }
+
+}

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/perf/JMSReconnectStressTestCase.java
===================================================================
--- branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/perf/JMSReconnectStressTestCase.java	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/perf/JMSReconnectStressTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,107 +0,0 @@
-/*
-  * 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.perf;
-
-import javax.jms.QueueConnection;
-import javax.jms.QueueConnectionFactory;
-import javax.naming.InitialContext;
-
-import org.jboss.test.jbossmessaging.JMSTestCase;
-
-/**
- * Reconnect stress
- *
- * @author <a href="mailto:richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
- * @author
- * @version
- */
-
-public class JMSReconnectStressTestCase extends JMSTestCase
-{
-   static String QUEUE_FACTORY = "ConnectionFactory";
-
-   public JMSReconnectStressTestCase(String name) throws Exception
-   {
-      super(name);
-   }
-
-   public void testReconnectStress() throws Throwable
-   {
-      InitialContext ctx = new InitialContext();
-      QueueConnectionFactory qcf = (QueueConnectionFactory) ctx.lookup(QUEUE_FACTORY);
-      
-      ReconnectThread[] threads = new ReconnectThread[getThreadCount()];
-      for (int i = 0; i < threads.length; ++i)
-         threads[i] = new ReconnectThread(qcf, "Reconnect-"+i);
-      for (int i = 0; i < threads.length; ++i)
-         threads[i].start();
-      for (int i = 0; i < threads.length; ++i)
-         threads[i].join();
-      for (int i = 0; i < threads.length; ++i)
-      {
-         if (threads[i].error != null)
-            throw threads[i].error;
-      }
-   }
-   
-   public class ReconnectThread extends Thread
-   {
-      public Throwable error;
-      public QueueConnectionFactory qcf;
-      
-      public ReconnectThread(QueueConnectionFactory qcf, String name)
-      {
-         super(name);
-         this.qcf = qcf;
-      }
-      
-      public void run()
-      {
-         QueueConnection c = null;
-         try
-         {
-            for (int i = 0; i < getIterationCount(); ++i)
-            {
-               log.info(Thread.currentThread() + " connect " + i);
-               c = qcf.createQueueConnection();
-               log.info(Thread.currentThread() + " close " + i);
-               c.close();
-               c = null;
-            }
-         }
-         catch (Throwable t)
-         {
-            if (c != null)
-            {
-               try
-               {
-                  c.close();
-               }
-               catch (Throwable ignored)
-               {
-                  log.warn("Ignored: ", ignored);
-               }
-            }
-         }
-      }
-   }
-}

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/perf/JMSReconnectStressTestCase.java (from rev 64641, branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/perf/JMSReconnectStressTestCase.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/perf/JMSReconnectStressTestCase.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/perf/JMSReconnectStressTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,107 @@
+/*
+  * 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.perf;
+
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.naming.InitialContext;
+
+import org.jboss.test.jbossmessaging.JMSTestCase;
+
+/**
+ * Reconnect stress
+ *
+ * @author <a href="mailto:richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
+ * @author
+ * @version
+ */
+
+public class JMSReconnectStressTestCase extends JMSTestCase
+{
+   static String QUEUE_FACTORY = "ConnectionFactory";
+
+   public JMSReconnectStressTestCase(String name) throws Exception
+   {
+      super(name);
+   }
+
+   public void testReconnectStress() throws Throwable
+   {
+      InitialContext ctx = new InitialContext();
+      QueueConnectionFactory qcf = (QueueConnectionFactory) ctx.lookup(QUEUE_FACTORY);
+      
+      ReconnectThread[] threads = new ReconnectThread[getThreadCount()];
+      for (int i = 0; i < threads.length; ++i)
+         threads[i] = new ReconnectThread(qcf, "Reconnect-"+i);
+      for (int i = 0; i < threads.length; ++i)
+         threads[i].start();
+      for (int i = 0; i < threads.length; ++i)
+         threads[i].join();
+      for (int i = 0; i < threads.length; ++i)
+      {
+         if (threads[i].error != null)
+            throw threads[i].error;
+      }
+   }
+   
+   public class ReconnectThread extends Thread
+   {
+      public Throwable error;
+      public QueueConnectionFactory qcf;
+      
+      public ReconnectThread(QueueConnectionFactory qcf, String name)
+      {
+         super(name);
+         this.qcf = qcf;
+      }
+      
+      public void run()
+      {
+         QueueConnection c = null;
+         try
+         {
+            for (int i = 0; i < getIterationCount(); ++i)
+            {
+               log.info(Thread.currentThread() + " connect " + i);
+               c = qcf.createQueueConnection();
+               log.info(Thread.currentThread() + " close " + i);
+               c.close();
+               c = null;
+            }
+         }
+         catch (Throwable t)
+         {
+            if (c != null)
+            {
+               try
+               {
+                  c.close();
+               }
+               catch (Throwable ignored)
+               {
+                  log.warn("Ignored: ", ignored);
+               }
+            }
+         }
+      }
+   }
+}

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/perf/ReceiveNackClientStressTestCase.java
===================================================================
--- branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/perf/ReceiveNackClientStressTestCase.java	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/perf/ReceiveNackClientStressTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,139 +0,0 @@
-/*
-  * 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.perf;
-
-import java.io.Serializable;
-import java.util.HashMap;
-
-import javax.jms.ExceptionListener;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.Queue;
-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.management.MBeanServerConnection;
-import javax.management.ObjectName;
-import javax.naming.InitialContext;
-
-import org.jboss.test.jbossmessaging.JMSTestCase;
-import org.jboss.util.NestedRuntimeException;
-
-/**
- * A stress test for an impatient receiver
- *
- * @author <a href="mailto:richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
- * @author    <a href="mailto:adrian at jboss.com">Adrian Brock</a>
- * @version   $Revision: 64130 $
- */
-public class ReceiveNackClientStressTestCase extends JMSTestCase implements ExceptionListener
-{
-   protected QueueConnection queueConnection;
-   
-   public ReceiveNackClientStressTestCase(String name) throws Exception
-   {
-      super(name);
-   }
-
-   public void onException(JMSException e)
-   {
-      log.error("Error: ", e);
-      try
-      {
-         queueConnection.close();
-      }
-      catch (Exception ignored)
-      {
-      }
-   }
-   
-    private void drainQueue(String name) throws Exception
-    {
-	InitialContext context = getInitialContext() ;
-
-	QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-	Queue queue = (Queue)context.lookup(name);
-
-	QueueReceiver receiver = session.createReceiver(queue);
-	queueConnection.start();
-	Message message = receiver.receive(50);
-	int c = 0;
-	while (message != null)
-	    {
-		message = receiver.receive(50);
-		c++;
-	    }
-
-	if (c != 0)
-	    getLog().debug("  Drained " + c + " messages from the queue");
-	session.close();
-	queueConnection.stop();
-
-    }
-
-   public void testImpatient() throws Exception
-   {
-      int target = getIterationCount();
-      createQueue("Impatient");
-      try
-      {
-         InitialContext context = getInitialContext();
-         QueueConnectionFactory queueFactory = (QueueConnectionFactory) context.lookup("ConnectionFactory");
-         Queue queue = (Queue) context.lookup("Impatient");
-         queueConnection = queueFactory.createQueueConnection();
-         drainQueue("Impatient") ;
-         try
-         {
-            QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-            QueueSender sender = session.createSender(queue);
-            QueueReceiver receiver = session.createReceiver(queue);
-            Serializable payload = new HashMap();
-            Message message = session.createObjectMessage(payload);
-            queueConnection.start();
-            int count = 0;
-            int sendCount = 0;
-            while (count < target)
-            {
-               if (sendCount <= target)
-               {
-                  for (int i = 0; i < 10 && ++sendCount <= target; ++i)
-                     sender.send(message);
-               }
-               if (receiver.receive(1) != null)
-                  ++count;
-            }
-         }
-         finally
-         {
-            drainQueue("Impatient") ;
-            queueConnection.close();
-         }
-      }
-      finally
-      {
-         deleteQueue("Impatient");
-      }
-   }
-}

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/perf/ReceiveNackClientStressTestCase.java (from rev 64641, branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/perf/ReceiveNackClientStressTestCase.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/perf/ReceiveNackClientStressTestCase.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/perf/ReceiveNackClientStressTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,139 @@
+/*
+  * 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.perf;
+
+import java.io.Serializable;
+import java.util.HashMap;
+
+import javax.jms.ExceptionListener;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.Queue;
+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.management.MBeanServerConnection;
+import javax.management.ObjectName;
+import javax.naming.InitialContext;
+
+import org.jboss.test.jbossmessaging.JMSTestCase;
+import org.jboss.util.NestedRuntimeException;
+
+/**
+ * A stress test for an impatient receiver
+ *
+ * @author <a href="mailto:richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
+ * @author    <a href="mailto:adrian at jboss.com">Adrian Brock</a>
+ * @version   $Revision: 64130 $
+ */
+public class ReceiveNackClientStressTestCase extends JMSTestCase implements ExceptionListener
+{
+   protected QueueConnection queueConnection;
+   
+   public ReceiveNackClientStressTestCase(String name) throws Exception
+   {
+      super(name);
+   }
+
+   public void onException(JMSException e)
+   {
+      log.error("Error: ", e);
+      try
+      {
+         queueConnection.close();
+      }
+      catch (Exception ignored)
+      {
+      }
+   }
+   
+    private void drainQueue(String name) throws Exception
+    {
+	InitialContext context = getInitialContext() ;
+
+	QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+	Queue queue = (Queue)context.lookup(name);
+
+	QueueReceiver receiver = session.createReceiver(queue);
+	queueConnection.start();
+	Message message = receiver.receive(50);
+	int c = 0;
+	while (message != null)
+	    {
+		message = receiver.receive(50);
+		c++;
+	    }
+
+	if (c != 0)
+	    getLog().debug("  Drained " + c + " messages from the queue");
+	session.close();
+	queueConnection.stop();
+
+    }
+
+   public void testImpatient() throws Exception
+   {
+      int target = getIterationCount();
+      createQueue("Impatient");
+      try
+      {
+         InitialContext context = getInitialContext();
+         QueueConnectionFactory queueFactory = (QueueConnectionFactory) context.lookup("ConnectionFactory");
+         Queue queue = (Queue) context.lookup("Impatient");
+         queueConnection = queueFactory.createQueueConnection();
+         drainQueue("Impatient") ;
+         try
+         {
+            QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+            QueueSender sender = session.createSender(queue);
+            QueueReceiver receiver = session.createReceiver(queue);
+            Serializable payload = new HashMap();
+            Message message = session.createObjectMessage(payload);
+            queueConnection.start();
+            int count = 0;
+            int sendCount = 0;
+            while (count < target)
+            {
+               if (sendCount <= target)
+               {
+                  for (int i = 0; i < 10 && ++sendCount <= target; ++i)
+                     sender.send(message);
+               }
+               if (receiver.receive(1) != null)
+                  ++count;
+            }
+         }
+         finally
+         {
+            drainQueue("Impatient") ;
+            queueConnection.close();
+         }
+      }
+      finally
+      {
+         deleteQueue("Impatient");
+      }
+   }
+}

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/perf/SendReplyPerfStressTestCase.java
===================================================================
--- branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/perf/SendReplyPerfStressTestCase.java	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/perf/SendReplyPerfStressTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,336 +0,0 @@
-/*
-  * 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.perf;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-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.jms.Topic;
-import javax.jms.TopicConnection;
-import javax.jms.TopicConnectionFactory;
-import javax.jms.TopicPublisher;
-import javax.jms.TopicSession;
-import javax.jms.TopicSubscriber;
-import javax.jms.Queue;
-import javax.naming.Context;
-
-import org.jboss.test.jbossmessaging.JMSTestCase;
-
-/**
- * SendReplyPerfStressTestCase.java
- * Some send/reply performance tests
- *
- * @author <a href="mailto:richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
- * @author
- * @version
- */
-public class SendReplyPerfStressTestCase extends JMSTestCase
-{
-   // Provider specific
-   static String TOPIC_FACTORY = "ConnectionFactory";
-   static String QUEUE_FACTORY = "ConnectionFactory";
-
-   static String TEST_QUEUE = "queue/testQueue";
-   static String TEST_TOPIC = "topic/testTopic";
-
-   static byte[] PERFORMANCE_TEST_DATA_PAYLOAD = new byte[10];
-
-   //JMSProviderAdapter providerAdapter;
-   static Context context;
-   static QueueConnection queueConnection;
-   static TopicConnection topicConnection;
-
-   public SendReplyPerfStressTestCase(String name) throws Exception
-   {
-      super(name);
-   }
-
-   /**
-    * The main entry-point for the SendReplyPerfStressTestCase class
-    *
-    * @param args  The command line arguments
-    */
-   public static void main(String[] args)
-   {
-
-      String newArgs[] = {"org.jboss.test.jbossmessaging.perf.SendReplyPerfStressTestCase"};
-      junit.swingui.TestRunner.main(newArgs);
-   }
-
-   public static class State
-   {
-      public int expected;
-      public int finished = 0;
-      public ArrayList errors = new ArrayList();
-      public State(int expected)
-      {
-         this.expected = expected;
-      }
-      public synchronized void addError(Throwable t)
-      {
-         errors.add(t);
-      }
-      public synchronized void finished()
-      {
-         ++finished;
-         if (finished == expected)
-            notifyAll();
-      }
-      public synchronized void waitForFinish() throws Exception
-      {
-         if (finished == expected)
-            return;
-         wait();
-      }
-   }
-
-   public static class MessageQueueSender
-      implements Runnable
-   {
-      State state;
-      public MessageQueueSender(State state)
-      {
-         this.state = state;
-      }
-
-      public void run()
-      {
-         try
-         {
-            Queue queue = (Queue)context.lookup(TEST_QUEUE);
-            QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-            TemporaryQueue temp = session.createTemporaryQueue();
-            Message message = session.createTextMessage();
-            message.setJMSReplyTo(temp);
-
-            QueueSender sender = session.createSender(queue);
-            sender.send(message);
-
-            QueueReceiver receiver = session.createReceiver(temp);
-            receiver.receive();
-            receiver.close();
-            temp.delete();
-            
-            session.close();
-         }
-         catch (Throwable t)
-         {
-            state.addError(t);
-         }
-         finally
-         {
-            state.finished();
-         }
-      }
-   }
-
-   public static class MessageTopicSender
-      implements Runnable
-   {
-      State state;
-      public MessageTopicSender(State state)
-      {
-         this.state = state;
-      }
-
-      public void run()
-      {
-         try
-         {
-            Topic topic = (Topic)context.lookup(TEST_TOPIC);
-            TopicSession session = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-            Message message = session.createTextMessage();
-
-            QueueSession qsession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-            TemporaryQueue temp = qsession.createTemporaryQueue();
-            message.setJMSReplyTo(temp);
-
-            TopicPublisher publisher = session.createPublisher(topic);
-            publisher.publish(message);
-
-            QueueReceiver receiver = qsession.createReceiver(temp);
-            receiver.receive();
-            receiver.close();
-            
-            session.close();
-         }
-         catch (Throwable t)
-         {
-            state.addError(t);
-         }
-         finally
-         {
-            state.finished();
-         }
-      }
-   }
-
-   public static class MessageReplier
-      implements MessageListener
-   {
-      State state;
-      public MessageReplier(State state)
-      {
-         this.state = state;
-      }
-      public void onMessage(Message message)
-      {
-         try
-         {
-            QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-            Queue replyQueue = session.createQueue(((Queue)message.getJMSReplyTo()).getQueueName());
-            QueueSender sender = session.createSender(replyQueue);
-            sender.send(message);
-            sender.close();
-            session.close();
-         }
-         catch (Throwable t)
-         {
-            state.addError(t);
-         }
-      }
-   }
-
-   public void testSendReplyQueue() throws Exception
-   {
-      drainQueue();
-
-      // Set up the workers
-      State state = new State(getThreadCount());
-      MessageReplier replier = new MessageReplier(state);
-      Thread[] threads = new Thread[getThreadCount()];
-      for (int i = 0; i < threads.length; ++i)
-          threads[i] = new Thread(new MessageQueueSender(state));
-
-      // Register the message listener
-      Queue queue = (Queue)context.lookup(TEST_QUEUE);
-      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-      QueueReceiver receiver = session.createReceiver(queue);
-      receiver.setMessageListener(replier);
-      queueConnection.start();
-
-      // Start the senders
-      for (int i = 0; i < threads.length; ++i)
-          threads[i].start();
-
-      // Wait for it to finish
-      state.waitForFinish();
-
-      // Report the result
-      for (Iterator i = state.errors.iterator(); i.hasNext();)
-         getLog().error("Error", (Throwable) i.next());
-      if (state.errors.size() > 0)
-         throw new RuntimeException("Test failed with " + state.errors.size() + " errors");
-   }
-
-   public void testSendReplyTopic() throws Exception
-   {
-      // Set up the workers
-      State state = new State(getThreadCount());
-      MessageReplier replier = new MessageReplier(state);
-
-      Thread[] threads = new Thread[getThreadCount()];
-      for (int i = 0; i < threads.length; ++i)
-          threads[i] = new Thread(new MessageTopicSender(state));
-
-
-      // Register the message listener
-      Topic topic = (Topic)context.lookup(TEST_TOPIC);
-      TopicSession session = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-      TopicSubscriber subscriber = session.createSubscriber(topic);
-      subscriber.setMessageListener(replier);
-      topicConnection.start();
-      queueConnection.start();
-
-      // Start the senders
-      for (int i = 0; i < threads.length; ++i)
-          threads[i].start();
-
-      // Wait for it to finish
-      state.waitForFinish();
-
-      // Report the result
-      for (Iterator i = state.errors.iterator(); i.hasNext();)
-         getLog().error("Error", (Throwable) i.next());
-      if (state.errors.size() > 0)
-         throw new RuntimeException("Test failed with " + state.errors.size() + " errors");
-   }
-
-   protected void setUp() throws Exception
-   {
-       // call setUp() of superclass
-       super.setUp() ;
-
-      getLog().info("Starting test: " + getName());
-
-      context = getInitialContext();
-
-      QueueConnectionFactory queueFactory = (QueueConnectionFactory)context.lookup(QUEUE_FACTORY);
-      queueConnection = queueFactory.createQueueConnection();
-
-      TopicConnectionFactory topicFactory = (TopicConnectionFactory)context.lookup(TOPIC_FACTORY);
-      topicConnection = topicFactory.createTopicConnection();
-
-      getLog().debug("Connection to JMS provider established.");
-   }
-
-   protected void tearDown() throws Exception
-   {
-      getLog().info("Ended test: " + getName());
-      queueConnection.close();
-      topicConnection.close();
-
-      // call tearDown() of superclass
-      super.tearDown() ;
-   }   
-
-   private void drainQueue() throws Exception
-   {
-      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-      Queue queue = (Queue)context.lookup(TEST_QUEUE);
-
-      QueueReceiver receiver = session.createReceiver(queue);
-      queueConnection.start();
-      Message message = receiver.receive(50);
-      int c = 0;
-      while (message != null)
-      {
-         message = receiver.receive(50);
-         c++;
-      }
-
-      if (c != 0)
-         getLog().debug("  Drained " + c + " messages from the queue");
-      session.close();
-      queueConnection.stop();
-
-   }
-
-}

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/perf/SendReplyPerfStressTestCase.java (from rev 64641, branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/perf/SendReplyPerfStressTestCase.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/perf/SendReplyPerfStressTestCase.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/perf/SendReplyPerfStressTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,336 @@
+/*
+  * 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.perf;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+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.jms.Topic;
+import javax.jms.TopicConnection;
+import javax.jms.TopicConnectionFactory;
+import javax.jms.TopicPublisher;
+import javax.jms.TopicSession;
+import javax.jms.TopicSubscriber;
+import javax.jms.Queue;
+import javax.naming.Context;
+
+import org.jboss.test.jbossmessaging.JMSTestCase;
+
+/**
+ * SendReplyPerfStressTestCase.java
+ * Some send/reply performance tests
+ *
+ * @author <a href="mailto:richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
+ * @author
+ * @version
+ */
+public class SendReplyPerfStressTestCase extends JMSTestCase
+{
+   // Provider specific
+   static String TOPIC_FACTORY = "ConnectionFactory";
+   static String QUEUE_FACTORY = "ConnectionFactory";
+
+   static String TEST_QUEUE = "queue/testQueue";
+   static String TEST_TOPIC = "topic/testTopic";
+
+   static byte[] PERFORMANCE_TEST_DATA_PAYLOAD = new byte[10];
+
+   //JMSProviderAdapter providerAdapter;
+   static Context context;
+   static QueueConnection queueConnection;
+   static TopicConnection topicConnection;
+
+   public SendReplyPerfStressTestCase(String name) throws Exception
+   {
+      super(name);
+   }
+
+   /**
+    * The main entry-point for the SendReplyPerfStressTestCase class
+    *
+    * @param args  The command line arguments
+    */
+   public static void main(String[] args)
+   {
+
+      String newArgs[] = {"org.jboss.test.jbossmessaging.perf.SendReplyPerfStressTestCase"};
+      junit.swingui.TestRunner.main(newArgs);
+   }
+
+   public static class State
+   {
+      public int expected;
+      public int finished = 0;
+      public ArrayList errors = new ArrayList();
+      public State(int expected)
+      {
+         this.expected = expected;
+      }
+      public synchronized void addError(Throwable t)
+      {
+         errors.add(t);
+      }
+      public synchronized void finished()
+      {
+         ++finished;
+         if (finished == expected)
+            notifyAll();
+      }
+      public synchronized void waitForFinish() throws Exception
+      {
+         if (finished == expected)
+            return;
+         wait();
+      }
+   }
+
+   public static class MessageQueueSender
+      implements Runnable
+   {
+      State state;
+      public MessageQueueSender(State state)
+      {
+         this.state = state;
+      }
+
+      public void run()
+      {
+         try
+         {
+            Queue queue = (Queue)context.lookup(TEST_QUEUE);
+            QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+            TemporaryQueue temp = session.createTemporaryQueue();
+            Message message = session.createTextMessage();
+            message.setJMSReplyTo(temp);
+
+            QueueSender sender = session.createSender(queue);
+            sender.send(message);
+
+            QueueReceiver receiver = session.createReceiver(temp);
+            receiver.receive();
+            receiver.close();
+            temp.delete();
+            
+            session.close();
+         }
+         catch (Throwable t)
+         {
+            state.addError(t);
+         }
+         finally
+         {
+            state.finished();
+         }
+      }
+   }
+
+   public static class MessageTopicSender
+      implements Runnable
+   {
+      State state;
+      public MessageTopicSender(State state)
+      {
+         this.state = state;
+      }
+
+      public void run()
+      {
+         try
+         {
+            Topic topic = (Topic)context.lookup(TEST_TOPIC);
+            TopicSession session = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+            Message message = session.createTextMessage();
+
+            QueueSession qsession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+            TemporaryQueue temp = qsession.createTemporaryQueue();
+            message.setJMSReplyTo(temp);
+
+            TopicPublisher publisher = session.createPublisher(topic);
+            publisher.publish(message);
+
+            QueueReceiver receiver = qsession.createReceiver(temp);
+            receiver.receive();
+            receiver.close();
+            
+            session.close();
+         }
+         catch (Throwable t)
+         {
+            state.addError(t);
+         }
+         finally
+         {
+            state.finished();
+         }
+      }
+   }
+
+   public static class MessageReplier
+      implements MessageListener
+   {
+      State state;
+      public MessageReplier(State state)
+      {
+         this.state = state;
+      }
+      public void onMessage(Message message)
+      {
+         try
+         {
+            QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+            Queue replyQueue = session.createQueue(((Queue)message.getJMSReplyTo()).getQueueName());
+            QueueSender sender = session.createSender(replyQueue);
+            sender.send(message);
+            sender.close();
+            session.close();
+         }
+         catch (Throwable t)
+         {
+            state.addError(t);
+         }
+      }
+   }
+
+   public void testSendReplyQueue() throws Exception
+   {
+      drainQueue();
+
+      // Set up the workers
+      State state = new State(getThreadCount());
+      MessageReplier replier = new MessageReplier(state);
+      Thread[] threads = new Thread[getThreadCount()];
+      for (int i = 0; i < threads.length; ++i)
+          threads[i] = new Thread(new MessageQueueSender(state));
+
+      // Register the message listener
+      Queue queue = (Queue)context.lookup(TEST_QUEUE);
+      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+      QueueReceiver receiver = session.createReceiver(queue);
+      receiver.setMessageListener(replier);
+      queueConnection.start();
+
+      // Start the senders
+      for (int i = 0; i < threads.length; ++i)
+          threads[i].start();
+
+      // Wait for it to finish
+      state.waitForFinish();
+
+      // Report the result
+      for (Iterator i = state.errors.iterator(); i.hasNext();)
+         getLog().error("Error", (Throwable) i.next());
+      if (state.errors.size() > 0)
+         throw new RuntimeException("Test failed with " + state.errors.size() + " errors");
+   }
+
+   public void testSendReplyTopic() throws Exception
+   {
+      // Set up the workers
+      State state = new State(getThreadCount());
+      MessageReplier replier = new MessageReplier(state);
+
+      Thread[] threads = new Thread[getThreadCount()];
+      for (int i = 0; i < threads.length; ++i)
+          threads[i] = new Thread(new MessageTopicSender(state));
+
+
+      // Register the message listener
+      Topic topic = (Topic)context.lookup(TEST_TOPIC);
+      TopicSession session = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+      TopicSubscriber subscriber = session.createSubscriber(topic);
+      subscriber.setMessageListener(replier);
+      topicConnection.start();
+      queueConnection.start();
+
+      // Start the senders
+      for (int i = 0; i < threads.length; ++i)
+          threads[i].start();
+
+      // Wait for it to finish
+      state.waitForFinish();
+
+      // Report the result
+      for (Iterator i = state.errors.iterator(); i.hasNext();)
+         getLog().error("Error", (Throwable) i.next());
+      if (state.errors.size() > 0)
+         throw new RuntimeException("Test failed with " + state.errors.size() + " errors");
+   }
+
+   protected void setUp() throws Exception
+   {
+       // call setUp() of superclass
+       super.setUp() ;
+
+      getLog().info("Starting test: " + getName());
+
+      context = getInitialContext();
+
+      QueueConnectionFactory queueFactory = (QueueConnectionFactory)context.lookup(QUEUE_FACTORY);
+      queueConnection = queueFactory.createQueueConnection();
+
+      TopicConnectionFactory topicFactory = (TopicConnectionFactory)context.lookup(TOPIC_FACTORY);
+      topicConnection = topicFactory.createTopicConnection();
+
+      getLog().debug("Connection to JMS provider established.");
+   }
+
+   protected void tearDown() throws Exception
+   {
+      getLog().info("Ended test: " + getName());
+      queueConnection.close();
+      topicConnection.close();
+
+      // call tearDown() of superclass
+      super.tearDown() ;
+   }   
+
+   private void drainQueue() throws Exception
+   {
+      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+      Queue queue = (Queue)context.lookup(TEST_QUEUE);
+
+      QueueReceiver receiver = session.createReceiver(queue);
+      queueConnection.start();
+      Message message = receiver.receive(50);
+      int c = 0;
+      while (message != null)
+      {
+         message = receiver.receive(50);
+         c++;
+      }
+
+      if (c != 0)
+         getLog().debug("  Drained " + c + " messages from the queue");
+      session.close();
+      queueConnection.stop();
+
+   }
+
+}

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra (from rev 64641, branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/ra)

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaJMSSessionUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaJMSSessionUnitTestCase.java	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaJMSSessionUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,84 +0,0 @@
-/*
-  * 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.ra;
-
-import javax.jms.*;
-import javax.naming.InitialContext;
-
-import org.jboss.test.jbossmessaging.JMSTestCase;
-import org.jboss.test.JBossTestSetup;
-import org.jboss.test.client.test.AppClientUnitTestCase;
-
-import org.jboss.test.jmsra.bean.*;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * Test for jmsra.
- *
- * @author <a href="richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
- * @author <a href="mailto:Adrian at jboss.org">Adrian Brock</a>
- * @version $Revision: 64130 $
- */
-
-public class RaJMSSessionUnitTestCase extends JMSTestCase
-{
-   public RaJMSSessionUnitTestCase(String name)
-   {
-      super(name);
-   }
-
-   public void testSendToQueueAndTopic()
-      throws Exception
-   {
-      JMSSessionHome home = (JMSSessionHome) getInitialContext().lookup("JMSSession");
-      JMSSession session = home.create();
-      session.sendToQueueAndTopic();
-   }
-
-   public static Test suite() throws Exception
-   {
-      TestSuite suite = new TestSuite();
-      
-      suite.addTest(new JBossTestSetup(new TestSuite(RaJMSSessionUnitTestCase.class))
-      {
-         protected void setUp() throws Exception
-         {
-            super.setUp();
-            deploy ("jmsra.jar");
-         }
-         protected void tearDown() throws Exception
-         {
-            undeploy ("jmsra.jar");
-            super.tearDown();
-         }
-      });
-
-      return suite;
-   }
-}
-
-
-
-
-

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaJMSSessionUnitTestCase.java (from rev 64641, branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaJMSSessionUnitTestCase.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaJMSSessionUnitTestCase.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaJMSSessionUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,84 @@
+/*
+  * 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.ra;
+
+import javax.jms.*;
+import javax.naming.InitialContext;
+
+import org.jboss.test.jbossmessaging.JMSTestCase;
+import org.jboss.test.JBossTestSetup;
+import org.jboss.test.client.test.AppClientUnitTestCase;
+
+import org.jboss.test.jmsra.bean.*;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * Test for jmsra.
+ *
+ * @author <a href="richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
+ * @author <a href="mailto:Adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 64130 $
+ */
+
+public class RaJMSSessionUnitTestCase extends JMSTestCase
+{
+   public RaJMSSessionUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void testSendToQueueAndTopic()
+      throws Exception
+   {
+      JMSSessionHome home = (JMSSessionHome) getInitialContext().lookup("JMSSession");
+      JMSSession session = home.create();
+      session.sendToQueueAndTopic();
+   }
+
+   public static Test suite() throws Exception
+   {
+      TestSuite suite = new TestSuite();
+      
+      suite.addTest(new JBossTestSetup(new TestSuite(RaJMSSessionUnitTestCase.class))
+      {
+         protected void setUp() throws Exception
+         {
+            super.setUp();
+            deploy ("jmsra.jar");
+         }
+         protected void tearDown() throws Exception
+         {
+            undeploy ("jmsra.jar");
+            super.tearDown();
+         }
+      });
+
+      return suite;
+   }
+}
+
+
+
+
+

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaQueueUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaQueueUnitTestCase.java	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaQueueUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,93 +0,0 @@
-/*
-  * 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.ra;
-
-import javax.jms.MessageConsumer;
-import javax.jms.Queue;
-import javax.jms.QueueConnection;
-
-import javax.jms.QueueConnectionFactory;
-import javax.jms.QueueSession;
-import javax.jms.Session;
-
-import javax.management.ObjectName;
-
-import javax.naming.Context;
-
-import junit.framework.Test;
-
-import org.jboss.test.JBossTestSetup;
-
-/**
- * Test cases for JMS Resource Adapter use a <em>Queue</em> . <p>
- *
- * Created: Mon Apr 23 21:35:25 2001
- *
- * @author    <a href="mailto:peter.antman at tim.se">Peter Antman</a>
- * @author    <a href="mailto:jason at planet57.com">Jason Dillon</a>
- * @version   $Revision: 64130 $
- */
-public class RaQueueUnitTestCase
-       extends RaTest
-{
-   private final static String QUEUE_FACTORY = "ConnectionFactory";
-   private final static String QUEUE = "queue/testQueue";
-   private final static String JNDI = "TxPublisher";
-
-   /**
-    * Constructor for the RaQueueUnitTestCase object
-    *
-    * @param name           Description of Parameter
-    * @exception Exception  Description of Exception
-    */
-   public RaQueueUnitTestCase(String name) throws Exception
-   {
-      super(name, JNDI);
-   }
-
-   /**
-    * #Description of the Method
-    *
-    * @param context        Description of Parameter
-    * @exception Exception  Description of Exception
-    */
-   protected void init(final Context context) throws Exception
-   {
-      QueueConnectionFactory factory =
-            (QueueConnectionFactory)context.lookup(QUEUE_FACTORY);
-
-      connection = factory.createQueueConnection();
-
-      session = ((QueueConnection)connection).createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-
-      Queue queue = (Queue)context.lookup(QUEUE);
-
-      consumer = ((QueueSession)session).createReceiver(queue);
-   }
-
-   public static Test suite() throws Exception
-   {
-      return getDeploySetup(RaQueueUnitTestCase.class, "jmsra.jar");
-   }
-
-
-}

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaQueueUnitTestCase.java (from rev 64641, branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaQueueUnitTestCase.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaQueueUnitTestCase.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaQueueUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,93 @@
+/*
+  * 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.ra;
+
+import javax.jms.MessageConsumer;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueSession;
+import javax.jms.Session;
+
+import javax.management.ObjectName;
+
+import javax.naming.Context;
+
+import junit.framework.Test;
+
+import org.jboss.test.JBossTestSetup;
+
+/**
+ * Test cases for JMS Resource Adapter use a <em>Queue</em> . <p>
+ *
+ * Created: Mon Apr 23 21:35:25 2001
+ *
+ * @author    <a href="mailto:peter.antman at tim.se">Peter Antman</a>
+ * @author    <a href="mailto:jason at planet57.com">Jason Dillon</a>
+ * @version   $Revision: 64130 $
+ */
+public class RaQueueUnitTestCase
+       extends RaTest
+{
+   private final static String QUEUE_FACTORY = "ConnectionFactory";
+   private final static String QUEUE = "queue/testQueue";
+   private final static String JNDI = "TxPublisher";
+
+   /**
+    * Constructor for the RaQueueUnitTestCase object
+    *
+    * @param name           Description of Parameter
+    * @exception Exception  Description of Exception
+    */
+   public RaQueueUnitTestCase(String name) throws Exception
+   {
+      super(name, JNDI);
+   }
+
+   /**
+    * #Description of the Method
+    *
+    * @param context        Description of Parameter
+    * @exception Exception  Description of Exception
+    */
+   protected void init(final Context context) throws Exception
+   {
+      QueueConnectionFactory factory =
+            (QueueConnectionFactory)context.lookup(QUEUE_FACTORY);
+
+      connection = factory.createQueueConnection();
+
+      session = ((QueueConnection)connection).createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+
+      Queue queue = (Queue)context.lookup(QUEUE);
+
+      consumer = ((QueueSession)session).createReceiver(queue);
+   }
+
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(RaQueueUnitTestCase.class, "jmsra.jar");
+   }
+
+
+}

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaSyncRecUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaSyncRecUnitTestCase.java	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaSyncRecUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,193 +0,0 @@
-/*
-  * 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.ra;
-
-import javax.jms.Connection;
-import javax.jms.Message;
-
-import javax.jms.QueueConnection;
-import javax.jms.QueueConnectionFactory;
-import javax.jms.QueueSender;
-import javax.jms.QueueSession;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.Queue;
-import javax.naming.Context;
-
-import javax.management.ObjectName;
-
-import javax.naming.InitialContext;
-import junit.framework.Assert;
-
-import junit.framework.Test;
-
-import org.jboss.test.jbossmessaging.JMSTestCase;
-import org.jboss.test.JBossTestSetup;
-
-import org.jboss.test.jmsra.bean.*;
-
-/**
- * 
- * <p>Test sync receive.
- *
- * <p>Created: Sat Sep 22 13:31:54 2001.
- *
- * @author <a href="mailto:richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
- * @author <a href="mailto:peter.antman at tim.se">Peter Antman</a>
- * @version $Revision: 64130 $
- */
-
-public class RaSyncRecUnitTestCase extends JMSTestCase {
-
-   private final static String BEAN_JNDI = "QueueRec";
-   private final static String QUEUE_FACTORY = "ConnectionFactory";
-   private final static String QUEUE = "queue/A";
-   private final static int MESSAGE_NR = 10;
-   
-   /**
-    * JMS connection
-    */
-   protected QueueConnection connection;
-   /**
-    * JMS session
-    */
-   protected QueueSession session;
-   /**
-    * JMS sender
-    */
-   protected QueueSender sender;
-
-   /**
-    * Receiving bean
-    */ 
-   protected QueueRec rec;
-
-   /**
-    *   
-    * Constructor for the RaSyncRecUnitTestCase object
-    *
-    * @param name           Description of Parameter
-    * @exception Exception  Description of Exception
-    */
-   public RaSyncRecUnitTestCase(String name) {
-      super(name);
-   }
-   
-   /**
-    * The JUnit setup method
-    *
-    * @exception Exception  Description of Exception
-    */
-   protected void setUp() throws Exception
-   {
-       // call setUp() in super class
-       super.setUp() ;
-
-      // Create a receiver
-      Context context = getInitialContext();
-      try
-      {
-         QueueRecHome home = (QueueRecHome)context.lookup(BEAN_JNDI);
-         rec = home.create();
-
-         init(context);
-      }
-      finally
-      {
-         context.close();
-      }
-
-      // start up the session
-      connection.start();
-
-   }
-
-   /**
-    * #Description of the Method
-    *
-    * @param context        Description of Parameter
-    * @exception Exception  Description of Exception
-    */
-   protected void init(final Context context) throws Exception
-   {
-      QueueConnectionFactory factory =
-	 (QueueConnectionFactory)context.lookup(QUEUE_FACTORY);
-      
-      connection = factory.createQueueConnection();
-      
-      session = ((QueueConnection)connection).createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-      
-      Queue queue = (Queue)context.lookup(QUEUE);
-      
-      sender = ((QueueSession)session).createSender(queue);
-   }
-
-   /**
-    * The teardown method for JUnit
-    *
-    * @exception Exception  Description of Exception
-    */
-   protected void tearDown() throws Exception
-   {
-      if (sender != null)
-      {
-         sender.close();
-      }
-      if (session != null) { 
-	 session.close();
-      }
-      if (connection != null)
-      {
-         connection.close();
-      }
-
-      // call tearDown() in superclass
-      super.tearDown() ;
-   }
-
-   /**
-    * Test sync receive of message with jms ra.
-    */
-   public void testSyncRec() throws Exception {
-      // Send a message to queue
-      TextMessage message = session.createTextMessage();
-      message.setText(String.valueOf(MESSAGE_NR));
-      message.setIntProperty(Publisher.JMS_MESSAGE_NR, MESSAGE_NR);
-      sender.send(message);
-      getLog().debug("sent message with nr = " + MESSAGE_NR);
-
-      // Let bean fetch it sync
-      int res = rec.getMessage();
-      Assert.assertEquals(MESSAGE_NR, res);
-      getLog().debug("testSyncRec() OK");
-   }
-
-   public static Test suite() throws Exception
-   {
-      return getDeploySetup(RaSyncRecUnitTestCase.class, "jmsra.jar");
-   }
-} // RaSyncRecUnitTestCase
-
-
-
-
-

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaSyncRecUnitTestCase.java (from rev 64641, branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaSyncRecUnitTestCase.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaSyncRecUnitTestCase.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaSyncRecUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,193 @@
+/*
+  * 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.ra;
+
+import javax.jms.Connection;
+import javax.jms.Message;
+
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueSender;
+import javax.jms.QueueSession;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Queue;
+import javax.naming.Context;
+
+import javax.management.ObjectName;
+
+import javax.naming.InitialContext;
+import junit.framework.Assert;
+
+import junit.framework.Test;
+
+import org.jboss.test.jbossmessaging.JMSTestCase;
+import org.jboss.test.JBossTestSetup;
+
+import org.jboss.test.jmsra.bean.*;
+
+/**
+ * 
+ * <p>Test sync receive.
+ *
+ * <p>Created: Sat Sep 22 13:31:54 2001.
+ *
+ * @author <a href="mailto:richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
+ * @author <a href="mailto:peter.antman at tim.se">Peter Antman</a>
+ * @version $Revision: 64130 $
+ */
+
+public class RaSyncRecUnitTestCase extends JMSTestCase {
+
+   private final static String BEAN_JNDI = "QueueRec";
+   private final static String QUEUE_FACTORY = "ConnectionFactory";
+   private final static String QUEUE = "queue/A";
+   private final static int MESSAGE_NR = 10;
+   
+   /**
+    * JMS connection
+    */
+   protected QueueConnection connection;
+   /**
+    * JMS session
+    */
+   protected QueueSession session;
+   /**
+    * JMS sender
+    */
+   protected QueueSender sender;
+
+   /**
+    * Receiving bean
+    */ 
+   protected QueueRec rec;
+
+   /**
+    *   
+    * Constructor for the RaSyncRecUnitTestCase object
+    *
+    * @param name           Description of Parameter
+    * @exception Exception  Description of Exception
+    */
+   public RaSyncRecUnitTestCase(String name) {
+      super(name);
+   }
+   
+   /**
+    * The JUnit setup method
+    *
+    * @exception Exception  Description of Exception
+    */
+   protected void setUp() throws Exception
+   {
+       // call setUp() in super class
+       super.setUp() ;
+
+      // Create a receiver
+      Context context = getInitialContext();
+      try
+      {
+         QueueRecHome home = (QueueRecHome)context.lookup(BEAN_JNDI);
+         rec = home.create();
+
+         init(context);
+      }
+      finally
+      {
+         context.close();
+      }
+
+      // start up the session
+      connection.start();
+
+   }
+
+   /**
+    * #Description of the Method
+    *
+    * @param context        Description of Parameter
+    * @exception Exception  Description of Exception
+    */
+   protected void init(final Context context) throws Exception
+   {
+      QueueConnectionFactory factory =
+	 (QueueConnectionFactory)context.lookup(QUEUE_FACTORY);
+      
+      connection = factory.createQueueConnection();
+      
+      session = ((QueueConnection)connection).createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+      
+      Queue queue = (Queue)context.lookup(QUEUE);
+      
+      sender = ((QueueSession)session).createSender(queue);
+   }
+
+   /**
+    * The teardown method for JUnit
+    *
+    * @exception Exception  Description of Exception
+    */
+   protected void tearDown() throws Exception
+   {
+      if (sender != null)
+      {
+         sender.close();
+      }
+      if (session != null) { 
+	 session.close();
+      }
+      if (connection != null)
+      {
+         connection.close();
+      }
+
+      // call tearDown() in superclass
+      super.tearDown() ;
+   }
+
+   /**
+    * Test sync receive of message with jms ra.
+    */
+   public void testSyncRec() throws Exception {
+      // Send a message to queue
+      TextMessage message = session.createTextMessage();
+      message.setText(String.valueOf(MESSAGE_NR));
+      message.setIntProperty(Publisher.JMS_MESSAGE_NR, MESSAGE_NR);
+      sender.send(message);
+      getLog().debug("sent message with nr = " + MESSAGE_NR);
+
+      // Let bean fetch it sync
+      int res = rec.getMessage();
+      Assert.assertEquals(MESSAGE_NR, res);
+      getLog().debug("testSyncRec() OK");
+   }
+
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(RaSyncRecUnitTestCase.class, "jmsra.jar");
+   }
+} // RaSyncRecUnitTestCase
+
+
+
+
+

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaTest.java
===================================================================
--- branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaTest.java	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaTest.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,294 +0,0 @@
-/*
-  * 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.ra;
-
-import javax.jms.Connection;
-import javax.jms.Message;
-
-import javax.jms.MessageConsumer;
-import javax.jms.Session;
-import javax.naming.Context;
-
-import javax.naming.InitialContext;
-import junit.framework.Assert;
-
-import junit.framework.TestCase;
-
-import org.jboss.test.jbossmessaging.JMSTestCase;
-
-import org.jboss.test.jmsra.bean.*;
-
-/**
- * Abstract test cases for JMS Resource Adapter. <p>
- *
- * Created: Mon Apr 23 21:35:25 2001
- *
- * @author <a href="richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
- * @author    <a href="mailto:peter.antman at tim.se">Peter Antman</a>
- * @author    <a href="mailto:jason at planet57.com">Jason Dillon</a>
- * @version   $Revision: 64130 $
- */
-public abstract class RaTest extends JMSTestCase
-{
-   /**
-    * Description of the Field
-    */
-   public final static long DEFAULT_TIMEOUT = 500L;
-   /**
-    * Description of the Field
-    */
-   public final static long FLUSH_TIMEOUT = 500L;
-
-   /**
-    * Description of the Field
-    */
-   protected String beanJNDI;
-   /**
-    * Description of the Field
-    */
-   protected MessageConsumer consumer;
-   /**
-    * Description of the Field
-    */
-   protected Publisher publisher;
-   /**
-    * Description of the Field
-    */
-   protected Connection connection;
-   /**
-    * Description of the Field
-    */
-   protected Session session;
-
-   /**
-    * Constructor for the RaTest object
-    *
-    * @param name           Description of Parameter
-    * @param beanJNDI       Description of Parameter
-    * @exception Exception  Description of Exception
-    */
-   protected RaTest(final String name, final String beanJNDI)
-          throws Exception
-   {
-      super(name);
-      this.beanJNDI = beanJNDI;
-   }
-
-   /**
-    * A unit test for JUnit
-    *
-    * @exception Exception  Description of Exception
-    */
-   public void testSimple() throws Exception
-   {
-      printHeader();
-      getLog().debug("Verify simple send of message");
-      publisher.simple(1);
-
-      Assert.assertEquals(1, getJmsMessage());
-      printOK();
-   }
-
-   /**
-    * A unit test for JUnit
-    *
-    * @exception Exception  Description of Exception
-    */
-   public void testSimpleFail() throws Exception
-   {
-      printHeader();
-      getLog().debug("Verify simple failed transaction");
-      publisher.simpleFail(2);
-
-      Assert.assertEquals(-1, getJmsMessage());
-      printOK();
-   }
-
-   /**
-    * A unit test for JUnit
-    *
-    * @exception Exception  Description of Exception
-    */
-   public void testBeanOk() throws Exception
-   {
-      printHeader();
-      getLog().debug("Verify bean ok");
-      publisher.beanOk(3);
-
-      Assert.assertEquals(3, getJmsMessage());
-      printOK();
-   }
-
-   /**
-    * A unit test for JUnit
-    *
-    * @exception Exception  Description of Exception
-    */
-   public void testBeanError() throws Exception
-   {
-      printHeader();
-      getLog().debug("Verify bean eroor failed transaction");
-
-      try
-      {
-         publisher.beanError(4);
-      }
-      catch (Exception ignore)
-      {
-      }
-
-      Assert.assertEquals(-1, getJmsMessage());
-      printOK();
-   }
-
-   /**
-    * The JUnit setup method
-    *
-    * @exception Exception  Description of Exception
-    */
-   protected void setUp() throws Exception
-   {
-       // call setUp() in superclass
-       super.setUp() ;
-
-      // Create a publisher
-      Context context = getInitialContext();
-      PublisherHome home = (PublisherHome)context.lookup(beanJNDI);
-      publisher = home.create();
-
-      init(context);
-
-      // start up the session
-      connection.start();
-
-      // flush the destination
-      flush();
-   }
-
-   /**
-    * Check if we got a message.
-    *
-    * @return               Publisher.JMS_MESSAGE_NR int property or -1 if no
-    *      message was received.
-    * @exception Exception  Description of Exception
-    */
-   protected int getJmsMessage() throws Exception
-   {
-      return getJmsMessage(DEFAULT_TIMEOUT);
-   }
-
-   /**
-    * Check if we got a message.
-    *
-    * @param timeout        The time to wait for a message.
-    * @return               Publisher.JMS_MESSAGE_NR int property or -1 if no
-    *      message was received.
-    * @exception Exception  Description of Exception
-    */
-   protected int getJmsMessage(long timeout) throws Exception
-   {
-      Message msg = consumer.receive(timeout);
-      if (msg != null)
-      {
-         getLog().debug("Recived message: " + msg);
-         int nr = msg.getIntProperty(Publisher.JMS_MESSAGE_NR);
-         getLog().debug("nr: " + nr);
-         return nr;
-      }
-      else
-      {
-         getLog().debug("NO message recived");
-         return -1;
-      }
-   }
-
-   /**
-    * #Description of the Method
-    *
-    * @param context        Description of Parameter
-    * @exception Exception  Description of Exception
-    */
-   protected abstract void init(final Context context) throws Exception;
-
-   /**
-    * The teardown method for JUnit
-    *
-    * @exception Exception  Description of Exception
-    */
-   protected void tearDown() throws Exception
-   {
-      if (consumer != null)
-      {
-         consumer.close();
-      }
-      if (connection != null)
-      {
-         connection.close();
-      }
-
-      //call tearDown() in superclass
-      super.tearDown() ;
-   }
-
-   /**
-    * #Description of the Method
-    */
-   protected void printHeader()
-   {
-      getLog().debug("\n---- Testing method " + getName() +
-            " for bean " + beanJNDI);
-   }
-
-   /**
-    * #Description of the Method
-    */
-   protected void printOK()
-   {
-      getLog().debug("---- Test OK\n");
-   }
-
-   /**
-    * Flush the destiniation so we know that it contains no messages which might
-    * mess up the test.
-    *
-    * @exception Exception  Description of Exception
-    */
-   protected void flush() throws Exception
-   {
-      // getLog().debug(" > Flushing Destination");
-
-      int nr = 0;
-      do
-      {
-         try
-         {
-            nr = getJmsMessage(FLUSH_TIMEOUT);
-         }
-         catch (Exception ignore)
-         {
-         }
-      } while (nr != -1);
-      // getLog().debug(" > Flushed");
-   }
-
-
-}

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaTest.java (from rev 64641, branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaTest.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaTest.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaTest.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,294 @@
+/*
+  * 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.ra;
+
+import javax.jms.Connection;
+import javax.jms.Message;
+
+import javax.jms.MessageConsumer;
+import javax.jms.Session;
+import javax.naming.Context;
+
+import javax.naming.InitialContext;
+import junit.framework.Assert;
+
+import junit.framework.TestCase;
+
+import org.jboss.test.jbossmessaging.JMSTestCase;
+
+import org.jboss.test.jmsra.bean.*;
+
+/**
+ * Abstract test cases for JMS Resource Adapter. <p>
+ *
+ * Created: Mon Apr 23 21:35:25 2001
+ *
+ * @author <a href="richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
+ * @author    <a href="mailto:peter.antman at tim.se">Peter Antman</a>
+ * @author    <a href="mailto:jason at planet57.com">Jason Dillon</a>
+ * @version   $Revision: 64130 $
+ */
+public abstract class RaTest extends JMSTestCase
+{
+   /**
+    * Description of the Field
+    */
+   public final static long DEFAULT_TIMEOUT = 500L;
+   /**
+    * Description of the Field
+    */
+   public final static long FLUSH_TIMEOUT = 500L;
+
+   /**
+    * Description of the Field
+    */
+   protected String beanJNDI;
+   /**
+    * Description of the Field
+    */
+   protected MessageConsumer consumer;
+   /**
+    * Description of the Field
+    */
+   protected Publisher publisher;
+   /**
+    * Description of the Field
+    */
+   protected Connection connection;
+   /**
+    * Description of the Field
+    */
+   protected Session session;
+
+   /**
+    * Constructor for the RaTest object
+    *
+    * @param name           Description of Parameter
+    * @param beanJNDI       Description of Parameter
+    * @exception Exception  Description of Exception
+    */
+   protected RaTest(final String name, final String beanJNDI)
+          throws Exception
+   {
+      super(name);
+      this.beanJNDI = beanJNDI;
+   }
+
+   /**
+    * A unit test for JUnit
+    *
+    * @exception Exception  Description of Exception
+    */
+   public void testSimple() throws Exception
+   {
+      printHeader();
+      getLog().debug("Verify simple send of message");
+      publisher.simple(1);
+
+      Assert.assertEquals(1, getJmsMessage());
+      printOK();
+   }
+
+   /**
+    * A unit test for JUnit
+    *
+    * @exception Exception  Description of Exception
+    */
+   public void testSimpleFail() throws Exception
+   {
+      printHeader();
+      getLog().debug("Verify simple failed transaction");
+      publisher.simpleFail(2);
+
+      Assert.assertEquals(-1, getJmsMessage());
+      printOK();
+   }
+
+   /**
+    * A unit test for JUnit
+    *
+    * @exception Exception  Description of Exception
+    */
+   public void testBeanOk() throws Exception
+   {
+      printHeader();
+      getLog().debug("Verify bean ok");
+      publisher.beanOk(3);
+
+      Assert.assertEquals(3, getJmsMessage());
+      printOK();
+   }
+
+   /**
+    * A unit test for JUnit
+    *
+    * @exception Exception  Description of Exception
+    */
+   public void testBeanError() throws Exception
+   {
+      printHeader();
+      getLog().debug("Verify bean eroor failed transaction");
+
+      try
+      {
+         publisher.beanError(4);
+      }
+      catch (Exception ignore)
+      {
+      }
+
+      Assert.assertEquals(-1, getJmsMessage());
+      printOK();
+   }
+
+   /**
+    * The JUnit setup method
+    *
+    * @exception Exception  Description of Exception
+    */
+   protected void setUp() throws Exception
+   {
+       // call setUp() in superclass
+       super.setUp() ;
+
+      // Create a publisher
+      Context context = getInitialContext();
+      PublisherHome home = (PublisherHome)context.lookup(beanJNDI);
+      publisher = home.create();
+
+      init(context);
+
+      // start up the session
+      connection.start();
+
+      // flush the destination
+      flush();
+   }
+
+   /**
+    * Check if we got a message.
+    *
+    * @return               Publisher.JMS_MESSAGE_NR int property or -1 if no
+    *      message was received.
+    * @exception Exception  Description of Exception
+    */
+   protected int getJmsMessage() throws Exception
+   {
+      return getJmsMessage(DEFAULT_TIMEOUT);
+   }
+
+   /**
+    * Check if we got a message.
+    *
+    * @param timeout        The time to wait for a message.
+    * @return               Publisher.JMS_MESSAGE_NR int property or -1 if no
+    *      message was received.
+    * @exception Exception  Description of Exception
+    */
+   protected int getJmsMessage(long timeout) throws Exception
+   {
+      Message msg = consumer.receive(timeout);
+      if (msg != null)
+      {
+         getLog().debug("Recived message: " + msg);
+         int nr = msg.getIntProperty(Publisher.JMS_MESSAGE_NR);
+         getLog().debug("nr: " + nr);
+         return nr;
+      }
+      else
+      {
+         getLog().debug("NO message recived");
+         return -1;
+      }
+   }
+
+   /**
+    * #Description of the Method
+    *
+    * @param context        Description of Parameter
+    * @exception Exception  Description of Exception
+    */
+   protected abstract void init(final Context context) throws Exception;
+
+   /**
+    * The teardown method for JUnit
+    *
+    * @exception Exception  Description of Exception
+    */
+   protected void tearDown() throws Exception
+   {
+      if (consumer != null)
+      {
+         consumer.close();
+      }
+      if (connection != null)
+      {
+         connection.close();
+      }
+
+      //call tearDown() in superclass
+      super.tearDown() ;
+   }
+
+   /**
+    * #Description of the Method
+    */
+   protected void printHeader()
+   {
+      getLog().debug("\n---- Testing method " + getName() +
+            " for bean " + beanJNDI);
+   }
+
+   /**
+    * #Description of the Method
+    */
+   protected void printOK()
+   {
+      getLog().debug("---- Test OK\n");
+   }
+
+   /**
+    * Flush the destiniation so we know that it contains no messages which might
+    * mess up the test.
+    *
+    * @exception Exception  Description of Exception
+    */
+   protected void flush() throws Exception
+   {
+      // getLog().debug(" > Flushing Destination");
+
+      int nr = 0;
+      do
+      {
+         try
+         {
+            nr = getJmsMessage(FLUSH_TIMEOUT);
+         }
+         catch (Exception ignore)
+         {
+         }
+      } while (nr != -1);
+      // getLog().debug(" > Flushed");
+   }
+
+
+}

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaTopicUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaTopicUnitTestCase.java	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaTopicUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,93 +0,0 @@
-/*
-  * 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.ra;
-
-import javax.jms.MessageConsumer;
-import javax.jms.Session;
-import javax.jms.Topic;
-import javax.jms.TopicConnection;
-
-import javax.jms.TopicConnectionFactory;
-import javax.jms.TopicSession;
-
-import javax.management.ObjectName;
-
-import javax.naming.Context;
-
-import junit.framework.Test;
-
-import org.jboss.test.JBossTestSetup;
-
-/**
- * Test cases for JMS Resource Adapter using a <em>Topic</em> . <p>
- *
- * Created: Mon Apr 23 21:35:25 2001
- *
- * @author    <a href="mailto:peter.antman at tim.se">Peter Antman</a>
- * @author    <a href="mailto:jason at planet57.com">Jason Dillon</a>
- * @version   $Revision: 64130 $
- */
-public class RaTopicUnitTestCase
-       extends RaTest
-{
-   private final static String TOPIC_FACTORY = "ConnectionFactory";
-   private final static String TOPIC = "topic/testTopic";
-   private final static String JNDI = "TxTopicPublisher";
-
-   /**
-    * Constructor for the RaTopicUnitTestCase object
-    *
-    * @param name           Description of Parameter
-    * @exception Exception  Description of Exception
-    */
-   public RaTopicUnitTestCase(String name) throws Exception
-   {
-      super(name, JNDI);
-   }
-
-   /**
-    * #Description of the Method
-    *
-    * @param context        Description of Parameter
-    * @exception Exception  Description of Exception
-    */
-   protected void init(final Context context) throws Exception
-   {
-      TopicConnectionFactory factory =
-            (TopicConnectionFactory)context.lookup(TOPIC_FACTORY);
-
-      connection = factory.createTopicConnection();
-
-      session = ((TopicConnection)connection).createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-
-      Topic topic = (Topic)context.lookup(TOPIC);
-
-      consumer = ((TopicSession)session).createSubscriber(topic);
-   }
-
-   public static Test suite() throws Exception
-   {
-      return getDeploySetup(RaQueueUnitTestCase.class, "jmsra.jar");
-   }
-
-
-}

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaTopicUnitTestCase.java (from rev 64641, branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaTopicUnitTestCase.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaTopicUnitTestCase.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/ra/RaTopicUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,93 @@
+/*
+  * 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.ra;
+
+import javax.jms.MessageConsumer;
+import javax.jms.Session;
+import javax.jms.Topic;
+import javax.jms.TopicConnection;
+
+import javax.jms.TopicConnectionFactory;
+import javax.jms.TopicSession;
+
+import javax.management.ObjectName;
+
+import javax.naming.Context;
+
+import junit.framework.Test;
+
+import org.jboss.test.JBossTestSetup;
+
+/**
+ * Test cases for JMS Resource Adapter using a <em>Topic</em> . <p>
+ *
+ * Created: Mon Apr 23 21:35:25 2001
+ *
+ * @author    <a href="mailto:peter.antman at tim.se">Peter Antman</a>
+ * @author    <a href="mailto:jason at planet57.com">Jason Dillon</a>
+ * @version   $Revision: 64130 $
+ */
+public class RaTopicUnitTestCase
+       extends RaTest
+{
+   private final static String TOPIC_FACTORY = "ConnectionFactory";
+   private final static String TOPIC = "topic/testTopic";
+   private final static String JNDI = "TxTopicPublisher";
+
+   /**
+    * Constructor for the RaTopicUnitTestCase object
+    *
+    * @param name           Description of Parameter
+    * @exception Exception  Description of Exception
+    */
+   public RaTopicUnitTestCase(String name) throws Exception
+   {
+      super(name, JNDI);
+   }
+
+   /**
+    * #Description of the Method
+    *
+    * @param context        Description of Parameter
+    * @exception Exception  Description of Exception
+    */
+   protected void init(final Context context) throws Exception
+   {
+      TopicConnectionFactory factory =
+            (TopicConnectionFactory)context.lookup(TOPIC_FACTORY);
+
+      connection = factory.createTopicConnection();
+
+      session = ((TopicConnection)connection).createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+
+      Topic topic = (Topic)context.lookup(TOPIC);
+
+      consumer = ((TopicSession)session).createSubscriber(topic);
+   }
+
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(RaQueueUnitTestCase.class, "jmsra.jar");
+   }
+
+
+}

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test (from rev 64641, branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/test)

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/ConcurrentDeliveryUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/test/ConcurrentDeliveryUnitTestCase.java	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/ConcurrentDeliveryUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,155 +0,0 @@
-/*
-  * 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.jbossmessaging.JMSTestCase;
-
-/**
- * Concurrent delivery tests
- *
- * @author <a href="mailto:richard.achmatowicz at jboss.org">Richard Achmatowicz</a>
- * @author <a href="mailto:adrian at jboss.org>Adrian Brock</a>
- * @version <tt>$Revision: 64130 $</tt>
- */
-public class ConcurrentDeliveryUnitTestCase extends JMSTestCase
-{
-   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);
-         }
-      }
-   }
-}
-

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/ConcurrentDeliveryUnitTestCase.java (from rev 64641, branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/test/ConcurrentDeliveryUnitTestCase.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/ConcurrentDeliveryUnitTestCase.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/ConcurrentDeliveryUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,155 @@
+/*
+  * 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.jbossmessaging.JMSTestCase;
+
+/**
+ * Concurrent delivery tests
+ *
+ * @author <a href="mailto:richard.achmatowicz at jboss.org">Richard Achmatowicz</a>
+ * @author <a href="mailto:adrian at jboss.org>Adrian Brock</a>
+ * @version <tt>$Revision: 64130 $</tt>
+ */
+public class ConcurrentDeliveryUnitTestCase extends JMSTestCase
+{
+   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);
+         }
+      }
+   }
+}
+

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/ConnectionConsumerUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/test/ConnectionConsumerUnitTestCase.java	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/ConnectionConsumerUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,151 +0,0 @@
-/*
-* 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.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.JMSException;
-import javax.jms.Queue;
-import javax.jms.QueueConnection;
-import javax.jms.QueueConnectionFactory;
-import javax.jms.QueueSession;
-import javax.jms.Session;
-import javax.jms.Topic;
-import javax.jms.TopicConnection;
-import javax.jms.TopicConnectionFactory;
-import javax.jms.TopicSession;
-import javax.naming.InitialContext;
-
-import org.jboss.test.jbossmessaging.JMSTestCase;
-import org.jboss.test.jbossmessaging.MockServerSessionPool;
-
-/**
- * ConnectionConsumerUnitTestCase.
- * 
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 64130 $
- */
-public class ConnectionConsumerUnitTestCase extends JMSTestCase
-{
-   /**
-    * Create a new ConnectionConsumerUnitTestCase.
-    * 
-    * @param name the test name
-    */
-   public ConnectionConsumerUnitTestCase(String name)
-   {
-      super(name);
-   }
-   
-   public void testConnectionConsumerWrongTemporaryDestination() throws Exception
-   {
-      InitialContext ctx = getInitialContext();
-      ConnectionFactory factory = (ConnectionFactory) ctx.lookup("ConnectionFactory");
-      Queue queue = null;
-      Connection connection = factory.createConnection();
-      try
-      {
-         Session s = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         queue = s.createTemporaryQueue();
-         Connection connection2 = factory.createConnection();
-         try
-         {
-            connection2.createConnectionConsumer(queue, "", MockServerSessionPool.getServerSessionPool(), 1);
-            fail("Expected an error listening to a temporary destination from a different connection");
-         }
-         catch (JMSException expected)
-         {
-            log.debug("Got the expected jms exception", expected);
-         }
-         finally
-         {
-            connection2.close();
-         }
-      }
-      finally
-      {
-         connection.close();
-      }
-   }
-   
-   public void testQueueConnectionConsumerWrongTemporaryDestination() throws Exception
-   {
-      InitialContext ctx = getInitialContext();
-      QueueConnectionFactory factory = (QueueConnectionFactory) ctx.lookup("ConnectionFactory");
-      Queue queue = null;
-      QueueConnection connection = factory.createQueueConnection();
-      try
-      {
-         QueueSession s = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-         queue = s.createTemporaryQueue();
-         QueueConnection connection2 = factory.createQueueConnection();
-         try
-         {
-            connection2.createConnectionConsumer(queue, "", MockServerSessionPool.getServerSessionPool(), 1);
-            fail("Expected an error listening to a temporary destination from a different connection");
-         }
-         catch (JMSException expected)
-         {
-            log.debug("Got the expected jms exception", expected);
-         }
-         finally
-         {
-            connection2.close();
-         }
-      }
-      finally
-      {
-         connection.close();
-      }
-   }
-   
-   public void testTopicConnectionConsumerWrongTemporaryDestination() throws Exception
-   {
-      InitialContext ctx = getInitialContext();
-      TopicConnectionFactory factory = (TopicConnectionFactory) ctx.lookup("ConnectionFactory");
-      Topic topic = null;
-      TopicConnection connection = factory.createTopicConnection();
-      try
-      {
-         TopicSession s = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-         topic = s.createTemporaryTopic();
-         TopicConnection connection2 = factory.createTopicConnection();
-         try
-         {
-            connection2.createConnectionConsumer(topic, "", MockServerSessionPool.getServerSessionPool(), 1);
-            fail("Expected an error listening to a temporary destination from a different connection");
-         }
-         catch (JMSException expected)
-         {
-            log.debug("Got the expected jms exception", expected);
-         }
-         finally
-         {
-            connection2.close();
-         }
-      }
-      finally
-      {
-         connection.close();
-      }
-   }
-}

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/ConnectionConsumerUnitTestCase.java (from rev 64641, branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/test/ConnectionConsumerUnitTestCase.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/ConnectionConsumerUnitTestCase.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/ConnectionConsumerUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,151 @@
+/*
+* 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.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueSession;
+import javax.jms.Session;
+import javax.jms.Topic;
+import javax.jms.TopicConnection;
+import javax.jms.TopicConnectionFactory;
+import javax.jms.TopicSession;
+import javax.naming.InitialContext;
+
+import org.jboss.test.jbossmessaging.JMSTestCase;
+import org.jboss.test.jbossmessaging.MockServerSessionPool;
+
+/**
+ * ConnectionConsumerUnitTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 64130 $
+ */
+public class ConnectionConsumerUnitTestCase extends JMSTestCase
+{
+   /**
+    * Create a new ConnectionConsumerUnitTestCase.
+    * 
+    * @param name the test name
+    */
+   public ConnectionConsumerUnitTestCase(String name)
+   {
+      super(name);
+   }
+   
+   public void testConnectionConsumerWrongTemporaryDestination() throws Exception
+   {
+      InitialContext ctx = getInitialContext();
+      ConnectionFactory factory = (ConnectionFactory) ctx.lookup("ConnectionFactory");
+      Queue queue = null;
+      Connection connection = factory.createConnection();
+      try
+      {
+         Session s = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         queue = s.createTemporaryQueue();
+         Connection connection2 = factory.createConnection();
+         try
+         {
+            connection2.createConnectionConsumer(queue, "", MockServerSessionPool.getServerSessionPool(), 1);
+            fail("Expected an error listening to a temporary destination from a different connection");
+         }
+         catch (JMSException expected)
+         {
+            log.debug("Got the expected jms exception", expected);
+         }
+         finally
+         {
+            connection2.close();
+         }
+      }
+      finally
+      {
+         connection.close();
+      }
+   }
+   
+   public void testQueueConnectionConsumerWrongTemporaryDestination() throws Exception
+   {
+      InitialContext ctx = getInitialContext();
+      QueueConnectionFactory factory = (QueueConnectionFactory) ctx.lookup("ConnectionFactory");
+      Queue queue = null;
+      QueueConnection connection = factory.createQueueConnection();
+      try
+      {
+         QueueSession s = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+         queue = s.createTemporaryQueue();
+         QueueConnection connection2 = factory.createQueueConnection();
+         try
+         {
+            connection2.createConnectionConsumer(queue, "", MockServerSessionPool.getServerSessionPool(), 1);
+            fail("Expected an error listening to a temporary destination from a different connection");
+         }
+         catch (JMSException expected)
+         {
+            log.debug("Got the expected jms exception", expected);
+         }
+         finally
+         {
+            connection2.close();
+         }
+      }
+      finally
+      {
+         connection.close();
+      }
+   }
+   
+   public void testTopicConnectionConsumerWrongTemporaryDestination() throws Exception
+   {
+      InitialContext ctx = getInitialContext();
+      TopicConnectionFactory factory = (TopicConnectionFactory) ctx.lookup("ConnectionFactory");
+      Topic topic = null;
+      TopicConnection connection = factory.createTopicConnection();
+      try
+      {
+         TopicSession s = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+         topic = s.createTemporaryTopic();
+         TopicConnection connection2 = factory.createTopicConnection();
+         try
+         {
+            connection2.createConnectionConsumer(topic, "", MockServerSessionPool.getServerSessionPool(), 1);
+            fail("Expected an error listening to a temporary destination from a different connection");
+         }
+         catch (JMSException expected)
+         {
+            log.debug("Got the expected jms exception", expected);
+         }
+         finally
+         {
+            connection2.close();
+         }
+      }
+      finally
+      {
+         connection.close();
+      }
+   }
+}

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/JBossJMSUnitTest.java
===================================================================
--- branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/test/JBossJMSUnitTest.java	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/JBossJMSUnitTest.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,1355 +0,0 @@
-/*
-  * 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 java.util.Enumeration;
-
-import javax.jms.DeliveryMode;
-import javax.jms.InvalidDestinationException;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-import javax.jms.Queue;
-import javax.jms.QueueBrowser;
-import javax.jms.QueueConnection;
-import javax.jms.QueueConnectionFactory;
-import javax.jms.QueueReceiver;
-import javax.jms.QueueRequestor;
-import javax.jms.QueueSender;
-import javax.jms.QueueSession;
-import javax.jms.ServerSession;
-import javax.jms.ServerSessionPool;
-import javax.jms.Session;
-import javax.jms.TemporaryQueue;
-import javax.jms.TemporaryTopic;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-import javax.jms.TopicConnection;
-import javax.jms.TopicConnectionFactory;
-import javax.jms.TopicPublisher;
-import javax.jms.TopicSession;
-import javax.jms.TopicSubscriber;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-
-import org.jboss.logging.Logger;
-import org.jboss.test.jbossmessaging.JMSTestCase;
-
-import EDU.oswego.cs.dl.util.concurrent.CountDown;
-
-/**
- * Basic jms tests.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision: 64261 $
- */
-public class JBossJMSUnitTest extends JMSTestCase
-{
-   /** The default TopicFactory jndi name */
-   static String TOPIC_FACTORY = "ConnectionFactory";
-   /** The default QueueFactory jndi name */
-   static String QUEUE_FACTORY = "ConnectionFactory";
-
-   static String TEST_QUEUE = "queue/testQueue";
-   static String TEST_TOPIC = "topic/testTopic";
-   static String TEST_DURABLE_TOPIC = "topic/testDurableTopic";
-
-   //JMSProviderAdapter providerAdapter;
-   static Context context;
-   static QueueConnection queueConnection;
-   static TopicConnection topicConnection;
-
-   public JBossJMSUnitTest(String name) throws Exception
-   {
-      super(name);
-   }
-
-   // Emptys out all the messages in a queue
-   protected void drainQueue() throws Exception
-   {
-      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-      Queue queue = (Queue) context.lookup(TEST_QUEUE);
-
-      QueueReceiver receiver = session.createReceiver(queue);
-      Message message = receiver.receive(50);
-      int c = 0;
-      while (message != null)
-      {
-         message = receiver.receive(50);
-         c++;
-      }
-
-      if (c != 0)
-         getLog().debug("  Drained " + c + " messages from the queue");
-
-      session.close();
-   }
-
-   protected void connect() throws Exception
-   {
-
-      if (context == null)
-      {
-
-         context = new InitialContext();
-
-      }
-      QueueConnectionFactory queueFactory = (QueueConnectionFactory) context.lookup(QUEUE_FACTORY);
-      queueConnection = queueFactory.createQueueConnection();
-
-      TopicConnectionFactory topicFactory = (TopicConnectionFactory) context.lookup(TOPIC_FACTORY);
-      topicConnection = topicFactory.createTopicConnection();
-
-      getLog().debug("Connection to spyderMQ established.");
-
-   }
-
-   protected void disconnect() throws Exception
-   {
-	  if (queueConnection != null)
-	  {
-	      queueConnection.close();
-	      queueConnection = null;
-	  }
-	  
-	  if (topicConnection != null)
-	  {
-	      topicConnection.close();
-	      topicConnection = null;
-	  }
-   }
-   
-   protected void tearDown() throws Exception
-   {
-	   super.tearDown();
-	   disconnect();
-   }
-
-   /**
-    * Test that messages are ordered by message arrival and priority.
-    * This also tests :
-    * 		Using a non-transacted AUTO_ACKNOWLEDGE session
-    *		Using a QueueReceiver
-    *		Using a QueueSender
-    *			Sending PERSITENT and NON_PERSISTENT text messages.
-    *		Using a QueueBrowser
-    */
-   public void testQueueMessageOrder() throws Exception
-   {
-
-      getLog().debug("Starting QueueMessageOrder test");
-
-      connect();
-
-      queueConnection.start();
-
-      drainQueue();
-
-      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-      Queue queue = (Queue) context.lookup(TEST_QUEUE);
-      QueueSender sender = session.createSender(queue);
-
-      TextMessage message = session.createTextMessage();
-      message.setText("Normal message");
-      sender.send(message, DeliveryMode.NON_PERSISTENT, 4, 0);
-      //sender.send(queue, message, DeliveryMode.NON_PERSISTENT, 4, 0);
-      message.setText("Persistent message");
-      sender.send(message, DeliveryMode.PERSISTENT, 4, 0);
-      //sender.send(queue, message, DeliveryMode.PERSISTENT, 4, 0);
-      message.setText("High Priority Persistent message");
-      sender.send(message, DeliveryMode.PERSISTENT, 10, 0);
-      //sender.send(queue, message, DeliveryMode.PERSISTENT, 10, 0);
-
-      //message.setText("Expiring Persistent message");
-      //sender.send(queue, message, DeliveryMode.NON_PERSISTENT, 4, 1);
-
-      QueueBrowser browser = session.createBrowser(queue);
-      Enumeration i = browser.getEnumeration();
-      //message = (TextMessage)enum.nextElement();
-      //if( !message.getText().equals("High Priority Persistent message") )
-      //	throw new Exception("Queue is not prioritizing messages correctly. Unexpected Message:"+message);
-      getLog().debug(message.getText());
-
-      message = (TextMessage) i.nextElement();
-      //if( !message.getText().equals("Normal message") )
-      //	throw new Exception("Queue is not ordering messages correctly. Unexpected Message:"+message);
-      getLog().debug(message.getText());
-
-      message = (TextMessage) i.nextElement();
-      //if( !message.getText().equals("Persistent message") )
-      //	throw new Exception("Queue is not ordering messages correctly. Unexpected Message:"+message);
-      getLog().debug(message.getText());
-
-      // if( enum.hasMoreElements() )
-      //	throw new Exception("Queue does not expire messages correctly. Unexpected Message:"+enum.nextElement());
-
-      disconnect();
-      getLog().debug("QueueMessageOrder passed");
-   }
-
-   /**
-    * Test that a using QueueRequestor works.
-    * this also tests that :
-    *		temporary queues work.
-    */
-   public void testRequestReplyQueue() throws Exception
-   {
-
-      getLog().debug("Starting RequestReplyQueue test");
-      connect();
-
-      {
-         queueConnection.start();
-         drainQueue();
-      }
-
-      Thread serverThread = new Thread()
-      {
-         public void run()
-         {
-            Logger log = Logger.getLogger(getClass().getName());
-            try
-            {
-               log.debug("Server Thread Started");
-               QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-               Queue queue = (Queue) context.lookup(TEST_QUEUE);
-
-               QueueReceiver queueReceiver = session.createReceiver(queue);
-
-               boolean done = false;
-               while (!done)
-               {
-                  TextMessage message = (TextMessage) queueReceiver.receive();
-                  Queue tempQueue = (Queue) message.getJMSReplyTo();
-
-                  QueueSender replySender = session.createSender(tempQueue);
-                  TextMessage reply = session.createTextMessage();
-                  reply.setText("Request Processed");
-                  reply.setJMSCorrelationID(message.getJMSMessageID());
-                  replySender.send(reply);
-
-                  if (message.getText().equals("Quit"))
-                     done = true;
-               }
-
-               session.close();
-               log.debug("Server Thread Finished");
-
-            }
-            catch (Exception e)
-            {
-               log.error("Error", e);
-            }
-         }
-      };
-
-      serverThread.start();
-
-      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-      Queue queue = (Queue) context.lookup(TEST_QUEUE);
-
-      QueueRequestor queueRequestor = new QueueRequestor(session, queue);
-      TextMessage message = session.createTextMessage();
-      message.setText("Request Test");
-
-      for (int i = 0; i < 5; i++)
-      {
-
-         getLog().debug("Making client request #" + i);
-         TextMessage reply = (TextMessage) queueRequestor.request(message);
-         String replyID = new String(reply.getJMSCorrelationID());
-         if (!replyID.equals(message.getJMSMessageID()))
-            throw new Exception("REQUEST: ERROR: Reply does not match sent message");
-
-      }
-
-      getLog().debug("Making client request to shut server down.");
-      message.setText("Quit");
-      queueRequestor.request(message);
-
-      serverThread.join();
-      disconnect();
-
-      getLog().debug("RequestReplyQueue passed");
-   }
-
-   /**
-    * Test that temporary queues can be deleted.
-    */
-   public void testTemporaryQueueDelete() throws Exception
-   {
-
-      getLog().debug("Starting TemporaryQueueDelete test");
-      connect();
-
-      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-      TemporaryQueue queue = session.createTemporaryQueue();
-
-      queue.delete();
-
-      disconnect();
-
-      getLog().debug("TemporaryQueueDelete passed");
-   }
-
-   /**
-    * Test that temporary topics can be deleted.
-    */
-   public void testTemporaryTopicDelete() throws Exception
-   {
-
-      getLog().debug("Starting TemporaryTopicDelete test");
-      connect();
-
-      TopicSession session = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-      TemporaryTopic topic = session.createTemporaryTopic();
-
-      topic.delete();
-
-      disconnect();
-
-      getLog().debug("TemporaryTopicDelete passed");
-   }
-
-   /**
-    * Test invalid destination trying to send a message.
-    */
-   public void testInvalidDestinationQueueSend() throws Exception
-   {
-
-      getLog().debug("Starting InvaidDestinationQueueSend test");
-      connect();
-
-      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-      TemporaryQueue queue = session.createTemporaryQueue();
-      QueueSender sender = session.createSender(queue);
-      queue.delete();
-
-      TextMessage message = session.createTextMessage("hello");
-      boolean caught = false;
-      try
-      {
-         sender.send(message);
-      }
-      catch (InvalidDestinationException expected)
-      {
-         caught = true;
-      }
-
-      disconnect();
-
-      assertTrue("Expected an InvalidDestinationException", caught);
-
-      getLog().debug("InvaldDestinationQueueSend passed");
-   }
-
-   /**
-    * Test invalid destination trying to browse a message.
-    */
-   public void testInvalidDestinationQueueBrowse() throws Exception
-   {
-
-      getLog().debug("Starting InvalidDestinationQueueBrowse test");
-      connect();
-
-      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-      TemporaryQueue queue = session.createTemporaryQueue();
-      QueueBrowser browser = session.createBrowser(queue);
-      queue.delete();
-
-      boolean caught = false;
-      try
-      {
-         browser.getEnumeration();
-      }
-      catch (InvalidDestinationException expected)
-      {
-         caught = true;
-      }
-
-      disconnect();
-
-      assertTrue("Expected an InvalidDestinationException", caught);
-
-      getLog().debug("InvalidDestinationQueueBrowse passed");
-   }
-
-   /**
-    * Test invalid destination trying to send a message.
-    */
-   public void testInvalidDestinationTopicPublish() throws Exception
-   {
-
-      getLog().debug("Starting InvaidDestinationTopicPublish test");
-      connect();
-
-      TopicSession session = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-      TemporaryTopic topic = session.createTemporaryTopic();
-      TopicPublisher publisher = session.createPublisher(topic);
-      topic.delete();
-
-      TextMessage message = session.createTextMessage("hello");
-      boolean caught = false;
-      try
-      {
-         publisher.publish(message);
-      }
-      catch (InvalidDestinationException expected)
-      {
-         caught = true;
-      }
-
-      disconnect();
-
-      assertTrue("Expected an InvalidDestinationException", caught);
-
-      getLog().debug("InvaldDestinationTopicPublish passed");
-   }
-
-   /**
-    * Test errors trying on topic subscribe.
-    */
-   public void testErrorsTopicSubscribe() throws Exception
-   {
-
-      getLog().debug("Starting InvalidDestinationTopicSubscribe test");
-      connect();
-
-      try
-      {
-         TopicSession session = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-         Topic topic = (Topic) context.lookup(TEST_TOPIC);
-         TemporaryTopic temp = session.createTemporaryTopic();
-
-         boolean caught = false;
-         try
-         {
-            session.createSubscriber(null);
-         }
-         catch (InvalidDestinationException expected)
-         {
-            caught = true;
-         }
-         assertTrue("Expected an InvalidDestinationException for a null topic", caught);
-
-         caught = false;
-         try
-         {
-            session.createSubscriber(null, null, true);
-         }
-         catch (InvalidDestinationException expected)
-         {
-            caught = true;
-         }
-         assertTrue("Expected an InvalidDestinationException for a null topic", caught);
-
-         caught = false;
-         try
-         {
-            session.createDurableSubscriber(null, "NotUsed");
-         }
-         catch (InvalidDestinationException expected)
-         {
-            caught = true;
-         }
-         assertTrue("Expected an InvalidDestinationException for a null topic", caught);
-
-         caught = false;
-         try
-         {
-            session.createDurableSubscriber(temp, "NotUsed");
-         }
-         catch (InvalidDestinationException expected)
-         {
-            caught = true;
-         }
-         assertTrue("Expected an InvalidDestinationException for a temporary topic", caught);
-
-         caught = false;
-         try
-         {
-            session.createDurableSubscriber(null, "NotUsed", null, true);
-         }
-         catch (InvalidDestinationException expected)
-         {
-            caught = true;
-         }
-         assertTrue("Expected an InvalidDestinationException for a null topic", caught);
-
-         caught = false;
-         try
-         {
-            session.createDurableSubscriber(temp, "NotUsed", null, true);
-         }
-         catch (InvalidDestinationException expected)
-         {
-            caught = true;
-         }
-         assertTrue("Expected an InvalidDestinationException for a temporary topic", caught);
-
-         caught = false;
-         try
-         {
-            session.createDurableSubscriber(topic, null);
-         }
-         catch (Exception expected)
-         {
-            caught = true;
-         }
-         assertTrue("Expected a Exception for a null subscription", caught);
-
-         caught = false;
-         try
-         {
-            session.createDurableSubscriber(topic, null, null, false);
-         }
-         catch (Exception expected)
-         {
-            caught = true;
-         }
-         assertTrue("Expected a Exception for a null subscription", caught);
-
-         caught = false;
-         try
-         {
-            session.createDurableSubscriber(topic, "  ");
-         }
-         catch (Exception expected)
-         {
-            caught = true;
-         }
-         assertTrue("Expected a Exception for an empty subscription", caught);
-
-         caught = false;
-         try
-         {
-            session.createDurableSubscriber(topic, "  ", null, false);
-         }
-         catch (Exception expected)
-         {
-            caught = true;
-         }
-         assertTrue("Expected a Exception for an empty subscription", caught);
-      }
-      finally
-      {
-         disconnect();
-      }
-
-      getLog().debug("InvalidDestinationTopicSubscriber passed");
-   }
-
-   /**
-    * Test create queue.
-    */
-   public void testCreateQueue() throws Exception
-   {
-
-      getLog().debug("Starting create queue test");
-      connect();
-
-      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-
-      Queue jndiQueue = (Queue) getInitialContext().lookup("queue/testQueue");
-      Queue createQueue = session.createQueue(jndiQueue.getQueueName());
-      assertTrue("Failed for " + QUEUE_FACTORY, jndiQueue.equals(createQueue));
-
-      getLog().debug("InvalidDestinationTopicSubscriber passed");
-   }
-
-   public void testMessageListener() throws Exception
-   {
-      getLog().debug("Starting create queue test");
-
-      connect();
-      queueConnection.start();
-      drainQueue();
-      final CountDown counter1 = new CountDown(3);
-
-      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-      Queue queue = (Queue) context.lookup(TEST_QUEUE);
-
-      QueueReceiver receiver = session.createReceiver(queue);
-      receiver.setMessageListener(new MessageListener()
-      {
-         public void onMessage(Message msg)
-         {
-            Logger log = Logger.getLogger(getClass().getName());
-            log.debug("ML");
-            try
-            {
-               if (msg instanceof TextMessage)
-               {
-                  log.debug(((TextMessage) msg).getText());
-                  counter1.release();
-               }
-            }
-            catch (Exception e)
-            {
-            }
-         }
-      });
-
-      QueueSender sender = session.createSender(queue);
-
-      TextMessage message = session.createTextMessage();
-      message.setText("Normal message");
-      sender.send(message, DeliveryMode.NON_PERSISTENT, 4, 0);
-      //sender.send(queue, message, DeliveryMode.NON_PERSISTENT, 4, 0);
-      message.setText("Persistent message");
-      sender.send(message, DeliveryMode.PERSISTENT, 4, 0);
-      //sender.send(queue, message, DeliveryMode.PERSISTENT, 4, 0);
-      message.setText("High Priority Persistent message");
-      sender.send(message, DeliveryMode.PERSISTENT, 10, 0);
-      //sender.send(queue, message, DeliveryMode.PERSISTENT, 10, 0);
-
-      // Wait for the msgs to be received
-      counter1.acquire();
-      log.debug("MessageListener1 received the TMs sent");
-
-      final CountDown counter2 = new CountDown(2);
-      receiver.setMessageListener(new MessageListener()
-      {
-         public void onMessage(Message msg)
-         {
-            Logger log = Logger.getLogger(getClass().getName());
-            log.debug("ML 2");
-            try
-            {
-               if (msg instanceof TextMessage)
-               {
-                  log.debug(((TextMessage) msg).getText());
-                  counter2.release();
-               }
-            }
-            catch (Exception e)
-            {
-            }
-         }
-      });
-
-      message.setText("Persistent message");
-      sender.send(message, DeliveryMode.PERSISTENT, 4, 0);
-      //sender.send(queue, message, DeliveryMode.PERSISTENT, 4, 0);
-      message.setText("High Priority Persistent message");
-      sender.send(message, DeliveryMode.PERSISTENT, 10, 0);
-      //sender.send(queue, message, DeliveryMode.PERSISTENT, 10, 0);
-
-      // Wait for the msgs to be received
-      counter2.acquire();
-      log.debug("MessageListener2 received the TMs sent");
-
-      receiver.setMessageListener(null);
-
-      message.setText("Persistent message");
-      sender.send(message, DeliveryMode.PERSISTENT, 4, 0);
-      //sender.send(queue, message, DeliveryMode.PERSISTENT, 4, 0);
-      message.setText("High Priority Persistent message");
-      sender.send(message, DeliveryMode.PERSISTENT, 10, 0);
-      //sender.send(queue, message, DeliveryMode.PERSISTENT, 10, 0);
-
-      sender.close();
-      drainQueue();
-      disconnect();
-      getLog().debug("MessageListener test passed");
-   }
-
-   public void testApplicationServerStuff() throws Exception
-   {
-      getLog().debug("Starting testing app server stuff");
-      connect();
-
-      Queue testQueue = (Queue) context.lookup(TEST_QUEUE);
-      final QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-
-      session.setMessageListener(new MessageListener()
-      {
-         public void onMessage(Message mess)
-         {
-            Logger log = Logger.getLogger(getClass().getName());
-            log.debug("Processing message");
-            try
-            {
-               if (mess instanceof TextMessage)
-                  log.debug(((TextMessage) mess).getText());
-            }
-            catch (Exception e)
-            {
-               log.error("Error", e);
-            }
-         }
-      });
-
-      QueueSender sender = session.createSender(testQueue);
-      sender.send(session.createTextMessage("Hi"));
-      sender.send(session.createTextMessage("There"));
-      sender.send(session.createTextMessage("Guys"));
-      queueConnection.createConnectionConsumer(testQueue, null, new ServerSessionPool()
-      {
-         public ServerSession getServerSession()
-         {
-            Logger.getLogger(getClass().getName()).debug("Getting server session.");
-            return new ServerSession()
-            {
-               public Session getSession()
-               {
-                  return session;
-               }
-               public void start()
-               {
-                  Logger.getLogger(getClass().getName()).debug("Starting server session.");
-                  session.run();
-               }
-            };
-         }
-      }, 10);
-
-      queueConnection.start();
-
-      try
-      {
-         Thread.sleep(5 * 1000);
-      }
-      catch (Exception e)
-      {
-      }
-
-      disconnect();
-      getLog().debug("Testing app server stuff passed");
-   }
-
-   //simply put a few messages on the test queue for next time.
-   /*   public void testPM() throws Exception
-      {
-         getLog().debug("Starting testing pm");
-         connect();
-         
-         Queue testQueue = (Queue)context.lookup(TEST_QUEUE);
-         QueueSession session = queueConnection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
-         QueueSender sender = session.createSender(testQueue);
-         sender.send(session.createTextMessage("From last time"));
-         sender.send(session.createTextMessage("From last time"));
-         sender.send(session.createTextMessage("From last time"));
-         sender.close();
-         session.close();
-         disconnect();
-         getLog().debug("Testing pm stuff passed");
-      }
-   */
-   private void drainMessagesForTopic(TopicSubscriber sub) throws JMSException
-   {
-      Message msg = sub.receive(50);
-      int c = 0;
-      while (msg != null)
-      {
-         c++;
-         if (msg instanceof TextMessage)
-            getLog().debug(((TextMessage) msg).getText());
-         msg = sub.receive(50);
-      }
-      getLog().debug("Received " + c + " messages from topic.");
-   }
-
-   public void testTopics() throws Exception
-   {
-      getLog().debug("Starting Topic test");
-      connect();
-
-      TopicConnectionFactory topicFactory = (TopicConnectionFactory) context.lookup(TOPIC_FACTORY);
-      topicConnection = topicFactory.createTopicConnection("john", "needle");
-
-      topicConnection.start();
-
-      //set up some subscribers to the topic
-      TopicSession session = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-      Topic topic = (Topic) context.lookup(TEST_TOPIC);
-
-      TopicSubscriber sub1 = session.createDurableSubscriber(topic, "sub1");
-      TopicSubscriber sub2 = session.createSubscriber(topic);
-      TopicSubscriber sub3 = session.createSubscriber(topic);
-
-      //Now a sender
-      TopicPublisher sender = session.createPublisher(topic);
-
-      //send some messages
-      sender.publish(session.createTextMessage("Message 1"));
-      sender.publish(session.createTextMessage("Message 2"));
-      sender.publish(session.createTextMessage("Message 3"));
-      drainMessagesForTopic(sub1);
-      drainMessagesForTopic(sub2);
-      drainMessagesForTopic(sub3);
-
-      //close some subscribers
-      sub1.close();
-      sub2.close();
-
-      //send some more messages
-      sender.publish(session.createTextMessage("Message 4"));
-      sender.publish(session.createTextMessage("Message 5"));
-      sender.publish(session.createTextMessage("Message 6"));
-
-      //give time for message 4 to be negatively acked (as it will be cause last receive timed out)
-      try
-      {
-         Thread.sleep(5 * 1000);
-      }
-      catch (InterruptedException e)
-      {
-      }
-
-      drainMessagesForTopic(sub3);
-
-      //open subscribers again.
-      sub1 = session.createDurableSubscriber(topic, "sub1");
-      sub2 = session.createSubscriber(topic);
-
-      //Send a final message
-      sender.publish(session.createTextMessage("Final message"));
-      sender.close();
-
-      drainMessagesForTopic(sub1);
-      drainMessagesForTopic(sub2);
-      drainMessagesForTopic(sub3);
-
-      sub1.close();
-      sub2.close();
-      sub3.close();
-
-      session.unsubscribe("sub1");
-
-      topicConnection.stop();
-      topicConnection.close();
-
-      disconnect();
-      getLog().debug("Topic test passed");
-   }
-
-   /**
-    * Test to seeif the NoLocal feature of topics works.
-    * Messages published from the same connection should not
-    * be received by Subscribers on the same connection.
-    */
-   public void testTopicNoLocal() throws Exception
-   {
-      getLog().debug("Starting TopicNoLocal test");
-      connect();
-
-      TopicConnectionFactory topicFactory = (TopicConnectionFactory) context.lookup(TOPIC_FACTORY);
-      TopicConnection topicConnection1 = topicFactory.createTopicConnection();
-      topicConnection1.start();
-      TopicConnection topicConnection2 = topicFactory.createTopicConnection();
-      topicConnection2.start();
-
-      // We don't want local messages on this topic.
-      TopicSession session1 = topicConnection1.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-      Topic topic = (Topic) context.lookup(TEST_TOPIC);
-      TopicSubscriber subscriber1 = session1.createSubscriber(topic, null, true);
-      TopicPublisher sender1 = session1.createPublisher(topic);
-
-      //Now a sender
-      TopicSession session2 = topicConnection2.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-      TopicPublisher sender2 = session2.createPublisher(topic);
-
-      drainMessagesForTopic(subscriber1);
-
-      //send some messages
-      sender1.publish(session1.createTextMessage("Local Message"));
-      sender2.publish(session2.createTextMessage("Remote Message"));
-
-      // Get the messages, we should get the remote message
-      // but not the local message
-      TextMessage msg1 = (TextMessage) subscriber1.receive(2000);
-      if (msg1 == null)
-      {
-         fail("Did not get any messages");
-      }
-      else
-      {
-         getLog().debug("Got message: " + msg1);
-         if (msg1.getText().equals("Local Message"))
-         {
-            fail("Got a local message");
-         }
-         TextMessage msg2 = (TextMessage) subscriber1.receive(2000);
-         if (msg2 != null)
-         {
-            getLog().debug("Got message: " + msg2);
-            fail("Got an extra message.  msg1:" + msg1 + ", msg2:" + msg2);
-         }
-      }
-
-      topicConnection1.stop();
-      topicConnection1.close();
-      topicConnection2.stop();
-      topicConnection2.close();
-
-      disconnect();
-      getLog().debug("TopicNoLocal test passed");
-   }
-
-   /**
-    * Test to see whether no local works if a message
-    * was created somewhere else.
-    */
-   public void testTopicNoLocalBounce() throws Exception
-   {
-      getLog().debug("Starting TopicNoLocalBounce test");
-      connect();
-
-      TopicConnectionFactory topicFactory = (TopicConnectionFactory) context.lookup(TOPIC_FACTORY);
-      TopicConnection topicConnection1 = topicFactory.createTopicConnection();
-      topicConnection1.start();
-      TopicConnection topicConnection2 = topicFactory.createTopicConnection();
-      topicConnection2.start();
-
-      // Session 1
-      TopicSession session1 = topicConnection1.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-      Topic topic = (Topic) context.lookup(TEST_TOPIC);
-      TopicSubscriber subscriber1 = session1.createSubscriber(topic, null, true);
-      TopicPublisher sender1 = session1.createPublisher(topic);
-
-      // Session 2
-      TopicSession session2 = topicConnection2.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-      TopicSubscriber subscriber2 = session2.createSubscriber(topic, null, true);
-      TopicPublisher sender2 = session2.createPublisher(topic);
-
-      drainMessagesForTopic(subscriber1);
-      drainMessagesForTopic(subscriber2);
-
-      //send the message
-      sender1.publish(session1.createTextMessage("Message"));
-
-      assertTrue("Subscriber1 should not get a message", subscriber1.receiveNoWait() == null);
-      TextMessage msg = (TextMessage) subscriber2.receive(2000);
-      assertTrue("Subscriber2 should get a message, got " + msg, msg != null && msg.getText().equals("Message"));
-
-      //send it back
-      sender2.publish(msg);
-
-      msg = (TextMessage) subscriber1.receive(2000);
-      assertTrue("Subscriber1 should get a message, got " + msg, msg != null && msg.getText().equals("Message"));
-      assertTrue("Subscriber2 should not get a message", subscriber2.receiveNoWait() == null);
-
-      topicConnection1.stop();
-      topicConnection1.close();
-      topicConnection2.stop();
-      topicConnection2.close();
-
-      disconnect();
-      getLog().debug("TopicNoLocalBounce test passed");
-   }
-
-   /**
-    * Test subscribing to a topic with one selector, then changing to another
-    */
-   public void testTopicSelectorChange() throws Exception
-   {
-      getLog().debug("Starting TopicSelectorChange test");
-
-      getLog().debug("Create topic connection");
-      TopicConnectionFactory topicFactory = (TopicConnectionFactory) context.lookup(TOPIC_FACTORY);
-      topicConnection = topicFactory.createTopicConnection("john", "needle");
-      topicConnection.start();
-
-      try
-      {
-         getLog().debug("Retrieving Topic");
-         Topic topic = (Topic) context.lookup(TEST_DURABLE_TOPIC);
-
-         getLog().debug("Creating a send session");
-         TopicSession sendSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-         TopicPublisher sender = sendSession.createPublisher(topic);
-
-         getLog().debug("Clearing the topic");
-         TopicSession subSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-         TopicSubscriber subscriber = subSession.createDurableSubscriber(topic, "test");
-         Message message = subscriber.receive(50);
-         while (message != null)
-            message = subscriber.receive(50);
-         subSession.close();
-
-         getLog().debug("Subscribing to topic, looking for Value = 'A'");
-         subSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-         subscriber = subSession.createDurableSubscriber(topic, "test", "Value = 'A'", false);
-
-         getLog().debug("Send some messages");
-         message = sendSession.createTextMessage("Message1");
-         message.setStringProperty("Value", "A");
-         sender.publish(message);
-         message = sendSession.createTextMessage("Message2");
-         message.setStringProperty("Value", "A");
-         sender.publish(message);
-         message = sendSession.createTextMessage("Message3");
-         message.setStringProperty("Value", "B");
-         sender.publish(message);
-
-         getLog().debug("Retrieving the A messages");
-         message = subscriber.receive(2000);
-         assertTrue("Expected message 1", message != null);
-         assertTrue("Should get an A", message.getStringProperty("Value").equals("A"));
-         message = subscriber.receive(2000);
-         assertTrue("Expected message 2", message != null);
-         assertTrue("Should get a second A", message.getStringProperty("Value").equals("A"));
-         assertTrue("That should be it for A", subscriber.receive(2000) == null);
-
-         getLog().debug("Closing the subscriber without acknowledgement");
-         subSession.close();
-
-         getLog().debug("Subscribing to topic, looking for Value = 'B'");
-         subSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-         subscriber = subSession.createDurableSubscriber(topic, "test", "Value = 'B'", false);
-
-         getLog().debug("Retrieving the non-existent B messages");
-         assertTrue("B should not be there", subscriber.receive(2000) == null);
-
-         getLog().debug("Closing the subscriber.");
-         subSession.close();
-
-         getLog().debug("Subscribing to topic, looking for those Value = 'A'");
-         subSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-         subscriber = subSession.createDurableSubscriber(topic, "test", "Value = 'A'", false);
-         assertTrue("Should not be any A the subscription was changed", subscriber.receive(2000) == null);
-         subSession.close();
-
-         getLog().debug("Subscribing to topic, looking for everything");
-         subSession = topicConnection.createTopicSession(false, Session.CLIENT_ACKNOWLEDGE);
-         subscriber = subSession.createDurableSubscriber(topic, "test", null, false);
-
-         message = sendSession.createTextMessage("Message4");
-         message.setStringProperty("Value", "A");
-         sender.publish(message);
-
-         message = subscriber.receive(2000);
-         assertTrue("Expected message 4", message != null);
-         assertTrue("Should be an A which we don't acknowledge", message.getStringProperty("Value").equals("A"));
-         subSession.close();
-
-         getLog().debug("Subscribing to topic, looking for the Value = 'A'");
-         subSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-         subscriber = subSession.createDurableSubscriber(topic, "test", "Value = 'A'", false);
-         assertTrue(
-            "Should not be any A, the subscription was changed. Even though the old and new selectors match the message",
-            subscriber.receive(2000) == null);
-         subSession.close();
-
-         getLog().debug("Closing the send session");
-         sendSession.close();
-
-         getLog().debug("Removing the subscription");
-         subSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-         subSession.unsubscribe("test");
-
-      }
-      finally
-      {
-         getLog().debug("Closing the connection");
-         topicConnection.close();
-      }
-
-      getLog().debug("TopicSelectorChange test passed");
-   }
-
-   /**
-    * Test subscribing to a topic with a null and empty selector
-    */
-   public void testTopicSelectorNullOrEmpty() throws Exception
-   {
-      getLog().debug("Starting TopicSelectorNullOrEmpty test");
-
-      getLog().debug("Create topic connection");
-      TopicConnectionFactory topicFactory = (TopicConnectionFactory) context.lookup(TOPIC_FACTORY);
-      topicConnection = topicFactory.createTopicConnection("john", "needle");
-      topicConnection.start();
-
-      try
-      {
-         getLog().debug("Retrieving Topic");
-         Topic topic = (Topic) context.lookup(TEST_DURABLE_TOPIC);
-
-         getLog().debug("Creating a send session");
-         TopicSession sendSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-         TopicPublisher sender = sendSession.createPublisher(topic);
-
-         getLog().debug("Clearing the topic");
-         TopicSession subSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-         TopicSubscriber subscriber = subSession.createDurableSubscriber(topic, "test");
-         TextMessage message = (TextMessage) subscriber.receive(50);
-         while (message != null)
-            message = (TextMessage) subscriber.receive(50);
-         subSession.close();
-
-         getLog().debug("Subscribing to topic, with null selector");
-         subSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-         subscriber = subSession.createDurableSubscriber(topic, "test", null, false);
-
-         getLog().debug("Send a message");
-         message = sendSession.createTextMessage("Message1");
-         sender.publish(message);
-
-         getLog().debug("Retrieving the message");
-         message = (TextMessage) subscriber.receive(2000);
-         assertTrue("Expected message 1", message != null);
-         assertTrue("Should get Message1", message.getText().equals("Message1"));
-         getLog().debug("Closing the subscriber");
-         subSession.close();
-
-         getLog().debug("Subscribing to topic, with an empty selector");
-         subSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-         subscriber = subSession.createDurableSubscriber(topic, "test", "   ", false);
-
-         getLog().debug("Send a message");
-         message = sendSession.createTextMessage("Message2");
-         sender.publish(message);
-
-         getLog().debug("Retrieving the message");
-         message = (TextMessage) subscriber.receive(2000);
-         assertTrue("Expected message 2", message != null);
-         assertTrue("Should get Message2", message.getText().equals("Message2"));
-         getLog().debug("Closing the subscriber");
-
-         getLog().debug("Removing the subscription");
-         subSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-         subSession.unsubscribe("test");
-         subSession.close();
-
-      }
-      finally
-      {
-         getLog().debug("Closing the connection");
-         topicConnection.close();
-      }
-
-      getLog().debug("TopicSelectorNullOrEmpty test passed");
-   }
-
-   /**
-    * Test sending/receiving an outdated message
-    */
-   public void testSendReceiveOutdated() throws Exception
-   {
-      getLog().debug("Starting SendReceiveOutdated test");
-
-      connect();
-      try
-      {
-         queueConnection.start();
-         drainQueue();
-         queueConnection.stop();
-
-         QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-         Queue queue = (Queue) context.lookup(TEST_QUEUE);
-         QueueSender sender = session.createSender(queue);
-         QueueReceiver receiver = session.createReceiver(queue);
-
-         // Send a message that has expired
-         TextMessage message = session.createTextMessage("Outdated");
-         sender.send(message, DeliveryMode.PERSISTENT, 4, 1);
-         Thread.sleep(100);
-
-         // Send a message that has not expired
-         message = session.createTextMessage("OK");
-         sender.send(message);
-
-         // Try to receive the message the not expired message
-         queueConnection.start();
-         message = (TextMessage) receiver.receiveNoWait();
-         assertEquals("OK", message.getText());
-
-         // Should be no more
-         assertTrue("Didn't expect anymore messages", receiver.receiveNoWait() == null);
-      }
-      finally
-      {
-         disconnect();
-      }
-
-      getLog().debug("SendReceiveOutdated test passed");
-   }
-
-   public void testSendReceiveExpired() throws Exception
-   {
-      getLog().debug("Starting testSendReceiveExpired test");
-
-      connect();
-      try
-      {
-         queueConnection.start();
-         drainQueue();
-
-         QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-         Queue queue = (Queue) context.lookup(TEST_QUEUE);
-         QueueSender sender = session.createSender(queue);
-         QueueReceiver receiver = session.createReceiver(queue);
-
-         // Send a message that expires in 5 seconds
-         TextMessage message = session.createTextMessage("5 Second Expiration");
-         sender.send(message, DeliveryMode.PERSISTENT, 4, 5*1000);
-         // Send a message that has not expired
-         message = session.createTextMessage("OK");
-         sender.send(message);
-         // Sleep 6 seconds
-         Thread.sleep(6*1000);
-         // Try to receive the OK message
-         message = (TextMessage) receiver.receiveNoWait();
-         assertEquals("OK", message.getText());
-
-         // Should be no more
-         assertTrue("Didn't expect anymore messages", receiver.receiveNoWait() == null);
-
-         // Send a message that expires in 10 seconds
-         message = session.createTextMessage("10 Second Expiration");
-         sender.send(message, DeliveryMode.PERSISTENT, 4, 10*1000);
-         // Send a message that has not expired
-         message = session.createTextMessage("OK");
-         sender.send(message);
-         // Sleep 1 seconds
-         Thread.sleep(1*1000);
-         // Try to receive the messages
-         message = (TextMessage) receiver.receiveNoWait();
-         assertEquals("10 Second Expiration", message.getText());
-         message = (TextMessage) receiver.receiveNoWait();
-         assertEquals("OK", message.getText());
-
-         // Should be no more
-         assertTrue("Didn't expect anymore messages", receiver.receiveNoWait() == null);
-         
-         // Test that JMSExpiration has no affect
-         message = session.createTextMessage("5 Second Expiration");
-         message.setJMSExpiration(System.currentTimeMillis() + 5*1000);
-         sender.send(message, DeliveryMode.PERSISTENT, 4, 0);
-         // Send a message that has not expired
-         message = session.createTextMessage("OK");
-         sender.send(message);
-         // Sleep 6 seconds
-         Thread.sleep(6*1000);
-         // Try to receive the OK message
-         message = (TextMessage) receiver.receiveNoWait();
-         assertEquals("5 Second Expiration", message.getText());
-         message = (TextMessage) receiver.receiveNoWait();
-         assertEquals("OK", message.getText());
-         assertTrue("Didn't expect anymore messages", receiver.receiveNoWait() == null);
-      }
-      finally
-      {
-         disconnect();
-      }
-   }
-
-   class Synch
-   {
-      boolean waiting = false;
-      String text;
-      public synchronized void doWait(long timeout) throws InterruptedException
-      {
-         waiting = true;
-         this.wait(timeout);
-      }
-      public synchronized void doNotify() throws InterruptedException
-      {
-         while (waiting == false)
-            wait(100);
-         this.notifyAll();
-      }
-      public String getText()
-      {
-         return text;
-      }
-      public void setText(String text)
-      {
-         this.text = text;
-      }
-   }
-
-   /**
-    * Test sending/listening an outdated message
-    */
-   public void testSendListenOutdated() throws Exception
-   {
-      getLog().debug("Starting SendListenOutdated test");
-
-      connect();
-      try
-      {
-         queueConnection.start();
-         drainQueue();
-         queueConnection.stop();
-
-         QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-         Queue queue = (Queue) context.lookup(TEST_QUEUE);
-         QueueSender sender = session.createSender(queue);
-         QueueReceiver receiver = session.createReceiver(queue);
-
-         // Send a message that has expired
-         TextMessage message = session.createTextMessage("Outdated");
-         sender.send(message, DeliveryMode.PERSISTENT, 4, 1);
-         Thread.sleep(100);
-
-         // Send a message that has not expired
-         message = session.createTextMessage("OK");
-         sender.send(message);
-
-         // Try to receive the message the not expired message
-         final Synch synch = new Synch();
-         MessageListener messagelistener = new MessageListener()
-         {
-            public void onMessage(Message message)
-            {
-               listenOutdated(message, synch);
-            }
-         };
-         receiver.setMessageListener(messagelistener);
-         queueConnection.start();
-
-         synch.doWait(10000);
-         assertEquals("OK", synch.getText());
-      }
-      finally
-      {
-         disconnect();
-      }
-
-      getLog().debug("SendListenOutdated test passed");
-   }
-
-   private void listenOutdated(Message message, Synch synch)
-   {
-      try
-      {
-         synch.setText(((TextMessage) message).getText());
-      }
-      catch (Throwable t)
-      {
-         log.error("Error:", t);
-      }
-      finally
-      {
-         try
-         {
-            synch.doNotify();
-         }
-         catch (Throwable t)
-         {
-            log.error("Error:", t);
-         }
-      }
-   }
-}

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/JBossJMSUnitTest.java (from rev 64641, branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/test/JBossJMSUnitTest.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/JBossJMSUnitTest.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/JBossJMSUnitTest.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,1355 @@
+/*
+  * 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 java.util.Enumeration;
+
+import javax.jms.DeliveryMode;
+import javax.jms.InvalidDestinationException;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.Queue;
+import javax.jms.QueueBrowser;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueReceiver;
+import javax.jms.QueueRequestor;
+import javax.jms.QueueSender;
+import javax.jms.QueueSession;
+import javax.jms.ServerSession;
+import javax.jms.ServerSessionPool;
+import javax.jms.Session;
+import javax.jms.TemporaryQueue;
+import javax.jms.TemporaryTopic;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+import javax.jms.TopicConnection;
+import javax.jms.TopicConnectionFactory;
+import javax.jms.TopicPublisher;
+import javax.jms.TopicSession;
+import javax.jms.TopicSubscriber;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.test.jbossmessaging.JMSTestCase;
+
+import EDU.oswego.cs.dl.util.concurrent.CountDown;
+
+/**
+ * Basic jms tests.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 64261 $
+ */
+public class JBossJMSUnitTest extends JMSTestCase
+{
+   /** The default TopicFactory jndi name */
+   static String TOPIC_FACTORY = "ConnectionFactory";
+   /** The default QueueFactory jndi name */
+   static String QUEUE_FACTORY = "ConnectionFactory";
+
+   static String TEST_QUEUE = "queue/testQueue";
+   static String TEST_TOPIC = "topic/testTopic";
+   static String TEST_DURABLE_TOPIC = "topic/testDurableTopic";
+
+   //JMSProviderAdapter providerAdapter;
+   static Context context;
+   static QueueConnection queueConnection;
+   static TopicConnection topicConnection;
+
+   public JBossJMSUnitTest(String name) throws Exception
+   {
+      super(name);
+   }
+
+   // Emptys out all the messages in a queue
+   protected void drainQueue() throws Exception
+   {
+      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+      Queue queue = (Queue) context.lookup(TEST_QUEUE);
+
+      QueueReceiver receiver = session.createReceiver(queue);
+      Message message = receiver.receive(50);
+      int c = 0;
+      while (message != null)
+      {
+         message = receiver.receive(50);
+         c++;
+      }
+
+      if (c != 0)
+         getLog().debug("  Drained " + c + " messages from the queue");
+
+      session.close();
+   }
+
+   protected void connect() throws Exception
+   {
+
+      if (context == null)
+      {
+
+         context = new InitialContext();
+
+      }
+      QueueConnectionFactory queueFactory = (QueueConnectionFactory) context.lookup(QUEUE_FACTORY);
+      queueConnection = queueFactory.createQueueConnection();
+
+      TopicConnectionFactory topicFactory = (TopicConnectionFactory) context.lookup(TOPIC_FACTORY);
+      topicConnection = topicFactory.createTopicConnection();
+
+      getLog().debug("Connection to spyderMQ established.");
+
+   }
+
+   protected void disconnect() throws Exception
+   {
+	  if (queueConnection != null)
+	  {
+	      queueConnection.close();
+	      queueConnection = null;
+	  }
+	  
+	  if (topicConnection != null)
+	  {
+	      topicConnection.close();
+	      topicConnection = null;
+	  }
+   }
+   
+   protected void tearDown() throws Exception
+   {
+	   super.tearDown();
+	   disconnect();
+   }
+
+   /**
+    * Test that messages are ordered by message arrival and priority.
+    * This also tests :
+    * 		Using a non-transacted AUTO_ACKNOWLEDGE session
+    *		Using a QueueReceiver
+    *		Using a QueueSender
+    *			Sending PERSITENT and NON_PERSISTENT text messages.
+    *		Using a QueueBrowser
+    */
+   public void testQueueMessageOrder() throws Exception
+   {
+
+      getLog().debug("Starting QueueMessageOrder test");
+
+      connect();
+
+      queueConnection.start();
+
+      drainQueue();
+
+      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+      Queue queue = (Queue) context.lookup(TEST_QUEUE);
+      QueueSender sender = session.createSender(queue);
+
+      TextMessage message = session.createTextMessage();
+      message.setText("Normal message");
+      sender.send(message, DeliveryMode.NON_PERSISTENT, 4, 0);
+      //sender.send(queue, message, DeliveryMode.NON_PERSISTENT, 4, 0);
+      message.setText("Persistent message");
+      sender.send(message, DeliveryMode.PERSISTENT, 4, 0);
+      //sender.send(queue, message, DeliveryMode.PERSISTENT, 4, 0);
+      message.setText("High Priority Persistent message");
+      sender.send(message, DeliveryMode.PERSISTENT, 10, 0);
+      //sender.send(queue, message, DeliveryMode.PERSISTENT, 10, 0);
+
+      //message.setText("Expiring Persistent message");
+      //sender.send(queue, message, DeliveryMode.NON_PERSISTENT, 4, 1);
+
+      QueueBrowser browser = session.createBrowser(queue);
+      Enumeration i = browser.getEnumeration();
+      //message = (TextMessage)enum.nextElement();
+      //if( !message.getText().equals("High Priority Persistent message") )
+      //	throw new Exception("Queue is not prioritizing messages correctly. Unexpected Message:"+message);
+      getLog().debug(message.getText());
+
+      message = (TextMessage) i.nextElement();
+      //if( !message.getText().equals("Normal message") )
+      //	throw new Exception("Queue is not ordering messages correctly. Unexpected Message:"+message);
+      getLog().debug(message.getText());
+
+      message = (TextMessage) i.nextElement();
+      //if( !message.getText().equals("Persistent message") )
+      //	throw new Exception("Queue is not ordering messages correctly. Unexpected Message:"+message);
+      getLog().debug(message.getText());
+
+      // if( enum.hasMoreElements() )
+      //	throw new Exception("Queue does not expire messages correctly. Unexpected Message:"+enum.nextElement());
+
+      disconnect();
+      getLog().debug("QueueMessageOrder passed");
+   }
+
+   /**
+    * Test that a using QueueRequestor works.
+    * this also tests that :
+    *		temporary queues work.
+    */
+   public void testRequestReplyQueue() throws Exception
+   {
+
+      getLog().debug("Starting RequestReplyQueue test");
+      connect();
+
+      {
+         queueConnection.start();
+         drainQueue();
+      }
+
+      Thread serverThread = new Thread()
+      {
+         public void run()
+         {
+            Logger log = Logger.getLogger(getClass().getName());
+            try
+            {
+               log.debug("Server Thread Started");
+               QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+               Queue queue = (Queue) context.lookup(TEST_QUEUE);
+
+               QueueReceiver queueReceiver = session.createReceiver(queue);
+
+               boolean done = false;
+               while (!done)
+               {
+                  TextMessage message = (TextMessage) queueReceiver.receive();
+                  Queue tempQueue = (Queue) message.getJMSReplyTo();
+
+                  QueueSender replySender = session.createSender(tempQueue);
+                  TextMessage reply = session.createTextMessage();
+                  reply.setText("Request Processed");
+                  reply.setJMSCorrelationID(message.getJMSMessageID());
+                  replySender.send(reply);
+
+                  if (message.getText().equals("Quit"))
+                     done = true;
+               }
+
+               session.close();
+               log.debug("Server Thread Finished");
+
+            }
+            catch (Exception e)
+            {
+               log.error("Error", e);
+            }
+         }
+      };
+
+      serverThread.start();
+
+      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+      Queue queue = (Queue) context.lookup(TEST_QUEUE);
+
+      QueueRequestor queueRequestor = new QueueRequestor(session, queue);
+      TextMessage message = session.createTextMessage();
+      message.setText("Request Test");
+
+      for (int i = 0; i < 5; i++)
+      {
+
+         getLog().debug("Making client request #" + i);
+         TextMessage reply = (TextMessage) queueRequestor.request(message);
+         String replyID = new String(reply.getJMSCorrelationID());
+         if (!replyID.equals(message.getJMSMessageID()))
+            throw new Exception("REQUEST: ERROR: Reply does not match sent message");
+
+      }
+
+      getLog().debug("Making client request to shut server down.");
+      message.setText("Quit");
+      queueRequestor.request(message);
+
+      serverThread.join();
+      disconnect();
+
+      getLog().debug("RequestReplyQueue passed");
+   }
+
+   /**
+    * Test that temporary queues can be deleted.
+    */
+   public void testTemporaryQueueDelete() throws Exception
+   {
+
+      getLog().debug("Starting TemporaryQueueDelete test");
+      connect();
+
+      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+      TemporaryQueue queue = session.createTemporaryQueue();
+
+      queue.delete();
+
+      disconnect();
+
+      getLog().debug("TemporaryQueueDelete passed");
+   }
+
+   /**
+    * Test that temporary topics can be deleted.
+    */
+   public void testTemporaryTopicDelete() throws Exception
+   {
+
+      getLog().debug("Starting TemporaryTopicDelete test");
+      connect();
+
+      TopicSession session = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+      TemporaryTopic topic = session.createTemporaryTopic();
+
+      topic.delete();
+
+      disconnect();
+
+      getLog().debug("TemporaryTopicDelete passed");
+   }
+
+   /**
+    * Test invalid destination trying to send a message.
+    */
+   public void testInvalidDestinationQueueSend() throws Exception
+   {
+
+      getLog().debug("Starting InvaidDestinationQueueSend test");
+      connect();
+
+      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+      TemporaryQueue queue = session.createTemporaryQueue();
+      QueueSender sender = session.createSender(queue);
+      queue.delete();
+
+      TextMessage message = session.createTextMessage("hello");
+      boolean caught = false;
+      try
+      {
+         sender.send(message);
+      }
+      catch (InvalidDestinationException expected)
+      {
+         caught = true;
+      }
+
+      disconnect();
+
+      assertTrue("Expected an InvalidDestinationException", caught);
+
+      getLog().debug("InvaldDestinationQueueSend passed");
+   }
+
+   /**
+    * Test invalid destination trying to browse a message.
+    */
+   public void testInvalidDestinationQueueBrowse() throws Exception
+   {
+
+      getLog().debug("Starting InvalidDestinationQueueBrowse test");
+      connect();
+
+      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+      TemporaryQueue queue = session.createTemporaryQueue();
+      QueueBrowser browser = session.createBrowser(queue);
+      queue.delete();
+
+      boolean caught = false;
+      try
+      {
+         browser.getEnumeration();
+      }
+      catch (InvalidDestinationException expected)
+      {
+         caught = true;
+      }
+
+      disconnect();
+
+      assertTrue("Expected an InvalidDestinationException", caught);
+
+      getLog().debug("InvalidDestinationQueueBrowse passed");
+   }
+
+   /**
+    * Test invalid destination trying to send a message.
+    */
+   public void testInvalidDestinationTopicPublish() throws Exception
+   {
+
+      getLog().debug("Starting InvaidDestinationTopicPublish test");
+      connect();
+
+      TopicSession session = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+      TemporaryTopic topic = session.createTemporaryTopic();
+      TopicPublisher publisher = session.createPublisher(topic);
+      topic.delete();
+
+      TextMessage message = session.createTextMessage("hello");
+      boolean caught = false;
+      try
+      {
+         publisher.publish(message);
+      }
+      catch (InvalidDestinationException expected)
+      {
+         caught = true;
+      }
+
+      disconnect();
+
+      assertTrue("Expected an InvalidDestinationException", caught);
+
+      getLog().debug("InvaldDestinationTopicPublish passed");
+   }
+
+   /**
+    * Test errors trying on topic subscribe.
+    */
+   public void testErrorsTopicSubscribe() throws Exception
+   {
+
+      getLog().debug("Starting InvalidDestinationTopicSubscribe test");
+      connect();
+
+      try
+      {
+         TopicSession session = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+         Topic topic = (Topic) context.lookup(TEST_TOPIC);
+         TemporaryTopic temp = session.createTemporaryTopic();
+
+         boolean caught = false;
+         try
+         {
+            session.createSubscriber(null);
+         }
+         catch (InvalidDestinationException expected)
+         {
+            caught = true;
+         }
+         assertTrue("Expected an InvalidDestinationException for a null topic", caught);
+
+         caught = false;
+         try
+         {
+            session.createSubscriber(null, null, true);
+         }
+         catch (InvalidDestinationException expected)
+         {
+            caught = true;
+         }
+         assertTrue("Expected an InvalidDestinationException for a null topic", caught);
+
+         caught = false;
+         try
+         {
+            session.createDurableSubscriber(null, "NotUsed");
+         }
+         catch (InvalidDestinationException expected)
+         {
+            caught = true;
+         }
+         assertTrue("Expected an InvalidDestinationException for a null topic", caught);
+
+         caught = false;
+         try
+         {
+            session.createDurableSubscriber(temp, "NotUsed");
+         }
+         catch (InvalidDestinationException expected)
+         {
+            caught = true;
+         }
+         assertTrue("Expected an InvalidDestinationException for a temporary topic", caught);
+
+         caught = false;
+         try
+         {
+            session.createDurableSubscriber(null, "NotUsed", null, true);
+         }
+         catch (InvalidDestinationException expected)
+         {
+            caught = true;
+         }
+         assertTrue("Expected an InvalidDestinationException for a null topic", caught);
+
+         caught = false;
+         try
+         {
+            session.createDurableSubscriber(temp, "NotUsed", null, true);
+         }
+         catch (InvalidDestinationException expected)
+         {
+            caught = true;
+         }
+         assertTrue("Expected an InvalidDestinationException for a temporary topic", caught);
+
+         caught = false;
+         try
+         {
+            session.createDurableSubscriber(topic, null);
+         }
+         catch (Exception expected)
+         {
+            caught = true;
+         }
+         assertTrue("Expected a Exception for a null subscription", caught);
+
+         caught = false;
+         try
+         {
+            session.createDurableSubscriber(topic, null, null, false);
+         }
+         catch (Exception expected)
+         {
+            caught = true;
+         }
+         assertTrue("Expected a Exception for a null subscription", caught);
+
+         caught = false;
+         try
+         {
+            session.createDurableSubscriber(topic, "  ");
+         }
+         catch (Exception expected)
+         {
+            caught = true;
+         }
+         assertTrue("Expected a Exception for an empty subscription", caught);
+
+         caught = false;
+         try
+         {
+            session.createDurableSubscriber(topic, "  ", null, false);
+         }
+         catch (Exception expected)
+         {
+            caught = true;
+         }
+         assertTrue("Expected a Exception for an empty subscription", caught);
+      }
+      finally
+      {
+         disconnect();
+      }
+
+      getLog().debug("InvalidDestinationTopicSubscriber passed");
+   }
+
+   /**
+    * Test create queue.
+    */
+   public void testCreateQueue() throws Exception
+   {
+
+      getLog().debug("Starting create queue test");
+      connect();
+
+      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+
+      Queue jndiQueue = (Queue) getInitialContext().lookup("queue/testQueue");
+      Queue createQueue = session.createQueue(jndiQueue.getQueueName());
+      assertTrue("Failed for " + QUEUE_FACTORY, jndiQueue.equals(createQueue));
+
+      getLog().debug("InvalidDestinationTopicSubscriber passed");
+   }
+
+   public void testMessageListener() throws Exception
+   {
+      getLog().debug("Starting create queue test");
+
+      connect();
+      queueConnection.start();
+      drainQueue();
+      final CountDown counter1 = new CountDown(3);
+
+      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+      Queue queue = (Queue) context.lookup(TEST_QUEUE);
+
+      QueueReceiver receiver = session.createReceiver(queue);
+      receiver.setMessageListener(new MessageListener()
+      {
+         public void onMessage(Message msg)
+         {
+            Logger log = Logger.getLogger(getClass().getName());
+            log.debug("ML");
+            try
+            {
+               if (msg instanceof TextMessage)
+               {
+                  log.debug(((TextMessage) msg).getText());
+                  counter1.release();
+               }
+            }
+            catch (Exception e)
+            {
+            }
+         }
+      });
+
+      QueueSender sender = session.createSender(queue);
+
+      TextMessage message = session.createTextMessage();
+      message.setText("Normal message");
+      sender.send(message, DeliveryMode.NON_PERSISTENT, 4, 0);
+      //sender.send(queue, message, DeliveryMode.NON_PERSISTENT, 4, 0);
+      message.setText("Persistent message");
+      sender.send(message, DeliveryMode.PERSISTENT, 4, 0);
+      //sender.send(queue, message, DeliveryMode.PERSISTENT, 4, 0);
+      message.setText("High Priority Persistent message");
+      sender.send(message, DeliveryMode.PERSISTENT, 10, 0);
+      //sender.send(queue, message, DeliveryMode.PERSISTENT, 10, 0);
+
+      // Wait for the msgs to be received
+      counter1.acquire();
+      log.debug("MessageListener1 received the TMs sent");
+
+      final CountDown counter2 = new CountDown(2);
+      receiver.setMessageListener(new MessageListener()
+      {
+         public void onMessage(Message msg)
+         {
+            Logger log = Logger.getLogger(getClass().getName());
+            log.debug("ML 2");
+            try
+            {
+               if (msg instanceof TextMessage)
+               {
+                  log.debug(((TextMessage) msg).getText());
+                  counter2.release();
+               }
+            }
+            catch (Exception e)
+            {
+            }
+         }
+      });
+
+      message.setText("Persistent message");
+      sender.send(message, DeliveryMode.PERSISTENT, 4, 0);
+      //sender.send(queue, message, DeliveryMode.PERSISTENT, 4, 0);
+      message.setText("High Priority Persistent message");
+      sender.send(message, DeliveryMode.PERSISTENT, 10, 0);
+      //sender.send(queue, message, DeliveryMode.PERSISTENT, 10, 0);
+
+      // Wait for the msgs to be received
+      counter2.acquire();
+      log.debug("MessageListener2 received the TMs sent");
+
+      receiver.setMessageListener(null);
+
+      message.setText("Persistent message");
+      sender.send(message, DeliveryMode.PERSISTENT, 4, 0);
+      //sender.send(queue, message, DeliveryMode.PERSISTENT, 4, 0);
+      message.setText("High Priority Persistent message");
+      sender.send(message, DeliveryMode.PERSISTENT, 10, 0);
+      //sender.send(queue, message, DeliveryMode.PERSISTENT, 10, 0);
+
+      sender.close();
+      drainQueue();
+      disconnect();
+      getLog().debug("MessageListener test passed");
+   }
+
+   public void testApplicationServerStuff() throws Exception
+   {
+      getLog().debug("Starting testing app server stuff");
+      connect();
+
+      Queue testQueue = (Queue) context.lookup(TEST_QUEUE);
+      final QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+
+      session.setMessageListener(new MessageListener()
+      {
+         public void onMessage(Message mess)
+         {
+            Logger log = Logger.getLogger(getClass().getName());
+            log.debug("Processing message");
+            try
+            {
+               if (mess instanceof TextMessage)
+                  log.debug(((TextMessage) mess).getText());
+            }
+            catch (Exception e)
+            {
+               log.error("Error", e);
+            }
+         }
+      });
+
+      QueueSender sender = session.createSender(testQueue);
+      sender.send(session.createTextMessage("Hi"));
+      sender.send(session.createTextMessage("There"));
+      sender.send(session.createTextMessage("Guys"));
+      queueConnection.createConnectionConsumer(testQueue, null, new ServerSessionPool()
+      {
+         public ServerSession getServerSession()
+         {
+            Logger.getLogger(getClass().getName()).debug("Getting server session.");
+            return new ServerSession()
+            {
+               public Session getSession()
+               {
+                  return session;
+               }
+               public void start()
+               {
+                  Logger.getLogger(getClass().getName()).debug("Starting server session.");
+                  session.run();
+               }
+            };
+         }
+      }, 10);
+
+      queueConnection.start();
+
+      try
+      {
+         Thread.sleep(5 * 1000);
+      }
+      catch (Exception e)
+      {
+      }
+
+      disconnect();
+      getLog().debug("Testing app server stuff passed");
+   }
+
+   //simply put a few messages on the test queue for next time.
+   /*   public void testPM() throws Exception
+      {
+         getLog().debug("Starting testing pm");
+         connect();
+         
+         Queue testQueue = (Queue)context.lookup(TEST_QUEUE);
+         QueueSession session = queueConnection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
+         QueueSender sender = session.createSender(testQueue);
+         sender.send(session.createTextMessage("From last time"));
+         sender.send(session.createTextMessage("From last time"));
+         sender.send(session.createTextMessage("From last time"));
+         sender.close();
+         session.close();
+         disconnect();
+         getLog().debug("Testing pm stuff passed");
+      }
+   */
+   private void drainMessagesForTopic(TopicSubscriber sub) throws JMSException
+   {
+      Message msg = sub.receive(50);
+      int c = 0;
+      while (msg != null)
+      {
+         c++;
+         if (msg instanceof TextMessage)
+            getLog().debug(((TextMessage) msg).getText());
+         msg = sub.receive(50);
+      }
+      getLog().debug("Received " + c + " messages from topic.");
+   }
+
+   public void testTopics() throws Exception
+   {
+      getLog().debug("Starting Topic test");
+      connect();
+
+      TopicConnectionFactory topicFactory = (TopicConnectionFactory) context.lookup(TOPIC_FACTORY);
+      topicConnection = topicFactory.createTopicConnection("john", "needle");
+
+      topicConnection.start();
+
+      //set up some subscribers to the topic
+      TopicSession session = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+      Topic topic = (Topic) context.lookup(TEST_TOPIC);
+
+      TopicSubscriber sub1 = session.createDurableSubscriber(topic, "sub1");
+      TopicSubscriber sub2 = session.createSubscriber(topic);
+      TopicSubscriber sub3 = session.createSubscriber(topic);
+
+      //Now a sender
+      TopicPublisher sender = session.createPublisher(topic);
+
+      //send some messages
+      sender.publish(session.createTextMessage("Message 1"));
+      sender.publish(session.createTextMessage("Message 2"));
+      sender.publish(session.createTextMessage("Message 3"));
+      drainMessagesForTopic(sub1);
+      drainMessagesForTopic(sub2);
+      drainMessagesForTopic(sub3);
+
+      //close some subscribers
+      sub1.close();
+      sub2.close();
+
+      //send some more messages
+      sender.publish(session.createTextMessage("Message 4"));
+      sender.publish(session.createTextMessage("Message 5"));
+      sender.publish(session.createTextMessage("Message 6"));
+
+      //give time for message 4 to be negatively acked (as it will be cause last receive timed out)
+      try
+      {
+         Thread.sleep(5 * 1000);
+      }
+      catch (InterruptedException e)
+      {
+      }
+
+      drainMessagesForTopic(sub3);
+
+      //open subscribers again.
+      sub1 = session.createDurableSubscriber(topic, "sub1");
+      sub2 = session.createSubscriber(topic);
+
+      //Send a final message
+      sender.publish(session.createTextMessage("Final message"));
+      sender.close();
+
+      drainMessagesForTopic(sub1);
+      drainMessagesForTopic(sub2);
+      drainMessagesForTopic(sub3);
+
+      sub1.close();
+      sub2.close();
+      sub3.close();
+
+      session.unsubscribe("sub1");
+
+      topicConnection.stop();
+      topicConnection.close();
+
+      disconnect();
+      getLog().debug("Topic test passed");
+   }
+
+   /**
+    * Test to seeif the NoLocal feature of topics works.
+    * Messages published from the same connection should not
+    * be received by Subscribers on the same connection.
+    */
+   public void testTopicNoLocal() throws Exception
+   {
+      getLog().debug("Starting TopicNoLocal test");
+      connect();
+
+      TopicConnectionFactory topicFactory = (TopicConnectionFactory) context.lookup(TOPIC_FACTORY);
+      TopicConnection topicConnection1 = topicFactory.createTopicConnection();
+      topicConnection1.start();
+      TopicConnection topicConnection2 = topicFactory.createTopicConnection();
+      topicConnection2.start();
+
+      // We don't want local messages on this topic.
+      TopicSession session1 = topicConnection1.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+      Topic topic = (Topic) context.lookup(TEST_TOPIC);
+      TopicSubscriber subscriber1 = session1.createSubscriber(topic, null, true);
+      TopicPublisher sender1 = session1.createPublisher(topic);
+
+      //Now a sender
+      TopicSession session2 = topicConnection2.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+      TopicPublisher sender2 = session2.createPublisher(topic);
+
+      drainMessagesForTopic(subscriber1);
+
+      //send some messages
+      sender1.publish(session1.createTextMessage("Local Message"));
+      sender2.publish(session2.createTextMessage("Remote Message"));
+
+      // Get the messages, we should get the remote message
+      // but not the local message
+      TextMessage msg1 = (TextMessage) subscriber1.receive(2000);
+      if (msg1 == null)
+      {
+         fail("Did not get any messages");
+      }
+      else
+      {
+         getLog().debug("Got message: " + msg1);
+         if (msg1.getText().equals("Local Message"))
+         {
+            fail("Got a local message");
+         }
+         TextMessage msg2 = (TextMessage) subscriber1.receive(2000);
+         if (msg2 != null)
+         {
+            getLog().debug("Got message: " + msg2);
+            fail("Got an extra message.  msg1:" + msg1 + ", msg2:" + msg2);
+         }
+      }
+
+      topicConnection1.stop();
+      topicConnection1.close();
+      topicConnection2.stop();
+      topicConnection2.close();
+
+      disconnect();
+      getLog().debug("TopicNoLocal test passed");
+   }
+
+   /**
+    * Test to see whether no local works if a message
+    * was created somewhere else.
+    */
+   public void testTopicNoLocalBounce() throws Exception
+   {
+      getLog().debug("Starting TopicNoLocalBounce test");
+      connect();
+
+      TopicConnectionFactory topicFactory = (TopicConnectionFactory) context.lookup(TOPIC_FACTORY);
+      TopicConnection topicConnection1 = topicFactory.createTopicConnection();
+      topicConnection1.start();
+      TopicConnection topicConnection2 = topicFactory.createTopicConnection();
+      topicConnection2.start();
+
+      // Session 1
+      TopicSession session1 = topicConnection1.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+      Topic topic = (Topic) context.lookup(TEST_TOPIC);
+      TopicSubscriber subscriber1 = session1.createSubscriber(topic, null, true);
+      TopicPublisher sender1 = session1.createPublisher(topic);
+
+      // Session 2
+      TopicSession session2 = topicConnection2.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+      TopicSubscriber subscriber2 = session2.createSubscriber(topic, null, true);
+      TopicPublisher sender2 = session2.createPublisher(topic);
+
+      drainMessagesForTopic(subscriber1);
+      drainMessagesForTopic(subscriber2);
+
+      //send the message
+      sender1.publish(session1.createTextMessage("Message"));
+
+      assertTrue("Subscriber1 should not get a message", subscriber1.receiveNoWait() == null);
+      TextMessage msg = (TextMessage) subscriber2.receive(2000);
+      assertTrue("Subscriber2 should get a message, got " + msg, msg != null && msg.getText().equals("Message"));
+
+      //send it back
+      sender2.publish(msg);
+
+      msg = (TextMessage) subscriber1.receive(2000);
+      assertTrue("Subscriber1 should get a message, got " + msg, msg != null && msg.getText().equals("Message"));
+      assertTrue("Subscriber2 should not get a message", subscriber2.receiveNoWait() == null);
+
+      topicConnection1.stop();
+      topicConnection1.close();
+      topicConnection2.stop();
+      topicConnection2.close();
+
+      disconnect();
+      getLog().debug("TopicNoLocalBounce test passed");
+   }
+
+   /**
+    * Test subscribing to a topic with one selector, then changing to another
+    */
+   public void testTopicSelectorChange() throws Exception
+   {
+      getLog().debug("Starting TopicSelectorChange test");
+
+      getLog().debug("Create topic connection");
+      TopicConnectionFactory topicFactory = (TopicConnectionFactory) context.lookup(TOPIC_FACTORY);
+      topicConnection = topicFactory.createTopicConnection("john", "needle");
+      topicConnection.start();
+
+      try
+      {
+         getLog().debug("Retrieving Topic");
+         Topic topic = (Topic) context.lookup(TEST_DURABLE_TOPIC);
+
+         getLog().debug("Creating a send session");
+         TopicSession sendSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+         TopicPublisher sender = sendSession.createPublisher(topic);
+
+         getLog().debug("Clearing the topic");
+         TopicSession subSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+         TopicSubscriber subscriber = subSession.createDurableSubscriber(topic, "test");
+         Message message = subscriber.receive(50);
+         while (message != null)
+            message = subscriber.receive(50);
+         subSession.close();
+
+         getLog().debug("Subscribing to topic, looking for Value = 'A'");
+         subSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+         subscriber = subSession.createDurableSubscriber(topic, "test", "Value = 'A'", false);
+
+         getLog().debug("Send some messages");
+         message = sendSession.createTextMessage("Message1");
+         message.setStringProperty("Value", "A");
+         sender.publish(message);
+         message = sendSession.createTextMessage("Message2");
+         message.setStringProperty("Value", "A");
+         sender.publish(message);
+         message = sendSession.createTextMessage("Message3");
+         message.setStringProperty("Value", "B");
+         sender.publish(message);
+
+         getLog().debug("Retrieving the A messages");
+         message = subscriber.receive(2000);
+         assertTrue("Expected message 1", message != null);
+         assertTrue("Should get an A", message.getStringProperty("Value").equals("A"));
+         message = subscriber.receive(2000);
+         assertTrue("Expected message 2", message != null);
+         assertTrue("Should get a second A", message.getStringProperty("Value").equals("A"));
+         assertTrue("That should be it for A", subscriber.receive(2000) == null);
+
+         getLog().debug("Closing the subscriber without acknowledgement");
+         subSession.close();
+
+         getLog().debug("Subscribing to topic, looking for Value = 'B'");
+         subSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+         subscriber = subSession.createDurableSubscriber(topic, "test", "Value = 'B'", false);
+
+         getLog().debug("Retrieving the non-existent B messages");
+         assertTrue("B should not be there", subscriber.receive(2000) == null);
+
+         getLog().debug("Closing the subscriber.");
+         subSession.close();
+
+         getLog().debug("Subscribing to topic, looking for those Value = 'A'");
+         subSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+         subscriber = subSession.createDurableSubscriber(topic, "test", "Value = 'A'", false);
+         assertTrue("Should not be any A the subscription was changed", subscriber.receive(2000) == null);
+         subSession.close();
+
+         getLog().debug("Subscribing to topic, looking for everything");
+         subSession = topicConnection.createTopicSession(false, Session.CLIENT_ACKNOWLEDGE);
+         subscriber = subSession.createDurableSubscriber(topic, "test", null, false);
+
+         message = sendSession.createTextMessage("Message4");
+         message.setStringProperty("Value", "A");
+         sender.publish(message);
+
+         message = subscriber.receive(2000);
+         assertTrue("Expected message 4", message != null);
+         assertTrue("Should be an A which we don't acknowledge", message.getStringProperty("Value").equals("A"));
+         subSession.close();
+
+         getLog().debug("Subscribing to topic, looking for the Value = 'A'");
+         subSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+         subscriber = subSession.createDurableSubscriber(topic, "test", "Value = 'A'", false);
+         assertTrue(
+            "Should not be any A, the subscription was changed. Even though the old and new selectors match the message",
+            subscriber.receive(2000) == null);
+         subSession.close();
+
+         getLog().debug("Closing the send session");
+         sendSession.close();
+
+         getLog().debug("Removing the subscription");
+         subSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+         subSession.unsubscribe("test");
+
+      }
+      finally
+      {
+         getLog().debug("Closing the connection");
+         topicConnection.close();
+      }
+
+      getLog().debug("TopicSelectorChange test passed");
+   }
+
+   /**
+    * Test subscribing to a topic with a null and empty selector
+    */
+   public void testTopicSelectorNullOrEmpty() throws Exception
+   {
+      getLog().debug("Starting TopicSelectorNullOrEmpty test");
+
+      getLog().debug("Create topic connection");
+      TopicConnectionFactory topicFactory = (TopicConnectionFactory) context.lookup(TOPIC_FACTORY);
+      topicConnection = topicFactory.createTopicConnection("john", "needle");
+      topicConnection.start();
+
+      try
+      {
+         getLog().debug("Retrieving Topic");
+         Topic topic = (Topic) context.lookup(TEST_DURABLE_TOPIC);
+
+         getLog().debug("Creating a send session");
+         TopicSession sendSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+         TopicPublisher sender = sendSession.createPublisher(topic);
+
+         getLog().debug("Clearing the topic");
+         TopicSession subSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+         TopicSubscriber subscriber = subSession.createDurableSubscriber(topic, "test");
+         TextMessage message = (TextMessage) subscriber.receive(50);
+         while (message != null)
+            message = (TextMessage) subscriber.receive(50);
+         subSession.close();
+
+         getLog().debug("Subscribing to topic, with null selector");
+         subSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+         subscriber = subSession.createDurableSubscriber(topic, "test", null, false);
+
+         getLog().debug("Send a message");
+         message = sendSession.createTextMessage("Message1");
+         sender.publish(message);
+
+         getLog().debug("Retrieving the message");
+         message = (TextMessage) subscriber.receive(2000);
+         assertTrue("Expected message 1", message != null);
+         assertTrue("Should get Message1", message.getText().equals("Message1"));
+         getLog().debug("Closing the subscriber");
+         subSession.close();
+
+         getLog().debug("Subscribing to topic, with an empty selector");
+         subSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+         subscriber = subSession.createDurableSubscriber(topic, "test", "   ", false);
+
+         getLog().debug("Send a message");
+         message = sendSession.createTextMessage("Message2");
+         sender.publish(message);
+
+         getLog().debug("Retrieving the message");
+         message = (TextMessage) subscriber.receive(2000);
+         assertTrue("Expected message 2", message != null);
+         assertTrue("Should get Message2", message.getText().equals("Message2"));
+         getLog().debug("Closing the subscriber");
+
+         getLog().debug("Removing the subscription");
+         subSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+         subSession.unsubscribe("test");
+         subSession.close();
+
+      }
+      finally
+      {
+         getLog().debug("Closing the connection");
+         topicConnection.close();
+      }
+
+      getLog().debug("TopicSelectorNullOrEmpty test passed");
+   }
+
+   /**
+    * Test sending/receiving an outdated message
+    */
+   public void testSendReceiveOutdated() throws Exception
+   {
+      getLog().debug("Starting SendReceiveOutdated test");
+
+      connect();
+      try
+      {
+         queueConnection.start();
+         drainQueue();
+         queueConnection.stop();
+
+         QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+         Queue queue = (Queue) context.lookup(TEST_QUEUE);
+         QueueSender sender = session.createSender(queue);
+         QueueReceiver receiver = session.createReceiver(queue);
+
+         // Send a message that has expired
+         TextMessage message = session.createTextMessage("Outdated");
+         sender.send(message, DeliveryMode.PERSISTENT, 4, 1);
+         Thread.sleep(100);
+
+         // Send a message that has not expired
+         message = session.createTextMessage("OK");
+         sender.send(message);
+
+         // Try to receive the message the not expired message
+         queueConnection.start();
+         message = (TextMessage) receiver.receiveNoWait();
+         assertEquals("OK", message.getText());
+
+         // Should be no more
+         assertTrue("Didn't expect anymore messages", receiver.receiveNoWait() == null);
+      }
+      finally
+      {
+         disconnect();
+      }
+
+      getLog().debug("SendReceiveOutdated test passed");
+   }
+
+   public void testSendReceiveExpired() throws Exception
+   {
+      getLog().debug("Starting testSendReceiveExpired test");
+
+      connect();
+      try
+      {
+         queueConnection.start();
+         drainQueue();
+
+         QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+         Queue queue = (Queue) context.lookup(TEST_QUEUE);
+         QueueSender sender = session.createSender(queue);
+         QueueReceiver receiver = session.createReceiver(queue);
+
+         // Send a message that expires in 5 seconds
+         TextMessage message = session.createTextMessage("5 Second Expiration");
+         sender.send(message, DeliveryMode.PERSISTENT, 4, 5*1000);
+         // Send a message that has not expired
+         message = session.createTextMessage("OK");
+         sender.send(message);
+         // Sleep 6 seconds
+         Thread.sleep(6*1000);
+         // Try to receive the OK message
+         message = (TextMessage) receiver.receiveNoWait();
+         assertEquals("OK", message.getText());
+
+         // Should be no more
+         assertTrue("Didn't expect anymore messages", receiver.receiveNoWait() == null);
+
+         // Send a message that expires in 10 seconds
+         message = session.createTextMessage("10 Second Expiration");
+         sender.send(message, DeliveryMode.PERSISTENT, 4, 10*1000);
+         // Send a message that has not expired
+         message = session.createTextMessage("OK");
+         sender.send(message);
+         // Sleep 1 seconds
+         Thread.sleep(1*1000);
+         // Try to receive the messages
+         message = (TextMessage) receiver.receiveNoWait();
+         assertEquals("10 Second Expiration", message.getText());
+         message = (TextMessage) receiver.receiveNoWait();
+         assertEquals("OK", message.getText());
+
+         // Should be no more
+         assertTrue("Didn't expect anymore messages", receiver.receiveNoWait() == null);
+         
+         // Test that JMSExpiration has no affect
+         message = session.createTextMessage("5 Second Expiration");
+         message.setJMSExpiration(System.currentTimeMillis() + 5*1000);
+         sender.send(message, DeliveryMode.PERSISTENT, 4, 0);
+         // Send a message that has not expired
+         message = session.createTextMessage("OK");
+         sender.send(message);
+         // Sleep 6 seconds
+         Thread.sleep(6*1000);
+         // Try to receive the OK message
+         message = (TextMessage) receiver.receiveNoWait();
+         assertEquals("5 Second Expiration", message.getText());
+         message = (TextMessage) receiver.receiveNoWait();
+         assertEquals("OK", message.getText());
+         assertTrue("Didn't expect anymore messages", receiver.receiveNoWait() == null);
+      }
+      finally
+      {
+         disconnect();
+      }
+   }
+
+   class Synch
+   {
+      boolean waiting = false;
+      String text;
+      public synchronized void doWait(long timeout) throws InterruptedException
+      {
+         waiting = true;
+         this.wait(timeout);
+      }
+      public synchronized void doNotify() throws InterruptedException
+      {
+         while (waiting == false)
+            wait(100);
+         this.notifyAll();
+      }
+      public String getText()
+      {
+         return text;
+      }
+      public void setText(String text)
+      {
+         this.text = text;
+      }
+   }
+
+   /**
+    * Test sending/listening an outdated message
+    */
+   public void testSendListenOutdated() throws Exception
+   {
+      getLog().debug("Starting SendListenOutdated test");
+
+      connect();
+      try
+      {
+         queueConnection.start();
+         drainQueue();
+         queueConnection.stop();
+
+         QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+         Queue queue = (Queue) context.lookup(TEST_QUEUE);
+         QueueSender sender = session.createSender(queue);
+         QueueReceiver receiver = session.createReceiver(queue);
+
+         // Send a message that has expired
+         TextMessage message = session.createTextMessage("Outdated");
+         sender.send(message, DeliveryMode.PERSISTENT, 4, 1);
+         Thread.sleep(100);
+
+         // Send a message that has not expired
+         message = session.createTextMessage("OK");
+         sender.send(message);
+
+         // Try to receive the message the not expired message
+         final Synch synch = new Synch();
+         MessageListener messagelistener = new MessageListener()
+         {
+            public void onMessage(Message message)
+            {
+               listenOutdated(message, synch);
+            }
+         };
+         receiver.setMessageListener(messagelistener);
+         queueConnection.start();
+
+         synch.doWait(10000);
+         assertEquals("OK", synch.getText());
+      }
+      finally
+      {
+         disconnect();
+      }
+
+      getLog().debug("SendListenOutdated test passed");
+   }
+
+   private void listenOutdated(Message message, Synch synch)
+   {
+      try
+      {
+         synch.setText(((TextMessage) message).getText());
+      }
+      catch (Throwable t)
+      {
+         log.error("Error:", t);
+      }
+      finally
+      {
+         try
+         {
+            synch.doNotify();
+         }
+         catch (Throwable t)
+         {
+            log.error("Error:", t);
+         }
+      }
+   }
+}

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/JBossMessagingJoramUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/test/JBossMessagingJoramUnitTestCase.java	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/JBossMessagingJoramUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,59 +0,0 @@
-/*
-  * 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 junit.framework.Test;
-
-import org.jboss.test.AbstractTestDelegate;
-import org.jboss.test.jbossmq.test.JBossMQJoramUnitTestCase;
-
-/**
- * Joram unit tests
- *
- * @author <a href="mailto:clebert.suconic at jboss.com">Clebert Suconic</a>
- * @version $Revision: 64152 $
- */
-public class JBossMessagingJoramUnitTestCase extends org.jboss.test.jms.JoramUnitTestCase
-{
-   public JBossMessagingJoramUnitTestCase(String name)
-   {
-      super(name);
-   }
-   
-   /**
-    * Get the test delegate
-    * 
-    * @param clazz the test class
-    * @return the delegate
-    * @throws Exception for any error
-    */
-   public static AbstractTestDelegate getDelegate(Class clazz) throws Exception
-   {
-      return getDelegate(clazz, "org.jboss.test.jbossmessaging.JBossMessagingAdmin");
-   }
-
-   public static Test suite() throws Exception
-   {
-      return getTestSuite(JBossMessagingJoramUnitTestCase.class);
-   }
-   
-}

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/JBossMessagingJoramUnitTestCase.java (from rev 64641, branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/test/JBossMessagingJoramUnitTestCase.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/JBossMessagingJoramUnitTestCase.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/JBossMessagingJoramUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,59 @@
+/*
+  * 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 junit.framework.Test;
+
+import org.jboss.test.AbstractTestDelegate;
+import org.jboss.test.jbossmq.test.JBossMQJoramUnitTestCase;
+
+/**
+ * Joram unit tests
+ *
+ * @author <a href="mailto:clebert.suconic at jboss.com">Clebert Suconic</a>
+ * @version $Revision: 64152 $
+ */
+public class JBossMessagingJoramUnitTestCase extends org.jboss.test.jms.JoramUnitTestCase
+{
+   public JBossMessagingJoramUnitTestCase(String name)
+   {
+      super(name);
+   }
+   
+   /**
+    * Get the test delegate
+    * 
+    * @param clazz the test class
+    * @return the delegate
+    * @throws Exception for any error
+    */
+   public static AbstractTestDelegate getDelegate(Class clazz) throws Exception
+   {
+      return getDelegate(clazz, "org.jboss.test.jbossmessaging.JBossMessagingAdmin");
+   }
+
+   public static Test suite() throws Exception
+   {
+      return getTestSuite(JBossMessagingJoramUnitTestCase.class);
+   }
+   
+}

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/JBossSessionRecoverUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/test/JBossSessionRecoverUnitTestCase.java	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/JBossSessionRecoverUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,555 +0,0 @@
-/*
-  * 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.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-import javax.jms.ObjectMessage;
-import javax.jms.Queue;
-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.naming.Context;
-import javax.naming.InitialContext;
-
-import org.jboss.test.jbossmessaging.JMSTestCase;
-
-/**
- * JBossSessionRecoverUnitTestCase.java
- *
- * a simple session.recover test of JBossMQ
- *
- * @author Seth Sites
- * @version $Revision: 64130 $
- */
-
-public class JBossSessionRecoverUnitTestCase extends JMSTestCase
-{
-   String QUEUE_FACTORY = "ConnectionFactory";
-   String TEST_QUEUE = "queue/testQueue";
-
-   Context context;
-   QueueConnection queueConnection;
-   QueueSession session;
-   int counter=0;
-   Exception exception=null;
-
-   public JBossSessionRecoverUnitTestCase(String name) throws Exception
-   {
-      super(name);
-   }
-
-   protected void setUp()
-      throws Exception
-   {
-       // call setUp() in superclass
-       super.setUp() ;
-
-      this.getLog().debug("JBossSessionRecoverUnitTestCase, ConnectionFactory started");
-   }
-
-   protected void tearDown() throws Exception
-   {
-      this.getLog().debug("JBossSessionRecoverUnitTestCase, ConnectionFactory done");
-
-      // call tearDown() in superclass
-      super.tearDown() ;
-   }
-
-   // Emptys out all the messages in a queue
-   private void drainQueue() throws Exception
-   {
-      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-      Queue queue = (Queue)context.lookup(TEST_QUEUE);
-
-      QueueReceiver receiver = session.createReceiver(queue);
-      Message message = receiver.receive( 1000 );
-
-      int c=0;
-      while( message != null )
-      {
-         message = receiver.receive( 1000 );
-         c++;
-      }
-
-      if( c!=0 )
-         getLog().debug("  Drained "+c+" messages from the queue");
-
-      session.close();
-   }
-
-   static public void main ( String []args )
-   {
-      String newArgs[] = { "org.jboss.test.jbossmq.test.JBossSessionRecoverUnitTestCase" };
-      junit.swingui.TestRunner.main(newArgs);
-   }
-
-   protected void connect() throws Exception
-   {
-      if( context == null )
-      {
-         context = new InitialContext();
-      }
-
-      QueueConnectionFactory queueFactory = (QueueConnectionFactory) context.lookup(QUEUE_FACTORY);
-      queueConnection = queueFactory.createQueueConnection();
-
-      getLog().debug("Connection to JBossMQ established.");
-   }
-
-   /**
-    * Test that session.recover works with a message listener
-    */
-   public void testQueueSessionRecovermessageListener()	throws Exception
-   {
-      counter = 0;
-      getLog().debug("Starting session.recover() Message Listener test");
-
-      connect();
-      queueConnection.start();
-      drainQueue();
-
-      session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-      Queue queue = (Queue)context.lookup(TEST_QUEUE);
-      QueueSender sender = session.createSender(queue);
-
-      // send 20 messages to the queue
-      for ( int i=0; i<20; i++ )
-      {
-         sender.send(session.createObjectMessage(new Integer(i)));
-      }
-
-      //close the session, so we can start one with CLIENT_ACKNOWLEDGE
-      session.close();
-      queueConnection.stop();
-      session = queueConnection.createQueueSession( false, Session.CLIENT_ACKNOWLEDGE );
-
-      //create our receiver
-      QueueReceiver receiver = session.createReceiver( queue );
-      MessageListener messagelistener = new MessageListener()
-      {
-         public void onMessage(Message message)
-         {
-            processMessage( message );
-         }
-      };
-
-      receiver.setMessageListener( messagelistener );
-      queueConnection.start();
-
-      //since we put in 20 messages and recovered after receiving 20 we should receive those 20
-      //back and get 40 total
-      while ( counter < 40 && exception == null )
-      {
-         try
-         {
-            Thread.sleep( 500 );
-         }
-         catch ( InterruptedException ie )
-         {
-         }
-      }
-
-      if ( exception != null )
-      {
-         queueConnection.close();
-         throw exception;
-      }
-
-      queueConnection.close();
-      getLog().debug("session.recover() Message Listener passed");
-   }
-
-   private void processMessage ( Message message )
-   {
-      try
-      {
-         if ( message instanceof ObjectMessage )
-         {
-            counter++;
-            ObjectMessage objectmessage = (ObjectMessage)message;
-            Integer integer = (Integer)objectmessage.getObject();
-            int mynumber = integer.intValue();
-            getLog().debug("message object " + integer + " counter=" + counter );
-
-            if ( mynumber == 19 )
-            {
-               if (counter == 20)
-               {
-                  session.recover();
-               }
-               else
-               {
-                  message.acknowledge();
-               }
-            }
-         }
-      }
-      catch ( JMSException e )
-      {
-         exception = e;
-      }
-   }
-
-   class Synch
-   {
-       boolean waiting = false;
-       public synchronized void doWait(long timeout)
-          throws InterruptedException
-       {
-          waiting = true;
-          this.wait(timeout);
-       }
-       public synchronized void doNotify()
-          throws InterruptedException
-       {
-          while (waiting == false)
-             wait(100);
-          this.notifyAll();
-       }
-   }
-
-
-   /**
-    * Test that session.recover delivers messages in the correct orer
-    */
-   public void testQueueSessionRecoverMessageListenerOrder()
-      throws Exception
-   {
-      counter = 0;
-      exception = null;
-      getLog().debug("Starting session.recover() Message Listener Order test");
-
-      connect();
-      queueConnection.start();
-      drainQueue();
-
-      session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-      Queue queue = (Queue)context.lookup(TEST_QUEUE);
-      QueueSender sender = session.createSender(queue);
-
-      // send 4 messages to the queue
-      for (int i=0; i<4; ++i)
-      {
-         sender.send(session.createObjectMessage(new Integer(i)));
-      }
-
-      //create our receiver
-      QueueReceiver receiver = session.createReceiver( queue );
-      final Synch synch = new Synch();
-      MessageListener messagelistener = new MessageListener()
-      {
-         public void onMessage(Message message)
-         {
-            checkMessagesInOrder(session, message, synch);
-         }
-      };
-
-      receiver.setMessageListener( messagelistener );
-      queueConnection.start();
-      synch.doWait(10000);
-
-      if ( exception != null )
-      {
-         queueConnection.close();
-         throw exception;
-      }
-
-      queueConnection.close();
-      getLog().debug("session.recover() Message Listener Order passed");
-   }
-
-   private void checkMessagesInOrder(Session session, Message message, Synch synch)
-   {
-      try
-      {
-         ObjectMessage objectmessage = (ObjectMessage)message;
-         Integer integer = (Integer)objectmessage.getObject();
-         int mynumber = integer.intValue();
-
-         if (message.getJMSRedelivered() == false)
-         {
-            log.debug("Recovering " + mynumber);
-            session.recover();
-            return;
-         }
-
-         log.debug("Checking " + mynumber);
-         assertTrue("Expected messages in order", mynumber == counter);
-         counter++;
-         if (counter == 4)
-            synch.doNotify();
-      }
-      catch (Exception e)
-      {
-         exception = e;
-      }
-   }
-
-
-
-   /**
-    * Test that session.recover works with receive
-    */
-   public void testQueueSessionRecoverReceive()	throws Exception
-   {
-      counter = 0;
-      getLog().debug("Starting session.recover() receive test");
-
-      connect();
-      queueConnection.start();
-      drainQueue();
-
-      session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-      Queue queue = (Queue)context.lookup(TEST_QUEUE);
-      QueueSender sender = session.createSender(queue);
-
-      // send 20 messages to the queue
-      for ( int i=0; i<20; i++ )
-      {
-         sender.send(session.createObjectMessage(new Integer(i)));
-      }
-
-      //close the session, so we can start one with CLIENT_ACKNOWLEDGE
-      session.close();
-      queueConnection.stop();
-      session = queueConnection.createQueueSession( false, Session.CLIENT_ACKNOWLEDGE );
-
-      //create our receiver
-      QueueReceiver receiver = session.createReceiver( queue );
-      queueConnection.start();
-
-      Message message = receiver.receive( 1000 );
-      int messagecounter=0;
-      while( message != null )
-      {
-         message = receiver.receive( 1000 );
-         messagecounter++;
-      }
-
-      if ( messagecounter != 20 )
-      {
-         throw new Exception ( "Not all sent messages were delivered! messagecounter=" + messagecounter );
-      }
-
-      //we got all of our messages, let's recover
-      session.recover();
-      message = receiver.receive();
-      messagecounter=0;
-
-      while( message != null )
-      {
-         if ( !message.getJMSRedelivered() )
-         {
-            throw new Exception ( "Message was not marked as redelivered! messagecounter=" + messagecounter );
-         }
-
-         message.acknowledge();
-         messagecounter++;
-
-         //workaround to keep from timing out since there are no more message on the server
-         if ( messagecounter < 15 )
-         {
-            message = receiver.receive();
-         }
-         else
-         {
-            message = receiver.receive ( 1000 );
-         }
-      }
-
-      if ( messagecounter != 20 )
-      {
-         throw new Exception ( "Not all unacknowledged messages were redelivered! messagecounter=" + messagecounter );
-      }
-
-      queueConnection.close();
-      getLog().debug("session.recover() receive passed");
-   }
-
-   /**
-    * Test that session.recover works with receive(timeout)
-    */
-   public void testQueueSessionRecoverReceiveTimeout()	throws Exception
-   {
-      counter = 0;
-      getLog().debug("Starting session.recover() receive(timeout) test");
-
-      connect();
-      queueConnection.start();
-      drainQueue();
-
-
-
-      session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-      Queue queue = (Queue)context.lookup(TEST_QUEUE);
-      QueueSender sender = session.createSender(queue);
-
-      // send 20 messages to the queue
-      for ( int i=0; i<20; i++ )
-      {
-         sender.send(session.createObjectMessage(new Integer(i)));
-      }
-
-      //close the session, so we can start one with CLIENT_ACKNOWLEDGE
-      session.close();
-      queueConnection.stop();
-      session = queueConnection.createQueueSession( false, Session.CLIENT_ACKNOWLEDGE );
-
-      //create our receiver
-      QueueReceiver receiver = session.createReceiver( queue );
-      queueConnection.start();
-
-      Message message = receiver.receive( 1000 );
-      int messagecounter=0;
-
-      while( message != null )
-      {
-         message = receiver.receive( 1000 );
-         messagecounter++;
-      }
-
-      if ( messagecounter != 20 )
-      {
-         throw new Exception ( "Not all sent messages were delivered! messagecounter=" + messagecounter );
-      }
-
-      //we got all of our messages, let's recover
-      session.recover();
-      message = receiver.receive(1000);
-      messagecounter=0;
-
-      while( message != null )
-      {
-         if ( !message.getJMSRedelivered() )
-         {
-            throw new Exception ( "Message was not marked as redelivered! messagecounter=" + messagecounter );
-         }
-
-         message.acknowledge();
-         messagecounter++;
-         message = receiver.receive( 1000 );
-      }
-
-      if ( messagecounter != 20 )
-      {
-         throw new Exception ( "Not all unacknowledged messages were redelivered! messagecounter=" + messagecounter );
-      }
-
-      queueConnection.close();
-      getLog().debug("session.recover() receive(timeout) passed");
-   }
-
-   /**
-    * Test that session.recover works with receiveNoWait
-    */
-   public void testQueueSessionRecoverReceiveNoWait()	throws Exception
-   {
-      counter = 0;
-
-      getLog().debug("Starting session.recover() receiveNoWait test");
-
-
-
-      connect();
-
-
-      queueConnection.start();
-      drainQueue();
-
-      session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-      Queue queue = (Queue)context.lookup(TEST_QUEUE);
-      QueueSender sender = session.createSender(queue);
-
-      // send 20 messages to the queue
-      for ( int i=0; i<20; i++ )
-      {
-         sender.send(session.createObjectMessage(new Integer(i)));
-      }
-
-      //close the session, so we can start one with CLIENT_ACKNOWLEDGE
-      session.close();
-      queueConnection.stop();
-      session = queueConnection.createQueueSession( false, Session.CLIENT_ACKNOWLEDGE );
-
-      //create our receiver
-      QueueReceiver receiver = session.createReceiver( queue );
-      queueConnection.start();
-
-      //NOTE! The semantics of receiveNoWait do not guarantee the message is available
-      //immediately after the message is sent
-      //It will be available some indeterminate time later.
-      //This is fine and as per spec.
-      //To implement receiveNoWait otherwise would be very costly
-      //Also other messaging systems e.g. Sun implement it this way
-
-      Thread.sleep(1000);
-
-      Message message = receiver.receiveNoWait();
-      int messagecounter=0;
-
-      while( message != null )
-      {
-         message = receiver.receiveNoWait();
-         messagecounter++;
-      }
-
-      if ( messagecounter != 20 )
-      {
-         throw new Exception ( "Not all sent messages were delivered! messagecounter=" + messagecounter );
-      }
-
-      //we got all of our messages, let's recover
-      session.recover();
-
-      // See previous note on sleep
-      Thread.sleep(1000);
-
-      message = receiver.receiveNoWait();
-      messagecounter=0;
-
-      while( message != null )
-      {
-         if ( !message.getJMSRedelivered() )
-         {
-            throw new Exception ( "Message was not marked as redelivered! messagecounter=" + messagecounter );
-         }
-
-         message.acknowledge();
-         messagecounter++;
-         message = receiver.receiveNoWait();
-      }
-
-      if ( messagecounter != 20 )
-      {
-         throw new Exception ( "Not all unacknowledged messages were redelivered! messagecounter=" + messagecounter );
-      }
-
-      queueConnection.close();
-      getLog().debug("session.recover() receiveNoWait passed");
-   }
-
-}

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/JBossSessionRecoverUnitTestCase.java (from rev 64641, branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/test/JBossSessionRecoverUnitTestCase.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/JBossSessionRecoverUnitTestCase.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/JBossSessionRecoverUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,555 @@
+/*
+  * 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.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.ObjectMessage;
+import javax.jms.Queue;
+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.naming.Context;
+import javax.naming.InitialContext;
+
+import org.jboss.test.jbossmessaging.JMSTestCase;
+
+/**
+ * JBossSessionRecoverUnitTestCase.java
+ *
+ * a simple session.recover test of JBossMQ
+ *
+ * @author Seth Sites
+ * @version $Revision: 64130 $
+ */
+
+public class JBossSessionRecoverUnitTestCase extends JMSTestCase
+{
+   String QUEUE_FACTORY = "ConnectionFactory";
+   String TEST_QUEUE = "queue/testQueue";
+
+   Context context;
+   QueueConnection queueConnection;
+   QueueSession session;
+   int counter=0;
+   Exception exception=null;
+
+   public JBossSessionRecoverUnitTestCase(String name) throws Exception
+   {
+      super(name);
+   }
+
+   protected void setUp()
+      throws Exception
+   {
+       // call setUp() in superclass
+       super.setUp() ;
+
+      this.getLog().debug("JBossSessionRecoverUnitTestCase, ConnectionFactory started");
+   }
+
+   protected void tearDown() throws Exception
+   {
+      this.getLog().debug("JBossSessionRecoverUnitTestCase, ConnectionFactory done");
+
+      // call tearDown() in superclass
+      super.tearDown() ;
+   }
+
+   // Emptys out all the messages in a queue
+   private void drainQueue() throws Exception
+   {
+      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+      Queue queue = (Queue)context.lookup(TEST_QUEUE);
+
+      QueueReceiver receiver = session.createReceiver(queue);
+      Message message = receiver.receive( 1000 );
+
+      int c=0;
+      while( message != null )
+      {
+         message = receiver.receive( 1000 );
+         c++;
+      }
+
+      if( c!=0 )
+         getLog().debug("  Drained "+c+" messages from the queue");
+
+      session.close();
+   }
+
+   static public void main ( String []args )
+   {
+      String newArgs[] = { "org.jboss.test.jbossmq.test.JBossSessionRecoverUnitTestCase" };
+      junit.swingui.TestRunner.main(newArgs);
+   }
+
+   protected void connect() throws Exception
+   {
+      if( context == null )
+      {
+         context = new InitialContext();
+      }
+
+      QueueConnectionFactory queueFactory = (QueueConnectionFactory) context.lookup(QUEUE_FACTORY);
+      queueConnection = queueFactory.createQueueConnection();
+
+      getLog().debug("Connection to JBossMQ established.");
+   }
+
+   /**
+    * Test that session.recover works with a message listener
+    */
+   public void testQueueSessionRecovermessageListener()	throws Exception
+   {
+      counter = 0;
+      getLog().debug("Starting session.recover() Message Listener test");
+
+      connect();
+      queueConnection.start();
+      drainQueue();
+
+      session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+      Queue queue = (Queue)context.lookup(TEST_QUEUE);
+      QueueSender sender = session.createSender(queue);
+
+      // send 20 messages to the queue
+      for ( int i=0; i<20; i++ )
+      {
+         sender.send(session.createObjectMessage(new Integer(i)));
+      }
+
+      //close the session, so we can start one with CLIENT_ACKNOWLEDGE
+      session.close();
+      queueConnection.stop();
+      session = queueConnection.createQueueSession( false, Session.CLIENT_ACKNOWLEDGE );
+
+      //create our receiver
+      QueueReceiver receiver = session.createReceiver( queue );
+      MessageListener messagelistener = new MessageListener()
+      {
+         public void onMessage(Message message)
+         {
+            processMessage( message );
+         }
+      };
+
+      receiver.setMessageListener( messagelistener );
+      queueConnection.start();
+
+      //since we put in 20 messages and recovered after receiving 20 we should receive those 20
+      //back and get 40 total
+      while ( counter < 40 && exception == null )
+      {
+         try
+         {
+            Thread.sleep( 500 );
+         }
+         catch ( InterruptedException ie )
+         {
+         }
+      }
+
+      if ( exception != null )
+      {
+         queueConnection.close();
+         throw exception;
+      }
+
+      queueConnection.close();
+      getLog().debug("session.recover() Message Listener passed");
+   }
+
+   private void processMessage ( Message message )
+   {
+      try
+      {
+         if ( message instanceof ObjectMessage )
+         {
+            counter++;
+            ObjectMessage objectmessage = (ObjectMessage)message;
+            Integer integer = (Integer)objectmessage.getObject();
+            int mynumber = integer.intValue();
+            getLog().debug("message object " + integer + " counter=" + counter );
+
+            if ( mynumber == 19 )
+            {
+               if (counter == 20)
+               {
+                  session.recover();
+               }
+               else
+               {
+                  message.acknowledge();
+               }
+            }
+         }
+      }
+      catch ( JMSException e )
+      {
+         exception = e;
+      }
+   }
+
+   class Synch
+   {
+       boolean waiting = false;
+       public synchronized void doWait(long timeout)
+          throws InterruptedException
+       {
+          waiting = true;
+          this.wait(timeout);
+       }
+       public synchronized void doNotify()
+          throws InterruptedException
+       {
+          while (waiting == false)
+             wait(100);
+          this.notifyAll();
+       }
+   }
+
+
+   /**
+    * Test that session.recover delivers messages in the correct orer
+    */
+   public void testQueueSessionRecoverMessageListenerOrder()
+      throws Exception
+   {
+      counter = 0;
+      exception = null;
+      getLog().debug("Starting session.recover() Message Listener Order test");
+
+      connect();
+      queueConnection.start();
+      drainQueue();
+
+      session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+      Queue queue = (Queue)context.lookup(TEST_QUEUE);
+      QueueSender sender = session.createSender(queue);
+
+      // send 4 messages to the queue
+      for (int i=0; i<4; ++i)
+      {
+         sender.send(session.createObjectMessage(new Integer(i)));
+      }
+
+      //create our receiver
+      QueueReceiver receiver = session.createReceiver( queue );
+      final Synch synch = new Synch();
+      MessageListener messagelistener = new MessageListener()
+      {
+         public void onMessage(Message message)
+         {
+            checkMessagesInOrder(session, message, synch);
+         }
+      };
+
+      receiver.setMessageListener( messagelistener );
+      queueConnection.start();
+      synch.doWait(10000);
+
+      if ( exception != null )
+      {
+         queueConnection.close();
+         throw exception;
+      }
+
+      queueConnection.close();
+      getLog().debug("session.recover() Message Listener Order passed");
+   }
+
+   private void checkMessagesInOrder(Session session, Message message, Synch synch)
+   {
+      try
+      {
+         ObjectMessage objectmessage = (ObjectMessage)message;
+         Integer integer = (Integer)objectmessage.getObject();
+         int mynumber = integer.intValue();
+
+         if (message.getJMSRedelivered() == false)
+         {
+            log.debug("Recovering " + mynumber);
+            session.recover();
+            return;
+         }
+
+         log.debug("Checking " + mynumber);
+         assertTrue("Expected messages in order", mynumber == counter);
+         counter++;
+         if (counter == 4)
+            synch.doNotify();
+      }
+      catch (Exception e)
+      {
+         exception = e;
+      }
+   }
+
+
+
+   /**
+    * Test that session.recover works with receive
+    */
+   public void testQueueSessionRecoverReceive()	throws Exception
+   {
+      counter = 0;
+      getLog().debug("Starting session.recover() receive test");
+
+      connect();
+      queueConnection.start();
+      drainQueue();
+
+      session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+      Queue queue = (Queue)context.lookup(TEST_QUEUE);
+      QueueSender sender = session.createSender(queue);
+
+      // send 20 messages to the queue
+      for ( int i=0; i<20; i++ )
+      {
+         sender.send(session.createObjectMessage(new Integer(i)));
+      }
+
+      //close the session, so we can start one with CLIENT_ACKNOWLEDGE
+      session.close();
+      queueConnection.stop();
+      session = queueConnection.createQueueSession( false, Session.CLIENT_ACKNOWLEDGE );
+
+      //create our receiver
+      QueueReceiver receiver = session.createReceiver( queue );
+      queueConnection.start();
+
+      Message message = receiver.receive( 1000 );
+      int messagecounter=0;
+      while( message != null )
+      {
+         message = receiver.receive( 1000 );
+         messagecounter++;
+      }
+
+      if ( messagecounter != 20 )
+      {
+         throw new Exception ( "Not all sent messages were delivered! messagecounter=" + messagecounter );
+      }
+
+      //we got all of our messages, let's recover
+      session.recover();
+      message = receiver.receive();
+      messagecounter=0;
+
+      while( message != null )
+      {
+         if ( !message.getJMSRedelivered() )
+         {
+            throw new Exception ( "Message was not marked as redelivered! messagecounter=" + messagecounter );
+         }
+
+         message.acknowledge();
+         messagecounter++;
+
+         //workaround to keep from timing out since there are no more message on the server
+         if ( messagecounter < 15 )
+         {
+            message = receiver.receive();
+         }
+         else
+         {
+            message = receiver.receive ( 1000 );
+         }
+      }
+
+      if ( messagecounter != 20 )
+      {
+         throw new Exception ( "Not all unacknowledged messages were redelivered! messagecounter=" + messagecounter );
+      }
+
+      queueConnection.close();
+      getLog().debug("session.recover() receive passed");
+   }
+
+   /**
+    * Test that session.recover works with receive(timeout)
+    */
+   public void testQueueSessionRecoverReceiveTimeout()	throws Exception
+   {
+      counter = 0;
+      getLog().debug("Starting session.recover() receive(timeout) test");
+
+      connect();
+      queueConnection.start();
+      drainQueue();
+
+
+
+      session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+      Queue queue = (Queue)context.lookup(TEST_QUEUE);
+      QueueSender sender = session.createSender(queue);
+
+      // send 20 messages to the queue
+      for ( int i=0; i<20; i++ )
+      {
+         sender.send(session.createObjectMessage(new Integer(i)));
+      }
+
+      //close the session, so we can start one with CLIENT_ACKNOWLEDGE
+      session.close();
+      queueConnection.stop();
+      session = queueConnection.createQueueSession( false, Session.CLIENT_ACKNOWLEDGE );
+
+      //create our receiver
+      QueueReceiver receiver = session.createReceiver( queue );
+      queueConnection.start();
+
+      Message message = receiver.receive( 1000 );
+      int messagecounter=0;
+
+      while( message != null )
+      {
+         message = receiver.receive( 1000 );
+         messagecounter++;
+      }
+
+      if ( messagecounter != 20 )
+      {
+         throw new Exception ( "Not all sent messages were delivered! messagecounter=" + messagecounter );
+      }
+
+      //we got all of our messages, let's recover
+      session.recover();
+      message = receiver.receive(1000);
+      messagecounter=0;
+
+      while( message != null )
+      {
+         if ( !message.getJMSRedelivered() )
+         {
+            throw new Exception ( "Message was not marked as redelivered! messagecounter=" + messagecounter );
+         }
+
+         message.acknowledge();
+         messagecounter++;
+         message = receiver.receive( 1000 );
+      }
+
+      if ( messagecounter != 20 )
+      {
+         throw new Exception ( "Not all unacknowledged messages were redelivered! messagecounter=" + messagecounter );
+      }
+
+      queueConnection.close();
+      getLog().debug("session.recover() receive(timeout) passed");
+   }
+
+   /**
+    * Test that session.recover works with receiveNoWait
+    */
+   public void testQueueSessionRecoverReceiveNoWait()	throws Exception
+   {
+      counter = 0;
+
+      getLog().debug("Starting session.recover() receiveNoWait test");
+
+
+
+      connect();
+
+
+      queueConnection.start();
+      drainQueue();
+
+      session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+      Queue queue = (Queue)context.lookup(TEST_QUEUE);
+      QueueSender sender = session.createSender(queue);
+
+      // send 20 messages to the queue
+      for ( int i=0; i<20; i++ )
+      {
+         sender.send(session.createObjectMessage(new Integer(i)));
+      }
+
+      //close the session, so we can start one with CLIENT_ACKNOWLEDGE
+      session.close();
+      queueConnection.stop();
+      session = queueConnection.createQueueSession( false, Session.CLIENT_ACKNOWLEDGE );
+
+      //create our receiver
+      QueueReceiver receiver = session.createReceiver( queue );
+      queueConnection.start();
+
+      //NOTE! The semantics of receiveNoWait do not guarantee the message is available
+      //immediately after the message is sent
+      //It will be available some indeterminate time later.
+      //This is fine and as per spec.
+      //To implement receiveNoWait otherwise would be very costly
+      //Also other messaging systems e.g. Sun implement it this way
+
+      Thread.sleep(1000);
+
+      Message message = receiver.receiveNoWait();
+      int messagecounter=0;
+
+      while( message != null )
+      {
+         message = receiver.receiveNoWait();
+         messagecounter++;
+      }
+
+      if ( messagecounter != 20 )
+      {
+         throw new Exception ( "Not all sent messages were delivered! messagecounter=" + messagecounter );
+      }
+
+      //we got all of our messages, let's recover
+      session.recover();
+
+      // See previous note on sleep
+      Thread.sleep(1000);
+
+      message = receiver.receiveNoWait();
+      messagecounter=0;
+
+      while( message != null )
+      {
+         if ( !message.getJMSRedelivered() )
+         {
+            throw new Exception ( "Message was not marked as redelivered! messagecounter=" + messagecounter );
+         }
+
+         message.acknowledge();
+         messagecounter++;
+         message = receiver.receiveNoWait();
+      }
+
+      if ( messagecounter != 20 )
+      {
+         throw new Exception ( "Not all unacknowledged messages were redelivered! messagecounter=" + messagecounter );
+      }
+
+      queueConnection.close();
+      getLog().debug("session.recover() receiveNoWait passed");
+   }
+
+}

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/Jms11UnitTest.java
===================================================================
--- branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/test/Jms11UnitTest.java	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/Jms11UnitTest.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,1226 +0,0 @@
-/*
-  * 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 java.util.Enumeration;
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.DeliveryMode;
-import javax.jms.InvalidDestinationException;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.QueueBrowser;
-import javax.jms.ServerSession;
-import javax.jms.ServerSessionPool;
-import javax.jms.Session;
-import javax.jms.TemporaryQueue;
-import javax.jms.TemporaryTopic;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-import javax.jms.TopicConnection;
-import javax.jms.TopicConnectionFactory;
-import javax.jms.TopicSubscriber;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-
-import EDU.oswego.cs.dl.util.concurrent.CountDown;
-import org.jboss.logging.Logger;
-import org.jboss.test.jbossmessaging.JMSTestCase;
-import org.jboss.test.jbossmessaging.perf.JMSPerfStressTestCase;
-
-/**
- * Basic tests using the jms 1.1 producer/consumer apis.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision: 64261 $
- */
-public class Jms11UnitTest extends JMSTestCase
-{
-   /** The default TopicFactory jndi name */
-   static String TOPIC_FACTORY = "ConnectionFactory";
-   /** The default QueueFactory jndi name */
-   static String QUEUE_FACTORY = "ConnectionFactory";
-
-   static String TEST_QUEUE = "queue/testQueue";
-   static String TEST_TOPIC = "topic/testTopic";
-   static String TEST_DURABLE_TOPIC = "topic/testDurableTopic";
-
-   //JMSProviderAdapter providerAdapter;
-   static Context context;
-   static Connection queueConnection;
-   static Connection topicConnection;
-
-   public Jms11UnitTest(String name) throws Exception
-   {
-      super(name);
-   }
-
-   protected void tearDown() throws Exception
-   {
-	   super.tearDown();
-	   disconnect();
-	   
-   }
-   
-   // Emptys out all the messages in a queue
-   protected void drainQueue() throws Exception
-   {
-      Session session = queueConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-      Queue queue = (Queue) context.lookup(TEST_QUEUE);
-
-      MessageConsumer receiver = session.createConsumer(queue);
-      Message message = receiver.receive(50);
-      int c = 0;
-      while (message != null)
-      {
-         message = receiver.receive(50);
-         c++;
-      }
-
-      if (c != 0)
-         getLog().debug("  Drained " + c + " messages from the queue");
-
-      session.close();
-   }
-
-   protected void connect() throws Exception
-   {
-      if (context == null)
-      {
-         context = new InitialContext();
-      }
-      ConnectionFactory queueFactory = (ConnectionFactory) context.lookup(QUEUE_FACTORY);
-      queueConnection = queueFactory.createConnection();
-
-      ConnectionFactory topicFactory = (ConnectionFactory) context.lookup(TOPIC_FACTORY);
-      topicConnection = topicFactory.createConnection();
-      getLog().debug("Connection to JBossMQ established.");
-   }
-
-   protected void disconnect() throws Exception
-   {
-	  if (queueConnection!=null)
-	  {
-	      queueConnection.close();
-	      queueConnection = null;
-	  }
-      
-	  if (topicConnection != null)
-	  {
-	      topicConnection.close();
-	      topicConnection = null;
-	  }
-   }
-
-   /**
-    * Test that messages are ordered by message arrival and priority.
-    * This also tests :
-    * 		Using a non-transacted AUTO_ACKNOWLEDGE session
-    *		Using a MessageConsumer
-    *		Using a QueueSender
-    *			Sending PERSITENT and NON_PERSISTENT text messages.
-    *		Using a QueueBrowser
-    */
-   public void testQueueMessageOrder() throws Exception
-   {
-
-      getLog().debug("Starting QueueMessageOrder test");
-
-      connect();
-
-      queueConnection.start();
-
-      drainQueue();
-
-      Session session = queueConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-      Queue queue = (Queue) context.lookup(TEST_QUEUE);
-      MessageProducer sender = session.createProducer(queue);
-
-      TextMessage message = session.createTextMessage();
-      message.setText("Normal message");
-      sender.send(message, DeliveryMode.NON_PERSISTENT, 4, 0);
-      message.setText("Persistent message");
-      sender.send(message, DeliveryMode.PERSISTENT, 4, 0);
-      message.setText("High Priority Persistent message");
-      sender.send(message, DeliveryMode.PERSISTENT, 10, 0);
-
-      QueueBrowser browser = session.createBrowser(queue);
-      Enumeration i = browser.getEnumeration();
-      getLog().debug(message.getText());
-
-      message = (TextMessage) i.nextElement();
-      getLog().debug(message.getText());
-
-      message = (TextMessage) i.nextElement();
-      getLog().debug(message.getText());
-
-      disconnect();
-      getLog().debug("QueueMessageOrder passed");
-   }
-
-   /**
-    * Test that temporary queues can be deleted.
-    */
-   public void testTemporaryQueueDelete() throws Exception
-   {
-
-      getLog().debug("Starting TemporaryQueueDelete test");
-      connect();
-
-      Session session = queueConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-      TemporaryQueue queue = session.createTemporaryQueue();
-
-      queue.delete();
-
-      disconnect();
-
-      getLog().debug("TemporaryQueueDelete passed");
-   }
-
-   /**
-    * Test that temporary topics can be deleted.
-    */
-   public void testTemporaryTopicDelete() throws Exception
-   {
-
-      getLog().debug("Starting TemporaryTopicDelete test");
-      connect();
-
-      Session session = topicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-      TemporaryTopic topic = session.createTemporaryTopic();
-
-      topic.delete();
-
-      disconnect();
-
-      getLog().debug("TemporaryTopicDelete passed");
-   }
-
-   /**
-    * Test invalid destination trying to send a message.
-    */
-   public void testInvalidDestinationQueueSend() throws Exception
-   {
-
-      getLog().debug("Starting InvaidDestinationQueueSend test");
-      connect();
-
-      Session session = queueConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-      TemporaryQueue queue = session.createTemporaryQueue();
-      MessageProducer sender = session.createProducer(queue);
-      queue.delete();
-
-      TextMessage message = session.createTextMessage("hello");
-      boolean caught = false;
-      try
-      {
-         sender.send(message);
-      }
-      catch (InvalidDestinationException expected)
-      {
-         caught = true;
-      }
-
-      disconnect();
-
-      assertTrue("Expected an InvalidDestinationException", caught);
-
-      getLog().debug("InvaldDestinationQueueSend passed");
-   }
-
-   /**
-    * Test invalid destination trying to browse a message.
-    */
-   public void testInvalidDestinationQueueBrowse() throws Exception
-   {
-
-      getLog().debug("Starting InvalidDestinationQueueBrowse test");
-      connect();
-
-      Session session = queueConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-      TemporaryQueue queue = session.createTemporaryQueue();
-      QueueBrowser browser = session.createBrowser(queue);
-      queue.delete();
-
-      boolean caught = false;
-      try
-      {
-         browser.getEnumeration();
-      }
-      catch (InvalidDestinationException expected)
-      {
-         caught = true;
-      }
-
-      disconnect();
-
-      assertTrue("Expected an InvalidDestinationException", caught);
-
-      getLog().debug("InvalidDestinationQueueBrowse passed");
-   }
-
-   /**
-    * Test invalid destination trying to send a message.
-    */
-   public void testInvalidDestinationTopicPublish() throws Exception
-   {
-
-      getLog().debug("Starting InvaidDestinationTopicPublish test");
-      connect();
-
-      Session session = topicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-      TemporaryTopic topic = session.createTemporaryTopic();
-      MessageProducer publisher = session.createProducer(topic);
-      topic.delete();
-
-      TextMessage message = session.createTextMessage("hello");
-      boolean caught = false;
-      try
-      {
-         publisher.send(message);
-      }
-      catch (InvalidDestinationException expected)
-      {
-         caught = true;
-      }
-
-      disconnect();
-
-      assertTrue("Expected an InvalidDestinationException", caught);
-
-      getLog().debug("InvaldDestinationTopicPublish passed");
-   }
-
-   /**
-    * Test errors trying on topic subscribe.
-    */
-   public void testErrorsTopicSubscribe() throws Exception
-   {
-
-      getLog().debug("Starting InvalidDestinationTopicSubscribe test");
-      connect();
-
-      try
-      {
-         Session session = topicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         Topic topic = (Topic) context.lookup(TEST_TOPIC);
-         TemporaryTopic temp = session.createTemporaryTopic();
-
-         boolean caught = false;
-         try
-         {
-            session.createConsumer(null);
-         }
-         catch (InvalidDestinationException expected)
-         {
-            caught = true;
-         }
-         assertTrue("Expected an InvalidDestinationException for a null topic", caught);
-
-         caught = false;
-         try
-         {
-            session.createConsumer(null, null, true);
-         }
-         catch (InvalidDestinationException expected)
-         {
-            caught = true;
-         }
-         assertTrue("Expected an InvalidDestinationException for a null topic", caught);
-
-         caught = false;
-         try
-         {
-            session.createDurableSubscriber(null, "NotUsed");
-         }
-         catch (InvalidDestinationException expected)
-         {
-            caught = true;
-         }
-         assertTrue("Expected an InvalidDestinationException for a null topic", caught);
-
-         caught = false;
-         try
-         {
-            session.createDurableSubscriber(temp, "NotUsed");
-         }
-         catch (InvalidDestinationException expected)
-         {
-            caught = true;
-         }
-         assertTrue("Expected an InvalidDestinationException for a temporary topic", caught);
-
-         caught = false;
-         try
-         {
-            session.createDurableSubscriber(null, "NotUsed", null, true);
-         }
-         catch (InvalidDestinationException expected)
-         {
-            caught = true;
-         }
-         assertTrue("Expected an InvalidDestinationException for a null topic", caught);
-
-         caught = false;
-         try
-         {
-            session.createDurableSubscriber(temp, "NotUsed", null, true);
-         }
-         catch (InvalidDestinationException expected)
-         {
-            caught = true;
-         }
-         assertTrue("Expected an InvalidDestinationException for a temporary topic", caught);
-
-         caught = false;
-         try
-         {
-            session.createDurableSubscriber(topic, null);
-         }
-         catch (Exception expected)
-         {
-            caught = true;
-         }
-         assertTrue("Expected a Exception for a null subscription", caught);
-
-         caught = false;
-         try
-         {
-            session.createDurableSubscriber(topic, null, null, false);
-         }
-         catch (Exception expected)
-         {
-            caught = true;
-         }
-         assertTrue("Expected a Exception for a null subscription", caught);
-
-         caught = false;
-         try
-         {
-            session.createDurableSubscriber(topic, "  ");
-         }
-         catch (Exception expected)
-         {
-            caught = true;
-         }
-         assertTrue("Expected a Exception for an empty subscription", caught);
-
-         caught = false;
-         try
-         {
-            session.createDurableSubscriber(topic, "  ", null, false);
-         }
-         catch (Exception expected)
-         {
-            caught = true;
-         }
-         assertTrue("Expected a Exception for an empty subscription", caught);
-      }
-      finally
-      {
-         disconnect();
-      }
-
-      getLog().debug("InvalidDestinationTopicSubscriber passed");
-   }
-
-   /**
-    * Test create queue.
-    */
-   public void testCreateQueue() throws Exception
-   {
-
-      getLog().debug("Starting create queue test");
-      connect();
-
-      Session session = queueConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
-      Queue jndiQueue = (Queue) getInitialContext().lookup("queue/testQueue");
-      Queue createQueue = session.createQueue(jndiQueue.getQueueName());
-      assertTrue("Failed for " + QUEUE_FACTORY, jndiQueue.equals(createQueue));
-
-      getLog().debug("InvalidDestinationTopicSubscriber passed");
-   }
-
-   public void testMessageListener() throws Exception
-   {
-      getLog().debug("Starting create queue test");
-
-      connect();
-      queueConnection.start();
-      drainQueue();
-      final CountDown counter1 = new CountDown(3);
-
-      Session session = queueConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-      Queue queue = (Queue) context.lookup(TEST_QUEUE);
-
-      MessageConsumer receiver = session.createConsumer(queue);
-      receiver.setMessageListener(new MessageListener()
-      {
-         public void onMessage(Message msg)
-         {
-            Logger log = Logger.getLogger(getClass().getName());
-            log.debug("ML");
-            try
-            {
-               if (msg instanceof TextMessage)
-               {
-                  log.debug(((TextMessage) msg).getText());
-                  counter1.release();
-               }
-            }
-            catch (Exception e)
-            {
-            }
-         }
-      });
-
-      MessageProducer sender = session.createProducer(queue);
-
-      TextMessage message = session.createTextMessage();
-      message.setText("Normal message");
-      sender.send(message, DeliveryMode.NON_PERSISTENT, 4, 0);
-      //sender.send(queue, message, DeliveryMode.NON_PERSISTENT, 4, 0);
-      message.setText("Persistent message");
-      sender.send(message, DeliveryMode.PERSISTENT, 4, 0);
-      //sender.send(queue, message, DeliveryMode.PERSISTENT, 4, 0);
-      message.setText("High Priority Persistent message");
-      sender.send(message, DeliveryMode.PERSISTENT, 10, 0);
-      //sender.send(queue, message, DeliveryMode.PERSISTENT, 10, 0);
-
-      // Wait for the msgs to be received
-      counter1.acquire();
-      log.debug("MessageListener1 received the TMs sent");
-
-      final CountDown counter2 = new CountDown(2);
-      receiver.setMessageListener(new MessageListener()
-      {
-         public void onMessage(Message msg)
-         {
-            Logger log = Logger.getLogger(getClass().getName());
-            log.debug("ML 2");
-            try
-            {
-               if (msg instanceof TextMessage)
-               {
-                  log.debug(((TextMessage) msg).getText());
-                  counter2.release();
-               }
-            }
-            catch (Exception e)
-            {
-            }
-         }
-      });
-
-      message.setText("Persistent message");
-      sender.send(message, DeliveryMode.PERSISTENT, 4, 0);
-      //sender.send(queue, message, DeliveryMode.PERSISTENT, 4, 0);
-      message.setText("High Priority Persistent message");
-      sender.send(message, DeliveryMode.PERSISTENT, 10, 0);
-      //sender.send(queue, message, DeliveryMode.PERSISTENT, 10, 0);
-
-      // Wait for the msgs to be received
-      counter2.acquire();
-      log.debug("MessageListener2 received the TMs sent");
-
-      receiver.setMessageListener(null);
-
-      message.setText("Persistent message");
-      sender.send(message, DeliveryMode.PERSISTENT, 4, 0);
-      //sender.send(queue, message, DeliveryMode.PERSISTENT, 4, 0);
-      message.setText("High Priority Persistent message");
-      sender.send(message, DeliveryMode.PERSISTENT, 10, 0);
-      //sender.send(queue, message, DeliveryMode.PERSISTENT, 10, 0);
-
-      sender.close();
-      drainQueue();
-      disconnect();
-      getLog().debug("MessageListener test passed");
-   }
-
-   public void testApplicationServerStuff() throws Exception
-   {
-      getLog().debug("Starting testing app server stuff");
-      connect();
-
-      Queue testQueue = (Queue) context.lookup(TEST_QUEUE);
-      final Session session = queueConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
-      session.setMessageListener(new MessageListener()
-      {
-         public void onMessage(Message mess)
-         {
-            Logger log = Logger.getLogger(getClass().getName());
-            log.debug("Processing message");
-            try
-            {
-               if (mess instanceof TextMessage)
-                  log.debug(((TextMessage) mess).getText());
-            }
-            catch (Exception e)
-            {
-               log.error("Error", e);
-            }
-         }
-      });
-
-      MessageProducer sender = session.createProducer(testQueue);
-      sender.send(session.createTextMessage("Hi"));
-      sender.send(session.createTextMessage("There"));
-      sender.send(session.createTextMessage("Guys"));
-      queueConnection.createConnectionConsumer(testQueue, null, new ServerSessionPool()
-      {
-         public ServerSession getServerSession()
-         {
-            Logger.getLogger(getClass().getName()).debug("Getting server session.");
-            return new ServerSession()
-            {
-               public Session getSession()
-               {
-                  return session;
-               }
-               public void start()
-               {
-                  Logger.getLogger(getClass().getName()).debug("Starting server session.");
-                  session.run();
-               }
-            };
-         }
-      }, 10);
-
-      queueConnection.start();
-
-      try
-      {
-         Thread.sleep(5 * 1000);
-      }
-      catch (Exception e)
-      {
-      }
-
-      disconnect();
-      getLog().debug("Testing app server stuff passed");
-   }
-
-   private void drainMessagesForTopic(MessageConsumer sub) throws JMSException
-   {
-      Message msg = sub.receive(50);
-      int c = 0;
-      while (msg != null)
-      {
-         c++;
-         if (msg instanceof TextMessage)
-            getLog().debug(((TextMessage) msg).getText());
-         msg = sub.receive(50);
-      }
-      getLog().debug("Received " + c + " messages from topic.");
-   }
-
-   public void testTopics() throws Exception
-   {
-      getLog().debug("Starting Topic test");
-      connect();
-
-      TopicConnectionFactory topicFactory = (TopicConnectionFactory) context.lookup(TOPIC_FACTORY);
-      topicConnection = topicFactory.createTopicConnection("john", "needle");
-
-      topicConnection.start();
-
-      //set up some subscribers to the topic
-      Session session = topicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-      Topic topic = (Topic) context.lookup(TEST_TOPIC);
-
-      TopicSubscriber sub1 = session.createDurableSubscriber(topic, "sub1");
-      MessageConsumer sub2 = session.createConsumer(topic);
-      MessageConsumer sub3 = session.createConsumer(topic);
-
-      //Now a sender
-      MessageProducer sender = session.createProducer(topic);
-
-      //send some messages
-      sender.send(session.createTextMessage("Message 1"));
-      sender.send(session.createTextMessage("Message 2"));
-      sender.send(session.createTextMessage("Message 3"));
-      drainMessagesForTopic(sub1);
-      drainMessagesForTopic(sub2);
-      drainMessagesForTopic(sub3);
-
-      //close some subscribers
-      sub1.close();
-      sub2.close();
-
-      //send some more messages
-      sender.send(session.createTextMessage("Message 4"));
-      sender.send(session.createTextMessage("Message 5"));
-      sender.send(session.createTextMessage("Message 6"));
-
-      //give time for message 4 to be negatively acked (as it will be cause last receive timed out)
-      try
-      {
-         Thread.sleep(5 * 1000);
-      }
-      catch (InterruptedException e)
-      {
-      }
-
-      drainMessagesForTopic(sub3);
-
-      //open subscribers again.
-      sub1 = session.createDurableSubscriber(topic, "sub1");
-      sub2 = session.createConsumer(topic);
-
-      //Send a final message
-      sender.send(session.createTextMessage("Final message"));
-      sender.close();
-
-      drainMessagesForTopic(sub1);
-      drainMessagesForTopic(sub2);
-      drainMessagesForTopic(sub3);
-
-      sub1.close();
-      sub2.close();
-      sub3.close();
-
-      session.unsubscribe("sub1");
-
-      topicConnection.stop();
-      topicConnection.close();
-
-      disconnect();
-      getLog().debug("Topic test passed");
-   }
-
-   /**
-    * Test to seeif the NoLocal feature of topics works.
-    * Messages sended from the same connection should not
-    * be received by Subscribers on the same connection.
-    */
-   public void testTopicNoLocal() throws Exception
-   {
-      getLog().debug("Starting TopicNoLocal test");
-      connect();
-
-      TopicConnectionFactory topicFactory = (TopicConnectionFactory) context.lookup(TOPIC_FACTORY);
-      TopicConnection topicConnection1 = topicFactory.createTopicConnection();
-      topicConnection1.start();
-      TopicConnection topicConnection2 = topicFactory.createTopicConnection();
-      topicConnection2.start();
-
-      // We don't want local messages on this topic.
-      Session session1 = topicConnection1.createSession(false, Session.AUTO_ACKNOWLEDGE);
-      Topic topic = (Topic) context.lookup(TEST_TOPIC);
-      MessageConsumer subscriber1 = session1.createConsumer(topic, null, true);
-      MessageProducer sender1 = session1.createProducer(topic);
-
-      //Now a sender
-      Session session2 = topicConnection2.createSession(false, Session.AUTO_ACKNOWLEDGE);
-      MessageProducer sender2 = session2.createProducer(topic);
-
-      drainMessagesForTopic(subscriber1);
-
-      //send some messages
-      sender1.send(session1.createTextMessage("Local Message"));
-      sender2.send(session2.createTextMessage("Remote Message"));
-
-      // Get the messages, we should get the remote message
-      // but not the local message
-      TextMessage msg1 = (TextMessage) subscriber1.receive(2000);
-      if (msg1 == null)
-      {
-         fail("Did not get any messages");
-      }
-      else
-      {
-         getLog().debug("Got message: " + msg1);
-         if (msg1.getText().equals("Local Message"))
-         {
-            fail("Got a local message");
-         }
-         TextMessage msg2 = (TextMessage) subscriber1.receive(2000);
-         if (msg2 != null)
-         {
-            getLog().debug("Got message: " + msg2);
-            fail("Got an extra message.  msg1:" + msg1 + ", msg2:" + msg2);
-         }
-      }
-
-      topicConnection1.stop();
-      topicConnection1.close();
-      topicConnection2.stop();
-      topicConnection2.close();
-
-      disconnect();
-      getLog().debug("TopicNoLocal test passed");
-   }
-
-   /**
-    * Test to see whether no local works if a message
-    * was created somewhere else.
-    */
-   public void testTopicNoLocalBounce() throws Exception
-   {
-      getLog().debug("Starting TopicNoLocalBounce test");
-      connect();
-
-      TopicConnectionFactory topicFactory = (TopicConnectionFactory) context.lookup(TOPIC_FACTORY);
-      TopicConnection topicConnection1 = topicFactory.createTopicConnection();
-      topicConnection1.start();
-      TopicConnection topicConnection2 = topicFactory.createTopicConnection();
-      topicConnection2.start();
-
-      // Session 1
-      Session session1 = topicConnection1.createSession(false, Session.AUTO_ACKNOWLEDGE);
-      Topic topic = (Topic) context.lookup(TEST_TOPIC);
-      MessageConsumer subscriber1 = session1.createConsumer(topic, null, true);
-      MessageProducer sender1 = session1.createProducer(topic);
-
-      // Session 2
-      Session session2 = topicConnection2.createSession(false, Session.AUTO_ACKNOWLEDGE);
-      MessageConsumer subscriber2 = session2.createConsumer(topic, null, true);
-      MessageProducer sender2 = session2.createProducer(topic);
-
-      drainMessagesForTopic(subscriber1);
-      drainMessagesForTopic(subscriber2);
-
-      //send the message
-      sender1.send(session1.createTextMessage("Message"));
-
-      assertTrue("Subscriber1 should not get a message", subscriber1.receiveNoWait() == null);
-      TextMessage msg = (TextMessage) subscriber2.receive(2000);
-      assertTrue("Subscriber2 should get a message, got " + msg, msg != null && msg.getText().equals("Message"));
-
-      //send it back
-      sender2.send(msg);
-
-      msg = (TextMessage) subscriber1.receive(2000);
-      assertTrue("Subscriber1 should get a message, got " + msg, msg != null && msg.getText().equals("Message"));
-      assertTrue("Subscriber2 should not get a message", subscriber2.receiveNoWait() == null);
-
-      topicConnection1.stop();
-      topicConnection1.close();
-      topicConnection2.stop();
-      topicConnection2.close();
-
-      disconnect();
-      getLog().debug("TopicNoLocalBounce test passed");
-   }
-
-   /**
-    * Test subscribing to a topic with one selector, then changing to another
-    */
-   public void testTopicSelectorChange() throws Exception
-   {
-      getLog().debug("Starting TopicSelectorChange test");
-
-      getLog().debug("Create topic connection");
-      TopicConnectionFactory topicFactory = (TopicConnectionFactory) context.lookup(TOPIC_FACTORY);
-      topicConnection = topicFactory.createTopicConnection("john", "needle");
-      topicConnection.start();
-
-      try
-      {
-         getLog().debug("Retrieving Topic");
-         Topic topic = (Topic) context.lookup(TEST_DURABLE_TOPIC);
-
-         getLog().debug("Creating a send session");
-         Session sendSession = topicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         MessageProducer sender = sendSession.createProducer(topic);
-
-         getLog().debug("Clearing the topic");
-         Session subSession = topicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         MessageConsumer subscriber = subSession.createDurableSubscriber(topic, "test");
-         Message message = subscriber.receive(50);
-         while (message != null)
-            message = subscriber.receive(50);
-         subSession.close();
-
-         getLog().debug("Subscribing to topic, looking for Value = 'A'");
-         subSession = topicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         subscriber = subSession.createDurableSubscriber(topic, "test", "Value = 'A'", false);
-
-         getLog().debug("Send some messages");
-         message = sendSession.createTextMessage("Message1");
-         message.setStringProperty("Value", "A");
-         sender.send(message);
-         message = sendSession.createTextMessage("Message2");
-         message.setStringProperty("Value", "A");
-         sender.send(message);
-         message = sendSession.createTextMessage("Message3");
-         message.setStringProperty("Value", "B");
-         sender.send(message);
-
-         getLog().debug("Retrieving the A messages");
-         message = subscriber.receive(2000);
-         assertTrue("Expected message 1", message != null);
-         assertTrue("Should get an A", message.getStringProperty("Value").equals("A"));
-         message = subscriber.receive(2000);
-         assertTrue("Expected message 2", message != null);
-         assertTrue("Should get a second A", message.getStringProperty("Value").equals("A"));
-         assertTrue("That should be it for A", subscriber.receive(2000) == null);
-
-         getLog().debug("Closing the subscriber without acknowledgement");
-         subSession.close();
-
-         getLog().debug("Subscribing to topic, looking for Value = 'B'");
-         subSession = topicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         subscriber = subSession.createDurableSubscriber(topic, "test", "Value = 'B'", false);
-
-         getLog().debug("Retrieving the non-existent B messages");
-         assertTrue("B should not be there", subscriber.receive(2000) == null);
-
-         getLog().debug("Closing the subscriber.");
-         subSession.close();
-
-         getLog().debug("Subscribing to topic, looking for those Value = 'A'");
-         subSession = topicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         subscriber = subSession.createDurableSubscriber(topic, "test", "Value = 'A'", false);
-         assertTrue("Should not be any A the subscription was changed", subscriber.receive(2000) == null);
-         subSession.close();
-
-         getLog().debug("Subscribing to topic, looking for everything");
-         subSession = topicConnection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
-         subscriber = subSession.createDurableSubscriber(topic, "test", null, false);
-
-         message = sendSession.createTextMessage("Message4");
-         message.setStringProperty("Value", "A");
-         sender.send(message);
-
-         message = subscriber.receive(2000);
-         assertTrue("Expected message 4", message != null);
-         assertTrue("Should be an A which we don't acknowledge", message.getStringProperty("Value").equals("A"));
-         subSession.close();
-
-         getLog().debug("Subscribing to topic, looking for the Value = 'A'");
-         subSession = topicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         subscriber = subSession.createDurableSubscriber(topic, "test", "Value = 'A'", false);
-         assertTrue(
-            "Should not be any A, the subscription was changed. Even though the old and new selectors match the message",
-            subscriber.receive(2000) == null);
-         subSession.close();
-
-         getLog().debug("Closing the send session");
-         sendSession.close();
-
-         getLog().debug("Removing the subscription");
-         subSession = topicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         subSession.unsubscribe("test");
-
-      }
-      finally
-      {
-         getLog().debug("Closing the connection");
-         topicConnection.close();
-      }
-
-      getLog().debug("TopicSelectorChange test passed");
-   }
-
-   /**
-    * Test subscribing to a topic with a null and empty selector
-    */
-   public void testTopicSelectorNullOrEmpty() throws Exception
-   {
-      getLog().debug("Starting TopicSelectorNullOrEmpty test");
-
-      getLog().debug("Create topic connection");
-      TopicConnectionFactory topicFactory = (TopicConnectionFactory) context.lookup(TOPIC_FACTORY);
-      topicConnection = topicFactory.createTopicConnection("john", "needle");
-      topicConnection.start();
-
-      try
-      {
-         getLog().debug("Retrieving Topic");
-         Topic topic = (Topic) context.lookup(TEST_DURABLE_TOPIC);
-
-         getLog().debug("Creating a send session");
-         Session sendSession = topicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         MessageProducer sender = sendSession.createProducer(topic);
-
-         getLog().debug("Clearing the topic");
-         Session subSession = topicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         MessageConsumer subscriber = subSession.createDurableSubscriber(topic, "test");
-         TextMessage message = (TextMessage) subscriber.receive(50);
-         while (message != null)
-            message = (TextMessage) subscriber.receive(50);
-         subSession.close();
-
-         getLog().debug("Subscribing to topic, with null selector");
-         subSession = topicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         subscriber = subSession.createDurableSubscriber(topic, "test", null, false);
-
-         getLog().debug("Send a message");
-         message = sendSession.createTextMessage("Message1");
-         sender.send(message);
-
-         getLog().debug("Retrieving the message");
-         message = (TextMessage) subscriber.receive(2000);
-         assertTrue("Expected message 1", message != null);
-         assertTrue("Should get Message1", message.getText().equals("Message1"));
-         getLog().debug("Closing the subscriber");
-         subSession.close();
-
-         getLog().debug("Subscribing to topic, with an empty selector");
-         subSession = topicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         subscriber = subSession.createDurableSubscriber(topic, "test", "   ", false);
-
-         getLog().debug("Send a message");
-         message = sendSession.createTextMessage("Message2");
-         sender.send(message);
-
-         getLog().debug("Retrieving the message");
-         message = (TextMessage) subscriber.receive(2000);
-         assertTrue("Expected message 2", message != null);
-         assertTrue("Should get Message2", message.getText().equals("Message2"));
-         getLog().debug("Closing the subscriber");
-
-         getLog().debug("Removing the subscription");
-         subSession = topicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         subSession.unsubscribe("test");
-         subSession.close();
-
-      }
-      finally
-      {
-         getLog().debug("Closing the connection");
-         topicConnection.close();
-      }
-
-      getLog().debug("TopicSelectorNullOrEmpty test passed");
-   }
-
-   /**
-    * Test sending/receiving an outdated message
-    */
-   public void testSendReceiveOutdated() throws Exception
-   {
-      getLog().debug("Starting SendReceiveOutdated test");
-
-      connect();
-      try
-      {
-         queueConnection.start();
-         drainQueue();
-         queueConnection.stop();
-
-         Session session = queueConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         Queue queue = (Queue) context.lookup(TEST_QUEUE);
-         MessageProducer sender = session.createProducer(queue);
-         MessageConsumer receiver = session.createConsumer(queue);
-
-         // Send a message that has expired
-         TextMessage message = session.createTextMessage("Outdated");
-         sender.send(message, DeliveryMode.PERSISTENT, 4, 1);
-         Thread.sleep(100);
-
-         // Send a message that has not expired
-         message = session.createTextMessage("OK");
-         sender.send(message);
-
-         // Try to receive the message the not expired message
-         queueConnection.start();
-         message = (TextMessage) receiver.receiveNoWait();
-         assertEquals("OK", message.getText());
-
-         // Should be no more
-         assertTrue("Didn't expect anymore messages", receiver.receiveNoWait() == null);
-      }
-      finally
-      {
-         disconnect();
-      }
-
-      getLog().debug("SendReceiveOutdated test passed");
-   }
-
-   public void testSendReceiveExpired() throws Exception
-   {
-      getLog().debug("Starting testSendReceiveExpired test");
-
-      connect();
-      try
-      {
-         queueConnection.start();
-         drainQueue();
-
-         Session session = queueConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         Queue queue = (Queue) context.lookup(TEST_QUEUE);
-         MessageProducer sender = session.createProducer(queue);
-         MessageConsumer receiver = session.createConsumer(queue);
-
-         // Send a message that expires in 5 seconds
-         TextMessage message = session.createTextMessage("5 Second Expiration");
-         sender.send(message, DeliveryMode.PERSISTENT, 4, 5*1000);
-         // Send a message that has not expired
-         message = session.createTextMessage("OK");
-         sender.send(message);
-         // Sleep 6 seconds
-         Thread.sleep(6*1000);
-         // Try to receive the OK message
-         message = (TextMessage) receiver.receiveNoWait();
-         assertEquals("OK", message.getText());
-
-         // Should be no more
-         assertTrue("Didn't expect anymore messages", receiver.receiveNoWait() == null);
-
-         // Send a message that expires in 10 seconds
-         message = session.createTextMessage("10 Second Expiration");
-         sender.send(message, DeliveryMode.PERSISTENT, 4, 10*1000);
-         // Send a message that has not expired
-         message = session.createTextMessage("OK");
-         sender.send(message);
-         // Sleep 1 seconds
-         Thread.sleep(1*1000);
-         // Try to receive the messages
-         message = (TextMessage) receiver.receiveNoWait();
-         assertEquals("10 Second Expiration", message.getText());
-         message = (TextMessage) receiver.receiveNoWait();
-         assertEquals("OK", message.getText());
-
-         // Should be no more
-         assertTrue("Didn't expect anymore messages", receiver.receiveNoWait() == null);
-         
-         // Test that JMSExpiration has no affect
-         message = session.createTextMessage("5 Second Expiration");
-         message.setJMSExpiration(System.currentTimeMillis() + 5*1000);
-         sender.send(message, DeliveryMode.PERSISTENT, 4, 0);
-         // Send a message that has not expired
-         message = session.createTextMessage("OK");
-         sender.send(message);
-         // Sleep 6 seconds
-         Thread.sleep(6*1000);
-         // Try to receive the OK message
-         message = (TextMessage) receiver.receiveNoWait();
-         assertEquals("5 Second Expiration", message.getText());
-         message = (TextMessage) receiver.receiveNoWait();
-         assertEquals("OK", message.getText());
-         assertTrue("Didn't expect anymore messages", receiver.receiveNoWait() == null);
-      }
-      finally
-      {
-         disconnect();
-      }
-   }
-
-   class Synch
-   {
-      boolean waiting = false;
-      String text;
-      public synchronized void doWait(long timeout) throws InterruptedException
-      {
-         waiting = true;
-         this.wait(timeout);
-      }
-      public synchronized void doNotify() throws InterruptedException
-      {
-         while (waiting == false)
-            wait(100);
-         this.notifyAll();
-      }
-      public String getText()
-      {
-         return text;
-      }
-      public void setText(String text)
-      {
-         this.text = text;
-      }
-   }
-
-   /**
-    * Test sending/listening an outdated message
-    */
-   public void testSendListenOutdated() throws Exception
-   {
-      getLog().debug("Starting SendListenOutdated test");
-
-      connect();
-      try
-      {
-         queueConnection.start();
-         drainQueue();
-         queueConnection.stop();
-
-         Session session = queueConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         Queue queue = (Queue) context.lookup(TEST_QUEUE);
-         MessageProducer sender = session.createProducer(queue);
-         MessageConsumer receiver = session.createConsumer(queue);
-
-         // Send a message that has expired
-         TextMessage message = session.createTextMessage("Outdated");
-         sender.send(message, DeliveryMode.PERSISTENT, 4, 1);
-         Thread.sleep(100);
-
-         // Send a message that has not expired
-         message = session.createTextMessage("OK");
-         sender.send(message);
-
-         // Try to receive the message the not expired message
-         final Synch synch = new Synch();
-         MessageListener messagelistener = new MessageListener()
-         {
-            public void onMessage(Message message)
-            {
-               listenOutdated(message, synch);
-            }
-         };
-         receiver.setMessageListener(messagelistener);
-         queueConnection.start();
-
-         synch.doWait(10000);
-         assertEquals("OK", synch.getText());
-      }
-      finally
-      {
-         disconnect();
-      }
-
-      getLog().debug("SendListenOutdated test passed");
-   }
-
-   private void listenOutdated(Message message, Synch synch)
-   {
-      try
-      {
-         synch.setText(((TextMessage) message).getText());
-      }
-      catch (Throwable t)
-      {
-         log.error("Error:", t);
-      }
-      finally
-      {
-         try
-         {
-            synch.doNotify();
-         }
-         catch (Throwable t)
-         {
-            log.error("Error:", t);
-         }
-      }
-   }
-}

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/Jms11UnitTest.java (from rev 64641, branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/test/Jms11UnitTest.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/Jms11UnitTest.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/Jms11UnitTest.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,1226 @@
+/*
+  * 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 java.util.Enumeration;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.DeliveryMode;
+import javax.jms.InvalidDestinationException;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.QueueBrowser;
+import javax.jms.ServerSession;
+import javax.jms.ServerSessionPool;
+import javax.jms.Session;
+import javax.jms.TemporaryQueue;
+import javax.jms.TemporaryTopic;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+import javax.jms.TopicConnection;
+import javax.jms.TopicConnectionFactory;
+import javax.jms.TopicSubscriber;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import EDU.oswego.cs.dl.util.concurrent.CountDown;
+import org.jboss.logging.Logger;
+import org.jboss.test.jbossmessaging.JMSTestCase;
+import org.jboss.test.jbossmessaging.perf.JMSPerfStressTestCase;
+
+/**
+ * Basic tests using the jms 1.1 producer/consumer apis.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 64261 $
+ */
+public class Jms11UnitTest extends JMSTestCase
+{
+   /** The default TopicFactory jndi name */
+   static String TOPIC_FACTORY = "ConnectionFactory";
+   /** The default QueueFactory jndi name */
+   static String QUEUE_FACTORY = "ConnectionFactory";
+
+   static String TEST_QUEUE = "queue/testQueue";
+   static String TEST_TOPIC = "topic/testTopic";
+   static String TEST_DURABLE_TOPIC = "topic/testDurableTopic";
+
+   //JMSProviderAdapter providerAdapter;
+   static Context context;
+   static Connection queueConnection;
+   static Connection topicConnection;
+
+   public Jms11UnitTest(String name) throws Exception
+   {
+      super(name);
+   }
+
+   protected void tearDown() throws Exception
+   {
+	   super.tearDown();
+	   disconnect();
+	   
+   }
+   
+   // Emptys out all the messages in a queue
+   protected void drainQueue() throws Exception
+   {
+      Session session = queueConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+      Queue queue = (Queue) context.lookup(TEST_QUEUE);
+
+      MessageConsumer receiver = session.createConsumer(queue);
+      Message message = receiver.receive(50);
+      int c = 0;
+      while (message != null)
+      {
+         message = receiver.receive(50);
+         c++;
+      }
+
+      if (c != 0)
+         getLog().debug("  Drained " + c + " messages from the queue");
+
+      session.close();
+   }
+
+   protected void connect() throws Exception
+   {
+      if (context == null)
+      {
+         context = new InitialContext();
+      }
+      ConnectionFactory queueFactory = (ConnectionFactory) context.lookup(QUEUE_FACTORY);
+      queueConnection = queueFactory.createConnection();
+
+      ConnectionFactory topicFactory = (ConnectionFactory) context.lookup(TOPIC_FACTORY);
+      topicConnection = topicFactory.createConnection();
+      getLog().debug("Connection to JBossMQ established.");
+   }
+
+   protected void disconnect() throws Exception
+   {
+	  if (queueConnection!=null)
+	  {
+	      queueConnection.close();
+	      queueConnection = null;
+	  }
+      
+	  if (topicConnection != null)
+	  {
+	      topicConnection.close();
+	      topicConnection = null;
+	  }
+   }
+
+   /**
+    * Test that messages are ordered by message arrival and priority.
+    * This also tests :
+    * 		Using a non-transacted AUTO_ACKNOWLEDGE session
+    *		Using a MessageConsumer
+    *		Using a QueueSender
+    *			Sending PERSITENT and NON_PERSISTENT text messages.
+    *		Using a QueueBrowser
+    */
+   public void testQueueMessageOrder() throws Exception
+   {
+
+      getLog().debug("Starting QueueMessageOrder test");
+
+      connect();
+
+      queueConnection.start();
+
+      drainQueue();
+
+      Session session = queueConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+      Queue queue = (Queue) context.lookup(TEST_QUEUE);
+      MessageProducer sender = session.createProducer(queue);
+
+      TextMessage message = session.createTextMessage();
+      message.setText("Normal message");
+      sender.send(message, DeliveryMode.NON_PERSISTENT, 4, 0);
+      message.setText("Persistent message");
+      sender.send(message, DeliveryMode.PERSISTENT, 4, 0);
+      message.setText("High Priority Persistent message");
+      sender.send(message, DeliveryMode.PERSISTENT, 10, 0);
+
+      QueueBrowser browser = session.createBrowser(queue);
+      Enumeration i = browser.getEnumeration();
+      getLog().debug(message.getText());
+
+      message = (TextMessage) i.nextElement();
+      getLog().debug(message.getText());
+
+      message = (TextMessage) i.nextElement();
+      getLog().debug(message.getText());
+
+      disconnect();
+      getLog().debug("QueueMessageOrder passed");
+   }
+
+   /**
+    * Test that temporary queues can be deleted.
+    */
+   public void testTemporaryQueueDelete() throws Exception
+   {
+
+      getLog().debug("Starting TemporaryQueueDelete test");
+      connect();
+
+      Session session = queueConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+      TemporaryQueue queue = session.createTemporaryQueue();
+
+      queue.delete();
+
+      disconnect();
+
+      getLog().debug("TemporaryQueueDelete passed");
+   }
+
+   /**
+    * Test that temporary topics can be deleted.
+    */
+   public void testTemporaryTopicDelete() throws Exception
+   {
+
+      getLog().debug("Starting TemporaryTopicDelete test");
+      connect();
+
+      Session session = topicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+      TemporaryTopic topic = session.createTemporaryTopic();
+
+      topic.delete();
+
+      disconnect();
+
+      getLog().debug("TemporaryTopicDelete passed");
+   }
+
+   /**
+    * Test invalid destination trying to send a message.
+    */
+   public void testInvalidDestinationQueueSend() throws Exception
+   {
+
+      getLog().debug("Starting InvaidDestinationQueueSend test");
+      connect();
+
+      Session session = queueConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+      TemporaryQueue queue = session.createTemporaryQueue();
+      MessageProducer sender = session.createProducer(queue);
+      queue.delete();
+
+      TextMessage message = session.createTextMessage("hello");
+      boolean caught = false;
+      try
+      {
+         sender.send(message);
+      }
+      catch (InvalidDestinationException expected)
+      {
+         caught = true;
+      }
+
+      disconnect();
+
+      assertTrue("Expected an InvalidDestinationException", caught);
+
+      getLog().debug("InvaldDestinationQueueSend passed");
+   }
+
+   /**
+    * Test invalid destination trying to browse a message.
+    */
+   public void testInvalidDestinationQueueBrowse() throws Exception
+   {
+
+      getLog().debug("Starting InvalidDestinationQueueBrowse test");
+      connect();
+
+      Session session = queueConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+      TemporaryQueue queue = session.createTemporaryQueue();
+      QueueBrowser browser = session.createBrowser(queue);
+      queue.delete();
+
+      boolean caught = false;
+      try
+      {
+         browser.getEnumeration();
+      }
+      catch (InvalidDestinationException expected)
+      {
+         caught = true;
+      }
+
+      disconnect();
+
+      assertTrue("Expected an InvalidDestinationException", caught);
+
+      getLog().debug("InvalidDestinationQueueBrowse passed");
+   }
+
+   /**
+    * Test invalid destination trying to send a message.
+    */
+   public void testInvalidDestinationTopicPublish() throws Exception
+   {
+
+      getLog().debug("Starting InvaidDestinationTopicPublish test");
+      connect();
+
+      Session session = topicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+      TemporaryTopic topic = session.createTemporaryTopic();
+      MessageProducer publisher = session.createProducer(topic);
+      topic.delete();
+
+      TextMessage message = session.createTextMessage("hello");
+      boolean caught = false;
+      try
+      {
+         publisher.send(message);
+      }
+      catch (InvalidDestinationException expected)
+      {
+         caught = true;
+      }
+
+      disconnect();
+
+      assertTrue("Expected an InvalidDestinationException", caught);
+
+      getLog().debug("InvaldDestinationTopicPublish passed");
+   }
+
+   /**
+    * Test errors trying on topic subscribe.
+    */
+   public void testErrorsTopicSubscribe() throws Exception
+   {
+
+      getLog().debug("Starting InvalidDestinationTopicSubscribe test");
+      connect();
+
+      try
+      {
+         Session session = topicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         Topic topic = (Topic) context.lookup(TEST_TOPIC);
+         TemporaryTopic temp = session.createTemporaryTopic();
+
+         boolean caught = false;
+         try
+         {
+            session.createConsumer(null);
+         }
+         catch (InvalidDestinationException expected)
+         {
+            caught = true;
+         }
+         assertTrue("Expected an InvalidDestinationException for a null topic", caught);
+
+         caught = false;
+         try
+         {
+            session.createConsumer(null, null, true);
+         }
+         catch (InvalidDestinationException expected)
+         {
+            caught = true;
+         }
+         assertTrue("Expected an InvalidDestinationException for a null topic", caught);
+
+         caught = false;
+         try
+         {
+            session.createDurableSubscriber(null, "NotUsed");
+         }
+         catch (InvalidDestinationException expected)
+         {
+            caught = true;
+         }
+         assertTrue("Expected an InvalidDestinationException for a null topic", caught);
+
+         caught = false;
+         try
+         {
+            session.createDurableSubscriber(temp, "NotUsed");
+         }
+         catch (InvalidDestinationException expected)
+         {
+            caught = true;
+         }
+         assertTrue("Expected an InvalidDestinationException for a temporary topic", caught);
+
+         caught = false;
+         try
+         {
+            session.createDurableSubscriber(null, "NotUsed", null, true);
+         }
+         catch (InvalidDestinationException expected)
+         {
+            caught = true;
+         }
+         assertTrue("Expected an InvalidDestinationException for a null topic", caught);
+
+         caught = false;
+         try
+         {
+            session.createDurableSubscriber(temp, "NotUsed", null, true);
+         }
+         catch (InvalidDestinationException expected)
+         {
+            caught = true;
+         }
+         assertTrue("Expected an InvalidDestinationException for a temporary topic", caught);
+
+         caught = false;
+         try
+         {
+            session.createDurableSubscriber(topic, null);
+         }
+         catch (Exception expected)
+         {
+            caught = true;
+         }
+         assertTrue("Expected a Exception for a null subscription", caught);
+
+         caught = false;
+         try
+         {
+            session.createDurableSubscriber(topic, null, null, false);
+         }
+         catch (Exception expected)
+         {
+            caught = true;
+         }
+         assertTrue("Expected a Exception for a null subscription", caught);
+
+         caught = false;
+         try
+         {
+            session.createDurableSubscriber(topic, "  ");
+         }
+         catch (Exception expected)
+         {
+            caught = true;
+         }
+         assertTrue("Expected a Exception for an empty subscription", caught);
+
+         caught = false;
+         try
+         {
+            session.createDurableSubscriber(topic, "  ", null, false);
+         }
+         catch (Exception expected)
+         {
+            caught = true;
+         }
+         assertTrue("Expected a Exception for an empty subscription", caught);
+      }
+      finally
+      {
+         disconnect();
+      }
+
+      getLog().debug("InvalidDestinationTopicSubscriber passed");
+   }
+
+   /**
+    * Test create queue.
+    */
+   public void testCreateQueue() throws Exception
+   {
+
+      getLog().debug("Starting create queue test");
+      connect();
+
+      Session session = queueConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+      Queue jndiQueue = (Queue) getInitialContext().lookup("queue/testQueue");
+      Queue createQueue = session.createQueue(jndiQueue.getQueueName());
+      assertTrue("Failed for " + QUEUE_FACTORY, jndiQueue.equals(createQueue));
+
+      getLog().debug("InvalidDestinationTopicSubscriber passed");
+   }
+
+   public void testMessageListener() throws Exception
+   {
+      getLog().debug("Starting create queue test");
+
+      connect();
+      queueConnection.start();
+      drainQueue();
+      final CountDown counter1 = new CountDown(3);
+
+      Session session = queueConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+      Queue queue = (Queue) context.lookup(TEST_QUEUE);
+
+      MessageConsumer receiver = session.createConsumer(queue);
+      receiver.setMessageListener(new MessageListener()
+      {
+         public void onMessage(Message msg)
+         {
+            Logger log = Logger.getLogger(getClass().getName());
+            log.debug("ML");
+            try
+            {
+               if (msg instanceof TextMessage)
+               {
+                  log.debug(((TextMessage) msg).getText());
+                  counter1.release();
+               }
+            }
+            catch (Exception e)
+            {
+            }
+         }
+      });
+
+      MessageProducer sender = session.createProducer(queue);
+
+      TextMessage message = session.createTextMessage();
+      message.setText("Normal message");
+      sender.send(message, DeliveryMode.NON_PERSISTENT, 4, 0);
+      //sender.send(queue, message, DeliveryMode.NON_PERSISTENT, 4, 0);
+      message.setText("Persistent message");
+      sender.send(message, DeliveryMode.PERSISTENT, 4, 0);
+      //sender.send(queue, message, DeliveryMode.PERSISTENT, 4, 0);
+      message.setText("High Priority Persistent message");
+      sender.send(message, DeliveryMode.PERSISTENT, 10, 0);
+      //sender.send(queue, message, DeliveryMode.PERSISTENT, 10, 0);
+
+      // Wait for the msgs to be received
+      counter1.acquire();
+      log.debug("MessageListener1 received the TMs sent");
+
+      final CountDown counter2 = new CountDown(2);
+      receiver.setMessageListener(new MessageListener()
+      {
+         public void onMessage(Message msg)
+         {
+            Logger log = Logger.getLogger(getClass().getName());
+            log.debug("ML 2");
+            try
+            {
+               if (msg instanceof TextMessage)
+               {
+                  log.debug(((TextMessage) msg).getText());
+                  counter2.release();
+               }
+            }
+            catch (Exception e)
+            {
+            }
+         }
+      });
+
+      message.setText("Persistent message");
+      sender.send(message, DeliveryMode.PERSISTENT, 4, 0);
+      //sender.send(queue, message, DeliveryMode.PERSISTENT, 4, 0);
+      message.setText("High Priority Persistent message");
+      sender.send(message, DeliveryMode.PERSISTENT, 10, 0);
+      //sender.send(queue, message, DeliveryMode.PERSISTENT, 10, 0);
+
+      // Wait for the msgs to be received
+      counter2.acquire();
+      log.debug("MessageListener2 received the TMs sent");
+
+      receiver.setMessageListener(null);
+
+      message.setText("Persistent message");
+      sender.send(message, DeliveryMode.PERSISTENT, 4, 0);
+      //sender.send(queue, message, DeliveryMode.PERSISTENT, 4, 0);
+      message.setText("High Priority Persistent message");
+      sender.send(message, DeliveryMode.PERSISTENT, 10, 0);
+      //sender.send(queue, message, DeliveryMode.PERSISTENT, 10, 0);
+
+      sender.close();
+      drainQueue();
+      disconnect();
+      getLog().debug("MessageListener test passed");
+   }
+
+   public void testApplicationServerStuff() throws Exception
+   {
+      getLog().debug("Starting testing app server stuff");
+      connect();
+
+      Queue testQueue = (Queue) context.lookup(TEST_QUEUE);
+      final Session session = queueConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+      session.setMessageListener(new MessageListener()
+      {
+         public void onMessage(Message mess)
+         {
+            Logger log = Logger.getLogger(getClass().getName());
+            log.debug("Processing message");
+            try
+            {
+               if (mess instanceof TextMessage)
+                  log.debug(((TextMessage) mess).getText());
+            }
+            catch (Exception e)
+            {
+               log.error("Error", e);
+            }
+         }
+      });
+
+      MessageProducer sender = session.createProducer(testQueue);
+      sender.send(session.createTextMessage("Hi"));
+      sender.send(session.createTextMessage("There"));
+      sender.send(session.createTextMessage("Guys"));
+      queueConnection.createConnectionConsumer(testQueue, null, new ServerSessionPool()
+      {
+         public ServerSession getServerSession()
+         {
+            Logger.getLogger(getClass().getName()).debug("Getting server session.");
+            return new ServerSession()
+            {
+               public Session getSession()
+               {
+                  return session;
+               }
+               public void start()
+               {
+                  Logger.getLogger(getClass().getName()).debug("Starting server session.");
+                  session.run();
+               }
+            };
+         }
+      }, 10);
+
+      queueConnection.start();
+
+      try
+      {
+         Thread.sleep(5 * 1000);
+      }
+      catch (Exception e)
+      {
+      }
+
+      disconnect();
+      getLog().debug("Testing app server stuff passed");
+   }
+
+   private void drainMessagesForTopic(MessageConsumer sub) throws JMSException
+   {
+      Message msg = sub.receive(50);
+      int c = 0;
+      while (msg != null)
+      {
+         c++;
+         if (msg instanceof TextMessage)
+            getLog().debug(((TextMessage) msg).getText());
+         msg = sub.receive(50);
+      }
+      getLog().debug("Received " + c + " messages from topic.");
+   }
+
+   public void testTopics() throws Exception
+   {
+      getLog().debug("Starting Topic test");
+      connect();
+
+      TopicConnectionFactory topicFactory = (TopicConnectionFactory) context.lookup(TOPIC_FACTORY);
+      topicConnection = topicFactory.createTopicConnection("john", "needle");
+
+      topicConnection.start();
+
+      //set up some subscribers to the topic
+      Session session = topicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+      Topic topic = (Topic) context.lookup(TEST_TOPIC);
+
+      TopicSubscriber sub1 = session.createDurableSubscriber(topic, "sub1");
+      MessageConsumer sub2 = session.createConsumer(topic);
+      MessageConsumer sub3 = session.createConsumer(topic);
+
+      //Now a sender
+      MessageProducer sender = session.createProducer(topic);
+
+      //send some messages
+      sender.send(session.createTextMessage("Message 1"));
+      sender.send(session.createTextMessage("Message 2"));
+      sender.send(session.createTextMessage("Message 3"));
+      drainMessagesForTopic(sub1);
+      drainMessagesForTopic(sub2);
+      drainMessagesForTopic(sub3);
+
+      //close some subscribers
+      sub1.close();
+      sub2.close();
+
+      //send some more messages
+      sender.send(session.createTextMessage("Message 4"));
+      sender.send(session.createTextMessage("Message 5"));
+      sender.send(session.createTextMessage("Message 6"));
+
+      //give time for message 4 to be negatively acked (as it will be cause last receive timed out)
+      try
+      {
+         Thread.sleep(5 * 1000);
+      }
+      catch (InterruptedException e)
+      {
+      }
+
+      drainMessagesForTopic(sub3);
+
+      //open subscribers again.
+      sub1 = session.createDurableSubscriber(topic, "sub1");
+      sub2 = session.createConsumer(topic);
+
+      //Send a final message
+      sender.send(session.createTextMessage("Final message"));
+      sender.close();
+
+      drainMessagesForTopic(sub1);
+      drainMessagesForTopic(sub2);
+      drainMessagesForTopic(sub3);
+
+      sub1.close();
+      sub2.close();
+      sub3.close();
+
+      session.unsubscribe("sub1");
+
+      topicConnection.stop();
+      topicConnection.close();
+
+      disconnect();
+      getLog().debug("Topic test passed");
+   }
+
+   /**
+    * Test to seeif the NoLocal feature of topics works.
+    * Messages sended from the same connection should not
+    * be received by Subscribers on the same connection.
+    */
+   public void testTopicNoLocal() throws Exception
+   {
+      getLog().debug("Starting TopicNoLocal test");
+      connect();
+
+      TopicConnectionFactory topicFactory = (TopicConnectionFactory) context.lookup(TOPIC_FACTORY);
+      TopicConnection topicConnection1 = topicFactory.createTopicConnection();
+      topicConnection1.start();
+      TopicConnection topicConnection2 = topicFactory.createTopicConnection();
+      topicConnection2.start();
+
+      // We don't want local messages on this topic.
+      Session session1 = topicConnection1.createSession(false, Session.AUTO_ACKNOWLEDGE);
+      Topic topic = (Topic) context.lookup(TEST_TOPIC);
+      MessageConsumer subscriber1 = session1.createConsumer(topic, null, true);
+      MessageProducer sender1 = session1.createProducer(topic);
+
+      //Now a sender
+      Session session2 = topicConnection2.createSession(false, Session.AUTO_ACKNOWLEDGE);
+      MessageProducer sender2 = session2.createProducer(topic);
+
+      drainMessagesForTopic(subscriber1);
+
+      //send some messages
+      sender1.send(session1.createTextMessage("Local Message"));
+      sender2.send(session2.createTextMessage("Remote Message"));
+
+      // Get the messages, we should get the remote message
+      // but not the local message
+      TextMessage msg1 = (TextMessage) subscriber1.receive(2000);
+      if (msg1 == null)
+      {
+         fail("Did not get any messages");
+      }
+      else
+      {
+         getLog().debug("Got message: " + msg1);
+         if (msg1.getText().equals("Local Message"))
+         {
+            fail("Got a local message");
+         }
+         TextMessage msg2 = (TextMessage) subscriber1.receive(2000);
+         if (msg2 != null)
+         {
+            getLog().debug("Got message: " + msg2);
+            fail("Got an extra message.  msg1:" + msg1 + ", msg2:" + msg2);
+         }
+      }
+
+      topicConnection1.stop();
+      topicConnection1.close();
+      topicConnection2.stop();
+      topicConnection2.close();
+
+      disconnect();
+      getLog().debug("TopicNoLocal test passed");
+   }
+
+   /**
+    * Test to see whether no local works if a message
+    * was created somewhere else.
+    */
+   public void testTopicNoLocalBounce() throws Exception
+   {
+      getLog().debug("Starting TopicNoLocalBounce test");
+      connect();
+
+      TopicConnectionFactory topicFactory = (TopicConnectionFactory) context.lookup(TOPIC_FACTORY);
+      TopicConnection topicConnection1 = topicFactory.createTopicConnection();
+      topicConnection1.start();
+      TopicConnection topicConnection2 = topicFactory.createTopicConnection();
+      topicConnection2.start();
+
+      // Session 1
+      Session session1 = topicConnection1.createSession(false, Session.AUTO_ACKNOWLEDGE);
+      Topic topic = (Topic) context.lookup(TEST_TOPIC);
+      MessageConsumer subscriber1 = session1.createConsumer(topic, null, true);
+      MessageProducer sender1 = session1.createProducer(topic);
+
+      // Session 2
+      Session session2 = topicConnection2.createSession(false, Session.AUTO_ACKNOWLEDGE);
+      MessageConsumer subscriber2 = session2.createConsumer(topic, null, true);
+      MessageProducer sender2 = session2.createProducer(topic);
+
+      drainMessagesForTopic(subscriber1);
+      drainMessagesForTopic(subscriber2);
+
+      //send the message
+      sender1.send(session1.createTextMessage("Message"));
+
+      assertTrue("Subscriber1 should not get a message", subscriber1.receiveNoWait() == null);
+      TextMessage msg = (TextMessage) subscriber2.receive(2000);
+      assertTrue("Subscriber2 should get a message, got " + msg, msg != null && msg.getText().equals("Message"));
+
+      //send it back
+      sender2.send(msg);
+
+      msg = (TextMessage) subscriber1.receive(2000);
+      assertTrue("Subscriber1 should get a message, got " + msg, msg != null && msg.getText().equals("Message"));
+      assertTrue("Subscriber2 should not get a message", subscriber2.receiveNoWait() == null);
+
+      topicConnection1.stop();
+      topicConnection1.close();
+      topicConnection2.stop();
+      topicConnection2.close();
+
+      disconnect();
+      getLog().debug("TopicNoLocalBounce test passed");
+   }
+
+   /**
+    * Test subscribing to a topic with one selector, then changing to another
+    */
+   public void testTopicSelectorChange() throws Exception
+   {
+      getLog().debug("Starting TopicSelectorChange test");
+
+      getLog().debug("Create topic connection");
+      TopicConnectionFactory topicFactory = (TopicConnectionFactory) context.lookup(TOPIC_FACTORY);
+      topicConnection = topicFactory.createTopicConnection("john", "needle");
+      topicConnection.start();
+
+      try
+      {
+         getLog().debug("Retrieving Topic");
+         Topic topic = (Topic) context.lookup(TEST_DURABLE_TOPIC);
+
+         getLog().debug("Creating a send session");
+         Session sendSession = topicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         MessageProducer sender = sendSession.createProducer(topic);
+
+         getLog().debug("Clearing the topic");
+         Session subSession = topicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         MessageConsumer subscriber = subSession.createDurableSubscriber(topic, "test");
+         Message message = subscriber.receive(50);
+         while (message != null)
+            message = subscriber.receive(50);
+         subSession.close();
+
+         getLog().debug("Subscribing to topic, looking for Value = 'A'");
+         subSession = topicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         subscriber = subSession.createDurableSubscriber(topic, "test", "Value = 'A'", false);
+
+         getLog().debug("Send some messages");
+         message = sendSession.createTextMessage("Message1");
+         message.setStringProperty("Value", "A");
+         sender.send(message);
+         message = sendSession.createTextMessage("Message2");
+         message.setStringProperty("Value", "A");
+         sender.send(message);
+         message = sendSession.createTextMessage("Message3");
+         message.setStringProperty("Value", "B");
+         sender.send(message);
+
+         getLog().debug("Retrieving the A messages");
+         message = subscriber.receive(2000);
+         assertTrue("Expected message 1", message != null);
+         assertTrue("Should get an A", message.getStringProperty("Value").equals("A"));
+         message = subscriber.receive(2000);
+         assertTrue("Expected message 2", message != null);
+         assertTrue("Should get a second A", message.getStringProperty("Value").equals("A"));
+         assertTrue("That should be it for A", subscriber.receive(2000) == null);
+
+         getLog().debug("Closing the subscriber without acknowledgement");
+         subSession.close();
+
+         getLog().debug("Subscribing to topic, looking for Value = 'B'");
+         subSession = topicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         subscriber = subSession.createDurableSubscriber(topic, "test", "Value = 'B'", false);
+
+         getLog().debug("Retrieving the non-existent B messages");
+         assertTrue("B should not be there", subscriber.receive(2000) == null);
+
+         getLog().debug("Closing the subscriber.");
+         subSession.close();
+
+         getLog().debug("Subscribing to topic, looking for those Value = 'A'");
+         subSession = topicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         subscriber = subSession.createDurableSubscriber(topic, "test", "Value = 'A'", false);
+         assertTrue("Should not be any A the subscription was changed", subscriber.receive(2000) == null);
+         subSession.close();
+
+         getLog().debug("Subscribing to topic, looking for everything");
+         subSession = topicConnection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
+         subscriber = subSession.createDurableSubscriber(topic, "test", null, false);
+
+         message = sendSession.createTextMessage("Message4");
+         message.setStringProperty("Value", "A");
+         sender.send(message);
+
+         message = subscriber.receive(2000);
+         assertTrue("Expected message 4", message != null);
+         assertTrue("Should be an A which we don't acknowledge", message.getStringProperty("Value").equals("A"));
+         subSession.close();
+
+         getLog().debug("Subscribing to topic, looking for the Value = 'A'");
+         subSession = topicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         subscriber = subSession.createDurableSubscriber(topic, "test", "Value = 'A'", false);
+         assertTrue(
+            "Should not be any A, the subscription was changed. Even though the old and new selectors match the message",
+            subscriber.receive(2000) == null);
+         subSession.close();
+
+         getLog().debug("Closing the send session");
+         sendSession.close();
+
+         getLog().debug("Removing the subscription");
+         subSession = topicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         subSession.unsubscribe("test");
+
+      }
+      finally
+      {
+         getLog().debug("Closing the connection");
+         topicConnection.close();
+      }
+
+      getLog().debug("TopicSelectorChange test passed");
+   }
+
+   /**
+    * Test subscribing to a topic with a null and empty selector
+    */
+   public void testTopicSelectorNullOrEmpty() throws Exception
+   {
+      getLog().debug("Starting TopicSelectorNullOrEmpty test");
+
+      getLog().debug("Create topic connection");
+      TopicConnectionFactory topicFactory = (TopicConnectionFactory) context.lookup(TOPIC_FACTORY);
+      topicConnection = topicFactory.createTopicConnection("john", "needle");
+      topicConnection.start();
+
+      try
+      {
+         getLog().debug("Retrieving Topic");
+         Topic topic = (Topic) context.lookup(TEST_DURABLE_TOPIC);
+
+         getLog().debug("Creating a send session");
+         Session sendSession = topicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         MessageProducer sender = sendSession.createProducer(topic);
+
+         getLog().debug("Clearing the topic");
+         Session subSession = topicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         MessageConsumer subscriber = subSession.createDurableSubscriber(topic, "test");
+         TextMessage message = (TextMessage) subscriber.receive(50);
+         while (message != null)
+            message = (TextMessage) subscriber.receive(50);
+         subSession.close();
+
+         getLog().debug("Subscribing to topic, with null selector");
+         subSession = topicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         subscriber = subSession.createDurableSubscriber(topic, "test", null, false);
+
+         getLog().debug("Send a message");
+         message = sendSession.createTextMessage("Message1");
+         sender.send(message);
+
+         getLog().debug("Retrieving the message");
+         message = (TextMessage) subscriber.receive(2000);
+         assertTrue("Expected message 1", message != null);
+         assertTrue("Should get Message1", message.getText().equals("Message1"));
+         getLog().debug("Closing the subscriber");
+         subSession.close();
+
+         getLog().debug("Subscribing to topic, with an empty selector");
+         subSession = topicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         subscriber = subSession.createDurableSubscriber(topic, "test", "   ", false);
+
+         getLog().debug("Send a message");
+         message = sendSession.createTextMessage("Message2");
+         sender.send(message);
+
+         getLog().debug("Retrieving the message");
+         message = (TextMessage) subscriber.receive(2000);
+         assertTrue("Expected message 2", message != null);
+         assertTrue("Should get Message2", message.getText().equals("Message2"));
+         getLog().debug("Closing the subscriber");
+
+         getLog().debug("Removing the subscription");
+         subSession = topicConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         subSession.unsubscribe("test");
+         subSession.close();
+
+      }
+      finally
+      {
+         getLog().debug("Closing the connection");
+         topicConnection.close();
+      }
+
+      getLog().debug("TopicSelectorNullOrEmpty test passed");
+   }
+
+   /**
+    * Test sending/receiving an outdated message
+    */
+   public void testSendReceiveOutdated() throws Exception
+   {
+      getLog().debug("Starting SendReceiveOutdated test");
+
+      connect();
+      try
+      {
+         queueConnection.start();
+         drainQueue();
+         queueConnection.stop();
+
+         Session session = queueConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         Queue queue = (Queue) context.lookup(TEST_QUEUE);
+         MessageProducer sender = session.createProducer(queue);
+         MessageConsumer receiver = session.createConsumer(queue);
+
+         // Send a message that has expired
+         TextMessage message = session.createTextMessage("Outdated");
+         sender.send(message, DeliveryMode.PERSISTENT, 4, 1);
+         Thread.sleep(100);
+
+         // Send a message that has not expired
+         message = session.createTextMessage("OK");
+         sender.send(message);
+
+         // Try to receive the message the not expired message
+         queueConnection.start();
+         message = (TextMessage) receiver.receiveNoWait();
+         assertEquals("OK", message.getText());
+
+         // Should be no more
+         assertTrue("Didn't expect anymore messages", receiver.receiveNoWait() == null);
+      }
+      finally
+      {
+         disconnect();
+      }
+
+      getLog().debug("SendReceiveOutdated test passed");
+   }
+
+   public void testSendReceiveExpired() throws Exception
+   {
+      getLog().debug("Starting testSendReceiveExpired test");
+
+      connect();
+      try
+      {
+         queueConnection.start();
+         drainQueue();
+
+         Session session = queueConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         Queue queue = (Queue) context.lookup(TEST_QUEUE);
+         MessageProducer sender = session.createProducer(queue);
+         MessageConsumer receiver = session.createConsumer(queue);
+
+         // Send a message that expires in 5 seconds
+         TextMessage message = session.createTextMessage("5 Second Expiration");
+         sender.send(message, DeliveryMode.PERSISTENT, 4, 5*1000);
+         // Send a message that has not expired
+         message = session.createTextMessage("OK");
+         sender.send(message);
+         // Sleep 6 seconds
+         Thread.sleep(6*1000);
+         // Try to receive the OK message
+         message = (TextMessage) receiver.receiveNoWait();
+         assertEquals("OK", message.getText());
+
+         // Should be no more
+         assertTrue("Didn't expect anymore messages", receiver.receiveNoWait() == null);
+
+         // Send a message that expires in 10 seconds
+         message = session.createTextMessage("10 Second Expiration");
+         sender.send(message, DeliveryMode.PERSISTENT, 4, 10*1000);
+         // Send a message that has not expired
+         message = session.createTextMessage("OK");
+         sender.send(message);
+         // Sleep 1 seconds
+         Thread.sleep(1*1000);
+         // Try to receive the messages
+         message = (TextMessage) receiver.receiveNoWait();
+         assertEquals("10 Second Expiration", message.getText());
+         message = (TextMessage) receiver.receiveNoWait();
+         assertEquals("OK", message.getText());
+
+         // Should be no more
+         assertTrue("Didn't expect anymore messages", receiver.receiveNoWait() == null);
+         
+         // Test that JMSExpiration has no affect
+         message = session.createTextMessage("5 Second Expiration");
+         message.setJMSExpiration(System.currentTimeMillis() + 5*1000);
+         sender.send(message, DeliveryMode.PERSISTENT, 4, 0);
+         // Send a message that has not expired
+         message = session.createTextMessage("OK");
+         sender.send(message);
+         // Sleep 6 seconds
+         Thread.sleep(6*1000);
+         // Try to receive the OK message
+         message = (TextMessage) receiver.receiveNoWait();
+         assertEquals("5 Second Expiration", message.getText());
+         message = (TextMessage) receiver.receiveNoWait();
+         assertEquals("OK", message.getText());
+         assertTrue("Didn't expect anymore messages", receiver.receiveNoWait() == null);
+      }
+      finally
+      {
+         disconnect();
+      }
+   }
+
+   class Synch
+   {
+      boolean waiting = false;
+      String text;
+      public synchronized void doWait(long timeout) throws InterruptedException
+      {
+         waiting = true;
+         this.wait(timeout);
+      }
+      public synchronized void doNotify() throws InterruptedException
+      {
+         while (waiting == false)
+            wait(100);
+         this.notifyAll();
+      }
+      public String getText()
+      {
+         return text;
+      }
+      public void setText(String text)
+      {
+         this.text = text;
+      }
+   }
+
+   /**
+    * Test sending/listening an outdated message
+    */
+   public void testSendListenOutdated() throws Exception
+   {
+      getLog().debug("Starting SendListenOutdated test");
+
+      connect();
+      try
+      {
+         queueConnection.start();
+         drainQueue();
+         queueConnection.stop();
+
+         Session session = queueConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         Queue queue = (Queue) context.lookup(TEST_QUEUE);
+         MessageProducer sender = session.createProducer(queue);
+         MessageConsumer receiver = session.createConsumer(queue);
+
+         // Send a message that has expired
+         TextMessage message = session.createTextMessage("Outdated");
+         sender.send(message, DeliveryMode.PERSISTENT, 4, 1);
+         Thread.sleep(100);
+
+         // Send a message that has not expired
+         message = session.createTextMessage("OK");
+         sender.send(message);
+
+         // Try to receive the message the not expired message
+         final Synch synch = new Synch();
+         MessageListener messagelistener = new MessageListener()
+         {
+            public void onMessage(Message message)
+            {
+               listenOutdated(message, synch);
+            }
+         };
+         receiver.setMessageListener(messagelistener);
+         queueConnection.start();
+
+         synch.doWait(10000);
+         assertEquals("OK", synch.getText());
+      }
+      finally
+      {
+         disconnect();
+      }
+
+      getLog().debug("SendListenOutdated test passed");
+   }
+
+   private void listenOutdated(Message message, Synch synch)
+   {
+      try
+      {
+         synch.setText(((TextMessage) message).getText());
+      }
+      catch (Throwable t)
+      {
+         log.error("Error:", t);
+      }
+      finally
+      {
+         try
+         {
+            synch.doNotify();
+         }
+         catch (Throwable t)
+         {
+            log.error("Error:", t);
+         }
+      }
+   }
+}

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/MessageBodyUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/test/MessageBodyUnitTestCase.java	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/MessageBodyUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,340 +0,0 @@
-/*
-  * 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 java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.ObjectMessage;
-import javax.jms.Queue;
-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.TextMessage;
-import javax.naming.Context;
-
-import org.jboss.logging.Logger;
-import org.jboss.test.jbossmessaging.JMSTestCase;
-
-/**
- * Tests message bodies.
- *
- * @author <a href="mailto:richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
- * @author Loren Rosen (submitted patch)
- * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
- * @version $Revision: 64265 $
- */
-public class MessageBodyUnitTestCase extends JMSTestCase
-{
-   // Provider specific
-   public static final String QUEUE_FACTORY = "ConnectionFactory";
-   public static final String TEST_QUEUE = "queue/testQueue";
-
-   Context context;
-   QueueConnection queueConnection;
-   QueueSession session;
-   Queue queue;
-
-   QueueReceiver receiver;
-   QueueSender sender;
-
-   public MessageBodyUnitTestCase(String name) throws Exception
-   {
-      super(name);
-   }
-
-   protected void setUp() throws Exception
-   {
-       // call setUp() in the superclass
-       super.setUp() ;
-
-      connect();
-   }
-
-   protected void tearDown() throws Exception
-   {
-      disconnect();
-      
-      // call tearDown() in the superclass to cleanup
-      super.tearDown() ;
-   }
-
-   protected void connect() throws Exception
-   {
-      getLog().debug("connecting");
-      if (context == null)
-      {
-         context = getInitialContext();
-      }
-
-      QueueConnectionFactory queueFactory = (QueueConnectionFactory) context.lookup(QUEUE_FACTORY);
-      queueConnection = queueFactory.createQueueConnection();
-      getLog().debug("connected");
-
-      queueConnection.start();
-      session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-      getLog().debug("session established");
-
-      queue = (Queue) context.lookup(TEST_QUEUE);
-
-      receiver = session.createReceiver(queue);
-      sender = session.createSender(queue);
-      getLog().debug("sender established");
-
-      drainQueue();
-      getLog().debug("end of connect call");
-   }
-
-   protected void disconnect() throws Exception
-   {
-      queueConnection.close();
-   }
-
-   private void drainQueue() throws Exception
-   {
-      getLog().debug("draining queue");
-
-      Message message = receiver.receive(2000);
-      int c = 0;
-      while (message != null)
-      {
-         message = receiver.receive(2000);
-         c++;
-      }
-
-      if (c != 0)
-         getLog().debug("Drained " + c + " messages from the queue");
-
-      getLog().debug("drained queue");
-
-   }
-
-   protected void validate(String payload) throws Exception
-   {
-      getLog().debug("validating text |" + payload + "|");
-
-      TextMessage outMessage = session.createTextMessage();
-      outMessage.setText(payload);
-      getLog().debug("sending |" + payload + "|");
-      sender.send(outMessage);
-
-      getLog().debug("receiving |" + payload + "|");
-      TextMessage inMessage = (TextMessage) receiver.receive();
-      getLog().debug("received |" + payload + "|");
-      String inPayload = inMessage.getText();
-
-      assertEquals("Message body text test", payload, inPayload);
-      getLog().debug("validated text " + payload);
-   }
-
-   public void testTextMessageBody() throws Exception
-   {
-      getLog().debug("testing text");
-
-      validate("ordinary text");
-      validate(" ");
-      validate("");
-      // very long strings, non-printable ASCII strings
-      char c[] = new char[1024 * 32];
-      Arrays.fill(c, 'x');
-      validate(new String(c));
-      Arrays.fill(c, '\u0130'); // I with dot
-      validate(new String(c));
-      Arrays.fill(c, '\u0008');
-      validate(new String(c));
-      getLog().debug("tested text");
-   }
-
-   protected void validate(java.io.Serializable payload) throws Exception
-   {
-      ObjectMessage outMessage = session.createObjectMessage();
-      outMessage.setObject(payload);
-      sender.send(outMessage);
-
-      ObjectMessage inMessage = (ObjectMessage) receiver.receive();
-      Object inPayload = inMessage.getObject();
-
-      assertEquals("Message body object test", payload, inPayload);
-   }
-
-   public void testObjectMessageBody() throws Exception
-   {
-      getLog().debug("testing object");
-      validate(new Integer(0));
-      validate(new Integer(1));
-      validate(new Integer(-1));
-      validate(new Integer(Integer.MAX_VALUE));
-      validate(new Integer(Integer.MIN_VALUE));
-      validate(new Integer(-1));
-      validate(new Float(1.0));
-      validate(new Float(0.0));
-      validate(new Float(-1.0));
-      validate(new Float(Float.MAX_VALUE));
-      validate(new Float(Float.MIN_VALUE));
-      validate(new Float(Float.NaN));
-      validate(new Float(Float.POSITIVE_INFINITY));
-      validate(new Float(Float.NEGATIVE_INFINITY));
-      validate(new Float(1.0));
-      HashMap m = new HashMap(); // Fill with serializable stuff
-      m.put("file", new java.io.File("somefile.txt"));
-      m.put("url", new java.net.URL("http://example.net"));
-      validate(m);
-      validate((java.io.Serializable)Collections.nCopies(10000, "Repeat"));
-   }
-
-   /**
-    * Test null properties.
-    */
-   public void testNullProperties() throws Exception
-   {
-      TextMessage message = session.createTextMessage();
-
-      message.setStringProperty("THE_PROP", null);
-      message.setObjectProperty("THE_PROP2", null);
-
-      try
-      {
-        message.setStringProperty("", null);
-        fail("empty string property");
-      }
-      catch (IllegalArgumentException e) {}
-
-      try
-      {
-        message.setStringProperty(null, null);
-        fail("null property");
-      }
-      catch (IllegalArgumentException e) {}
-   }
-
-   public void testInvalidPropertyName() throws Exception
-   {
-      Message message = session.createMessage();
-
-      String[] invalid = new String[]
-      {
-         "invalid-hyphen",
-         "1digitfirst",
-         "NULL",
-         "TRUE",
-         "FALSE",
-         "NOT",
-         "AND",
-         "OR",
-         "BETWEEN",
-         "LIKE",
-         "IN",
-         "IS",
-         "ESCAPE"
-      };
-
-      for (int i = 0; i < invalid.length; ++i)
-      {
-         try
-         {
-            message.setStringProperty(invalid[i], "whatever");
-            fail("expected error for invalid property name " + invalid[i]);
-         }
-         catch (IllegalArgumentException expected)
-         {
-         }
-      }
-
-      String[] valid = new String[]
-      {
-         "identifier",
-         "_",
-         "$",
-         "_xSx",
-         "$x_x",
-         "A1",
-         "null",
-         "true",
-         "false",
-         "not",
-         "and",
-         "or",
-         "between",
-         "like",
-         "in",
-         "is",
-         "escape"
-      };
-
-      for (int i = 0; i < invalid.length; ++i)
-         message.setStringProperty(valid[i], "whatever");
-   }
-
-   /**
-    * Test vendor properties.
-    * Test disabled for JBossMessaging
-    */
-   /*public void testVendorProperties() throws Exception
-   {
-      TextMessage message = session.createTextMessage();
-      
-      System.out.println("hello!!!");
-
-      try
-      {
-        message.setStringProperty("JMS_JBOSS_SCHEDULED_DELIVERY", "whenever");
-        fail("invalid type");
-      }
-      catch (JMSException e) {
-    	  e.printStackTrace();
-      }
-      try
-      {
-        message.setObjectProperty("JMS_JBOSS_SCHEDULED_DELIVERY", "10234");
-        fail("invalid type");
-      }
-      catch (JMSException e) {
-    	  e.printStackTrace();
-      }
-      try
-      {
-        message.setStringProperty("JMS_JBOSS_REDELIVERY_COUNT", "fruity");
-        fail("invalid type");
-      }
-      catch (JMSException e) {
-    	  e.printStackTrace();
-      }
-      try
-      {
-        message.setStringProperty("JMS_JBOSS_REDELIVERY_LIMIT", "fruity");
-        fail("invalid type");
-      }
-      catch (JMSException e) {
-    	  e.printStackTrace();
-      }
-
-      message.setLongProperty("JMS_JBOSS_SCHEDULED_DELIVERY", 10234);
-      message.setIntProperty("JMS_JBOSS_REDELIVERY_COUNT", 123);
-      message.setShortProperty("JMS_JBOSS_REDELIVERY_LIMIT", (short)1);
-   } */
-
-}

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/MessageBodyUnitTestCase.java (from rev 64641, branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/test/MessageBodyUnitTestCase.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/MessageBodyUnitTestCase.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/MessageBodyUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,340 @@
+/*
+  * 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 java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.ObjectMessage;
+import javax.jms.Queue;
+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.TextMessage;
+import javax.naming.Context;
+
+import org.jboss.logging.Logger;
+import org.jboss.test.jbossmessaging.JMSTestCase;
+
+/**
+ * Tests message bodies.
+ *
+ * @author <a href="mailto:richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
+ * @author Loren Rosen (submitted patch)
+ * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
+ * @version $Revision: 64265 $
+ */
+public class MessageBodyUnitTestCase extends JMSTestCase
+{
+   // Provider specific
+   public static final String QUEUE_FACTORY = "ConnectionFactory";
+   public static final String TEST_QUEUE = "queue/testQueue";
+
+   Context context;
+   QueueConnection queueConnection;
+   QueueSession session;
+   Queue queue;
+
+   QueueReceiver receiver;
+   QueueSender sender;
+
+   public MessageBodyUnitTestCase(String name) throws Exception
+   {
+      super(name);
+   }
+
+   protected void setUp() throws Exception
+   {
+       // call setUp() in the superclass
+       super.setUp() ;
+
+      connect();
+   }
+
+   protected void tearDown() throws Exception
+   {
+      disconnect();
+      
+      // call tearDown() in the superclass to cleanup
+      super.tearDown() ;
+   }
+
+   protected void connect() throws Exception
+   {
+      getLog().debug("connecting");
+      if (context == null)
+      {
+         context = getInitialContext();
+      }
+
+      QueueConnectionFactory queueFactory = (QueueConnectionFactory) context.lookup(QUEUE_FACTORY);
+      queueConnection = queueFactory.createQueueConnection();
+      getLog().debug("connected");
+
+      queueConnection.start();
+      session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+      getLog().debug("session established");
+
+      queue = (Queue) context.lookup(TEST_QUEUE);
+
+      receiver = session.createReceiver(queue);
+      sender = session.createSender(queue);
+      getLog().debug("sender established");
+
+      drainQueue();
+      getLog().debug("end of connect call");
+   }
+
+   protected void disconnect() throws Exception
+   {
+      queueConnection.close();
+   }
+
+   private void drainQueue() throws Exception
+   {
+      getLog().debug("draining queue");
+
+      Message message = receiver.receive(2000);
+      int c = 0;
+      while (message != null)
+      {
+         message = receiver.receive(2000);
+         c++;
+      }
+
+      if (c != 0)
+         getLog().debug("Drained " + c + " messages from the queue");
+
+      getLog().debug("drained queue");
+
+   }
+
+   protected void validate(String payload) throws Exception
+   {
+      getLog().debug("validating text |" + payload + "|");
+
+      TextMessage outMessage = session.createTextMessage();
+      outMessage.setText(payload);
+      getLog().debug("sending |" + payload + "|");
+      sender.send(outMessage);
+
+      getLog().debug("receiving |" + payload + "|");
+      TextMessage inMessage = (TextMessage) receiver.receive();
+      getLog().debug("received |" + payload + "|");
+      String inPayload = inMessage.getText();
+
+      assertEquals("Message body text test", payload, inPayload);
+      getLog().debug("validated text " + payload);
+   }
+
+   public void testTextMessageBody() throws Exception
+   {
+      getLog().debug("testing text");
+
+      validate("ordinary text");
+      validate(" ");
+      validate("");
+      // very long strings, non-printable ASCII strings
+      char c[] = new char[1024 * 32];
+      Arrays.fill(c, 'x');
+      validate(new String(c));
+      Arrays.fill(c, '\u0130'); // I with dot
+      validate(new String(c));
+      Arrays.fill(c, '\u0008');
+      validate(new String(c));
+      getLog().debug("tested text");
+   }
+
+   protected void validate(java.io.Serializable payload) throws Exception
+   {
+      ObjectMessage outMessage = session.createObjectMessage();
+      outMessage.setObject(payload);
+      sender.send(outMessage);
+
+      ObjectMessage inMessage = (ObjectMessage) receiver.receive();
+      Object inPayload = inMessage.getObject();
+
+      assertEquals("Message body object test", payload, inPayload);
+   }
+
+   public void testObjectMessageBody() throws Exception
+   {
+      getLog().debug("testing object");
+      validate(new Integer(0));
+      validate(new Integer(1));
+      validate(new Integer(-1));
+      validate(new Integer(Integer.MAX_VALUE));
+      validate(new Integer(Integer.MIN_VALUE));
+      validate(new Integer(-1));
+      validate(new Float(1.0));
+      validate(new Float(0.0));
+      validate(new Float(-1.0));
+      validate(new Float(Float.MAX_VALUE));
+      validate(new Float(Float.MIN_VALUE));
+      validate(new Float(Float.NaN));
+      validate(new Float(Float.POSITIVE_INFINITY));
+      validate(new Float(Float.NEGATIVE_INFINITY));
+      validate(new Float(1.0));
+      HashMap m = new HashMap(); // Fill with serializable stuff
+      m.put("file", new java.io.File("somefile.txt"));
+      m.put("url", new java.net.URL("http://example.net"));
+      validate(m);
+      validate((java.io.Serializable)Collections.nCopies(10000, "Repeat"));
+   }
+
+   /**
+    * Test null properties.
+    */
+   public void testNullProperties() throws Exception
+   {
+      TextMessage message = session.createTextMessage();
+
+      message.setStringProperty("THE_PROP", null);
+      message.setObjectProperty("THE_PROP2", null);
+
+      try
+      {
+        message.setStringProperty("", null);
+        fail("empty string property");
+      }
+      catch (IllegalArgumentException e) {}
+
+      try
+      {
+        message.setStringProperty(null, null);
+        fail("null property");
+      }
+      catch (IllegalArgumentException e) {}
+   }
+
+   public void testInvalidPropertyName() throws Exception
+   {
+      Message message = session.createMessage();
+
+      String[] invalid = new String[]
+      {
+         "invalid-hyphen",
+         "1digitfirst",
+         "NULL",
+         "TRUE",
+         "FALSE",
+         "NOT",
+         "AND",
+         "OR",
+         "BETWEEN",
+         "LIKE",
+         "IN",
+         "IS",
+         "ESCAPE"
+      };
+
+      for (int i = 0; i < invalid.length; ++i)
+      {
+         try
+         {
+            message.setStringProperty(invalid[i], "whatever");
+            fail("expected error for invalid property name " + invalid[i]);
+         }
+         catch (IllegalArgumentException expected)
+         {
+         }
+      }
+
+      String[] valid = new String[]
+      {
+         "identifier",
+         "_",
+         "$",
+         "_xSx",
+         "$x_x",
+         "A1",
+         "null",
+         "true",
+         "false",
+         "not",
+         "and",
+         "or",
+         "between",
+         "like",
+         "in",
+         "is",
+         "escape"
+      };
+
+      for (int i = 0; i < invalid.length; ++i)
+         message.setStringProperty(valid[i], "whatever");
+   }
+
+   /**
+    * Test vendor properties.
+    * Test disabled for JBossMessaging
+    */
+   /*public void testVendorProperties() throws Exception
+   {
+      TextMessage message = session.createTextMessage();
+      
+      System.out.println("hello!!!");
+
+      try
+      {
+        message.setStringProperty("JMS_JBOSS_SCHEDULED_DELIVERY", "whenever");
+        fail("invalid type");
+      }
+      catch (JMSException e) {
+    	  e.printStackTrace();
+      }
+      try
+      {
+        message.setObjectProperty("JMS_JBOSS_SCHEDULED_DELIVERY", "10234");
+        fail("invalid type");
+      }
+      catch (JMSException e) {
+    	  e.printStackTrace();
+      }
+      try
+      {
+        message.setStringProperty("JMS_JBOSS_REDELIVERY_COUNT", "fruity");
+        fail("invalid type");
+      }
+      catch (JMSException e) {
+    	  e.printStackTrace();
+      }
+      try
+      {
+        message.setStringProperty("JMS_JBOSS_REDELIVERY_LIMIT", "fruity");
+        fail("invalid type");
+      }
+      catch (JMSException e) {
+    	  e.printStackTrace();
+      }
+
+      message.setLongProperty("JMS_JBOSS_SCHEDULED_DELIVERY", 10234);
+      message.setIntProperty("JMS_JBOSS_REDELIVERY_COUNT", 123);
+      message.setShortProperty("JMS_JBOSS_REDELIVERY_LIMIT", (short)1);
+   } */
+
+}

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/MessageTypesUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/test/MessageTypesUnitTestCase.java	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/MessageTypesUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,267 +0,0 @@
-/*
-  * 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 java.util.Arrays;
-import java.math.BigInteger;
-import javax.jms.DeliveryMode;
-import javax.jms.MapMessage;
-import javax.jms.Message;
-import javax.jms.Queue;
-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.TextMessage;
-import javax.jms.BytesMessage;
-import javax.jms.ObjectMessage;
-import javax.jms.StreamMessage;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-
-import org.jboss.test.jbossmessaging.JMSTestCase;
-
-/**
- * Tests of sending/receiving all jms message types to/from a queue
- * 
- * @author <a href="mailto:richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
- * @author Scott.Stark at jboss.org
- * @version $Revision: 64130 $
- */
-public class MessageTypesUnitTestCase extends JMSTestCase
-{
-   static String QUEUE_FACTORY = "ConnectionFactory";
-   static String TEST_QUEUE = "queue/testQueue";
-
-   private Context context;
-   private QueueConnection queueConnection;
-   private QueueSession session;
-   private QueueSender sender;
-   private QueueReceiver receiver;
-
-   public MessageTypesUnitTestCase(String name) throws Exception
-   {
-      super(name);
-   }
-
-   public void testMapMessage() throws Exception
-   {
-      log.info("+++ testMapMessage");
-      MapMessage sent = session.createMapMessage();
-      sent.setBoolean("Boolean", true);
-      sent.setByte("Byte", (byte) 1);
-      sent.setBytes("Bytes", "Bytes".getBytes());
-      sent.setChar("Char", 'c');
-      sent.setShort("Short", (short) 31415);
-      sent.setInt("Int", 314159);
-      sent.setLong("Long", 3141592653589793238L);
-      sent.setDouble("Double", 3.1415926535897932384626433832795);
-      sent.setFloat("Float", 3.141f);
-      sent.setObject("Object", "31415926535897932384626433832795");
-      sent.setString("String", "31415926535897932384626433832795");
-
-      MapMessage recv = (MapMessage) sendRecMsg(sent);
-      log.debug("recv: "+recv);
-      assertTrue("Boolean == true", recv.getBoolean("Boolean") == true);
-      assertTrue("Byte == 1", recv.getByte("Byte") == 1);
-      assertTrue("Bytes == Bytes[]",
-         Arrays.equals(recv.getBytes("Bytes"), "Bytes".getBytes()));
-      assertTrue("Char == c", recv.getChar("Char") == 'c');
-      assertTrue("Short == 314159", recv.getShort("Short") == 31415);
-      assertTrue("Int == 314159", recv.getInt("Int") == 314159);
-      assertTrue("Long == 3141592653589793238L",
-         recv.getLong("Long") == 3141592653589793238L);
-      assertTrue("Double == 3.1415926535897932384626433832795",
-         recv.getDouble("Double") == 3.1415926535897932384626433832795);
-      assertTrue("Float == true", recv.getFloat("Float") == 3.141f);
-      assertTrue("Object == 31415926535897932384626433832795",
-         recv.getObject("Object").equals("31415926535897932384626433832795"));
-      assertTrue("String == 31415926535897932384626433832795",
-         recv.getString("String").equals("31415926535897932384626433832795"));
-   }
-   public void testTextMessage() throws Exception
-   {
-      log.info("+++ testTextMessage");
-      String text = "A multiline text msg.\nSecond line.\n";
-      TextMessage sent = session.createTextMessage(text);
-      TextMessage recv = (TextMessage) sendRecMsg(sent);
-      log.debug("recv: "+recv);
-      assertTrue(recv.getText().equals(text));
-   }
-   public void testMessage() throws Exception
-   {
-      log.info("+++ testMessage");
-      Message sent = session.createMessage();
-      sent.setBooleanProperty("Boolean", true);
-      sent.setByteProperty("Byte", (byte) 1);
-      sent.setShortProperty("Short", (short) 31415);
-      sent.setIntProperty("Int", 314159);
-      sent.setLongProperty("Long", 3141592653589793238L);
-      sent.setDoubleProperty("Double", 3.1415926535897932384626433832795);
-      sent.setFloatProperty("Float", 3.141f);
-      sent.setObjectProperty("Object", "31415926535897932384626433832795");
-      sent.setStringProperty("String", "31415926535897932384626433832795");
-
-      Message recv = sendRecMsg(sent);
-      log.debug("recv: "+recv);
-      assertTrue("Boolean == true", recv.getBooleanProperty("Boolean") == true);
-      assertTrue("Byte == 1", recv.getByteProperty("Byte") == 1);
-      assertTrue("Short == 314159", recv.getShortProperty("Short") == 31415);
-      assertTrue("Int == 314159", recv.getIntProperty("Int") == 314159);
-      assertTrue("Long == 3141592653589793238L",
-         recv.getLongProperty("Long") == 3141592653589793238L);
-      assertTrue("Double == 3.1415926535897932384626433832795",
-         recv.getDoubleProperty("Double") == 3.1415926535897932384626433832795);
-      assertTrue("Float == true", recv.getFloatProperty("Float") == 3.141f);
-      assertTrue("Object == 31415926535897932384626433832795",
-         recv.getObjectProperty("Object").equals("31415926535897932384626433832795"));
-      assertTrue("String == 31415926535897932384626433832795",
-         recv.getStringProperty("String").equals("31415926535897932384626433832795"));
-   }
-   public void testBytesMessage() throws Exception
-   {
-      log.info("+++ testBytesMessage");
-      BytesMessage sent = session.createBytesMessage();
-      sent.writeBoolean(true);
-      sent.writeByte((byte) 1);
-      byte[] testBytes = "Bytes".getBytes();
-      sent.writeBytes(testBytes);
-      sent.writeChar('c');
-      sent.writeShort((short) 31415);
-      sent.writeInt(314159);
-      sent.writeLong(3141592653589793238L);
-      sent.writeDouble(3.1415926535897932384626433832795);
-      sent.writeFloat(3.141f);
-      sent.writeObject("31415926535897932384626433832795");
-      sent.writeUTF("31415926535897932384626433832795");
-
-      BytesMessage recv = (BytesMessage) sendRecMsg(sent);
-      log.debug("recv: "+recv);
-      assertTrue("Boolean == true", recv.readBoolean() == true);
-      assertTrue("Byte == 1", recv.readByte() == 1);
-      byte[] bytes = new byte[testBytes.length];
-      recv.readBytes(bytes); 
-      assertTrue("Bytes == Bytes[]",
-         Arrays.equals(bytes, testBytes));
-      assertTrue("Char == c", recv.readChar() == 'c');
-      assertTrue("Short == 314159", recv.readShort() == 31415);
-      assertTrue("Int == 314159", recv.readInt() == 314159);
-      assertTrue("Long == 3141592653589793238L",
-         recv.readLong() == 3141592653589793238L);
-      assertTrue("Double == 3.1415926535897932384626433832795",
-         recv.readDouble() == 3.1415926535897932384626433832795);
-      assertTrue("Float == true", recv.readFloat() == 3.141f);
-      assertTrue("Object == 31415926535897932384626433832795",
-         recv.readUTF().equals("31415926535897932384626433832795"));
-      assertTrue("String == 31415926535897932384626433832795",
-         recv.readUTF().equals("31415926535897932384626433832795"));
-   }
-   public void testObjectMessage() throws Exception
-   {
-      log.info("+++ testObjectMessage");
-      BigInteger data = new BigInteger("31415926535897932384626433832795", 10);
-      ObjectMessage sent = session.createObjectMessage(data);
-      ObjectMessage recv = (ObjectMessage) sendRecMsg(sent);
-      log.debug("recv: "+recv);
-      BigInteger data2 = (BigInteger) recv.getObject();
-      assertTrue("BigInteger == BigInteger2", data2.equals(data));
-   }
-   public void testStreamMessage() throws Exception
-   {
-      log.info("+++ testStreamMessage");
-      StreamMessage sent = session.createStreamMessage();
-      sent.writeBoolean(true);
-      sent.writeByte((byte) 1);
-      byte[] testBytes = "Bytes".getBytes();
-      sent.writeBytes(testBytes);
-      sent.writeChar('c');
-      sent.writeShort((short) 31415);
-      sent.writeInt(314159);
-      sent.writeLong(3141592653589793238L);
-      sent.writeDouble(3.1415926535897932384626433832795);
-      sent.writeFloat(3.141f);
-      sent.writeObject("31415926535897932384626433832795");
-      sent.writeString("31415926535897932384626433832795");
-
-      StreamMessage recv = (StreamMessage) sendRecMsg(sent);
-      log.debug("recv: "+recv);
-      assertTrue("Boolean == true", recv.readBoolean() == true);
-      assertTrue("Byte == 1", recv.readByte() == 1);
-      // Quirky spec behavior requires a read past the end of the byte[] field
-      byte[] bytes = new byte[testBytes.length];
-      recv.readBytes(bytes);
-      assertTrue(recv.readBytes(bytes) < 0);
-      assertTrue("Bytes == Bytes[]",
-         Arrays.equals(bytes, testBytes));
-      char c = recv.readChar();
-      assertTrue("Char == c", c == 'c');
-      assertTrue("Short == 314159", recv.readShort() == 31415);
-      assertTrue("Int == 314159", recv.readInt() == 314159);
-      assertTrue("Long == 3141592653589793238L",
-         recv.readLong() == 3141592653589793238L);
-      assertTrue("Double == 3.1415926535897932384626433832795",
-         recv.readDouble() == 3.1415926535897932384626433832795);
-      assertTrue("Float == true", recv.readFloat() == 3.141f);
-      assertTrue("Object == 31415926535897932384626433832795",
-         recv.readObject().equals("31415926535897932384626433832795"));
-      assertTrue("String == 31415926535897932384626433832795",
-         recv.readString().equals("31415926535897932384626433832795"));
-   }
-
-   protected void setUp() throws Exception
-   {
-       // call setUp() in superclass
-       super.setUp() ;
-
-      context = new InitialContext();
-      QueueConnectionFactory queueFactory = (QueueConnectionFactory) context.lookup(QUEUE_FACTORY);
-      queueConnection = queueFactory.createQueueConnection();
-      queueConnection.start();
-      session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-      Queue queue = (Queue) context.lookup(TEST_QUEUE);
-      sender = session.createSender(queue);
-      receiver = session.createReceiver(queue);
-
-      log.debug("Connection to jms established.");
-   }
-
-   protected void tearDown() throws Exception
-   {
-      sender.close();
-      receiver.close();
-      session.close();
-      queueConnection.close();
-
-      // call tearDown() in superclass
-      super.tearDown() ;
-   }
-
-   private Message sendRecMsg(Message in) throws Exception
-   {
-      sender.send(in, DeliveryMode.NON_PERSISTENT, 4, 0);
-      Message out = receiver.receive(5000);
-      return out;
-   }
-
-}

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/MessageTypesUnitTestCase.java (from rev 64641, branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/test/MessageTypesUnitTestCase.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/MessageTypesUnitTestCase.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/MessageTypesUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,267 @@
+/*
+  * 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 java.util.Arrays;
+import java.math.BigInteger;
+import javax.jms.DeliveryMode;
+import javax.jms.MapMessage;
+import javax.jms.Message;
+import javax.jms.Queue;
+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.TextMessage;
+import javax.jms.BytesMessage;
+import javax.jms.ObjectMessage;
+import javax.jms.StreamMessage;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import org.jboss.test.jbossmessaging.JMSTestCase;
+
+/**
+ * Tests of sending/receiving all jms message types to/from a queue
+ * 
+ * @author <a href="mailto:richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 64130 $
+ */
+public class MessageTypesUnitTestCase extends JMSTestCase
+{
+   static String QUEUE_FACTORY = "ConnectionFactory";
+   static String TEST_QUEUE = "queue/testQueue";
+
+   private Context context;
+   private QueueConnection queueConnection;
+   private QueueSession session;
+   private QueueSender sender;
+   private QueueReceiver receiver;
+
+   public MessageTypesUnitTestCase(String name) throws Exception
+   {
+      super(name);
+   }
+
+   public void testMapMessage() throws Exception
+   {
+      log.info("+++ testMapMessage");
+      MapMessage sent = session.createMapMessage();
+      sent.setBoolean("Boolean", true);
+      sent.setByte("Byte", (byte) 1);
+      sent.setBytes("Bytes", "Bytes".getBytes());
+      sent.setChar("Char", 'c');
+      sent.setShort("Short", (short) 31415);
+      sent.setInt("Int", 314159);
+      sent.setLong("Long", 3141592653589793238L);
+      sent.setDouble("Double", 3.1415926535897932384626433832795);
+      sent.setFloat("Float", 3.141f);
+      sent.setObject("Object", "31415926535897932384626433832795");
+      sent.setString("String", "31415926535897932384626433832795");
+
+      MapMessage recv = (MapMessage) sendRecMsg(sent);
+      log.debug("recv: "+recv);
+      assertTrue("Boolean == true", recv.getBoolean("Boolean") == true);
+      assertTrue("Byte == 1", recv.getByte("Byte") == 1);
+      assertTrue("Bytes == Bytes[]",
+         Arrays.equals(recv.getBytes("Bytes"), "Bytes".getBytes()));
+      assertTrue("Char == c", recv.getChar("Char") == 'c');
+      assertTrue("Short == 314159", recv.getShort("Short") == 31415);
+      assertTrue("Int == 314159", recv.getInt("Int") == 314159);
+      assertTrue("Long == 3141592653589793238L",
+         recv.getLong("Long") == 3141592653589793238L);
+      assertTrue("Double == 3.1415926535897932384626433832795",
+         recv.getDouble("Double") == 3.1415926535897932384626433832795);
+      assertTrue("Float == true", recv.getFloat("Float") == 3.141f);
+      assertTrue("Object == 31415926535897932384626433832795",
+         recv.getObject("Object").equals("31415926535897932384626433832795"));
+      assertTrue("String == 31415926535897932384626433832795",
+         recv.getString("String").equals("31415926535897932384626433832795"));
+   }
+   public void testTextMessage() throws Exception
+   {
+      log.info("+++ testTextMessage");
+      String text = "A multiline text msg.\nSecond line.\n";
+      TextMessage sent = session.createTextMessage(text);
+      TextMessage recv = (TextMessage) sendRecMsg(sent);
+      log.debug("recv: "+recv);
+      assertTrue(recv.getText().equals(text));
+   }
+   public void testMessage() throws Exception
+   {
+      log.info("+++ testMessage");
+      Message sent = session.createMessage();
+      sent.setBooleanProperty("Boolean", true);
+      sent.setByteProperty("Byte", (byte) 1);
+      sent.setShortProperty("Short", (short) 31415);
+      sent.setIntProperty("Int", 314159);
+      sent.setLongProperty("Long", 3141592653589793238L);
+      sent.setDoubleProperty("Double", 3.1415926535897932384626433832795);
+      sent.setFloatProperty("Float", 3.141f);
+      sent.setObjectProperty("Object", "31415926535897932384626433832795");
+      sent.setStringProperty("String", "31415926535897932384626433832795");
+
+      Message recv = sendRecMsg(sent);
+      log.debug("recv: "+recv);
+      assertTrue("Boolean == true", recv.getBooleanProperty("Boolean") == true);
+      assertTrue("Byte == 1", recv.getByteProperty("Byte") == 1);
+      assertTrue("Short == 314159", recv.getShortProperty("Short") == 31415);
+      assertTrue("Int == 314159", recv.getIntProperty("Int") == 314159);
+      assertTrue("Long == 3141592653589793238L",
+         recv.getLongProperty("Long") == 3141592653589793238L);
+      assertTrue("Double == 3.1415926535897932384626433832795",
+         recv.getDoubleProperty("Double") == 3.1415926535897932384626433832795);
+      assertTrue("Float == true", recv.getFloatProperty("Float") == 3.141f);
+      assertTrue("Object == 31415926535897932384626433832795",
+         recv.getObjectProperty("Object").equals("31415926535897932384626433832795"));
+      assertTrue("String == 31415926535897932384626433832795",
+         recv.getStringProperty("String").equals("31415926535897932384626433832795"));
+   }
+   public void testBytesMessage() throws Exception
+   {
+      log.info("+++ testBytesMessage");
+      BytesMessage sent = session.createBytesMessage();
+      sent.writeBoolean(true);
+      sent.writeByte((byte) 1);
+      byte[] testBytes = "Bytes".getBytes();
+      sent.writeBytes(testBytes);
+      sent.writeChar('c');
+      sent.writeShort((short) 31415);
+      sent.writeInt(314159);
+      sent.writeLong(3141592653589793238L);
+      sent.writeDouble(3.1415926535897932384626433832795);
+      sent.writeFloat(3.141f);
+      sent.writeObject("31415926535897932384626433832795");
+      sent.writeUTF("31415926535897932384626433832795");
+
+      BytesMessage recv = (BytesMessage) sendRecMsg(sent);
+      log.debug("recv: "+recv);
+      assertTrue("Boolean == true", recv.readBoolean() == true);
+      assertTrue("Byte == 1", recv.readByte() == 1);
+      byte[] bytes = new byte[testBytes.length];
+      recv.readBytes(bytes); 
+      assertTrue("Bytes == Bytes[]",
+         Arrays.equals(bytes, testBytes));
+      assertTrue("Char == c", recv.readChar() == 'c');
+      assertTrue("Short == 314159", recv.readShort() == 31415);
+      assertTrue("Int == 314159", recv.readInt() == 314159);
+      assertTrue("Long == 3141592653589793238L",
+         recv.readLong() == 3141592653589793238L);
+      assertTrue("Double == 3.1415926535897932384626433832795",
+         recv.readDouble() == 3.1415926535897932384626433832795);
+      assertTrue("Float == true", recv.readFloat() == 3.141f);
+      assertTrue("Object == 31415926535897932384626433832795",
+         recv.readUTF().equals("31415926535897932384626433832795"));
+      assertTrue("String == 31415926535897932384626433832795",
+         recv.readUTF().equals("31415926535897932384626433832795"));
+   }
+   public void testObjectMessage() throws Exception
+   {
+      log.info("+++ testObjectMessage");
+      BigInteger data = new BigInteger("31415926535897932384626433832795", 10);
+      ObjectMessage sent = session.createObjectMessage(data);
+      ObjectMessage recv = (ObjectMessage) sendRecMsg(sent);
+      log.debug("recv: "+recv);
+      BigInteger data2 = (BigInteger) recv.getObject();
+      assertTrue("BigInteger == BigInteger2", data2.equals(data));
+   }
+   public void testStreamMessage() throws Exception
+   {
+      log.info("+++ testStreamMessage");
+      StreamMessage sent = session.createStreamMessage();
+      sent.writeBoolean(true);
+      sent.writeByte((byte) 1);
+      byte[] testBytes = "Bytes".getBytes();
+      sent.writeBytes(testBytes);
+      sent.writeChar('c');
+      sent.writeShort((short) 31415);
+      sent.writeInt(314159);
+      sent.writeLong(3141592653589793238L);
+      sent.writeDouble(3.1415926535897932384626433832795);
+      sent.writeFloat(3.141f);
+      sent.writeObject("31415926535897932384626433832795");
+      sent.writeString("31415926535897932384626433832795");
+
+      StreamMessage recv = (StreamMessage) sendRecMsg(sent);
+      log.debug("recv: "+recv);
+      assertTrue("Boolean == true", recv.readBoolean() == true);
+      assertTrue("Byte == 1", recv.readByte() == 1);
+      // Quirky spec behavior requires a read past the end of the byte[] field
+      byte[] bytes = new byte[testBytes.length];
+      recv.readBytes(bytes);
+      assertTrue(recv.readBytes(bytes) < 0);
+      assertTrue("Bytes == Bytes[]",
+         Arrays.equals(bytes, testBytes));
+      char c = recv.readChar();
+      assertTrue("Char == c", c == 'c');
+      assertTrue("Short == 314159", recv.readShort() == 31415);
+      assertTrue("Int == 314159", recv.readInt() == 314159);
+      assertTrue("Long == 3141592653589793238L",
+         recv.readLong() == 3141592653589793238L);
+      assertTrue("Double == 3.1415926535897932384626433832795",
+         recv.readDouble() == 3.1415926535897932384626433832795);
+      assertTrue("Float == true", recv.readFloat() == 3.141f);
+      assertTrue("Object == 31415926535897932384626433832795",
+         recv.readObject().equals("31415926535897932384626433832795"));
+      assertTrue("String == 31415926535897932384626433832795",
+         recv.readString().equals("31415926535897932384626433832795"));
+   }
+
+   protected void setUp() throws Exception
+   {
+       // call setUp() in superclass
+       super.setUp() ;
+
+      context = new InitialContext();
+      QueueConnectionFactory queueFactory = (QueueConnectionFactory) context.lookup(QUEUE_FACTORY);
+      queueConnection = queueFactory.createQueueConnection();
+      queueConnection.start();
+      session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+      Queue queue = (Queue) context.lookup(TEST_QUEUE);
+      sender = session.createSender(queue);
+      receiver = session.createReceiver(queue);
+
+      log.debug("Connection to jms established.");
+   }
+
+   protected void tearDown() throws Exception
+   {
+      sender.close();
+      receiver.close();
+      session.close();
+      queueConnection.close();
+
+      // call tearDown() in superclass
+      super.tearDown() ;
+   }
+
+   private Message sendRecMsg(Message in) throws Exception
+   {
+      sender.send(in, DeliveryMode.NON_PERSISTENT, 4, 0);
+      Message out = receiver.receive(5000);
+      return out;
+   }
+
+}

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/RollBackUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/test/RollBackUnitTestCase.java	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/RollBackUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,729 +0,0 @@
-/*
-  * 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.BytesMessage;
-import javax.jms.DeliveryMode;
-import javax.jms.JMSException;
-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.Topic;
-import javax.jms.TopicConnection;
-import javax.jms.TopicConnectionFactory;
-import javax.jms.TopicPublisher;
-import javax.jms.TopicSession;
-import javax.jms.TopicSubscriber;
-import javax.jms.Queue;
-import javax.naming.Context;
-
-import org.apache.log4j.Logger;
-import org.jboss.test.jbossmessaging.JMSTestCase;
-
-/**
- * Rollback tests
- *
- * @author <a href="mailto:richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
- * @author
- * @version
- */
-public class RollBackUnitTestCase extends JMSTestCase
-{
-
-   // Provider specific
-   static String TOPIC_FACTORY = "ConnectionFactory";
-
-   static String QUEUE_FACTORY = "ConnectionFactory";
-
-   static String TEST_QUEUE = "queue/testQueue";
-
-   static String TEST_TOPIC = "topic/testTopic";
-
-   static String TEST_DURABLE_TOPIC = "topic/testDurableTopic";
-
-   static byte[] PAYLOAD = new byte[10];
-
-   static Context context;
-
-   static QueueConnection queueConnection;
-
-   static TopicConnection topicConnection;
-
-   static TopicConnection topicDurableConnection;
-
-   /**
-    * Constructor the test
-    *
-    * @param name           Description of Parameter
-    * @exception Exception  Description of Exception
-    */
-   public RollBackUnitTestCase(String name) throws Exception
-   {
-      super(name);
-   }
-
-   /**
-    * #Description of the Method
-    *
-    * @param persistence    Description of Parameter
-    * @exception Exception  Description of Exception
-    */
-   public void runQueueSendRollBack(final int persistence, final boolean explicit) throws Exception
-   {
-      drainQueue();
-      final int iterationCount = getIterationCount();
-      final Logger log = getLog();
-
-      Thread sendThread = new Thread()
-      {
-         public void run()
-         {
-            try
-            {
-               QueueSession session = queueConnection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
-               Queue queue = (Queue) context.lookup(TEST_QUEUE);
-
-               QueueSender sender = session.createSender(queue);
-
-               BytesMessage message = session.createBytesMessage();
-               message.writeBytes(PAYLOAD);
-               message.setStringProperty("TEST_NAME", "runQueueSendRollback");
-               message.setIntProperty("TEST_PERSISTENCE", persistence);
-               message.setBooleanProperty("TEST_EXPLICIT", explicit);
-               
-               for (int i = 0; i < iterationCount; i++)
-               {
-                  sender.send(message, persistence, 4, 0);
-               }
-
-               if (explicit)
-                  session.rollback();
-               session.close();
-            }
-            catch (Exception e)
-            {
-               log.error("error", e);
-            }
-         }
-      };
-
-      sendThread.start();
-      sendThread.join();
-      assertTrue("Queue should be empty", drainQueue() == 0);
-   }
-
-   /**
-    * #Description of the Method
-    *
-    * @param persistence    Description of Parameter
-    * @exception Exception  Description of Exception
-    */
-   public void runTopicSendRollBack(final int persistence, final boolean explicit) throws Exception
-   {
-      drainQueue();
-      drainTopic();
-
-      final int iterationCount = getIterationCount();
-      final Logger log = getLog();
-
-      Thread sendThread = new Thread()
-      {
-         public void run()
-         {
-            try
-            {
-
-               TopicSession session = topicConnection.createTopicSession(true, Session.AUTO_ACKNOWLEDGE);
-               Topic topic = (Topic) context.lookup(TEST_TOPIC);
-
-               TopicPublisher publisher = session.createPublisher(topic);
-
-               BytesMessage message = session.createBytesMessage();
-               message.writeBytes(PAYLOAD);
-               message.setStringProperty("TEST_NAME", "runTopicSendRollback");
-               message.setIntProperty("TEST_PERSISTENCE", persistence);
-               message.setBooleanProperty("TEST_EXPLICIT", explicit);
-
-               for (int i = 0; i < iterationCount; i++)
-               {
-                  publisher.publish(message, persistence, 4, 0);
-               }
-
-               session.close();
-            }
-            catch (Exception e)
-            {
-               log.error("error", e);
-            }
-         }
-      };
-
-      sendThread.start();
-      sendThread.join();
-      assertTrue("Topic should be empty", drainTopic() == 0);
-   }
-
-   /**
-    * #Description of the Method
-    *
-    * @param persistence    Description of Parameter
-    * @exception Exception  Description of Exception
-    */
-   public void runAsynchQueueReceiveRollBack(final int persistence, final boolean explicit) throws Exception
-   {
-      drainQueue();
-
-      final int iterationCount = getIterationCount();
-      final Logger log = getLog();
-
-      Thread sendThread = new Thread()
-      {
-         public void run()
-         {
-            try
-            {
-               QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-               Queue queue = (Queue) context.lookup(TEST_QUEUE);
-
-               QueueSender sender = session.createSender(queue);
-
-               BytesMessage message = session.createBytesMessage();
-               message.writeBytes(PAYLOAD);
-               message.setStringProperty("TEST_NAME", "runAsynchQueueReceiveRollback");
-               message.setIntProperty("TEST_PERSISTENCE", persistence);
-               message.setBooleanProperty("TEST_EXPLICIT", explicit);
-
-               for (int i = 0; i < iterationCount; i++)
-               {
-                  sender.send(message, persistence, 4, 0);
-               }
-
-               session.close();
-            }
-            catch (Exception e)
-            {
-               log.error("error", e);
-            }
-         }
-      };
-
-      QueueSession session = queueConnection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
-      Queue queue = (Queue) context.lookup(TEST_QUEUE);
-      QueueReceiver receiver = session.createReceiver(queue);
-
-      MyMessageListener listener = new MyMessageListener(iterationCount, log);
-
-      sendThread.start();
-      receiver.setMessageListener(listener);
-      queueConnection.start();
-      synchronized (listener)
-      {
-         if (listener.i < iterationCount)
-            listener.wait();
-      }
-      receiver.setMessageListener(null);
-
-      if (explicit)
-         session.rollback();
-      session.close();
-
-      queueConnection.stop();
-
-      sendThread.join();
-
-      assertTrue("Queue should be full", drainQueue() == iterationCount);
-
-   }
-
-   /**
-    * #Description of the Method
-    *
-    * @param persistence    Description of Parameter
-    * @exception Exception  Description of Exception
-    */
-   public void runAsynchTopicReceiveRollBack(final int persistence, final boolean explicit) throws Exception
-   {
-      drainQueue();
-      drainTopic();
-
-      final int iterationCount = getIterationCount();
-      final Logger log = getLog();
-
-      Thread sendThread = new Thread()
-      {
-         public void run()
-         {
-            try
-            {
-
-               TopicSession session = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-               Topic topic = (Topic) context.lookup(TEST_TOPIC);
-
-               TopicPublisher publisher = session.createPublisher(topic);
-
-               waitForSynchMessage();
-
-               BytesMessage message = session.createBytesMessage();
-               message.writeBytes(PAYLOAD);
-               message.setStringProperty("TEST_NAME", "runAsynchTopicReceiveRollback");
-               message.setIntProperty("TEST_PERSISTENCE", persistence);
-               message.setBooleanProperty("TEST_EXPLICIT", explicit);
-
-               for (int i = 0; i < iterationCount; i++)
-               {
-                  publisher.publish(message, persistence, 4, 0);
-                  log.debug("Published message " + i);
-               }
-
-               session.close();
-            }
-            catch (Exception e)
-            {
-               log.error("error", e);
-            }
-         }
-      };
-
-      TopicSession session = topicConnection.createTopicSession(true, Session.AUTO_ACKNOWLEDGE);
-      Topic topic = (Topic) context.lookup(TEST_TOPIC);
-      TopicSubscriber subscriber = session.createSubscriber(topic);
-
-      MyMessageListener listener = new MyMessageListener(iterationCount, log);
-
-      queueConnection.start();
-      sendThread.start();
-      subscriber.setMessageListener(listener);
-      topicConnection.start();
-      sendSynchMessage();
-      getLog().debug("Waiting for all messages");
-      synchronized (listener)
-      {
-         if (listener.i < iterationCount)
-            listener.wait();
-      }
-      getLog().debug("Got all messages");
-      subscriber.setMessageListener(null);
-
-      if (explicit)
-         session.rollback();
-      session.close();
-
-      sendThread.join();
-      topicConnection.stop();
-      queueConnection.stop();
-      assertTrue("Topic should be empty", drainTopic() == 0);
-   }
-
-   /**
-    * #Description of the Method
-    *
-    * @param persistence    Description of Parameter
-    * @exception Exception  Description of Exception
-    */
-   public void runAsynchDurableTopicReceiveRollBack(final int persistence, final boolean explicit) throws Exception
-   {
-      getLog().debug("====> runAsynchDurableTopicReceiveRollBack persistence=" + persistence + " explicit=" + explicit);
-      drainQueue();
-      drainDurableTopic();
-
-      final int iterationCount = getIterationCount();
-      final Logger log = getLog();
-
-      Thread sendThread = new Thread()
-      {
-         public void run()
-         {
-            try
-            {
-
-               TopicSession session = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-               Topic topic = (Topic) context.lookup(TEST_DURABLE_TOPIC);
-
-               TopicPublisher publisher = session.createPublisher(topic);
-
-               waitForSynchMessage();
-
-               BytesMessage message = session.createBytesMessage();
-               message.writeBytes(PAYLOAD);
-               message.setStringProperty("TEST_NAME", "runAsynchDurableTopicReceiveRollback");
-               message.setIntProperty("TEST_PERSISTENCE", persistence);
-               message.setBooleanProperty("TEST_EXPLICIT", explicit);
-
-               for (int i = 0; i < iterationCount; i++)
-               {
-                  publisher.publish(message, persistence, 4, 0);
-                  log.debug("Published message " + i);
-               }
-
-               session.close();
-            }
-            catch (Exception e)
-            {
-               log.error("error", e);
-            }
-         }
-      };
-
-      TopicSession session = topicDurableConnection.createTopicSession(true, Session.AUTO_ACKNOWLEDGE);
-      Topic topic = (Topic) context.lookup(TEST_DURABLE_TOPIC);
-      TopicSubscriber subscriber = session.createDurableSubscriber(topic, "test");
-      try
-      {
-         MyMessageListener listener = new MyMessageListener(iterationCount, log);
-
-         queueConnection.start();
-         sendThread.start();
-         subscriber.setMessageListener(listener);
-         topicDurableConnection.start();
-         sendSynchMessage();
-         getLog().debug("Waiting for all messages");
-         synchronized (listener)
-         {
-            if (listener.i < iterationCount)
-               listener.wait();
-         }
-         getLog().debug("Got all messages");
-         subscriber.setMessageListener(null);
-         subscriber.close();
-
-         if (explicit)
-            session.rollback();
-         session.close();
-
-         sendThread.join();
-         topicDurableConnection.stop();
-         queueConnection.stop();
-         assertTrue("Topic should be full", drainDurableTopic() == iterationCount);
-      }
-      finally
-      {
-         removeDurableSubscription();
-      }
-   }
-
-   /**
-    * A unit test for JUnit
-    *
-    * @exception Exception  Description of Exception
-    */
-   public void testQueueSendRollBack() throws Exception
-   {
-
-      getLog().debug("Starting AsynchQueueSendRollBack test");
-
-      runQueueSendRollBack(DeliveryMode.NON_PERSISTENT, false);
-      runQueueSendRollBack(DeliveryMode.PERSISTENT, false);
-      runQueueSendRollBack(DeliveryMode.NON_PERSISTENT, true);
-      runQueueSendRollBack(DeliveryMode.PERSISTENT, true);
-
-      getLog().debug("AsynchQueueSendRollBack passed");
-   }
-
-   /**
-    * A unit test for JUnit
-    *
-    * @exception Exception  Description of Exception
-    */
-   public void testAsynchQueueReceiveBack() throws Exception
-   {
-
-      getLog().debug("Starting AsynchQueueReceiveRollBack test");
-
-      runAsynchQueueReceiveRollBack(DeliveryMode.NON_PERSISTENT, false);
-      runAsynchQueueReceiveRollBack(DeliveryMode.PERSISTENT, false);
-      runQueueSendRollBack(DeliveryMode.NON_PERSISTENT, true);
-      runQueueSendRollBack(DeliveryMode.PERSISTENT, true);
-
-      getLog().debug("AsynchQueueReceiveRollBack passed");
-   }
-
-   /**
-    * A unit test for JUnit
-    *
-    * @exception Exception  Description of Exception
-    */
-   public void testTopicSendRollBack() throws Exception
-   {
-
-      getLog().debug("Starting AsynchTopicSendRollBack test");
-
-      runTopicSendRollBack(DeliveryMode.NON_PERSISTENT, false);
-      runTopicSendRollBack(DeliveryMode.PERSISTENT, false);
-      runTopicSendRollBack(DeliveryMode.NON_PERSISTENT, true);
-      runTopicSendRollBack(DeliveryMode.PERSISTENT, true);
-
-      getLog().debug("AsynchTopicSendRollBack passed");
-   }
-
-   /**
-    * A unit test for JUnit
-    *
-    * @exception Exception  Description of Exception
-    */
-   public void testAsynchTopicReceiveRollBack() throws Exception
-   {
-
-      getLog().debug("Starting AsynchTopicReceiveRollBack test");
-
-      runAsynchTopicReceiveRollBack(DeliveryMode.NON_PERSISTENT, false);
-      runAsynchTopicReceiveRollBack(DeliveryMode.PERSISTENT, false);
-      runAsynchTopicReceiveRollBack(DeliveryMode.NON_PERSISTENT, true);
-      runAsynchTopicReceiveRollBack(DeliveryMode.PERSISTENT, true);
-
-      getLog().debug("AsynchTopicReceiveRollBack passed");
-   }
-
-   /**
-    * A unit test for JUnit
-    *
-    * @exception Exception  Description of Exception
-    */
-   public void testAsynchDurableTopicReceiveRollBack() throws Exception
-   {
-
-      getLog().debug("Starting AsynchDurableTopicReceiveRollBack test");
-
-      runAsynchDurableTopicReceiveRollBack(DeliveryMode.NON_PERSISTENT, false);
-      runAsynchDurableTopicReceiveRollBack(DeliveryMode.PERSISTENT, false);
-      runAsynchDurableTopicReceiveRollBack(DeliveryMode.NON_PERSISTENT, true);
-      runAsynchDurableTopicReceiveRollBack(DeliveryMode.PERSISTENT, true);
-
-      getLog().debug("AsynchDurableTopicReceiveRollBack passed");
-   }
-
-   /**
-    * A unit test for JUnit
-    *
-    * @exception Exception  Description of Exception
-    */
-   public void removeDurableSubscription() throws Exception
-   {
-
-      TopicSession session = topicDurableConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-      session.unsubscribe("test");
-   }
-
-   /**
-    * The JUnit setup method
-    *
-    * @exception Exception  Description of Exception
-    */
-   protected void setUp() throws Exception
-   {
-      super.setUp();
-      
-      getLog().debug("START TEST " + getName());
-      context = getInitialContext();
-
-      QueueConnectionFactory queueFactory = (QueueConnectionFactory) context.lookup(QUEUE_FACTORY);
-      queueConnection = queueFactory.createQueueConnection();
-
-      TopicConnectionFactory topicFactory = (TopicConnectionFactory) context.lookup(TOPIC_FACTORY);
-      topicConnection = topicFactory.createTopicConnection();
-      topicDurableConnection = topicFactory.createTopicConnection("john", "needle");
-
-      getLog().debug("Connection to JBossMQ established.");
-   }
-   
-   protected void tearDown() throws Exception
-   {
-      try
-      {
-         if (topicDurableConnection != null)
-         {
-            topicDurableConnection.close();
-            topicDurableConnection = null;
-         }
-      }
-      catch (JMSException ignored)
-      {
-      }
-      try
-      {
-         if (topicConnection != null)
-         {
-            topicConnection.close();
-            topicConnection = null;
-         }
-      }
-      catch (JMSException ignored)
-      {
-      }
-      try
-      {
-         if (queueConnection != null)
-         {
-            queueConnection.close();
-            queueConnection = null;
-         }
-      }
-      catch (JMSException ignored)
-      {
-      }
-      super.tearDown();
-   }
-
-   // Emptys out all the messages in a queue
-   private int drainQueue() throws Exception
-   {
-      getLog().debug("Draining Queue");
-      queueConnection.start();
-
-      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-      Queue queue = (Queue) context.lookup(TEST_QUEUE);
-
-      QueueReceiver receiver = session.createReceiver(queue);
-      Message message = receiver.receive(50);
-      int c = 0;
-      while (message != null)
-      {
-         c++;
-         message = receiver.receive(50);
-      }
-
-      getLog().debug("  Drained " + c + " messages from the queue");
-
-      session.close();
-
-      queueConnection.stop();
-
-      return c;
-   }
-
-   // Emptys out all the messages in a topic
-   private int drainTopic() throws Exception
-   {
-      getLog().debug("Draining Topic");
-      topicConnection.start();
-
-      final TopicSession session = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-      Topic topic = (Topic) context.lookup(TEST_TOPIC);
-      TopicSubscriber subscriber = session.createSubscriber(topic);
-
-      Message message = subscriber.receive(50);
-      int c = 0;
-      while (message != null)
-      {
-         c++;
-         message = subscriber.receive(50);
-      }
-
-      getLog().debug("  Drained " + c + " messages from the topic");
-
-      session.close();
-
-      topicConnection.stop();
-
-      return c;
-   }
-
-   // Emptys out all the messages in a durable topic
-   private int drainDurableTopic() throws Exception
-   {
-      getLog().debug("Draining Durable Topic");
-      topicDurableConnection.start();
-
-      final TopicSession session = topicDurableConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-      Topic topic = (Topic) context.lookup(TEST_DURABLE_TOPIC);
-      TopicSubscriber subscriber = session.createDurableSubscriber(topic, "test");
-
-      Message message = subscriber.receive(50);
-      int c = 0;
-      while (message != null)
-      {
-         c++;
-         message = subscriber.receive(50);
-      }
-
-      getLog().debug("  Drained " + c + " messages from the durable topic");
-
-      session.close();
-
-      topicDurableConnection.stop();
-
-      return c;
-   }
-
-   private void waitForSynchMessage() throws Exception
-   {
-      getLog().debug("Waiting for Synch Message");
-      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-      Queue queue = (Queue) context.lookup(TEST_QUEUE);
-
-      QueueReceiver receiver = session.createReceiver(queue);
-      receiver.receive();
-      session.close();
-      getLog().debug("Got Synch Message");
-   }
-
-   private void sendSynchMessage() throws Exception
-   {
-      getLog().debug("Sending Synch Message");
-      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-      Queue queue = (Queue) context.lookup(TEST_QUEUE);
-
-      QueueSender sender = session.createSender(queue);
-
-      Message message = session.createMessage();
-      sender.send(message);
-
-      session.close();
-      getLog().debug("Sent Synch Message");
-   }
-
-   public class MyMessageListener implements MessageListener
-   {
-      public int i = 0;
-
-      public int iterationCount;
-
-      public Logger log;
-
-      public MyMessageListener(int iterationCount, Logger log)
-      {
-         this.iterationCount = iterationCount;
-         this.log = log;
-      }
-
-      public void onMessage(Message message)
-      {
-         synchronized (this)
-         {
-            i++;
-            log.debug("Got message " + i);
-            if (i >= iterationCount)
-               this.notify();
-         }
-      }
-   }
-
-   public int getIterationCount()
-   {
-      return 5;
-   }
-
-}

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/RollBackUnitTestCase.java (from rev 64641, branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/test/RollBackUnitTestCase.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/RollBackUnitTestCase.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/RollBackUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,729 @@
+/*
+  * 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.BytesMessage;
+import javax.jms.DeliveryMode;
+import javax.jms.JMSException;
+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.Topic;
+import javax.jms.TopicConnection;
+import javax.jms.TopicConnectionFactory;
+import javax.jms.TopicPublisher;
+import javax.jms.TopicSession;
+import javax.jms.TopicSubscriber;
+import javax.jms.Queue;
+import javax.naming.Context;
+
+import org.apache.log4j.Logger;
+import org.jboss.test.jbossmessaging.JMSTestCase;
+
+/**
+ * Rollback tests
+ *
+ * @author <a href="mailto:richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
+ * @author
+ * @version
+ */
+public class RollBackUnitTestCase extends JMSTestCase
+{
+
+   // Provider specific
+   static String TOPIC_FACTORY = "ConnectionFactory";
+
+   static String QUEUE_FACTORY = "ConnectionFactory";
+
+   static String TEST_QUEUE = "queue/testQueue";
+
+   static String TEST_TOPIC = "topic/testTopic";
+
+   static String TEST_DURABLE_TOPIC = "topic/testDurableTopic";
+
+   static byte[] PAYLOAD = new byte[10];
+
+   static Context context;
+
+   static QueueConnection queueConnection;
+
+   static TopicConnection topicConnection;
+
+   static TopicConnection topicDurableConnection;
+
+   /**
+    * Constructor the test
+    *
+    * @param name           Description of Parameter
+    * @exception Exception  Description of Exception
+    */
+   public RollBackUnitTestCase(String name) throws Exception
+   {
+      super(name);
+   }
+
+   /**
+    * #Description of the Method
+    *
+    * @param persistence    Description of Parameter
+    * @exception Exception  Description of Exception
+    */
+   public void runQueueSendRollBack(final int persistence, final boolean explicit) throws Exception
+   {
+      drainQueue();
+      final int iterationCount = getIterationCount();
+      final Logger log = getLog();
+
+      Thread sendThread = new Thread()
+      {
+         public void run()
+         {
+            try
+            {
+               QueueSession session = queueConnection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
+               Queue queue = (Queue) context.lookup(TEST_QUEUE);
+
+               QueueSender sender = session.createSender(queue);
+
+               BytesMessage message = session.createBytesMessage();
+               message.writeBytes(PAYLOAD);
+               message.setStringProperty("TEST_NAME", "runQueueSendRollback");
+               message.setIntProperty("TEST_PERSISTENCE", persistence);
+               message.setBooleanProperty("TEST_EXPLICIT", explicit);
+               
+               for (int i = 0; i < iterationCount; i++)
+               {
+                  sender.send(message, persistence, 4, 0);
+               }
+
+               if (explicit)
+                  session.rollback();
+               session.close();
+            }
+            catch (Exception e)
+            {
+               log.error("error", e);
+            }
+         }
+      };
+
+      sendThread.start();
+      sendThread.join();
+      assertTrue("Queue should be empty", drainQueue() == 0);
+   }
+
+   /**
+    * #Description of the Method
+    *
+    * @param persistence    Description of Parameter
+    * @exception Exception  Description of Exception
+    */
+   public void runTopicSendRollBack(final int persistence, final boolean explicit) throws Exception
+   {
+      drainQueue();
+      drainTopic();
+
+      final int iterationCount = getIterationCount();
+      final Logger log = getLog();
+
+      Thread sendThread = new Thread()
+      {
+         public void run()
+         {
+            try
+            {
+
+               TopicSession session = topicConnection.createTopicSession(true, Session.AUTO_ACKNOWLEDGE);
+               Topic topic = (Topic) context.lookup(TEST_TOPIC);
+
+               TopicPublisher publisher = session.createPublisher(topic);
+
+               BytesMessage message = session.createBytesMessage();
+               message.writeBytes(PAYLOAD);
+               message.setStringProperty("TEST_NAME", "runTopicSendRollback");
+               message.setIntProperty("TEST_PERSISTENCE", persistence);
+               message.setBooleanProperty("TEST_EXPLICIT", explicit);
+
+               for (int i = 0; i < iterationCount; i++)
+               {
+                  publisher.publish(message, persistence, 4, 0);
+               }
+
+               session.close();
+            }
+            catch (Exception e)
+            {
+               log.error("error", e);
+            }
+         }
+      };
+
+      sendThread.start();
+      sendThread.join();
+      assertTrue("Topic should be empty", drainTopic() == 0);
+   }
+
+   /**
+    * #Description of the Method
+    *
+    * @param persistence    Description of Parameter
+    * @exception Exception  Description of Exception
+    */
+   public void runAsynchQueueReceiveRollBack(final int persistence, final boolean explicit) throws Exception
+   {
+      drainQueue();
+
+      final int iterationCount = getIterationCount();
+      final Logger log = getLog();
+
+      Thread sendThread = new Thread()
+      {
+         public void run()
+         {
+            try
+            {
+               QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+               Queue queue = (Queue) context.lookup(TEST_QUEUE);
+
+               QueueSender sender = session.createSender(queue);
+
+               BytesMessage message = session.createBytesMessage();
+               message.writeBytes(PAYLOAD);
+               message.setStringProperty("TEST_NAME", "runAsynchQueueReceiveRollback");
+               message.setIntProperty("TEST_PERSISTENCE", persistence);
+               message.setBooleanProperty("TEST_EXPLICIT", explicit);
+
+               for (int i = 0; i < iterationCount; i++)
+               {
+                  sender.send(message, persistence, 4, 0);
+               }
+
+               session.close();
+            }
+            catch (Exception e)
+            {
+               log.error("error", e);
+            }
+         }
+      };
+
+      QueueSession session = queueConnection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
+      Queue queue = (Queue) context.lookup(TEST_QUEUE);
+      QueueReceiver receiver = session.createReceiver(queue);
+
+      MyMessageListener listener = new MyMessageListener(iterationCount, log);
+
+      sendThread.start();
+      receiver.setMessageListener(listener);
+      queueConnection.start();
+      synchronized (listener)
+      {
+         if (listener.i < iterationCount)
+            listener.wait();
+      }
+      receiver.setMessageListener(null);
+
+      if (explicit)
+         session.rollback();
+      session.close();
+
+      queueConnection.stop();
+
+      sendThread.join();
+
+      assertTrue("Queue should be full", drainQueue() == iterationCount);
+
+   }
+
+   /**
+    * #Description of the Method
+    *
+    * @param persistence    Description of Parameter
+    * @exception Exception  Description of Exception
+    */
+   public void runAsynchTopicReceiveRollBack(final int persistence, final boolean explicit) throws Exception
+   {
+      drainQueue();
+      drainTopic();
+
+      final int iterationCount = getIterationCount();
+      final Logger log = getLog();
+
+      Thread sendThread = new Thread()
+      {
+         public void run()
+         {
+            try
+            {
+
+               TopicSession session = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+               Topic topic = (Topic) context.lookup(TEST_TOPIC);
+
+               TopicPublisher publisher = session.createPublisher(topic);
+
+               waitForSynchMessage();
+
+               BytesMessage message = session.createBytesMessage();
+               message.writeBytes(PAYLOAD);
+               message.setStringProperty("TEST_NAME", "runAsynchTopicReceiveRollback");
+               message.setIntProperty("TEST_PERSISTENCE", persistence);
+               message.setBooleanProperty("TEST_EXPLICIT", explicit);
+
+               for (int i = 0; i < iterationCount; i++)
+               {
+                  publisher.publish(message, persistence, 4, 0);
+                  log.debug("Published message " + i);
+               }
+
+               session.close();
+            }
+            catch (Exception e)
+            {
+               log.error("error", e);
+            }
+         }
+      };
+
+      TopicSession session = topicConnection.createTopicSession(true, Session.AUTO_ACKNOWLEDGE);
+      Topic topic = (Topic) context.lookup(TEST_TOPIC);
+      TopicSubscriber subscriber = session.createSubscriber(topic);
+
+      MyMessageListener listener = new MyMessageListener(iterationCount, log);
+
+      queueConnection.start();
+      sendThread.start();
+      subscriber.setMessageListener(listener);
+      topicConnection.start();
+      sendSynchMessage();
+      getLog().debug("Waiting for all messages");
+      synchronized (listener)
+      {
+         if (listener.i < iterationCount)
+            listener.wait();
+      }
+      getLog().debug("Got all messages");
+      subscriber.setMessageListener(null);
+
+      if (explicit)
+         session.rollback();
+      session.close();
+
+      sendThread.join();
+      topicConnection.stop();
+      queueConnection.stop();
+      assertTrue("Topic should be empty", drainTopic() == 0);
+   }
+
+   /**
+    * #Description of the Method
+    *
+    * @param persistence    Description of Parameter
+    * @exception Exception  Description of Exception
+    */
+   public void runAsynchDurableTopicReceiveRollBack(final int persistence, final boolean explicit) throws Exception
+   {
+      getLog().debug("====> runAsynchDurableTopicReceiveRollBack persistence=" + persistence + " explicit=" + explicit);
+      drainQueue();
+      drainDurableTopic();
+
+      final int iterationCount = getIterationCount();
+      final Logger log = getLog();
+
+      Thread sendThread = new Thread()
+      {
+         public void run()
+         {
+            try
+            {
+
+               TopicSession session = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+               Topic topic = (Topic) context.lookup(TEST_DURABLE_TOPIC);
+
+               TopicPublisher publisher = session.createPublisher(topic);
+
+               waitForSynchMessage();
+
+               BytesMessage message = session.createBytesMessage();
+               message.writeBytes(PAYLOAD);
+               message.setStringProperty("TEST_NAME", "runAsynchDurableTopicReceiveRollback");
+               message.setIntProperty("TEST_PERSISTENCE", persistence);
+               message.setBooleanProperty("TEST_EXPLICIT", explicit);
+
+               for (int i = 0; i < iterationCount; i++)
+               {
+                  publisher.publish(message, persistence, 4, 0);
+                  log.debug("Published message " + i);
+               }
+
+               session.close();
+            }
+            catch (Exception e)
+            {
+               log.error("error", e);
+            }
+         }
+      };
+
+      TopicSession session = topicDurableConnection.createTopicSession(true, Session.AUTO_ACKNOWLEDGE);
+      Topic topic = (Topic) context.lookup(TEST_DURABLE_TOPIC);
+      TopicSubscriber subscriber = session.createDurableSubscriber(topic, "test");
+      try
+      {
+         MyMessageListener listener = new MyMessageListener(iterationCount, log);
+
+         queueConnection.start();
+         sendThread.start();
+         subscriber.setMessageListener(listener);
+         topicDurableConnection.start();
+         sendSynchMessage();
+         getLog().debug("Waiting for all messages");
+         synchronized (listener)
+         {
+            if (listener.i < iterationCount)
+               listener.wait();
+         }
+         getLog().debug("Got all messages");
+         subscriber.setMessageListener(null);
+         subscriber.close();
+
+         if (explicit)
+            session.rollback();
+         session.close();
+
+         sendThread.join();
+         topicDurableConnection.stop();
+         queueConnection.stop();
+         assertTrue("Topic should be full", drainDurableTopic() == iterationCount);
+      }
+      finally
+      {
+         removeDurableSubscription();
+      }
+   }
+
+   /**
+    * A unit test for JUnit
+    *
+    * @exception Exception  Description of Exception
+    */
+   public void testQueueSendRollBack() throws Exception
+   {
+
+      getLog().debug("Starting AsynchQueueSendRollBack test");
+
+      runQueueSendRollBack(DeliveryMode.NON_PERSISTENT, false);
+      runQueueSendRollBack(DeliveryMode.PERSISTENT, false);
+      runQueueSendRollBack(DeliveryMode.NON_PERSISTENT, true);
+      runQueueSendRollBack(DeliveryMode.PERSISTENT, true);
+
+      getLog().debug("AsynchQueueSendRollBack passed");
+   }
+
+   /**
+    * A unit test for JUnit
+    *
+    * @exception Exception  Description of Exception
+    */
+   public void testAsynchQueueReceiveBack() throws Exception
+   {
+
+      getLog().debug("Starting AsynchQueueReceiveRollBack test");
+
+      runAsynchQueueReceiveRollBack(DeliveryMode.NON_PERSISTENT, false);
+      runAsynchQueueReceiveRollBack(DeliveryMode.PERSISTENT, false);
+      runQueueSendRollBack(DeliveryMode.NON_PERSISTENT, true);
+      runQueueSendRollBack(DeliveryMode.PERSISTENT, true);
+
+      getLog().debug("AsynchQueueReceiveRollBack passed");
+   }
+
+   /**
+    * A unit test for JUnit
+    *
+    * @exception Exception  Description of Exception
+    */
+   public void testTopicSendRollBack() throws Exception
+   {
+
+      getLog().debug("Starting AsynchTopicSendRollBack test");
+
+      runTopicSendRollBack(DeliveryMode.NON_PERSISTENT, false);
+      runTopicSendRollBack(DeliveryMode.PERSISTENT, false);
+      runTopicSendRollBack(DeliveryMode.NON_PERSISTENT, true);
+      runTopicSendRollBack(DeliveryMode.PERSISTENT, true);
+
+      getLog().debug("AsynchTopicSendRollBack passed");
+   }
+
+   /**
+    * A unit test for JUnit
+    *
+    * @exception Exception  Description of Exception
+    */
+   public void testAsynchTopicReceiveRollBack() throws Exception
+   {
+
+      getLog().debug("Starting AsynchTopicReceiveRollBack test");
+
+      runAsynchTopicReceiveRollBack(DeliveryMode.NON_PERSISTENT, false);
+      runAsynchTopicReceiveRollBack(DeliveryMode.PERSISTENT, false);
+      runAsynchTopicReceiveRollBack(DeliveryMode.NON_PERSISTENT, true);
+      runAsynchTopicReceiveRollBack(DeliveryMode.PERSISTENT, true);
+
+      getLog().debug("AsynchTopicReceiveRollBack passed");
+   }
+
+   /**
+    * A unit test for JUnit
+    *
+    * @exception Exception  Description of Exception
+    */
+   public void testAsynchDurableTopicReceiveRollBack() throws Exception
+   {
+
+      getLog().debug("Starting AsynchDurableTopicReceiveRollBack test");
+
+      runAsynchDurableTopicReceiveRollBack(DeliveryMode.NON_PERSISTENT, false);
+      runAsynchDurableTopicReceiveRollBack(DeliveryMode.PERSISTENT, false);
+      runAsynchDurableTopicReceiveRollBack(DeliveryMode.NON_PERSISTENT, true);
+      runAsynchDurableTopicReceiveRollBack(DeliveryMode.PERSISTENT, true);
+
+      getLog().debug("AsynchDurableTopicReceiveRollBack passed");
+   }
+
+   /**
+    * A unit test for JUnit
+    *
+    * @exception Exception  Description of Exception
+    */
+   public void removeDurableSubscription() throws Exception
+   {
+
+      TopicSession session = topicDurableConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+      session.unsubscribe("test");
+   }
+
+   /**
+    * The JUnit setup method
+    *
+    * @exception Exception  Description of Exception
+    */
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+      
+      getLog().debug("START TEST " + getName());
+      context = getInitialContext();
+
+      QueueConnectionFactory queueFactory = (QueueConnectionFactory) context.lookup(QUEUE_FACTORY);
+      queueConnection = queueFactory.createQueueConnection();
+
+      TopicConnectionFactory topicFactory = (TopicConnectionFactory) context.lookup(TOPIC_FACTORY);
+      topicConnection = topicFactory.createTopicConnection();
+      topicDurableConnection = topicFactory.createTopicConnection("john", "needle");
+
+      getLog().debug("Connection to JBossMQ established.");
+   }
+   
+   protected void tearDown() throws Exception
+   {
+      try
+      {
+         if (topicDurableConnection != null)
+         {
+            topicDurableConnection.close();
+            topicDurableConnection = null;
+         }
+      }
+      catch (JMSException ignored)
+      {
+      }
+      try
+      {
+         if (topicConnection != null)
+         {
+            topicConnection.close();
+            topicConnection = null;
+         }
+      }
+      catch (JMSException ignored)
+      {
+      }
+      try
+      {
+         if (queueConnection != null)
+         {
+            queueConnection.close();
+            queueConnection = null;
+         }
+      }
+      catch (JMSException ignored)
+      {
+      }
+      super.tearDown();
+   }
+
+   // Emptys out all the messages in a queue
+   private int drainQueue() throws Exception
+   {
+      getLog().debug("Draining Queue");
+      queueConnection.start();
+
+      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+      Queue queue = (Queue) context.lookup(TEST_QUEUE);
+
+      QueueReceiver receiver = session.createReceiver(queue);
+      Message message = receiver.receive(50);
+      int c = 0;
+      while (message != null)
+      {
+         c++;
+         message = receiver.receive(50);
+      }
+
+      getLog().debug("  Drained " + c + " messages from the queue");
+
+      session.close();
+
+      queueConnection.stop();
+
+      return c;
+   }
+
+   // Emptys out all the messages in a topic
+   private int drainTopic() throws Exception
+   {
+      getLog().debug("Draining Topic");
+      topicConnection.start();
+
+      final TopicSession session = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+      Topic topic = (Topic) context.lookup(TEST_TOPIC);
+      TopicSubscriber subscriber = session.createSubscriber(topic);
+
+      Message message = subscriber.receive(50);
+      int c = 0;
+      while (message != null)
+      {
+         c++;
+         message = subscriber.receive(50);
+      }
+
+      getLog().debug("  Drained " + c + " messages from the topic");
+
+      session.close();
+
+      topicConnection.stop();
+
+      return c;
+   }
+
+   // Emptys out all the messages in a durable topic
+   private int drainDurableTopic() throws Exception
+   {
+      getLog().debug("Draining Durable Topic");
+      topicDurableConnection.start();
+
+      final TopicSession session = topicDurableConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+      Topic topic = (Topic) context.lookup(TEST_DURABLE_TOPIC);
+      TopicSubscriber subscriber = session.createDurableSubscriber(topic, "test");
+
+      Message message = subscriber.receive(50);
+      int c = 0;
+      while (message != null)
+      {
+         c++;
+         message = subscriber.receive(50);
+      }
+
+      getLog().debug("  Drained " + c + " messages from the durable topic");
+
+      session.close();
+
+      topicDurableConnection.stop();
+
+      return c;
+   }
+
+   private void waitForSynchMessage() throws Exception
+   {
+      getLog().debug("Waiting for Synch Message");
+      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+      Queue queue = (Queue) context.lookup(TEST_QUEUE);
+
+      QueueReceiver receiver = session.createReceiver(queue);
+      receiver.receive();
+      session.close();
+      getLog().debug("Got Synch Message");
+   }
+
+   private void sendSynchMessage() throws Exception
+   {
+      getLog().debug("Sending Synch Message");
+      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+      Queue queue = (Queue) context.lookup(TEST_QUEUE);
+
+      QueueSender sender = session.createSender(queue);
+
+      Message message = session.createMessage();
+      sender.send(message);
+
+      session.close();
+      getLog().debug("Sent Synch Message");
+   }
+
+   public class MyMessageListener implements MessageListener
+   {
+      public int i = 0;
+
+      public int iterationCount;
+
+      public Logger log;
+
+      public MyMessageListener(int iterationCount, Logger log)
+      {
+         this.iterationCount = iterationCount;
+         this.log = log;
+      }
+
+      public void onMessage(Message message)
+      {
+         synchronized (this)
+         {
+            i++;
+            log.debug("Got message " + i);
+            if (i >= iterationCount)
+               this.notify();
+         }
+      }
+   }
+
+   public int getIterationCount()
+   {
+      return 5;
+   }
+
+}

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/SecurityUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/test/SecurityUnitTestCase.java	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/SecurityUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,1170 +0,0 @@
-/*
-  * 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.management.ObjectName;
-import junit.framework.Assert;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.jboss.test.JBossTestSetup;
-import org.jboss.test.jbossmessaging.JMSBase;
-/**
- * Test of security features in JMS providers
- *
- * @author <a href="mailto:richard.achmatowicz">Richard Achmatowicz</a>
- * @author     <a href="pra at tim.se">Peter Antman</a>
- * @version $Revision: 64201 $
- */
-public class SecurityUnitTestCase extends JMSBase
-{
-   public SecurityUnitTestCase(String name)
-   {
-      super(name);
-   }
-
-   public void testLoginTest() throws Exception
-   {
-      TopicWorker sub1 = null;
-      TopicWorker pub1 = null;
-      try
-      {
-         drainTopic();
-         int ic = 5;
-         IntRangeMessageFilter f1 = new IntRangeMessageFilter(javax.jms.Message.class, "USER_NR", 0, ic);
-         sub1 = new TopicWorker(SUBSCRIBER, TRANS_NONE, f1);
-         sub1.setUser("john", "needle");
-         Thread t1 = new Thread(sub1);
-         t1.start();
-         // Publish
-         IntRangeMessageCreator c1 = new IntRangeMessageCreator("USER_NR", 0);
-         pub1 = new TopicWorker(PUBLISHER, TRANS_NONE, c1, ic);
-         pub1.connect();
-         pub1.publish();
-         Assert.assertEquals("Publisher did not publish correct number of messages " + pub1.getMessageHandled(), ic,
-               pub1.getMessageHandled());
-         // let sub1 have some time to handle the messages.
-         log.debug("Sleeping for " + ((ic * 10) / 60000) + " minutes");
-         sleep(ic * 100);
-         Assert.assertEquals("Subscriber did not get correct number of messages " + sub1.getMessageHandled(), ic, sub1
-               .getMessageHandled());
-         sub1.close();
-         pub1.close();
-      }
-      catch (Throwable t)
-      {
-         if (t instanceof junit.framework.AssertionFailedError)
-            throw (junit.framework.AssertionFailedError) t;
-         log.error("Error in test: " + t, t);
-         throw new Exception(t.getMessage());
-      }
-      finally
-      {
-         try
-         {
-            if (sub1 != null)
-               sub1.close();
-         }
-         catch (Exception ex)
-         {
-         }
-         try
-         {
-            if (pub1 != null)
-               pub1.close();
-         }
-         catch (Exception ex)
-         {
-         }
-      }
-   }
-
-   /**
-    Tests that check authentication
-    1. Login without cred
-    2. Login with valid usedid,pwd
-    3. Login with valid user, unvalid pwd
-    4. Login with unvalid user.
-    */
-   public void testLoginNoCred() throws Exception
-   {
-      TopicWorker pub1 = null;
-      try
-      {
-         drainTopic();
-         pub1 = new TopicWorker(PUBLISHER, TRANS_NONE, null, 0);
-         pub1.connect();
-      }
-      catch (Exception ex)
-      {
-         Assert.fail("Could lot login without any cred");
-      }
-      finally
-      {
-         try
-         {
-            pub1.close();
-         }
-         catch (Exception ex)
-         {
-         }
-      }
-   }
-
-   public void testLoginValidCred() throws Exception
-   {
-      TopicWorker pub1 = null;
-      try
-      {
-         drainTopic();
-         pub1 = new TopicWorker(PUBLISHER, TRANS_NONE, null, 0);
-         pub1.setUser("john", "needle");
-         pub1.connect();
-      }
-      catch (Exception ex)
-      {
-         Assert.fail("Could lot login with valid cred");
-      }
-      finally
-      {
-         try
-         {
-            pub1.close();
-         }
-         catch (Exception ex)
-         {
-         }
-      }
-   }
-
-   public void testLoginInvalidPwd() throws Exception
-   {
-      TopicWorker pub1 = null;
-      try
-      {
-         drainTopic();
-         pub1 = new TopicWorker(PUBLISHER, TRANS_NONE, null, 0);
-         pub1.setUser("john", "bogus");
-         Exception e = null;
-         try
-         {
-            pub1.connect();
-         }
-         catch (Exception ex)
-         {
-            e = ex;
-         }
-         log.debug(e);
-         Assert.assertTrue("Loggin in with invalid password did not throw correct exception",
-               e instanceof javax.jms.JMSSecurityException);
-      }
-      finally
-      {
-         try
-         {
-            pub1.close();
-         }
-         catch (Exception ex)
-         {
-         }
-      }
-   }
-
-   public void testLoginInvalidCred() throws Exception
-   {
-      TopicWorker pub1 = null;
-      try
-      {
-         drainTopic();
-         pub1 = new TopicWorker(PUBLISHER, TRANS_NONE, null, 0);
-         pub1.setUser("bogus", "bogus");
-         Exception e = null;
-         try
-         {
-            pub1.connect();
-         }
-         catch (Exception ex)
-         {
-            e = ex;
-         }
-         log.debug(e);
-         Assert.assertTrue("Loggin in with invalid user did not throw correct exception",
-               e instanceof javax.jms.JMSSecurityException);
-      }
-      finally
-      {
-         try
-         {
-            pub1.close();
-         }
-         catch (Exception ex)
-         {
-         }
-      }
-   }
-
-   /**
-    An number of tests to verrify that clientID works as expected:
-    
-    This tests a specific a specific behavior from JBossMQ.
-    This tests creates a TopicSession and expects the clientID to be set. There is no requirement for this on JMS Spec.
-    */
-   /*public void testClientIDNormalTest() throws Exception
-   {
-      TopicWorker pub1 = null;
-      try
-      {
-         drainTopic();
-         int ic = 5;
-         // Publish
-         IntRangeMessageCreator c1 = new IntRangeMessageCreator("USER_NR", 0);
-         pub1 = new TopicWorker(PUBLISHER, TRANS_NONE, c1, ic);
-         pub1.connect();
-         pub1.publish();
-         Assert.assertTrue("Client did not get a valid clientID", pub1.connection.getClientID().startsWith("ID"));
-         pub1.close();
-      }
-      catch (Throwable t)
-      {
-         if (t instanceof junit.framework.AssertionFailedError)
-            throw (junit.framework.AssertionFailedError) t;
-         log.error("Error in test: " + t, t);
-         throw new Exception(t.getMessage());
-      }
-      finally
-      {
-         try
-         {
-            pub1.close();
-         }
-         catch (Exception ex)
-         {
-         }
-      }
-   } */
-
-   public void testClientIDPreconfTest() throws Exception
-   {
-      TopicWorker pub1 = null;
-      try
-      {
-         drainTopic();
-         int ic = 5;
-         // Publish
-         IntRangeMessageCreator c1 = new IntRangeMessageCreator("USER_NR", 0);
-         pub1 = new TopicWorker(PUBLISHER, TRANS_NONE, c1, ic);
-         pub1.setUser("john", "needle");
-         pub1.connect();
-         pub1.publish();
-         Assert.assertEquals("Client did not get a valid clientID", "DurableSubscriberExample", pub1.connection
-               .getClientID());
-         pub1.close();
-      }
-      catch (Throwable t)
-      {
-         if (t instanceof junit.framework.AssertionFailedError)
-            throw (junit.framework.AssertionFailedError) t;
-         log.error("Error in test: " + t, t);
-         throw new Exception(t.getMessage());
-      }
-      finally
-      {
-         try
-         {
-            pub1.close();
-         }
-         catch (Exception ex)
-         {
-         }
-      }
-   }
-
-   public void testClientIDSetTest() throws Exception
-   {
-      TopicWorker pub1 = null;
-      try
-      {
-         drainTopic();
-         int ic = 5;
-         // Publish
-         IntRangeMessageCreator c1 = new IntRangeMessageCreator("USER_NR", 0);
-         pub1 = new TopicWorker(PUBLISHER, TRANS_NONE, c1, ic);
-         pub1.setClientID("myId");
-         pub1.connect();
-         pub1.publish();
-         Assert.assertEquals("Client did not get a valid clientID", "myId", pub1.connection.getClientID());
-         pub1.close();
-      }
-      finally
-      {
-         try
-         {
-            pub1.close();
-         }
-         catch (Exception ex)
-         {
-         }
-      }
-   }
-
-   /*
-    * Test only valid on JBossMQ - commented out.
-    * public void testClientIDSetSteelPreconf() throws Exception
-   {
-      TopicWorker pub1 = null;
-      try
-      {
-         drainTopic();
-         int ic = 5;
-         // Publish
-         IntRangeMessageCreator c1 = new IntRangeMessageCreator("USER_NR", 0);
-         pub1 = new TopicWorker(PUBLISHER, TRANS_NONE, c1, ic);
-         pub1.setClientID("DurableSubscriberExample");
-         Exception e = null;
-         try
-         {
-            pub1.connect();
-         }
-         catch (Exception ex)
-         {
-            e = ex;
-         }
-         log.debug(e);
-         Assert.assertTrue("Setting a clientID wich is preconfigured did not throw correct exception",
-               e instanceof javax.jms.InvalidClientIDException);
-         pub1.close();
-      }
-      finally
-      {
-         try
-         {
-            pub1.close();
-         }
-         catch (Exception ex)
-         {
-         }
-      }
-   } */
-
-   public void testClientIDSetAfterInvoke() throws Exception
-   {
-      TopicWorker pub1 = null;
-      try
-      {
-         drainTopic();
-         int ic = 5;
-         // Publish
-         IntRangeMessageCreator c1 = new IntRangeMessageCreator("USER_NR", 0);
-         pub1 = new TopicWorker(PUBLISHER, TRANS_NONE, c1, ic);
-         pub1.connect();
-         pub1.publish();
-         Exception e = null;
-         try
-         {
-            pub1.connection.setClientID("myID");
-         }
-         catch (Exception ex)
-         {
-            e = ex;
-         }
-         log.debug(e);
-         Assert.assertTrue("Setting a clientID after connection is used did not throw correct exception: " + e,
-               e instanceof javax.jms.IllegalStateException);
-         pub1.close();
-      }
-      finally
-      {
-         try
-         {
-            pub1.close();
-         }
-         catch (Exception ex)
-         {
-         }
-      }
-   }
-
-   /**
-    Tests to check autorization.
-    
-    Remember there are actuallt two types of fails:
-    a) You are a user, but do no belong to a group that has acl.
-    b) You belong to a group, but that group does not have acl.
-    we test the first for topics and the second for queues, by
-    configuration in jbossmq-testsuite-service.xml
-    
-    Tests that check autorization.
-    1. test valid topic publisher
-    2. test invalid topic publisher
-    3. test valid topic subscriber
-    4. test invalid topic subscriber
-    5. test valid queue sender
-    6. test invalid queue sender
-    7. test valid queue receiver
-    8. test invalid queue receiver
-    9. test valid queue browser.
-    10. test invalid queue browser
-    11. test preconf dur sub, to valid dest.
-    12. test preconf dur sub, to invalid dest.
-    13. test dyn dur sub, to valid dest.
-    14. test  dyn dur sub, to valid dest.
-    */
-   public void testAuzValidTopicPublisher() throws Exception
-   {
-      TopicWorker pub1 = null;
-      try
-      {
-         IntRangeMessageCreator c1 = new IntRangeMessageCreator("USER_NR", 0);
-         pub1 = new TopicWorker(PUBLISHER, TRANS_NONE, c1, 1);
-         pub1.setUser("john", "needle");
-         pub1.connect();
-         pub1.publish();
-      }
-      catch (Exception ex)
-      {
-         Assert.fail("Could not publish to valid destination");
-      }
-      finally
-      {
-         try
-         {
-            pub1.close();
-         }
-         catch (Exception ex)
-         {
-         }
-      }
-   }
-
-   public void testAuzValidTopicPublisherTransaction() throws Exception
-   {
-      TopicWorker pub1 = null;
-      try
-      {
-         IntRangeMessageCreator c1 = new IntRangeMessageCreator("USER_NR", 0);
-         pub1 = new TopicWorker(PUBLISHER, TRANS_INDIVIDUAL, c1, 1);
-         pub1.setUser("john", "needle");
-         pub1.connect();
-         pub1.publish();
-      }
-      catch (Exception ex)
-      {
-         Assert.fail("Could not publish to valid destination");
-      }
-      finally
-      {
-         try
-         {
-            pub1.close();
-         }
-         catch (Exception ex)
-         {
-         }
-      }
-   }
-
-   public void testAuzInvalidTopicPublisher() throws Exception
-   {
-      TopicWorker pub1 = null;
-      try
-      {
-         IntRangeMessageCreator c1 = new IntRangeMessageCreator("USER_NR", 0);
-         pub1 = new TopicWorker(PUBLISHER, TRANS_NONE, c1, 1);
-         pub1.setUser("nobody", "nobody");
-         pub1.connect();
-         Exception e = null;
-         try
-         {
-            pub1.publish();
-         }
-         catch (Exception ex)
-         {
-            e = ex;
-         }
-         log.debug(e);
-         Assert.assertTrue("Unauz topic publishing throw wrong exception: " + e,
-               e instanceof javax.jms.JMSSecurityException);
-      }
-      finally
-      {
-         try
-         {
-            pub1.close();
-         }
-         catch (Exception ex)
-         {
-         }
-      }
-   }
-
-   public void testAuzInvalidTopicPublisherTransaction() throws Exception
-   {
-      TopicWorker pub1 = null;
-      try
-      {
-         IntRangeMessageCreator c1 = new IntRangeMessageCreator("USER_NR", 0);
-         pub1 = new TopicWorker(PUBLISHER, TRANS_INDIVIDUAL, c1, 1);
-         pub1.setUser("nobody", "nobody");
-         pub1.connect();
-         Exception e = null;
-         try
-         {
-            pub1.publish();
-         }
-         catch (Exception ex)
-         {
-            e = ex;
-         }
-         log.debug(e);
-         Assert.assertTrue("Unauz topic publishing throw wrong exception: " + e,
-               e instanceof javax.jms.JMSSecurityException);
-      }
-      finally
-      {
-         try
-         {
-            pub1.close();
-         }
-         catch (Exception ex)
-         {
-         }
-      }
-   }
-
-   public void testAuzValidTopicSubscriber() throws Exception
-   {
-      TopicWorker sub1 = null;
-      try
-      {
-         drainTopic();
-         IntRangeMessageFilter f1 = new IntRangeMessageFilter(javax.jms.Message.class, "USER_NR", 0, 1);
-         sub1 = new TopicWorker(SUBSCRIBER, TRANS_NONE, f1);
-         sub1.setUser("john", "needle");
-         Thread t1 = new Thread(sub1);
-         t1.start();
-         sleep(1000L);
-         Exception ex = sub1.getException();
-         t1.interrupt();
-         Assert.assertTrue("Autz topic subscriber did not work", ex == null);
-      }
-      finally
-      {
-         try
-         {
-            sub1.close();
-         }
-         catch (Exception ex)
-         {
-         }
-      }
-   }
-
-   public void testAuzValidTopicSubscriberTransaction() throws Exception
-   {
-      TopicWorker sub1 = null;
-      try
-      {
-         drainTopic();
-         IntRangeMessageFilter f1 = new IntRangeMessageFilter(javax.jms.Message.class, "USER_NR", 0, 1);
-         sub1 = new TopicWorker(SUBSCRIBER, TRANS_INDIVIDUAL, f1);
-         sub1.setUser("john", "needle");
-         Thread t1 = new Thread(sub1);
-         t1.start();
-         sleep(1000L);
-         Exception ex = sub1.getException();
-         t1.interrupt();
-         Assert.assertTrue("Autz topic subscriber did not work", ex == null);
-      }
-      finally
-      {
-         try
-         {
-            sub1.close();
-         }
-         catch (Exception ex)
-         {
-         }
-      }
-   }
-
-   public void testAuzInvalidTopicSubscriber() throws Exception
-   {
-      TopicWorker sub1 = null;
-      try
-      {
-         drainTopic();
-         IntRangeMessageFilter f1 = new IntRangeMessageFilter(javax.jms.Message.class, "USER_NR", 0, 1);
-         sub1 = new TopicWorker(SUBSCRIBER, TRANS_NONE, f1);
-         sub1.setUser("nobody", "nobody");
-         Thread t1 = new Thread(sub1);
-         t1.start();
-         sleep(1000L);
-         Exception ex = sub1.getException();
-         t1.interrupt();
-         Assert.assertTrue("Unautz topic subscriber throw wrong exception: " + ex,
-               ex instanceof javax.jms.JMSSecurityException);
-      }
-      finally
-      {
-         try
-         {
-            sub1.close();
-         }
-         catch (Exception ex)
-         {
-         }
-      }
-   }
-
-   public void testAuzInvalidTopicSubscriberTransaction() throws Exception
-   {
-      TopicWorker sub1 = null;
-      try
-      {
-         drainTopic();
-         IntRangeMessageFilter f1 = new IntRangeMessageFilter(javax.jms.Message.class, "USER_NR", 0, 1);
-         sub1 = new TopicWorker(SUBSCRIBER, TRANS_INDIVIDUAL, f1);
-         sub1.setUser("nobody", "nobody");
-         Thread t1 = new Thread(sub1);
-         t1.start();
-         sleep(1000L);
-         Exception ex = sub1.getException();
-         t1.interrupt();
-         Assert.assertTrue("Unautz topic subscriber throw wrong exception: " + ex,
-               ex instanceof javax.jms.JMSSecurityException);
-      }
-      finally
-      {
-         try
-         {
-            sub1.close();
-         }
-         catch (Exception ex)
-         {
-         }
-      }
-   }
-
-   public void testAuzValidQueueSender() throws Exception
-   {
-      QueueWorker pub1 = null;
-      try
-      {
-         IntRangeMessageCreator c1 = new IntRangeMessageCreator("USER_NR", 0);
-         pub1 = new QueueWorker(PUBLISHER, TRANS_NONE, c1, 1);
-         pub1.setUser("john", "needle");
-         pub1.connect();
-         pub1.publish();
-      }
-      catch (Exception ex)
-      {
-         Assert.fail("Could not publish to valid destination");
-      }
-      finally
-      {
-         try
-         {
-            pub1.close();
-         }
-         catch (Exception ex)
-         {
-         }
-      }
-   }
-
-   public void testAuzValidQueueSenderTransaction() throws Exception
-   {
-      QueueWorker pub1 = null;
-      try
-      {
-         IntRangeMessageCreator c1 = new IntRangeMessageCreator("USER_NR", 0);
-         pub1 = new QueueWorker(PUBLISHER, TRANS_INDIVIDUAL, c1, 1);
-         pub1.setUser("john", "needle");
-         pub1.connect();
-         pub1.publish();
-      }
-      catch (Exception ex)
-      {
-         Assert.fail("Could not publish to valid destination");
-      }
-      finally
-      {
-         try
-         {
-            pub1.close();
-         }
-         catch (Exception ex)
-         {
-         }
-      }
-   }
-
-   public void testAuzInvalidQueueSender() throws Exception
-   {
-      QueueWorker pub1 = null;
-      try
-      {
-         IntRangeMessageCreator c1 = new IntRangeMessageCreator("USER_NR", 0);
-         pub1 = new QueueWorker(PUBLISHER, TRANS_NONE, c1, 1);
-         pub1.setUser("nobody", "nobody");
-         pub1.connect();
-         Exception e = null;
-         try
-         {
-            pub1.publish();
-         }
-         catch (Exception ex)
-         {
-            e = ex;
-         }
-         log.debug(e);
-         Assert.assertTrue("Unauz queue publishing throw wrong exception: " + e,
-               e instanceof javax.jms.JMSSecurityException);
-      }
-      finally
-      {
-         try
-         {
-            pub1.close();
-         }
-         catch (Exception ex)
-         {
-         }
-      }
-   }
-
-   public void testAuzInvalidQueueSenderTransaction() throws Exception
-   {
-      QueueWorker pub1 = null;
-      try
-      {
-         IntRangeMessageCreator c1 = new IntRangeMessageCreator("USER_NR", 0);
-         pub1 = new QueueWorker(PUBLISHER, TRANS_INDIVIDUAL, c1, 1);
-         pub1.setUser("nobody", "nobody");
-         pub1.connect();
-         Exception e = null;
-         try
-         {
-            pub1.publish();
-         }
-         catch (Exception ex)
-         {
-            e = ex;
-         }
-         log.debug(e);
-         Assert.assertTrue("Unauz queue publishing throw wrong exception: " + e,
-               e instanceof javax.jms.JMSSecurityException);
-      }
-      finally
-      {
-         try
-         {
-            pub1.close();
-         }
-         catch (Exception ex)
-         {
-         }
-      }
-   }
-
-   public void testAuzValidQueueReceiver() throws Exception
-   {
-      QueueWorker sub1 = null;
-      try
-      {
-         IntRangeMessageFilter f1 = new IntRangeMessageFilter(javax.jms.Message.class, "USER_NR", 0, 1);
-         sub1 = new QueueWorker(GETTER, TRANS_NONE, f1);
-         sub1.setUser("john", "needle");
-         sub1.connect();
-         Exception ex = null;
-         try
-         {
-            sub1.get();
-         }
-         catch (Exception e)
-         {
-            ex = e;
-            log.error("ValidQueueReceiver got an exception: " + e, e);
-         }
-         Assert.assertTrue("Autz queue receiver did not work", ex == null);
-      }
-      finally
-      {
-         try
-         {
-            sub1.close();
-         }
-         catch (Exception ex)
-         {
-         }
-      }
-   }
-
-   public void testAuzValidQueueReceiverTransaction() throws Exception
-   {
-      QueueWorker sub1 = null;
-      try
-      {
-         IntRangeMessageFilter f1 = new IntRangeMessageFilter(javax.jms.Message.class, "USER_NR", 0, 1);
-         sub1 = new QueueWorker(GETTER, TRANS_INDIVIDUAL, f1);
-         sub1.setUser("john", "needle");
-         sub1.connect();
-         Exception ex = null;
-         try
-         {
-            sub1.get();
-         }
-         catch (Exception e)
-         {
-            ex = e;
-            log.error("ValidQueueReceiver got an exception: " + e, e);
-         }
-         Assert.assertTrue("Autz queue receiver did not work", ex == null);
-      }
-      finally
-      {
-         try
-         {
-            sub1.close();
-         }
-         catch (Exception ex)
-         {
-         }
-      }
-   }
-
-   public void testAuzInvalidQueueReceiver() throws Exception
-   {
-      QueueWorker sub1 = null;
-      try
-      {
-         IntRangeMessageFilter f1 = new IntRangeMessageFilter(javax.jms.Message.class, "USER_NR", 0, 1);
-         sub1 = new QueueWorker(GETTER, TRANS_NONE, f1);
-         sub1.setUser("nobody", "nobody");
-         sub1.connect();
-         Exception ex = null;
-         try
-         {
-            sub1.get();
-         }
-         catch (Exception e)
-         {
-            ex = e;
-         }
-         Assert.assertTrue("Unautz queue receiver throw wrong exception: " + ex,
-               ex instanceof javax.jms.JMSSecurityException);
-      }
-      finally
-      {
-         try
-         {
-            sub1.close();
-         }
-         catch (Exception ex)
-         {
-         }
-      }
-   }
-
-   public void testAuzInvalidQueueReceiverTransaction() throws Exception
-   {
-      QueueWorker sub1 = null;
-      try
-      {
-         IntRangeMessageFilter f1 = new IntRangeMessageFilter(javax.jms.Message.class, "USER_NR", 0, 1);
-         sub1 = new QueueWorker(GETTER, TRANS_INDIVIDUAL, f1);
-         sub1.setUser("nobody", "nobody");
-         sub1.connect();
-         Exception ex = null;
-         try
-         {
-            sub1.get();
-         }
-         catch (Exception e)
-         {
-            ex = e;
-         }
-         Assert.assertTrue("Unautz queue receiver throw wrong exception: " + ex,
-               ex instanceof javax.jms.JMSSecurityException);
-      }
-      finally
-      {
-         try
-         {
-            sub1.close();
-         }
-         catch (Exception ex)
-         {
-         }
-      }
-   }
-
-   public void testAuzValidQueueBrowser() throws Exception
-   {
-      QueueWorker sub1 = null;
-      try
-      {
-         IntRangeMessageFilter f1 = new IntRangeMessageFilter(javax.jms.Message.class, "USER_NR", 0, 1);
-         sub1 = new QueueWorker(GETTER, TRANS_NONE, f1);
-         sub1.setUser("john", "needle");
-         sub1.connect();
-         Exception ex = null;
-         try
-         {
-            sub1.browse();
-         }
-         catch (Exception e)
-         {
-            ex = e;
-            log.error("ValidQueueBrowser throw exception: " + e, e);
-         }
-         Assert.assertTrue("Autz queue receiver did not work", ex == null);
-      }
-      finally
-      {
-         try
-         {
-            sub1.close();
-         }
-         catch (Exception ex)
-         {
-         }
-      }
-   }
-
-   public void testAuzInvalidQueueBrowser() throws Exception
-   {
-      QueueWorker sub1 = null;
-      try
-      {
-         IntRangeMessageFilter f1 = new IntRangeMessageFilter(javax.jms.Message.class, "USER_NR", 0, 1);
-         sub1 = new QueueWorker(GETTER, TRANS_NONE, f1);
-         sub1.setUser("nobody", "nobody");
-         sub1.connect();
-         Exception ex = null;
-         try
-         {
-            sub1.browse();
-         }
-         catch (Exception e)
-         {
-            ex = e;
-         }
-         Assert.assertTrue("Unautz queue receiver throw wrong exception: " + ex,
-               ex instanceof javax.jms.JMSSecurityException);
-      }
-      finally
-      {
-         try
-         {
-            sub1.close();
-         }
-         catch (Exception ex)
-         {
-         }
-      }
-   }
-
-   public void testValidPreconfDurSub() throws Exception
-   {
-      TopicWorker sub1 = null;
-      TopicWorker pub1 = null;
-      try
-      {
-         // Clean testarea up
-         drainTopic();
-         int ic = 5;
-         // Set up a durable subscriber
-         IntRangeMessageFilter f1 = new IntRangeMessageFilter(javax.jms.Message.class, "DURABLE_NR", 0, ic);
-         sub1 = new TopicWorker(SUBSCRIBER, TRANS_NONE, f1);
-         sub1.setDurable("john", "needle", "sub2");
-         Thread t1 = new Thread(sub1);
-         t1.start();
-         // Let is take some time to really set up the dur sub
-         sleep(2000);
-         // Publish
-         IntRangeMessageCreator c1 = new IntRangeMessageCreator("DURABLE_NR", 0);
-         pub1 = new TopicWorker(PUBLISHER, TRANS_NONE, c1, ic);
-         pub1.connect();
-         pub1.publish();
-         Assert.assertEquals("Publisher did not publish correct number of messages " + pub1.getMessageHandled(), ic,
-               pub1.getMessageHandled());
-         // let sub1 have some time to handle the messages.
-         log.debug("Sleeping for " + ((ic * 100) / 60000) + " minutes");
-         sleep(ic * 100);
-         Exception ex = sub1.getException();
-         if (ex != null)
-            log.error("ValidPreconfDurSub got an exception: " + ex, ex);
-         Assert.assertTrue("ValidPreconfDurSub did not work", ex == null);
-         Assert.assertEquals("Subscriber did not get correct number of messages " + sub1.getMessageHandled(), ic, sub1
-               .getMessageHandled());
-         t1.interrupt();
-      }
-      finally
-      {
-         try
-         {
-            pub1.close();
-         }
-         catch (Exception ex)
-         {
-         }
-         try
-         {
-            // if this stops working it might be that we have become spec
-            // compliant an do not allow unsubscribe with an open consumer.
-            sub1.unsubscribe();
-            sub1.close();
-         }
-         catch (Exception ex)
-         {
-         }
-      }
-   }
-
-   public void testInvalidPreconfDurSub() throws Exception
-   {
-      TopicWorker sub1 = null;
-      try
-      {
-         // Clean testarea up
-         TEST_TOPIC = "topic/securedTopic";
-         //drainTopic();
-         int ic = 5;
-         // Set up a durable subscriber
-         IntRangeMessageFilter f1 = new IntRangeMessageFilter(javax.jms.Message.class, "DURABLE_NR", 0, ic);
-         sub1 = new TopicWorker(SUBSCRIBER, TRANS_NONE, f1);
-         sub1.setDurable("john", "needle", "sub3");
-         Thread t1 = new Thread(sub1);
-         t1.start();
-         // Let is take some time to really set up the dur sub
-         sleep(2000);
-         Exception ex = sub1.getException();
-         Assert.assertTrue("InvalidPreconfDurSub did not get correct exception:" + ex,
-               ex instanceof javax.jms.JMSSecurityException);
-         t1.interrupt();
-      }
-      finally
-      {
-         try
-         {
-            sub1.close();
-         }
-         catch (Exception ex)
-         {
-         }
-      }
-   }
-
-   public void testValidDynDurSub() throws Exception
-   {
-      TopicWorker sub1 = null;
-      TopicWorker pub1 = null;
-      try
-      {
-         // Clean testarea up
-         drainTopic();
-         int ic = 5;
-         // Set up a durable subscriber
-         IntRangeMessageFilter f1 = new IntRangeMessageFilter(javax.jms.Message.class, "DURABLE_NR", 0, ic);
-         sub1 = new TopicWorker(SUBSCRIBER, TRANS_NONE, f1);
-         sub1.setDurable("dynsub", "dynsub", "sub4");
-         sub1.setClientID("myId");
-         Thread t1 = new Thread(sub1);
-         t1.start();
-         // Let is take some time to really set up the dur sub
-         sleep(2000);
-         // Publish
-         IntRangeMessageCreator c1 = new IntRangeMessageCreator("DURABLE_NR", 0);
-         pub1 = new TopicWorker(PUBLISHER, TRANS_NONE, c1, ic);
-         pub1.connect();
-         pub1.publish();
-         Assert.assertEquals("Publisher did not publish correct number of messages " + pub1.getMessageHandled(), ic,
-               pub1.getMessageHandled());
-         // let sub1 have some time to handle the messages.
-         log.debug("Sleeping for " + ((ic * 100) / 60000) + " minutes");
-         sleep(ic * 100);
-         Exception ex = sub1.getException();
-         if (ex != null)
-            log.error("ValidDynDurSub got an exception: " + ex, ex);
-         Assert.assertTrue("ValidDynDurSub did not work", ex == null);
-         Assert.assertEquals("Subscriber did not get correct number of messages " + sub1.getMessageHandled(), ic, sub1
-               .getMessageHandled());
-         t1.interrupt();
-      }
-      finally
-      {
-         try
-         {
-            pub1.close();
-         }
-         catch (Exception ex)
-         {
-         }
-         try
-         {
-            // if this stops working it might be that we have become spec
-            // compliant an do not allow unsubscribe with an open consumer.
-            sub1.unsubscribe();
-            sub1.close();
-         }
-         catch (Exception ex)
-         {
-         }
-      }
-   }
-
-   public void testInvalidDynDurSub() throws Exception
-   {
-      TopicWorker sub1 = null;
-      try
-      {
-         // Clean testarea up
-         TEST_TOPIC = "topic/securedTopic";
-         //drainTopic();
-         int ic = 5;
-         // Set up a durable subscriber
-         IntRangeMessageFilter f1 = new IntRangeMessageFilter(javax.jms.Message.class, "DURABLE_NR", 0, ic);
-         sub1 = new TopicWorker(SUBSCRIBER, TRANS_NONE, f1);
-         sub1.setDurable("dynsub", "dynsub", "sub5");
-         sub1.setClientID("myId2");
-         Thread t1 = new Thread(sub1);
-         t1.start();
-         // Let is take some time to really set up the dur sub
-         sleep(2000);
-         Exception ex = sub1.getException();
-         Assert.assertTrue("InvalidDynDurSub did not get correct exception:" + ex,
-               ex instanceof javax.jms.JMSSecurityException);
-         t1.interrupt();
-      }
-      finally
-      {
-         try
-         {
-            sub1.close();
-         }
-         catch (Exception ex)
-         {
-         }
-      }
-   }
-
-}

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/SecurityUnitTestCase.java (from rev 64641, branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/test/SecurityUnitTestCase.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/SecurityUnitTestCase.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/SecurityUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,1170 @@
+/*
+  * 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.management.ObjectName;
+import junit.framework.Assert;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.jboss.test.JBossTestSetup;
+import org.jboss.test.jbossmessaging.JMSBase;
+/**
+ * Test of security features in JMS providers
+ *
+ * @author <a href="mailto:richard.achmatowicz">Richard Achmatowicz</a>
+ * @author     <a href="pra at tim.se">Peter Antman</a>
+ * @version $Revision: 64201 $
+ */
+public class SecurityUnitTestCase extends JMSBase
+{
+   public SecurityUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void testLoginTest() throws Exception
+   {
+      TopicWorker sub1 = null;
+      TopicWorker pub1 = null;
+      try
+      {
+         drainTopic();
+         int ic = 5;
+         IntRangeMessageFilter f1 = new IntRangeMessageFilter(javax.jms.Message.class, "USER_NR", 0, ic);
+         sub1 = new TopicWorker(SUBSCRIBER, TRANS_NONE, f1);
+         sub1.setUser("john", "needle");
+         Thread t1 = new Thread(sub1);
+         t1.start();
+         // Publish
+         IntRangeMessageCreator c1 = new IntRangeMessageCreator("USER_NR", 0);
+         pub1 = new TopicWorker(PUBLISHER, TRANS_NONE, c1, ic);
+         pub1.connect();
+         pub1.publish();
+         Assert.assertEquals("Publisher did not publish correct number of messages " + pub1.getMessageHandled(), ic,
+               pub1.getMessageHandled());
+         // let sub1 have some time to handle the messages.
+         log.debug("Sleeping for " + ((ic * 10) / 60000) + " minutes");
+         sleep(ic * 100);
+         Assert.assertEquals("Subscriber did not get correct number of messages " + sub1.getMessageHandled(), ic, sub1
+               .getMessageHandled());
+         sub1.close();
+         pub1.close();
+      }
+      catch (Throwable t)
+      {
+         if (t instanceof junit.framework.AssertionFailedError)
+            throw (junit.framework.AssertionFailedError) t;
+         log.error("Error in test: " + t, t);
+         throw new Exception(t.getMessage());
+      }
+      finally
+      {
+         try
+         {
+            if (sub1 != null)
+               sub1.close();
+         }
+         catch (Exception ex)
+         {
+         }
+         try
+         {
+            if (pub1 != null)
+               pub1.close();
+         }
+         catch (Exception ex)
+         {
+         }
+      }
+   }
+
+   /**
+    Tests that check authentication
+    1. Login without cred
+    2. Login with valid usedid,pwd
+    3. Login with valid user, unvalid pwd
+    4. Login with unvalid user.
+    */
+   public void testLoginNoCred() throws Exception
+   {
+      TopicWorker pub1 = null;
+      try
+      {
+         drainTopic();
+         pub1 = new TopicWorker(PUBLISHER, TRANS_NONE, null, 0);
+         pub1.connect();
+      }
+      catch (Exception ex)
+      {
+         Assert.fail("Could lot login without any cred");
+      }
+      finally
+      {
+         try
+         {
+            pub1.close();
+         }
+         catch (Exception ex)
+         {
+         }
+      }
+   }
+
+   public void testLoginValidCred() throws Exception
+   {
+      TopicWorker pub1 = null;
+      try
+      {
+         drainTopic();
+         pub1 = new TopicWorker(PUBLISHER, TRANS_NONE, null, 0);
+         pub1.setUser("john", "needle");
+         pub1.connect();
+      }
+      catch (Exception ex)
+      {
+         Assert.fail("Could lot login with valid cred");
+      }
+      finally
+      {
+         try
+         {
+            pub1.close();
+         }
+         catch (Exception ex)
+         {
+         }
+      }
+   }
+
+   public void testLoginInvalidPwd() throws Exception
+   {
+      TopicWorker pub1 = null;
+      try
+      {
+         drainTopic();
+         pub1 = new TopicWorker(PUBLISHER, TRANS_NONE, null, 0);
+         pub1.setUser("john", "bogus");
+         Exception e = null;
+         try
+         {
+            pub1.connect();
+         }
+         catch (Exception ex)
+         {
+            e = ex;
+         }
+         log.debug(e);
+         Assert.assertTrue("Loggin in with invalid password did not throw correct exception",
+               e instanceof javax.jms.JMSSecurityException);
+      }
+      finally
+      {
+         try
+         {
+            pub1.close();
+         }
+         catch (Exception ex)
+         {
+         }
+      }
+   }
+
+   public void testLoginInvalidCred() throws Exception
+   {
+      TopicWorker pub1 = null;
+      try
+      {
+         drainTopic();
+         pub1 = new TopicWorker(PUBLISHER, TRANS_NONE, null, 0);
+         pub1.setUser("bogus", "bogus");
+         Exception e = null;
+         try
+         {
+            pub1.connect();
+         }
+         catch (Exception ex)
+         {
+            e = ex;
+         }
+         log.debug(e);
+         Assert.assertTrue("Loggin in with invalid user did not throw correct exception",
+               e instanceof javax.jms.JMSSecurityException);
+      }
+      finally
+      {
+         try
+         {
+            pub1.close();
+         }
+         catch (Exception ex)
+         {
+         }
+      }
+   }
+
+   /**
+    An number of tests to verrify that clientID works as expected:
+    
+    This tests a specific a specific behavior from JBossMQ.
+    This tests creates a TopicSession and expects the clientID to be set. There is no requirement for this on JMS Spec.
+    */
+   /*public void testClientIDNormalTest() throws Exception
+   {
+      TopicWorker pub1 = null;
+      try
+      {
+         drainTopic();
+         int ic = 5;
+         // Publish
+         IntRangeMessageCreator c1 = new IntRangeMessageCreator("USER_NR", 0);
+         pub1 = new TopicWorker(PUBLISHER, TRANS_NONE, c1, ic);
+         pub1.connect();
+         pub1.publish();
+         Assert.assertTrue("Client did not get a valid clientID", pub1.connection.getClientID().startsWith("ID"));
+         pub1.close();
+      }
+      catch (Throwable t)
+      {
+         if (t instanceof junit.framework.AssertionFailedError)
+            throw (junit.framework.AssertionFailedError) t;
+         log.error("Error in test: " + t, t);
+         throw new Exception(t.getMessage());
+      }
+      finally
+      {
+         try
+         {
+            pub1.close();
+         }
+         catch (Exception ex)
+         {
+         }
+      }
+   } */
+
+   public void testClientIDPreconfTest() throws Exception
+   {
+      TopicWorker pub1 = null;
+      try
+      {
+         drainTopic();
+         int ic = 5;
+         // Publish
+         IntRangeMessageCreator c1 = new IntRangeMessageCreator("USER_NR", 0);
+         pub1 = new TopicWorker(PUBLISHER, TRANS_NONE, c1, ic);
+         pub1.setUser("john", "needle");
+         pub1.connect();
+         pub1.publish();
+         Assert.assertEquals("Client did not get a valid clientID", "DurableSubscriberExample", pub1.connection
+               .getClientID());
+         pub1.close();
+      }
+      catch (Throwable t)
+      {
+         if (t instanceof junit.framework.AssertionFailedError)
+            throw (junit.framework.AssertionFailedError) t;
+         log.error("Error in test: " + t, t);
+         throw new Exception(t.getMessage());
+      }
+      finally
+      {
+         try
+         {
+            pub1.close();
+         }
+         catch (Exception ex)
+         {
+         }
+      }
+   }
+
+   public void testClientIDSetTest() throws Exception
+   {
+      TopicWorker pub1 = null;
+      try
+      {
+         drainTopic();
+         int ic = 5;
+         // Publish
+         IntRangeMessageCreator c1 = new IntRangeMessageCreator("USER_NR", 0);
+         pub1 = new TopicWorker(PUBLISHER, TRANS_NONE, c1, ic);
+         pub1.setClientID("myId");
+         pub1.connect();
+         pub1.publish();
+         Assert.assertEquals("Client did not get a valid clientID", "myId", pub1.connection.getClientID());
+         pub1.close();
+      }
+      finally
+      {
+         try
+         {
+            pub1.close();
+         }
+         catch (Exception ex)
+         {
+         }
+      }
+   }
+
+   /*
+    * Test only valid on JBossMQ - commented out.
+    * public void testClientIDSetSteelPreconf() throws Exception
+   {
+      TopicWorker pub1 = null;
+      try
+      {
+         drainTopic();
+         int ic = 5;
+         // Publish
+         IntRangeMessageCreator c1 = new IntRangeMessageCreator("USER_NR", 0);
+         pub1 = new TopicWorker(PUBLISHER, TRANS_NONE, c1, ic);
+         pub1.setClientID("DurableSubscriberExample");
+         Exception e = null;
+         try
+         {
+            pub1.connect();
+         }
+         catch (Exception ex)
+         {
+            e = ex;
+         }
+         log.debug(e);
+         Assert.assertTrue("Setting a clientID wich is preconfigured did not throw correct exception",
+               e instanceof javax.jms.InvalidClientIDException);
+         pub1.close();
+      }
+      finally
+      {
+         try
+         {
+            pub1.close();
+         }
+         catch (Exception ex)
+         {
+         }
+      }
+   } */
+
+   public void testClientIDSetAfterInvoke() throws Exception
+   {
+      TopicWorker pub1 = null;
+      try
+      {
+         drainTopic();
+         int ic = 5;
+         // Publish
+         IntRangeMessageCreator c1 = new IntRangeMessageCreator("USER_NR", 0);
+         pub1 = new TopicWorker(PUBLISHER, TRANS_NONE, c1, ic);
+         pub1.connect();
+         pub1.publish();
+         Exception e = null;
+         try
+         {
+            pub1.connection.setClientID("myID");
+         }
+         catch (Exception ex)
+         {
+            e = ex;
+         }
+         log.debug(e);
+         Assert.assertTrue("Setting a clientID after connection is used did not throw correct exception: " + e,
+               e instanceof javax.jms.IllegalStateException);
+         pub1.close();
+      }
+      finally
+      {
+         try
+         {
+            pub1.close();
+         }
+         catch (Exception ex)
+         {
+         }
+      }
+   }
+
+   /**
+    Tests to check autorization.
+    
+    Remember there are actuallt two types of fails:
+    a) You are a user, but do no belong to a group that has acl.
+    b) You belong to a group, but that group does not have acl.
+    we test the first for topics and the second for queues, by
+    configuration in jbossmq-testsuite-service.xml
+    
+    Tests that check autorization.
+    1. test valid topic publisher
+    2. test invalid topic publisher
+    3. test valid topic subscriber
+    4. test invalid topic subscriber
+    5. test valid queue sender
+    6. test invalid queue sender
+    7. test valid queue receiver
+    8. test invalid queue receiver
+    9. test valid queue browser.
+    10. test invalid queue browser
+    11. test preconf dur sub, to valid dest.
+    12. test preconf dur sub, to invalid dest.
+    13. test dyn dur sub, to valid dest.
+    14. test  dyn dur sub, to valid dest.
+    */
+   public void testAuzValidTopicPublisher() throws Exception
+   {
+      TopicWorker pub1 = null;
+      try
+      {
+         IntRangeMessageCreator c1 = new IntRangeMessageCreator("USER_NR", 0);
+         pub1 = new TopicWorker(PUBLISHER, TRANS_NONE, c1, 1);
+         pub1.setUser("john", "needle");
+         pub1.connect();
+         pub1.publish();
+      }
+      catch (Exception ex)
+      {
+         Assert.fail("Could not publish to valid destination");
+      }
+      finally
+      {
+         try
+         {
+            pub1.close();
+         }
+         catch (Exception ex)
+         {
+         }
+      }
+   }
+
+   public void testAuzValidTopicPublisherTransaction() throws Exception
+   {
+      TopicWorker pub1 = null;
+      try
+      {
+         IntRangeMessageCreator c1 = new IntRangeMessageCreator("USER_NR", 0);
+         pub1 = new TopicWorker(PUBLISHER, TRANS_INDIVIDUAL, c1, 1);
+         pub1.setUser("john", "needle");
+         pub1.connect();
+         pub1.publish();
+      }
+      catch (Exception ex)
+      {
+         Assert.fail("Could not publish to valid destination");
+      }
+      finally
+      {
+         try
+         {
+            pub1.close();
+         }
+         catch (Exception ex)
+         {
+         }
+      }
+   }
+
+   public void testAuzInvalidTopicPublisher() throws Exception
+   {
+      TopicWorker pub1 = null;
+      try
+      {
+         IntRangeMessageCreator c1 = new IntRangeMessageCreator("USER_NR", 0);
+         pub1 = new TopicWorker(PUBLISHER, TRANS_NONE, c1, 1);
+         pub1.setUser("nobody", "nobody");
+         pub1.connect();
+         Exception e = null;
+         try
+         {
+            pub1.publish();
+         }
+         catch (Exception ex)
+         {
+            e = ex;
+         }
+         log.debug(e);
+         Assert.assertTrue("Unauz topic publishing throw wrong exception: " + e,
+               e instanceof javax.jms.JMSSecurityException);
+      }
+      finally
+      {
+         try
+         {
+            pub1.close();
+         }
+         catch (Exception ex)
+         {
+         }
+      }
+   }
+
+   public void testAuzInvalidTopicPublisherTransaction() throws Exception
+   {
+      TopicWorker pub1 = null;
+      try
+      {
+         IntRangeMessageCreator c1 = new IntRangeMessageCreator("USER_NR", 0);
+         pub1 = new TopicWorker(PUBLISHER, TRANS_INDIVIDUAL, c1, 1);
+         pub1.setUser("nobody", "nobody");
+         pub1.connect();
+         Exception e = null;
+         try
+         {
+            pub1.publish();
+         }
+         catch (Exception ex)
+         {
+            e = ex;
+         }
+         log.debug(e);
+         Assert.assertTrue("Unauz topic publishing throw wrong exception: " + e,
+               e instanceof javax.jms.JMSSecurityException);
+      }
+      finally
+      {
+         try
+         {
+            pub1.close();
+         }
+         catch (Exception ex)
+         {
+         }
+      }
+   }
+
+   public void testAuzValidTopicSubscriber() throws Exception
+   {
+      TopicWorker sub1 = null;
+      try
+      {
+         drainTopic();
+         IntRangeMessageFilter f1 = new IntRangeMessageFilter(javax.jms.Message.class, "USER_NR", 0, 1);
+         sub1 = new TopicWorker(SUBSCRIBER, TRANS_NONE, f1);
+         sub1.setUser("john", "needle");
+         Thread t1 = new Thread(sub1);
+         t1.start();
+         sleep(1000L);
+         Exception ex = sub1.getException();
+         t1.interrupt();
+         Assert.assertTrue("Autz topic subscriber did not work", ex == null);
+      }
+      finally
+      {
+         try
+         {
+            sub1.close();
+         }
+         catch (Exception ex)
+         {
+         }
+      }
+   }
+
+   public void testAuzValidTopicSubscriberTransaction() throws Exception
+   {
+      TopicWorker sub1 = null;
+      try
+      {
+         drainTopic();
+         IntRangeMessageFilter f1 = new IntRangeMessageFilter(javax.jms.Message.class, "USER_NR", 0, 1);
+         sub1 = new TopicWorker(SUBSCRIBER, TRANS_INDIVIDUAL, f1);
+         sub1.setUser("john", "needle");
+         Thread t1 = new Thread(sub1);
+         t1.start();
+         sleep(1000L);
+         Exception ex = sub1.getException();
+         t1.interrupt();
+         Assert.assertTrue("Autz topic subscriber did not work", ex == null);
+      }
+      finally
+      {
+         try
+         {
+            sub1.close();
+         }
+         catch (Exception ex)
+         {
+         }
+      }
+   }
+
+   public void testAuzInvalidTopicSubscriber() throws Exception
+   {
+      TopicWorker sub1 = null;
+      try
+      {
+         drainTopic();
+         IntRangeMessageFilter f1 = new IntRangeMessageFilter(javax.jms.Message.class, "USER_NR", 0, 1);
+         sub1 = new TopicWorker(SUBSCRIBER, TRANS_NONE, f1);
+         sub1.setUser("nobody", "nobody");
+         Thread t1 = new Thread(sub1);
+         t1.start();
+         sleep(1000L);
+         Exception ex = sub1.getException();
+         t1.interrupt();
+         Assert.assertTrue("Unautz topic subscriber throw wrong exception: " + ex,
+               ex instanceof javax.jms.JMSSecurityException);
+      }
+      finally
+      {
+         try
+         {
+            sub1.close();
+         }
+         catch (Exception ex)
+         {
+         }
+      }
+   }
+
+   public void testAuzInvalidTopicSubscriberTransaction() throws Exception
+   {
+      TopicWorker sub1 = null;
+      try
+      {
+         drainTopic();
+         IntRangeMessageFilter f1 = new IntRangeMessageFilter(javax.jms.Message.class, "USER_NR", 0, 1);
+         sub1 = new TopicWorker(SUBSCRIBER, TRANS_INDIVIDUAL, f1);
+         sub1.setUser("nobody", "nobody");
+         Thread t1 = new Thread(sub1);
+         t1.start();
+         sleep(1000L);
+         Exception ex = sub1.getException();
+         t1.interrupt();
+         Assert.assertTrue("Unautz topic subscriber throw wrong exception: " + ex,
+               ex instanceof javax.jms.JMSSecurityException);
+      }
+      finally
+      {
+         try
+         {
+            sub1.close();
+         }
+         catch (Exception ex)
+         {
+         }
+      }
+   }
+
+   public void testAuzValidQueueSender() throws Exception
+   {
+      QueueWorker pub1 = null;
+      try
+      {
+         IntRangeMessageCreator c1 = new IntRangeMessageCreator("USER_NR", 0);
+         pub1 = new QueueWorker(PUBLISHER, TRANS_NONE, c1, 1);
+         pub1.setUser("john", "needle");
+         pub1.connect();
+         pub1.publish();
+      }
+      catch (Exception ex)
+      {
+         Assert.fail("Could not publish to valid destination");
+      }
+      finally
+      {
+         try
+         {
+            pub1.close();
+         }
+         catch (Exception ex)
+         {
+         }
+      }
+   }
+
+   public void testAuzValidQueueSenderTransaction() throws Exception
+   {
+      QueueWorker pub1 = null;
+      try
+      {
+         IntRangeMessageCreator c1 = new IntRangeMessageCreator("USER_NR", 0);
+         pub1 = new QueueWorker(PUBLISHER, TRANS_INDIVIDUAL, c1, 1);
+         pub1.setUser("john", "needle");
+         pub1.connect();
+         pub1.publish();
+      }
+      catch (Exception ex)
+      {
+         Assert.fail("Could not publish to valid destination");
+      }
+      finally
+      {
+         try
+         {
+            pub1.close();
+         }
+         catch (Exception ex)
+         {
+         }
+      }
+   }
+
+   public void testAuzInvalidQueueSender() throws Exception
+   {
+      QueueWorker pub1 = null;
+      try
+      {
+         IntRangeMessageCreator c1 = new IntRangeMessageCreator("USER_NR", 0);
+         pub1 = new QueueWorker(PUBLISHER, TRANS_NONE, c1, 1);
+         pub1.setUser("nobody", "nobody");
+         pub1.connect();
+         Exception e = null;
+         try
+         {
+            pub1.publish();
+         }
+         catch (Exception ex)
+         {
+            e = ex;
+         }
+         log.debug(e);
+         Assert.assertTrue("Unauz queue publishing throw wrong exception: " + e,
+               e instanceof javax.jms.JMSSecurityException);
+      }
+      finally
+      {
+         try
+         {
+            pub1.close();
+         }
+         catch (Exception ex)
+         {
+         }
+      }
+   }
+
+   public void testAuzInvalidQueueSenderTransaction() throws Exception
+   {
+      QueueWorker pub1 = null;
+      try
+      {
+         IntRangeMessageCreator c1 = new IntRangeMessageCreator("USER_NR", 0);
+         pub1 = new QueueWorker(PUBLISHER, TRANS_INDIVIDUAL, c1, 1);
+         pub1.setUser("nobody", "nobody");
+         pub1.connect();
+         Exception e = null;
+         try
+         {
+            pub1.publish();
+         }
+         catch (Exception ex)
+         {
+            e = ex;
+         }
+         log.debug(e);
+         Assert.assertTrue("Unauz queue publishing throw wrong exception: " + e,
+               e instanceof javax.jms.JMSSecurityException);
+      }
+      finally
+      {
+         try
+         {
+            pub1.close();
+         }
+         catch (Exception ex)
+         {
+         }
+      }
+   }
+
+   public void testAuzValidQueueReceiver() throws Exception
+   {
+      QueueWorker sub1 = null;
+      try
+      {
+         IntRangeMessageFilter f1 = new IntRangeMessageFilter(javax.jms.Message.class, "USER_NR", 0, 1);
+         sub1 = new QueueWorker(GETTER, TRANS_NONE, f1);
+         sub1.setUser("john", "needle");
+         sub1.connect();
+         Exception ex = null;
+         try
+         {
+            sub1.get();
+         }
+         catch (Exception e)
+         {
+            ex = e;
+            log.error("ValidQueueReceiver got an exception: " + e, e);
+         }
+         Assert.assertTrue("Autz queue receiver did not work", ex == null);
+      }
+      finally
+      {
+         try
+         {
+            sub1.close();
+         }
+         catch (Exception ex)
+         {
+         }
+      }
+   }
+
+   public void testAuzValidQueueReceiverTransaction() throws Exception
+   {
+      QueueWorker sub1 = null;
+      try
+      {
+         IntRangeMessageFilter f1 = new IntRangeMessageFilter(javax.jms.Message.class, "USER_NR", 0, 1);
+         sub1 = new QueueWorker(GETTER, TRANS_INDIVIDUAL, f1);
+         sub1.setUser("john", "needle");
+         sub1.connect();
+         Exception ex = null;
+         try
+         {
+            sub1.get();
+         }
+         catch (Exception e)
+         {
+            ex = e;
+            log.error("ValidQueueReceiver got an exception: " + e, e);
+         }
+         Assert.assertTrue("Autz queue receiver did not work", ex == null);
+      }
+      finally
+      {
+         try
+         {
+            sub1.close();
+         }
+         catch (Exception ex)
+         {
+         }
+      }
+   }
+
+   public void testAuzInvalidQueueReceiver() throws Exception
+   {
+      QueueWorker sub1 = null;
+      try
+      {
+         IntRangeMessageFilter f1 = new IntRangeMessageFilter(javax.jms.Message.class, "USER_NR", 0, 1);
+         sub1 = new QueueWorker(GETTER, TRANS_NONE, f1);
+         sub1.setUser("nobody", "nobody");
+         sub1.connect();
+         Exception ex = null;
+         try
+         {
+            sub1.get();
+         }
+         catch (Exception e)
+         {
+            ex = e;
+         }
+         Assert.assertTrue("Unautz queue receiver throw wrong exception: " + ex,
+               ex instanceof javax.jms.JMSSecurityException);
+      }
+      finally
+      {
+         try
+         {
+            sub1.close();
+         }
+         catch (Exception ex)
+         {
+         }
+      }
+   }
+
+   public void testAuzInvalidQueueReceiverTransaction() throws Exception
+   {
+      QueueWorker sub1 = null;
+      try
+      {
+         IntRangeMessageFilter f1 = new IntRangeMessageFilter(javax.jms.Message.class, "USER_NR", 0, 1);
+         sub1 = new QueueWorker(GETTER, TRANS_INDIVIDUAL, f1);
+         sub1.setUser("nobody", "nobody");
+         sub1.connect();
+         Exception ex = null;
+         try
+         {
+            sub1.get();
+         }
+         catch (Exception e)
+         {
+            ex = e;
+         }
+         Assert.assertTrue("Unautz queue receiver throw wrong exception: " + ex,
+               ex instanceof javax.jms.JMSSecurityException);
+      }
+      finally
+      {
+         try
+         {
+            sub1.close();
+         }
+         catch (Exception ex)
+         {
+         }
+      }
+   }
+
+   public void testAuzValidQueueBrowser() throws Exception
+   {
+      QueueWorker sub1 = null;
+      try
+      {
+         IntRangeMessageFilter f1 = new IntRangeMessageFilter(javax.jms.Message.class, "USER_NR", 0, 1);
+         sub1 = new QueueWorker(GETTER, TRANS_NONE, f1);
+         sub1.setUser("john", "needle");
+         sub1.connect();
+         Exception ex = null;
+         try
+         {
+            sub1.browse();
+         }
+         catch (Exception e)
+         {
+            ex = e;
+            log.error("ValidQueueBrowser throw exception: " + e, e);
+         }
+         Assert.assertTrue("Autz queue receiver did not work", ex == null);
+      }
+      finally
+      {
+         try
+         {
+            sub1.close();
+         }
+         catch (Exception ex)
+         {
+         }
+      }
+   }
+
+   public void testAuzInvalidQueueBrowser() throws Exception
+   {
+      QueueWorker sub1 = null;
+      try
+      {
+         IntRangeMessageFilter f1 = new IntRangeMessageFilter(javax.jms.Message.class, "USER_NR", 0, 1);
+         sub1 = new QueueWorker(GETTER, TRANS_NONE, f1);
+         sub1.setUser("nobody", "nobody");
+         sub1.connect();
+         Exception ex = null;
+         try
+         {
+            sub1.browse();
+         }
+         catch (Exception e)
+         {
+            ex = e;
+         }
+         Assert.assertTrue("Unautz queue receiver throw wrong exception: " + ex,
+               ex instanceof javax.jms.JMSSecurityException);
+      }
+      finally
+      {
+         try
+         {
+            sub1.close();
+         }
+         catch (Exception ex)
+         {
+         }
+      }
+   }
+
+   public void testValidPreconfDurSub() throws Exception
+   {
+      TopicWorker sub1 = null;
+      TopicWorker pub1 = null;
+      try
+      {
+         // Clean testarea up
+         drainTopic();
+         int ic = 5;
+         // Set up a durable subscriber
+         IntRangeMessageFilter f1 = new IntRangeMessageFilter(javax.jms.Message.class, "DURABLE_NR", 0, ic);
+         sub1 = new TopicWorker(SUBSCRIBER, TRANS_NONE, f1);
+         sub1.setDurable("john", "needle", "sub2");
+         Thread t1 = new Thread(sub1);
+         t1.start();
+         // Let is take some time to really set up the dur sub
+         sleep(2000);
+         // Publish
+         IntRangeMessageCreator c1 = new IntRangeMessageCreator("DURABLE_NR", 0);
+         pub1 = new TopicWorker(PUBLISHER, TRANS_NONE, c1, ic);
+         pub1.connect();
+         pub1.publish();
+         Assert.assertEquals("Publisher did not publish correct number of messages " + pub1.getMessageHandled(), ic,
+               pub1.getMessageHandled());
+         // let sub1 have some time to handle the messages.
+         log.debug("Sleeping for " + ((ic * 100) / 60000) + " minutes");
+         sleep(ic * 100);
+         Exception ex = sub1.getException();
+         if (ex != null)
+            log.error("ValidPreconfDurSub got an exception: " + ex, ex);
+         Assert.assertTrue("ValidPreconfDurSub did not work", ex == null);
+         Assert.assertEquals("Subscriber did not get correct number of messages " + sub1.getMessageHandled(), ic, sub1
+               .getMessageHandled());
+         t1.interrupt();
+      }
+      finally
+      {
+         try
+         {
+            pub1.close();
+         }
+         catch (Exception ex)
+         {
+         }
+         try
+         {
+            // if this stops working it might be that we have become spec
+            // compliant an do not allow unsubscribe with an open consumer.
+            sub1.unsubscribe();
+            sub1.close();
+         }
+         catch (Exception ex)
+         {
+         }
+      }
+   }
+
+   public void testInvalidPreconfDurSub() throws Exception
+   {
+      TopicWorker sub1 = null;
+      try
+      {
+         // Clean testarea up
+         TEST_TOPIC = "topic/securedTopic";
+         //drainTopic();
+         int ic = 5;
+         // Set up a durable subscriber
+         IntRangeMessageFilter f1 = new IntRangeMessageFilter(javax.jms.Message.class, "DURABLE_NR", 0, ic);
+         sub1 = new TopicWorker(SUBSCRIBER, TRANS_NONE, f1);
+         sub1.setDurable("john", "needle", "sub3");
+         Thread t1 = new Thread(sub1);
+         t1.start();
+         // Let is take some time to really set up the dur sub
+         sleep(2000);
+         Exception ex = sub1.getException();
+         Assert.assertTrue("InvalidPreconfDurSub did not get correct exception:" + ex,
+               ex instanceof javax.jms.JMSSecurityException);
+         t1.interrupt();
+      }
+      finally
+      {
+         try
+         {
+            sub1.close();
+         }
+         catch (Exception ex)
+         {
+         }
+      }
+   }
+
+   public void testValidDynDurSub() throws Exception
+   {
+      TopicWorker sub1 = null;
+      TopicWorker pub1 = null;
+      try
+      {
+         // Clean testarea up
+         drainTopic();
+         int ic = 5;
+         // Set up a durable subscriber
+         IntRangeMessageFilter f1 = new IntRangeMessageFilter(javax.jms.Message.class, "DURABLE_NR", 0, ic);
+         sub1 = new TopicWorker(SUBSCRIBER, TRANS_NONE, f1);
+         sub1.setDurable("dynsub", "dynsub", "sub4");
+         sub1.setClientID("myId");
+         Thread t1 = new Thread(sub1);
+         t1.start();
+         // Let is take some time to really set up the dur sub
+         sleep(2000);
+         // Publish
+         IntRangeMessageCreator c1 = new IntRangeMessageCreator("DURABLE_NR", 0);
+         pub1 = new TopicWorker(PUBLISHER, TRANS_NONE, c1, ic);
+         pub1.connect();
+         pub1.publish();
+         Assert.assertEquals("Publisher did not publish correct number of messages " + pub1.getMessageHandled(), ic,
+               pub1.getMessageHandled());
+         // let sub1 have some time to handle the messages.
+         log.debug("Sleeping for " + ((ic * 100) / 60000) + " minutes");
+         sleep(ic * 100);
+         Exception ex = sub1.getException();
+         if (ex != null)
+            log.error("ValidDynDurSub got an exception: " + ex, ex);
+         Assert.assertTrue("ValidDynDurSub did not work", ex == null);
+         Assert.assertEquals("Subscriber did not get correct number of messages " + sub1.getMessageHandled(), ic, sub1
+               .getMessageHandled());
+         t1.interrupt();
+      }
+      finally
+      {
+         try
+         {
+            pub1.close();
+         }
+         catch (Exception ex)
+         {
+         }
+         try
+         {
+            // if this stops working it might be that we have become spec
+            // compliant an do not allow unsubscribe with an open consumer.
+            sub1.unsubscribe();
+            sub1.close();
+         }
+         catch (Exception ex)
+         {
+         }
+      }
+   }
+
+   public void testInvalidDynDurSub() throws Exception
+   {
+      TopicWorker sub1 = null;
+      try
+      {
+         // Clean testarea up
+         TEST_TOPIC = "topic/securedTopic";
+         //drainTopic();
+         int ic = 5;
+         // Set up a durable subscriber
+         IntRangeMessageFilter f1 = new IntRangeMessageFilter(javax.jms.Message.class, "DURABLE_NR", 0, ic);
+         sub1 = new TopicWorker(SUBSCRIBER, TRANS_NONE, f1);
+         sub1.setDurable("dynsub", "dynsub", "sub5");
+         sub1.setClientID("myId2");
+         Thread t1 = new Thread(sub1);
+         t1.start();
+         // Let is take some time to really set up the dur sub
+         sleep(2000);
+         Exception ex = sub1.getException();
+         Assert.assertTrue("InvalidDynDurSub did not get correct exception:" + ex,
+               ex instanceof javax.jms.JMSSecurityException);
+         t1.interrupt();
+      }
+      finally
+      {
+         try
+         {
+            sub1.close();
+         }
+         catch (Exception ex)
+         {
+         }
+      }
+   }
+
+}

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/SessionCloseStressTestCase.java
===================================================================
--- branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/test/SessionCloseStressTestCase.java	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/SessionCloseStressTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,333 +0,0 @@
-/*
-* 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 java.util.Random;
-
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.QueueConnection;
-import javax.jms.QueueConnectionFactory;
-import javax.jms.QueueSession;
-import javax.jms.Session;
-import javax.naming.Context;
-
-import junit.framework.Test;
-
-import org.jboss.test.jbossmessaging.JMSTestCase;
-
-/**
- * Tests for receiving while closing the session
- *
- * @author <a href="mailto:richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
- * @author <a href="mailto:adrian at jboss.org>Adrian Brock</a>
- * @version <tt>$Revision: 64130 $</tt>
- */
-public class SessionCloseStressTestCase extends JMSTestCase
-{
-   static String QUEUE_FACTORY = "ConnectionFactory";
-   static String QUEUE = "queue/testQueue";
-
-   QueueConnection queueConnection;
-   Queue queue;
-   
-   public SessionCloseStressTestCase(String name) throws Exception
-   {
-      super(name);
-   }
-
-   public abstract class TestRunnable implements Runnable
-   {
-      public Throwable error = null;
-      
-      public abstract void doRun() throws Exception;
-      
-      public void run()
-      {
-         try
-         {
-            doRun();
-         }
-         catch (Throwable t)
-         {
-            log.error("Error in " + Thread.currentThread(), t);
-            error = t;
-         }
-      }
-   }
-   
-   public class SessionRunnable extends TestRunnable
-   {
-      MessageConsumer consumer;
-      
-      int received = 0;
-      
-      public void doRun() throws Exception
-      {
-         QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-         MessageProducer producer = session.createProducer(queue);
-         for (int i = 0; i < getIterationCount(); ++i)
-         {
-            Message message = session.createTextMessage("" + i);
-            producer.send(message);
-         }
-         producer.close();
-         consumer = session.createConsumer(queue);
-         waitForMessages();
-         session.close();
-      }
-      
-      public synchronized MessageConsumer getConsumer() throws Exception
-      {
-         while (true)
-         {
-            if (consumer != null)
-               return consumer;
-            wait();
-         }
-      }
-      
-      public synchronized void incReceived()
-      {
-         ++received;
-         notifyAll();
-      }
-      
-      public synchronized void waitForMessages() throws Exception
-      {
-         notifyAll();
-         int target = new Random().nextInt(getIterationCount());
-         while (received < target)
-            wait();
-      }
-   }
-   
-   public class ReceiverRunnable extends TestRunnable
-   {
-      SessionRunnable sessionRunnable;
-      
-      public ReceiverRunnable(SessionRunnable sessionRunnable)
-      {
-         this.sessionRunnable = sessionRunnable;
-      }
-      
-      public void doRun() throws Exception
-      {
-         MessageConsumer consumer = sessionRunnable.getConsumer();
-         try
-         {
-            while (true)
-            {
-               consumer.receive();
-               sessionRunnable.incReceived();
-            }
-         }
-         catch (JMSException expected)
-         {
-            if (expected.getMessage().indexOf("closed") == -1)
-               throw expected;
-         }
-      }
-   }
-   
-   public class ReceiverNoWaitRunnable extends TestRunnable
-   {
-      SessionRunnable sessionRunnable;
-      
-      public ReceiverNoWaitRunnable(SessionRunnable sessionRunnable)
-      {
-         this.sessionRunnable = sessionRunnable;
-      }
-      
-      public void doRun() throws Exception
-      {
-         MessageConsumer consumer = sessionRunnable.getConsumer();
-         try
-         {
-            while (true)
-            {
-               if (consumer.receiveNoWait() != null)
-                  sessionRunnable.incReceived();
-            }
-         }
-         catch (JMSException expected)
-         {
-            if (expected.getMessage().indexOf("closed") == -1)
-               throw expected;
-         }
-      }
-   }
-   
-   public class ReceiverMessageListenerRunnable extends TestRunnable implements MessageListener
-   {
-      SessionRunnable sessionRunnable;
-      
-      public ReceiverMessageListenerRunnable(SessionRunnable sessionRunnable)
-      {
-         this.sessionRunnable = sessionRunnable;
-      }
-      
-      public void onMessage(Message message)
-      {
-         sessionRunnable.incReceived();
-      }
-      
-      public void doRun() throws Exception
-      {
-         MessageConsumer consumer = sessionRunnable.getConsumer();
-         try
-         {
-            consumer.setMessageListener(this);
-         }
-         catch (JMSException expected)
-         {
-            if (expected.getMessage().indexOf("closed") == -1)
-               throw expected;
-         }
-      }
-   }
-   
-   public void testSessionCloseCompetesWithReceive() throws Exception
-   {
-      connect();
-      try
-      {
-         for (int i = 0; i < getThreadCount(); ++i)
-         {
-            SessionRunnable sessionRunnable = new SessionRunnable(); 
-            Thread sessionThread = new Thread(sessionRunnable, "Session");
-            Thread consumerThread = new Thread(new ReceiverRunnable(sessionRunnable), "Consumer");
-            consumerThread.start();
-            sessionThread.start();
-            sessionThread.join();
-            consumerThread.join();
-            assertNull(sessionRunnable.error);
-
-            // Drain the queue
-            QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-            MessageConsumer consumer = session.createConsumer(queue);
-            while (consumer.receiveNoWait() != null);
-            session.close();
-         }
-      }
-      finally
-      {
-         disconnect();
-      }
-   }
-   
-   public void testSessionCloseCompetesWithReceiveNoWait() throws Exception
-   {
-      connect();
-      try
-      {
-         for (int i = 0; i < getThreadCount(); ++i)
-         {
-            SessionRunnable sessionRunnable = new SessionRunnable(); 
-            Thread sessionThread = new Thread(sessionRunnable, "Session");
-            Thread consumerThread = new Thread(new ReceiverNoWaitRunnable(sessionRunnable), "Consumer");
-            consumerThread.start();
-            sessionThread.start();
-            sessionThread.join();
-            consumerThread.join();
-            assertNull(sessionRunnable.error);
-
-            // Drain the queue
-            QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-            MessageConsumer consumer = session.createConsumer(queue);
-            while (consumer.receiveNoWait() != null);
-            session.close();
-         }
-      }
-      finally
-      {
-         disconnect();
-      }
-   }
-   
-   public void testSessionCloseCompetesWithMessageListener() throws Exception
-   {
-      connect();
-      try
-      {
-         for (int i = 0; i < getThreadCount(); ++i)
-         {
-            SessionRunnable sessionRunnable = new SessionRunnable(); 
-            Thread sessionThread = new Thread(sessionRunnable, "Session");
-            Thread consumerThread = new Thread(new ReceiverMessageListenerRunnable(sessionRunnable), "Consumer");
-            consumerThread.start();
-            sessionThread.start();
-            sessionThread.join();
-            consumerThread.join();
-            assertNull(sessionRunnable.error);
-
-            // Drain the queue
-            QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-            MessageConsumer consumer = session.createConsumer(queue);
-            while (consumer.receiveNoWait() != null);
-            session.close();
-         }
-      }
-      finally
-      {
-         disconnect();
-      }
-   }
-
-   protected void connect() throws Exception
-   {
-      Context context = getInitialContext();
-      queue = (Queue) context.lookup(QUEUE);
-      QueueConnectionFactory queueFactory = (QueueConnectionFactory) context.lookup(QUEUE_FACTORY);
-      queueConnection = queueFactory.createQueueConnection();
-      queueConnection.start();
-
-      getLog().debug("Connection established.");
-   }
-
-   protected void disconnect()
-   {
-      try
-      {
-         if (queueConnection != null)
-            queueConnection.close();
-      }
-      catch (Exception ignored)
-      {
-      }
-
-      getLog().debug("Connection closed.");
-   }
-
-   public static Test suite() throws Exception
-   {
-       ClassLoader loader = Thread.currentThread().getContextClassLoader();
-       String resourceName = getJMSResourceRelativePathname("tests-destinations-service.xml") ;
-
-       return getDeploySetup(SessionCloseStressTestCase.class,
-               loader.getResource(resourceName).toString());
-   }
-}

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/SessionCloseStressTestCase.java (from rev 64641, branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/test/SessionCloseStressTestCase.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/SessionCloseStressTestCase.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/SessionCloseStressTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,333 @@
+/*
+* 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 java.util.Random;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueSession;
+import javax.jms.Session;
+import javax.naming.Context;
+
+import junit.framework.Test;
+
+import org.jboss.test.jbossmessaging.JMSTestCase;
+
+/**
+ * Tests for receiving while closing the session
+ *
+ * @author <a href="mailto:richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
+ * @author <a href="mailto:adrian at jboss.org>Adrian Brock</a>
+ * @version <tt>$Revision: 64130 $</tt>
+ */
+public class SessionCloseStressTestCase extends JMSTestCase
+{
+   static String QUEUE_FACTORY = "ConnectionFactory";
+   static String QUEUE = "queue/testQueue";
+
+   QueueConnection queueConnection;
+   Queue queue;
+   
+   public SessionCloseStressTestCase(String name) throws Exception
+   {
+      super(name);
+   }
+
+   public abstract class TestRunnable implements Runnable
+   {
+      public Throwable error = null;
+      
+      public abstract void doRun() throws Exception;
+      
+      public void run()
+      {
+         try
+         {
+            doRun();
+         }
+         catch (Throwable t)
+         {
+            log.error("Error in " + Thread.currentThread(), t);
+            error = t;
+         }
+      }
+   }
+   
+   public class SessionRunnable extends TestRunnable
+   {
+      MessageConsumer consumer;
+      
+      int received = 0;
+      
+      public void doRun() throws Exception
+      {
+         QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+         MessageProducer producer = session.createProducer(queue);
+         for (int i = 0; i < getIterationCount(); ++i)
+         {
+            Message message = session.createTextMessage("" + i);
+            producer.send(message);
+         }
+         producer.close();
+         consumer = session.createConsumer(queue);
+         waitForMessages();
+         session.close();
+      }
+      
+      public synchronized MessageConsumer getConsumer() throws Exception
+      {
+         while (true)
+         {
+            if (consumer != null)
+               return consumer;
+            wait();
+         }
+      }
+      
+      public synchronized void incReceived()
+      {
+         ++received;
+         notifyAll();
+      }
+      
+      public synchronized void waitForMessages() throws Exception
+      {
+         notifyAll();
+         int target = new Random().nextInt(getIterationCount());
+         while (received < target)
+            wait();
+      }
+   }
+   
+   public class ReceiverRunnable extends TestRunnable
+   {
+      SessionRunnable sessionRunnable;
+      
+      public ReceiverRunnable(SessionRunnable sessionRunnable)
+      {
+         this.sessionRunnable = sessionRunnable;
+      }
+      
+      public void doRun() throws Exception
+      {
+         MessageConsumer consumer = sessionRunnable.getConsumer();
+         try
+         {
+            while (true)
+            {
+               consumer.receive();
+               sessionRunnable.incReceived();
+            }
+         }
+         catch (JMSException expected)
+         {
+            if (expected.getMessage().indexOf("closed") == -1)
+               throw expected;
+         }
+      }
+   }
+   
+   public class ReceiverNoWaitRunnable extends TestRunnable
+   {
+      SessionRunnable sessionRunnable;
+      
+      public ReceiverNoWaitRunnable(SessionRunnable sessionRunnable)
+      {
+         this.sessionRunnable = sessionRunnable;
+      }
+      
+      public void doRun() throws Exception
+      {
+         MessageConsumer consumer = sessionRunnable.getConsumer();
+         try
+         {
+            while (true)
+            {
+               if (consumer.receiveNoWait() != null)
+                  sessionRunnable.incReceived();
+            }
+         }
+         catch (JMSException expected)
+         {
+            if (expected.getMessage().indexOf("closed") == -1)
+               throw expected;
+         }
+      }
+   }
+   
+   public class ReceiverMessageListenerRunnable extends TestRunnable implements MessageListener
+   {
+      SessionRunnable sessionRunnable;
+      
+      public ReceiverMessageListenerRunnable(SessionRunnable sessionRunnable)
+      {
+         this.sessionRunnable = sessionRunnable;
+      }
+      
+      public void onMessage(Message message)
+      {
+         sessionRunnable.incReceived();
+      }
+      
+      public void doRun() throws Exception
+      {
+         MessageConsumer consumer = sessionRunnable.getConsumer();
+         try
+         {
+            consumer.setMessageListener(this);
+         }
+         catch (JMSException expected)
+         {
+            if (expected.getMessage().indexOf("closed") == -1)
+               throw expected;
+         }
+      }
+   }
+   
+   public void testSessionCloseCompetesWithReceive() throws Exception
+   {
+      connect();
+      try
+      {
+         for (int i = 0; i < getThreadCount(); ++i)
+         {
+            SessionRunnable sessionRunnable = new SessionRunnable(); 
+            Thread sessionThread = new Thread(sessionRunnable, "Session");
+            Thread consumerThread = new Thread(new ReceiverRunnable(sessionRunnable), "Consumer");
+            consumerThread.start();
+            sessionThread.start();
+            sessionThread.join();
+            consumerThread.join();
+            assertNull(sessionRunnable.error);
+
+            // Drain the queue
+            QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+            MessageConsumer consumer = session.createConsumer(queue);
+            while (consumer.receiveNoWait() != null);
+            session.close();
+         }
+      }
+      finally
+      {
+         disconnect();
+      }
+   }
+   
+   public void testSessionCloseCompetesWithReceiveNoWait() throws Exception
+   {
+      connect();
+      try
+      {
+         for (int i = 0; i < getThreadCount(); ++i)
+         {
+            SessionRunnable sessionRunnable = new SessionRunnable(); 
+            Thread sessionThread = new Thread(sessionRunnable, "Session");
+            Thread consumerThread = new Thread(new ReceiverNoWaitRunnable(sessionRunnable), "Consumer");
+            consumerThread.start();
+            sessionThread.start();
+            sessionThread.join();
+            consumerThread.join();
+            assertNull(sessionRunnable.error);
+
+            // Drain the queue
+            QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+            MessageConsumer consumer = session.createConsumer(queue);
+            while (consumer.receiveNoWait() != null);
+            session.close();
+         }
+      }
+      finally
+      {
+         disconnect();
+      }
+   }
+   
+   public void testSessionCloseCompetesWithMessageListener() throws Exception
+   {
+      connect();
+      try
+      {
+         for (int i = 0; i < getThreadCount(); ++i)
+         {
+            SessionRunnable sessionRunnable = new SessionRunnable(); 
+            Thread sessionThread = new Thread(sessionRunnable, "Session");
+            Thread consumerThread = new Thread(new ReceiverMessageListenerRunnable(sessionRunnable), "Consumer");
+            consumerThread.start();
+            sessionThread.start();
+            sessionThread.join();
+            consumerThread.join();
+            assertNull(sessionRunnable.error);
+
+            // Drain the queue
+            QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+            MessageConsumer consumer = session.createConsumer(queue);
+            while (consumer.receiveNoWait() != null);
+            session.close();
+         }
+      }
+      finally
+      {
+         disconnect();
+      }
+   }
+
+   protected void connect() throws Exception
+   {
+      Context context = getInitialContext();
+      queue = (Queue) context.lookup(QUEUE);
+      QueueConnectionFactory queueFactory = (QueueConnectionFactory) context.lookup(QUEUE_FACTORY);
+      queueConnection = queueFactory.createQueueConnection();
+      queueConnection.start();
+
+      getLog().debug("Connection established.");
+   }
+
+   protected void disconnect()
+   {
+      try
+      {
+         if (queueConnection != null)
+            queueConnection.close();
+      }
+      catch (Exception ignored)
+      {
+      }
+
+      getLog().debug("Connection closed.");
+   }
+
+   public static Test suite() throws Exception
+   {
+       ClassLoader loader = Thread.currentThread().getContextClassLoader();
+       String resourceName = getJMSResourceRelativePathname("tests-destinations-service.xml") ;
+
+       return getDeploySetup(SessionCloseStressTestCase.class,
+               loader.getResource(resourceName).toString());
+   }
+}

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/TemporarySessionConnectionUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/test/TemporarySessionConnectionUnitTestCase.java	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/TemporarySessionConnectionUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,119 +0,0 @@
-/*
-  * 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.JMSException;
-import javax.jms.QueueConnection;
-import javax.jms.QueueConnectionFactory;
-import javax.jms.QueueSession;
-import javax.jms.Session;
-import javax.jms.TemporaryQueue;
-import javax.naming.Context;
-
-import org.jboss.test.jbossmessaging.JMSTestCase;
-
-/**
- * Tests for temporaries and session/connection consumer construction
- *
- * @author <a href="mailto:richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
- * @author <a href="mailto:adrian at jboss.org>Adrian Brock</a>
- * @version <tt>$Revision: 64130 $</tt>
- */
-public class TemporarySessionConnectionUnitTestCase extends JMSTestCase
-{
-   static String QUEUE_FACTORY = "ConnectionFactory";
-
-   QueueConnection queueConnection;
-
-   public TemporarySessionConnectionUnitTestCase(String name) throws Exception
-   {
-      super(name);
-   }
-
-   public void testTemporaryDifferentSession() throws Exception
-   {
-      connect();
-      try
-      {
-         QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-         TemporaryQueue temp = session.createTemporaryQueue(); 
-         session.createConsumer(temp);
-         session.close();
-         session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-         session.createConsumer(temp).close();
-      }
-      finally
-      {
-         disconnect();
-      }
-   }
-
-   public void testTemporaryDifferentConnection() throws Exception
-   {
-      connect();
-      try
-      {
-         QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-         TemporaryQueue temp = session.createTemporaryQueue(); 
-         session.createConsumer(temp);
-         disconnect();
-         connect();
-         session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-         try
-         {
-            session.createConsumer(temp).close();
-            fail("Should not be able to consume a temporary on different connection");
-         }
-         catch (JMSException expected)
-         {
-         }
-      }
-      finally
-      {
-         disconnect();
-      }
-   }
-
-   protected void connect() throws Exception
-   {
-      Context context = getInitialContext();
-      QueueConnectionFactory queueFactory = (QueueConnectionFactory) context.lookup(QUEUE_FACTORY);
-      queueConnection = queueFactory.createQueueConnection();
-      queueConnection.start();
-
-      getLog().debug("Connection established.");
-   }
-
-   protected void disconnect()
-   {
-      try
-      {
-         if (queueConnection != null)
-            queueConnection.close();
-      }
-      catch (Exception ignored)
-      {
-      }
-
-      getLog().debug("Connection closed.");
-   }
-}

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/TemporarySessionConnectionUnitTestCase.java (from rev 64641, branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/test/TemporarySessionConnectionUnitTestCase.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/TemporarySessionConnectionUnitTestCase.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/TemporarySessionConnectionUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,119 @@
+/*
+  * 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.JMSException;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueSession;
+import javax.jms.Session;
+import javax.jms.TemporaryQueue;
+import javax.naming.Context;
+
+import org.jboss.test.jbossmessaging.JMSTestCase;
+
+/**
+ * Tests for temporaries and session/connection consumer construction
+ *
+ * @author <a href="mailto:richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
+ * @author <a href="mailto:adrian at jboss.org>Adrian Brock</a>
+ * @version <tt>$Revision: 64130 $</tt>
+ */
+public class TemporarySessionConnectionUnitTestCase extends JMSTestCase
+{
+   static String QUEUE_FACTORY = "ConnectionFactory";
+
+   QueueConnection queueConnection;
+
+   public TemporarySessionConnectionUnitTestCase(String name) throws Exception
+   {
+      super(name);
+   }
+
+   public void testTemporaryDifferentSession() throws Exception
+   {
+      connect();
+      try
+      {
+         QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+         TemporaryQueue temp = session.createTemporaryQueue(); 
+         session.createConsumer(temp);
+         session.close();
+         session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+         session.createConsumer(temp).close();
+      }
+      finally
+      {
+         disconnect();
+      }
+   }
+
+   public void testTemporaryDifferentConnection() throws Exception
+   {
+      connect();
+      try
+      {
+         QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+         TemporaryQueue temp = session.createTemporaryQueue(); 
+         session.createConsumer(temp);
+         disconnect();
+         connect();
+         session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+         try
+         {
+            session.createConsumer(temp).close();
+            fail("Should not be able to consume a temporary on different connection");
+         }
+         catch (JMSException expected)
+         {
+         }
+      }
+      finally
+      {
+         disconnect();
+      }
+   }
+
+   protected void connect() throws Exception
+   {
+      Context context = getInitialContext();
+      QueueConnectionFactory queueFactory = (QueueConnectionFactory) context.lookup(QUEUE_FACTORY);
+      queueConnection = queueFactory.createQueueConnection();
+      queueConnection.start();
+
+      getLog().debug("Connection established.");
+   }
+
+   protected void disconnect()
+   {
+      try
+      {
+         if (queueConnection != null)
+            queueConnection.close();
+      }
+      catch (Exception ignored)
+      {
+      }
+
+      getLog().debug("Connection closed.");
+   }
+}

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/UnackedUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/test/UnackedUnitTestCase.java	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/UnackedUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,749 +0,0 @@
-/*
- * 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.BytesMessage;
-import javax.jms.DeliveryMode;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-import javax.jms.Queue;
-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.Topic;
-import javax.jms.TopicConnection;
-import javax.jms.TopicConnectionFactory;
-import javax.jms.TopicPublisher;
-import javax.jms.TopicSession;
-import javax.jms.TopicSubscriber;
-import javax.naming.Context;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.apache.log4j.Logger;
-import org.jboss.test.jbossmessaging.JMSTestCase;
-
-/**
- * Rollback tests
- *
- * @author <a href="mailto:richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
- * @author
- * @version $Revision: 64265 $
- */
-public class UnackedUnitTestCase extends JMSTestCase
-{
-   // Provider specific
-   static String TOPIC_FACTORY = "ConnectionFactory";
-   static String QUEUE_FACTORY = "ConnectionFactory";
-
-   static String TEST_QUEUE = "queue/testQueue";
-   static String TEST_TOPIC = "topic/testTopic";
-   static String TEST_DURABLE_TOPIC = "topic/testDurableTopic";
-
-   static byte[] PAYLOAD = new byte[10];
-
-   static Context context;
-   static QueueConnection queueConnection;
-   static TopicConnection topicConnection;
-   static TopicConnection topicDurableConnection;
-
-   public static Test suite() throws Exception
-   {
-      // JBAS-3580, the execution order of tests in this test case is important
-      // so it must be defined explicitly when running under some JVMs
-      TestSuite suite = new TestSuite();
-      suite.addTest(new UnackedUnitTestCase("testUnackedQueue"));
-      suite.addTest(new UnackedUnitTestCase("testUnackedMultipleConnection"));
-      suite.addTest(new UnackedUnitTestCase("testUnackedMultipleSession"));
-      suite.addTest(new UnackedUnitTestCase("testUnackedTopic"));
-      suite.addTest(new UnackedUnitTestCase("testUnackedDurableTopic"));
-      suite.addTest(new UnackedUnitTestCase("testDummyLast"));
-      
-      return suite;
-   }
-   
-   /**
-    * Constructor the test
-    *
-    * @param name           Description of Parameter
-    * @exception Exception  Description of Exception
-    */
-   public UnackedUnitTestCase(String name) throws Exception
-   {
-      super(name);
-   }
-
-   /**
-    * #Description of the Method
-    *
-    * @param persistence    Description of Parameter
-    * @exception Exception  Description of Exception
-    */
-   public void runUnackedQueue(final int persistence) throws Exception
-   {
-      drainQueue();
-
-      final int iterationCount = getIterationCount();
-
-      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-      Queue queue = (Queue)context.lookup(TEST_QUEUE);
-
-      QueueSender sender = session.createSender(queue);
-
-      Message message = session.createBytesMessage();
-      ((BytesMessage)message).writeBytes(PAYLOAD);
-
-      for (int i = 0; i < iterationCount; i++)
-         sender.send(message, persistence, 4, 0);
-
-      session.close();
-
-      session = queueConnection.createQueueSession(false, Session.CLIENT_ACKNOWLEDGE);
-      queue = (Queue)context.lookup(TEST_QUEUE);
-      QueueReceiver receiver = session.createReceiver(queue);
-      queueConnection.start();
-      message = receiver.receive(50);
-      int c = 0;
-      while (message != null)
-      {
-         message = receiver.receive(50);
-         c++;
-      }
-      assertTrue("Should have received all data unacked", c == iterationCount);
-
-      queueConnection.close();
-      QueueConnectionFactory queueFactory = (QueueConnectionFactory)context.lookup(QUEUE_FACTORY);
-      queueConnection = queueFactory.createQueueConnection();
-
-      assertTrue("Queue should be full", drainQueue() == iterationCount);
-
-   }
-
-   /**
-    * #Description of the Method
-    *
-    * @param persistence    Description of Parameter
-    * @exception Exception  Description of Exception
-    */
-   public void runUnackedMultipleSession(final int persistence) throws Exception
-   {
-	  System.out.println("++ runUnackedMultipleSession");
-      drainQueue();
-
-      final int iterationCount = getIterationCount();
-
-      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-      Queue queue = (Queue)context.lookup(TEST_QUEUE);
-
-      QueueSender sender = session.createSender(queue);
-
-      Message message = session.createBytesMessage();
-      ((BytesMessage)message).writeBytes(PAYLOAD);
-
-      for (int i = 0; i < iterationCount; i++)
-         sender.send(message, persistence, 4, 0);
-
-      session.close();
-
-      QueueSession session1 = queueConnection.createQueueSession(false, Session.CLIENT_ACKNOWLEDGE);
-      QueueSession session2 = queueConnection.createQueueSession(false, Session.CLIENT_ACKNOWLEDGE);
-      try
-      {
-	      queue = (Queue)context.lookup(TEST_QUEUE);
-	      QueueReceiver receiver1 = session1.createReceiver(queue);
-	      
-	      QueueReceiver receiver2 = session2.createReceiver(queue);
-	      queueConnection.start();
-	
-	      int c1=0, c2=0;
-	      
-	      Message messageConsumer1=null, messageConsumer2=null;
-	      
-	      Message lastMessageConsumer1 = null, lastMessageConsumer2=null;
-	      
-	      do
-	      {
-	    	  messageConsumer1 = receiver1.receive(1000);
-	    	  messageConsumer2 = receiver2.receive(1000);
-	    	  if (messageConsumer1 != null)
-	    	  {
-	    		  c1 ++;
-	    		  lastMessageConsumer1 = messageConsumer1;
-	    	  }
-	    	  
-	    	  if (messageConsumer2 != null)
-	    	  {
-	    		  c2 ++;
-	    		  lastMessageConsumer2 = messageConsumer2;
-	    	  }
-	    	  
-	    	  System.out.println("messageConsumer1=" + messageConsumer1 + " messageConsumer2=" + messageConsumer2 + " c1=" + c1 + " c2 = " + c2);
-	      }
-	      while (messageConsumer1!=null || messageConsumer2!=null);
-	      
-	      assertEquals(iterationCount, c1 + c2);
-	      
-	      lastMessageConsumer1.acknowledge();
-	      lastMessageConsumer2.acknowledge();
-	
-	      queueConnection.stop();
-	      session1.close();
-	      session2.close();
-      }
-      finally
-      {
-    	  try
-    	  {
-    		  session1.close();
-    	  }
-    	  catch (Throwable ignored)
-    	  {
-    	  }
-    	  try
-    	  {
-    		  session2.close();
-    	  }
-    	  catch (Throwable ignored)
-    	  {
-    	  }
-      }
-
-	  System.out.println("-- runUnackedMultipleSession");
-   }
-
-   /**
-    * #Description of the Method
-    *
-    * @param persistence    Description of Parameter
-    * @exception Exception  Description of Exception
-    */
-   public void runUnackedMultipleConnection(final int persistence) throws Exception
-   {
-	  System.out.println("++runUnackedMultipleConnection");
-      drainQueue();
-
-      final int iterationCount = getIterationCount();
-
-      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-      Queue queue = (Queue)context.lookup(TEST_QUEUE);
-
-      QueueSender sender = session.createSender(queue);
-
-      Message message = session.createBytesMessage();
-      ((BytesMessage)message).writeBytes(PAYLOAD);
-
-      for (int i = 0; i < iterationCount; i++)
-         sender.send(message, persistence, 4, 0);
-
-      session.close();
-
-      QueueConnectionFactory queueFactory = (QueueConnectionFactory)context.lookup(QUEUE_FACTORY);
-      QueueConnection queueConnection1 = queueFactory.createQueueConnection();
-      QueueConnection queueConnection2 = queueFactory.createQueueConnection();
-
-      try
-      {
-	      QueueSession session1 = queueConnection1.createQueueSession(false, Session.CLIENT_ACKNOWLEDGE);
-	      queue = (Queue)context.lookup(TEST_QUEUE);
-	      QueueReceiver receiver1 = session1.createReceiver(queue);
-	
-	      QueueSession session2 = queueConnection2.createQueueSession(false, Session.CLIENT_ACKNOWLEDGE);
-	      QueueReceiver receiver2 = session2.createReceiver(queue);
-	
-	      queueConnection1.start();
-	      queueConnection2.start();
-	
-	      int c1=0, c2=0;
-	      
-	      Message messageConsumer1=null, messageConsumer2=null;
-	      
-	      Message lastMessageConsumer1 = null, lastMessageConsumer2=null;
-	      
-	      do
-	      {
-	    	  messageConsumer1 = receiver1.receive(100);
-	    	  messageConsumer2 = receiver2.receive(100);
-	    	  if (messageConsumer1 != null)
-	    	  {
-	    		  c1 ++;
-	    		  lastMessageConsumer1 = messageConsumer1;
-	    	  }
-	    	  
-	    	  if (messageConsumer2 != null)
-	    	  {
-	    		  c2 ++;
-	    		  lastMessageConsumer2 = messageConsumer2;
-	    	  }
-	    	  
-	    	  System.out.println("messageConsumer1=" + messageConsumer1 + " messageConsumer2=" + messageConsumer2 + " c1=" + c1 + " c2 = " + c2);
-	      }
-	      while (messageConsumer1!=null || messageConsumer2!=null);
-
-	      if (lastMessageConsumer1!=null) lastMessageConsumer1.acknowledge();
-	      if (lastMessageConsumer2!=null) lastMessageConsumer2.acknowledge();
-	      
-	      assertEquals(iterationCount, c1 + c2);
-	      
-      }
-      finally
-      {
-    	  try{queueConnection1.close();} catch (Throwable ignored){}
-    	  try{queueConnection2.close();} catch (Throwable ignored){}
-      }
-
-	  System.out.println("--runUnackedMultipleConnection");
-   }
-
-   /**
-    * #Description of the Method
-    *
-    * @param persistence    Description of Parameter
-    * @exception Exception  Description of Exception
-    */
-   public void runUnackedTopic(final int persistence) throws Exception
-   {
-      drainQueue();
-      drainTopic();
-
-      final int iterationCount = getIterationCount();
-      final Logger log = getLog();
-
-      Thread sendThread =
-         new Thread()
-         {
-            public void run()
-            {
-               try
-               {
-
-                  TopicSession session = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-                  Topic topic = (Topic)context.lookup(TEST_TOPIC);
-
-                  TopicPublisher publisher = session.createPublisher(topic);
-
-                  waitForSynchMessage();
-
-                  BytesMessage message = session.createBytesMessage();
-                  message.writeBytes(PAYLOAD);
-
-                  for (int i = 0; i < iterationCount; i++)
-                  {
-                     publisher.publish(message, persistence, 4, 0);
-                  }
-
-                  session.close();
-               }
-               catch (Exception e)
-               {
-                  log.error("error", e);
-               }
-            }
-         };
-
-      TopicSession session = topicConnection.createTopicSession(false, Session.CLIENT_ACKNOWLEDGE);
-      Topic topic = (Topic)context.lookup(TEST_TOPIC);
-      TopicSubscriber subscriber = session.createSubscriber(topic);
-
-
-      MyMessageListener listener = new MyMessageListener(iterationCount, log);
-
-      queueConnection.start();
-      sendThread.start();
-      subscriber.setMessageListener(listener);
-      topicConnection.start();
-      sendSynchMessage();
-      synchronized (listener)
-      {
-         if (listener.i < iterationCount)
-            listener.wait(5000);
-         
-         assertEquals(iterationCount, listener.i);
-      }
-      sendThread.join();
-      topicConnection.close();
-      TopicConnectionFactory topicFactory = (TopicConnectionFactory)context.lookup(TOPIC_FACTORY);
-      topicConnection = topicFactory.createTopicConnection();
-      queueConnection.stop();
-      assertTrue("Topic should be empty", drainTopic() == 0);
-   }
-
-   /**
-    * #Description of the Method
-    *
-    * @param persistence    Description of Parameter
-    * @exception Exception  Description of Exception
-    */
-   public void runUnackedDurableTopic(final int persistence) throws Exception
-   {
-      drainQueue();
-      drainDurableTopic();
-
-      final int iterationCount = getIterationCount();
-      final Logger log = getLog();
-
-      Thread sendThread =
-         new Thread()
-         {
-            public void run()
-            {
-               try
-               {
-
-                  TopicSession session = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-                  Topic topic = (Topic)context.lookup(TEST_DURABLE_TOPIC);
-
-                  TopicPublisher publisher = session.createPublisher(topic);
-
-                  waitForSynchMessage();
-
-                  BytesMessage message = session.createBytesMessage();
-                  message.writeBytes(PAYLOAD);
-
-                  for (int i = 0; i < iterationCount; i++)
-                  {
-                     publisher.publish(message, persistence, 4, 0);
-                  }
-
-                  session.close();
-               }
-               catch (Exception e)
-               {
-                  log.error("error", e);
-               }
-            }
-         };
-
-      TopicSession session = topicDurableConnection.createTopicSession(false, Session.CLIENT_ACKNOWLEDGE);
-      Topic topic = (Topic)context.lookup(TEST_DURABLE_TOPIC);
-      TopicSubscriber subscriber = session.createDurableSubscriber(topic, "test");
-
-      MyMessageListener listener = new MyMessageListener(iterationCount, log);
-
-      queueConnection.start();
-      sendThread.start();
-      subscriber.setMessageListener(listener);
-      topicDurableConnection.start();
-      sendSynchMessage();
-      synchronized (listener)
-      {
-    	 System.out.println("Hello");
-         if (listener.i < iterationCount)
-         {
-            listener.wait(5000);
-         }
-         assertEquals(iterationCount, listener.i);
-      }
-      
-
-      sendThread.join();
-      topicDurableConnection.close();
-      TopicConnectionFactory topicFactory = (TopicConnectionFactory)context.lookup(TOPIC_FACTORY);
-      topicDurableConnection = topicFactory.createTopicConnection("john", "needle");
-      queueConnection.stop();
-      assertTrue("Topic should be full", drainDurableTopic() == iterationCount);
-   }
-
-   /**
-    * A unit test for JUnit
-    *
-    * @exception Exception  Description of Exception
-    */
-   public void testUnackedQueue() throws Exception
-   {
-
-      getLog().debug("Starting UnackedQueue test");
-
-      runUnackedQueue(DeliveryMode.NON_PERSISTENT);
-      runUnackedQueue(DeliveryMode.PERSISTENT);
-
-      getLog().debug("UnackedQueue passed");
-   }
-
-   /**
-    * A unit test for JUnit
-    *
-    * @exception Exception  Description of Exception
-    */
-   public void testUnackedMultipleSession() throws Exception
-   {
-
-      getLog().debug("Starting UnackedMultipleSession test");
-
-      runUnackedMultipleSession(DeliveryMode.NON_PERSISTENT);
-      runUnackedMultipleSession(DeliveryMode.PERSISTENT);
-
-      getLog().debug("UnackedMultipleSession passed");
-   }
-
-   /**
-    * A unit test for JUnit
-    *
-    * @exception Exception  Description of Exception
-    */
-   public void testUnackedMultipleConnection() throws Exception
-   {
-
-      getLog().debug("Starting UnackedMultipleConnection test");
-
-      runUnackedMultipleConnection(DeliveryMode.NON_PERSISTENT);
-      runUnackedMultipleConnection(DeliveryMode.PERSISTENT);
-
-      getLog().debug("UnackedMultipleConnection passed");
-   }
-
-   /**
-    * A unit test for JUnit
-    *
-    * @exception Exception  Description of Exception
-    */
-   public void testUnackedTopic() throws Exception
-   {
-
-      getLog().debug("Starting UnackedTopic test");
-
-      runUnackedTopic(DeliveryMode.NON_PERSISTENT);
-      runUnackedTopic(DeliveryMode.PERSISTENT);
-
-      getLog().debug("UnackedTopic passed");
-   }
-
-   /**
-    * A unit test for JUnit
-    *
-    * @exception Exception  Description of Exception
-    */
-   public void testUnackedDurableTopic() throws Exception
-   {
-
-      getLog().debug("Starting UnackedDurableTopic test");
-
-      runUnackedDurableTopic(DeliveryMode.NON_PERSISTENT);
-      runUnackedDurableTopic(DeliveryMode.PERSISTENT);
-
-      getLog().debug("UnackedDurableTopic passed");
-   }
-
-   /**
-    * A unit test for JUnit
-    *
-    * @exception Exception  Description of Exception
-    */
-   public void testDummyLast() throws Exception
-   {
-
-      TopicSession session = topicDurableConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-      session.unsubscribe("test");
-
-      queueConnection.close();
-      topicConnection.close();
-      topicDurableConnection.close();
-   }
-
-   /**
-    * The JUnit setup method
-    *
-    * @exception Exception  Description of Exception
-    */
-   protected void setUp() throws Exception
-   {
-       // call setUp() in superclass 
-       super.setUp() ;
-
-      if (context == null)
-      {
-         context = getInitialContext();
-      }
-
-      QueueConnectionFactory queueFactory = (QueueConnectionFactory)context.lookup(QUEUE_FACTORY);
-      queueConnection = queueFactory.createQueueConnection();
-
-      TopicConnectionFactory topicFactory = (TopicConnectionFactory)context.lookup(TOPIC_FACTORY);
-      topicConnection = topicFactory.createTopicConnection();
-      topicDurableConnection = topicFactory.createTopicConnection("john", "needle");
-   }
-   
-   protected void tearDown() throws Exception
-   {
-	   if (queueConnection != null)
-	   {
-		   queueConnection.close();
-		   queueConnection = null;
-	   }
-	   
-	   if (topicConnection != null)
-	   {
-		   topicConnection.close();
-		   topicConnection = null;
-	   }
-	   
-	   if (topicDurableConnection != null)
-	   {
-		   topicDurableConnection.close();
-		   topicDurableConnection = null;
-	   }
-   }
-
-   // Emptys out all the messages in a queue
-   private int drainQueue() throws Exception
-   {
-      getLog().debug("Draining Queue");
-      queueConnection.start();
-
-      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-      Queue queue = (Queue)context.lookup(TEST_QUEUE);
-
-      QueueReceiver receiver = session.createReceiver(queue);
-      Message message = receiver.receive(1000);
-      int c = 0;
-      while (message != null)
-      {
-         message = receiver.receive(1000);
-         c++;
-      }
-
-      getLog().debug("  Drained " + c + " messages from the queue");
-
-      session.close();
-
-      queueConnection.stop();
-
-      return c;
-   }
-
-   // Emptys out all the messages in a topic
-   private int drainTopic() throws Exception
-   {
-      getLog().debug("Draining Topic");
-      topicConnection.start();
-
-      final TopicSession session = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-      Topic topic = (Topic)context.lookup(TEST_TOPIC);
-      TopicSubscriber subscriber = session.createSubscriber(topic);
-
-      Message message = subscriber.receive(1000);
-      int c = 0;
-      while (message != null)
-      {
-         message = subscriber.receive(1000);
-         c++;
-      }
-
-      getLog().debug("  Drained " + c + " messages from the topic");
-
-      session.close();
-
-      topicConnection.stop();
-
-      return c;
-   }
-
-   // Emptys out all the messages in a durable topic
-   private int drainDurableTopic() throws Exception
-   {
-      getLog().debug("Draining Durable Topic");
-      topicDurableConnection.start();
-
-      final TopicSession session = topicDurableConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-      Topic topic = (Topic)context.lookup(TEST_DURABLE_TOPIC);
-      TopicSubscriber subscriber = session.createDurableSubscriber(topic, "test");
-
-      Message message = subscriber.receive(1000);
-      int c = 0;
-      while (message != null)
-      {
-         message = subscriber.receive(1000);
-         c++;
-      }
-
-      getLog().debug("  Drained " + c + " messages from the durable topic");
-
-      session.close();
-
-      topicDurableConnection.stop();
-
-      return c;
-   }
-
-   private void waitForSynchMessage() throws Exception
-   {
-      getLog().debug("Waiting for Synch Message");
-      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-      Queue queue = (Queue)context.lookup(TEST_QUEUE);
-
-      QueueReceiver receiver = session.createReceiver(queue);
-      receiver.receive();
-      session.close();
-      getLog().debug("Got Synch Message");
-   }
-
-   private void sendSynchMessage() throws Exception
-   {
-      getLog().debug("Sending Synch Message");
-      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-      Queue queue = (Queue)context.lookup(TEST_QUEUE);
-
-      QueueSender sender = session.createSender(queue);
-
-      Message message = session.createMessage();
-      sender.send(message);
-
-      session.close();
-      getLog().debug("Sent Synch Message");
-   }
-
-   public class MyMessageListener
-      implements MessageListener
-   {
-      public int i = 0;
-
-      public int iterationCount;
-
-      public Logger log;
-
-      public MyMessageListener(int iterationCount, Logger log)
-      {
-         this.iterationCount = iterationCount;
-         this.log = log; 
-      }
-
-      public void onMessage(Message message)
-      {
-         synchronized (this)
-         {
-        	System.out.println("Listener:: Got message " + i);
-            i++;
-            log.debug("Got message " + i);
-            if (i >= iterationCount)
-               this.notifyAll();
-         }
-      }
-   }
-
-   public int getIterationCount()
-   {
-      return 200;
-   }
-}

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/UnackedUnitTestCase.java (from rev 64641, branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/test/UnackedUnitTestCase.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/UnackedUnitTestCase.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/UnackedUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,749 @@
+/*
+ * 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.BytesMessage;
+import javax.jms.DeliveryMode;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.Queue;
+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.Topic;
+import javax.jms.TopicConnection;
+import javax.jms.TopicConnectionFactory;
+import javax.jms.TopicPublisher;
+import javax.jms.TopicSession;
+import javax.jms.TopicSubscriber;
+import javax.naming.Context;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.log4j.Logger;
+import org.jboss.test.jbossmessaging.JMSTestCase;
+
+/**
+ * Rollback tests
+ *
+ * @author <a href="mailto:richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
+ * @author
+ * @version $Revision: 64265 $
+ */
+public class UnackedUnitTestCase extends JMSTestCase
+{
+   // Provider specific
+   static String TOPIC_FACTORY = "ConnectionFactory";
+   static String QUEUE_FACTORY = "ConnectionFactory";
+
+   static String TEST_QUEUE = "queue/testQueue";
+   static String TEST_TOPIC = "topic/testTopic";
+   static String TEST_DURABLE_TOPIC = "topic/testDurableTopic";
+
+   static byte[] PAYLOAD = new byte[10];
+
+   static Context context;
+   static QueueConnection queueConnection;
+   static TopicConnection topicConnection;
+   static TopicConnection topicDurableConnection;
+
+   public static Test suite() throws Exception
+   {
+      // JBAS-3580, the execution order of tests in this test case is important
+      // so it must be defined explicitly when running under some JVMs
+      TestSuite suite = new TestSuite();
+      suite.addTest(new UnackedUnitTestCase("testUnackedQueue"));
+      suite.addTest(new UnackedUnitTestCase("testUnackedMultipleConnection"));
+      suite.addTest(new UnackedUnitTestCase("testUnackedMultipleSession"));
+      suite.addTest(new UnackedUnitTestCase("testUnackedTopic"));
+      suite.addTest(new UnackedUnitTestCase("testUnackedDurableTopic"));
+      suite.addTest(new UnackedUnitTestCase("testDummyLast"));
+      
+      return suite;
+   }
+   
+   /**
+    * Constructor the test
+    *
+    * @param name           Description of Parameter
+    * @exception Exception  Description of Exception
+    */
+   public UnackedUnitTestCase(String name) throws Exception
+   {
+      super(name);
+   }
+
+   /**
+    * #Description of the Method
+    *
+    * @param persistence    Description of Parameter
+    * @exception Exception  Description of Exception
+    */
+   public void runUnackedQueue(final int persistence) throws Exception
+   {
+      drainQueue();
+
+      final int iterationCount = getIterationCount();
+
+      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+      Queue queue = (Queue)context.lookup(TEST_QUEUE);
+
+      QueueSender sender = session.createSender(queue);
+
+      Message message = session.createBytesMessage();
+      ((BytesMessage)message).writeBytes(PAYLOAD);
+
+      for (int i = 0; i < iterationCount; i++)
+         sender.send(message, persistence, 4, 0);
+
+      session.close();
+
+      session = queueConnection.createQueueSession(false, Session.CLIENT_ACKNOWLEDGE);
+      queue = (Queue)context.lookup(TEST_QUEUE);
+      QueueReceiver receiver = session.createReceiver(queue);
+      queueConnection.start();
+      message = receiver.receive(50);
+      int c = 0;
+      while (message != null)
+      {
+         message = receiver.receive(50);
+         c++;
+      }
+      assertTrue("Should have received all data unacked", c == iterationCount);
+
+      queueConnection.close();
+      QueueConnectionFactory queueFactory = (QueueConnectionFactory)context.lookup(QUEUE_FACTORY);
+      queueConnection = queueFactory.createQueueConnection();
+
+      assertTrue("Queue should be full", drainQueue() == iterationCount);
+
+   }
+
+   /**
+    * #Description of the Method
+    *
+    * @param persistence    Description of Parameter
+    * @exception Exception  Description of Exception
+    */
+   public void runUnackedMultipleSession(final int persistence) throws Exception
+   {
+	  System.out.println("++ runUnackedMultipleSession");
+      drainQueue();
+
+      final int iterationCount = getIterationCount();
+
+      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+      Queue queue = (Queue)context.lookup(TEST_QUEUE);
+
+      QueueSender sender = session.createSender(queue);
+
+      Message message = session.createBytesMessage();
+      ((BytesMessage)message).writeBytes(PAYLOAD);
+
+      for (int i = 0; i < iterationCount; i++)
+         sender.send(message, persistence, 4, 0);
+
+      session.close();
+
+      QueueSession session1 = queueConnection.createQueueSession(false, Session.CLIENT_ACKNOWLEDGE);
+      QueueSession session2 = queueConnection.createQueueSession(false, Session.CLIENT_ACKNOWLEDGE);
+      try
+      {
+	      queue = (Queue)context.lookup(TEST_QUEUE);
+	      QueueReceiver receiver1 = session1.createReceiver(queue);
+	      
+	      QueueReceiver receiver2 = session2.createReceiver(queue);
+	      queueConnection.start();
+	
+	      int c1=0, c2=0;
+	      
+	      Message messageConsumer1=null, messageConsumer2=null;
+	      
+	      Message lastMessageConsumer1 = null, lastMessageConsumer2=null;
+	      
+	      do
+	      {
+	    	  messageConsumer1 = receiver1.receive(1000);
+	    	  messageConsumer2 = receiver2.receive(1000);
+	    	  if (messageConsumer1 != null)
+	    	  {
+	    		  c1 ++;
+	    		  lastMessageConsumer1 = messageConsumer1;
+	    	  }
+	    	  
+	    	  if (messageConsumer2 != null)
+	    	  {
+	    		  c2 ++;
+	    		  lastMessageConsumer2 = messageConsumer2;
+	    	  }
+	    	  
+	    	  System.out.println("messageConsumer1=" + messageConsumer1 + " messageConsumer2=" + messageConsumer2 + " c1=" + c1 + " c2 = " + c2);
+	      }
+	      while (messageConsumer1!=null || messageConsumer2!=null);
+	      
+	      assertEquals(iterationCount, c1 + c2);
+	      
+	      lastMessageConsumer1.acknowledge();
+	      lastMessageConsumer2.acknowledge();
+	
+	      queueConnection.stop();
+	      session1.close();
+	      session2.close();
+      }
+      finally
+      {
+    	  try
+    	  {
+    		  session1.close();
+    	  }
+    	  catch (Throwable ignored)
+    	  {
+    	  }
+    	  try
+    	  {
+    		  session2.close();
+    	  }
+    	  catch (Throwable ignored)
+    	  {
+    	  }
+      }
+
+	  System.out.println("-- runUnackedMultipleSession");
+   }
+
+   /**
+    * #Description of the Method
+    *
+    * @param persistence    Description of Parameter
+    * @exception Exception  Description of Exception
+    */
+   public void runUnackedMultipleConnection(final int persistence) throws Exception
+   {
+	  System.out.println("++runUnackedMultipleConnection");
+      drainQueue();
+
+      final int iterationCount = getIterationCount();
+
+      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+      Queue queue = (Queue)context.lookup(TEST_QUEUE);
+
+      QueueSender sender = session.createSender(queue);
+
+      Message message = session.createBytesMessage();
+      ((BytesMessage)message).writeBytes(PAYLOAD);
+
+      for (int i = 0; i < iterationCount; i++)
+         sender.send(message, persistence, 4, 0);
+
+      session.close();
+
+      QueueConnectionFactory queueFactory = (QueueConnectionFactory)context.lookup(QUEUE_FACTORY);
+      QueueConnection queueConnection1 = queueFactory.createQueueConnection();
+      QueueConnection queueConnection2 = queueFactory.createQueueConnection();
+
+      try
+      {
+	      QueueSession session1 = queueConnection1.createQueueSession(false, Session.CLIENT_ACKNOWLEDGE);
+	      queue = (Queue)context.lookup(TEST_QUEUE);
+	      QueueReceiver receiver1 = session1.createReceiver(queue);
+	
+	      QueueSession session2 = queueConnection2.createQueueSession(false, Session.CLIENT_ACKNOWLEDGE);
+	      QueueReceiver receiver2 = session2.createReceiver(queue);
+	
+	      queueConnection1.start();
+	      queueConnection2.start();
+	
+	      int c1=0, c2=0;
+	      
+	      Message messageConsumer1=null, messageConsumer2=null;
+	      
+	      Message lastMessageConsumer1 = null, lastMessageConsumer2=null;
+	      
+	      do
+	      {
+	    	  messageConsumer1 = receiver1.receive(100);
+	    	  messageConsumer2 = receiver2.receive(100);
+	    	  if (messageConsumer1 != null)
+	    	  {
+	    		  c1 ++;
+	    		  lastMessageConsumer1 = messageConsumer1;
+	    	  }
+	    	  
+	    	  if (messageConsumer2 != null)
+	    	  {
+	    		  c2 ++;
+	    		  lastMessageConsumer2 = messageConsumer2;
+	    	  }
+	    	  
+	    	  System.out.println("messageConsumer1=" + messageConsumer1 + " messageConsumer2=" + messageConsumer2 + " c1=" + c1 + " c2 = " + c2);
+	      }
+	      while (messageConsumer1!=null || messageConsumer2!=null);
+
+	      if (lastMessageConsumer1!=null) lastMessageConsumer1.acknowledge();
+	      if (lastMessageConsumer2!=null) lastMessageConsumer2.acknowledge();
+	      
+	      assertEquals(iterationCount, c1 + c2);
+	      
+      }
+      finally
+      {
+    	  try{queueConnection1.close();} catch (Throwable ignored){}
+    	  try{queueConnection2.close();} catch (Throwable ignored){}
+      }
+
+	  System.out.println("--runUnackedMultipleConnection");
+   }
+
+   /**
+    * #Description of the Method
+    *
+    * @param persistence    Description of Parameter
+    * @exception Exception  Description of Exception
+    */
+   public void runUnackedTopic(final int persistence) throws Exception
+   {
+      drainQueue();
+      drainTopic();
+
+      final int iterationCount = getIterationCount();
+      final Logger log = getLog();
+
+      Thread sendThread =
+         new Thread()
+         {
+            public void run()
+            {
+               try
+               {
+
+                  TopicSession session = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+                  Topic topic = (Topic)context.lookup(TEST_TOPIC);
+
+                  TopicPublisher publisher = session.createPublisher(topic);
+
+                  waitForSynchMessage();
+
+                  BytesMessage message = session.createBytesMessage();
+                  message.writeBytes(PAYLOAD);
+
+                  for (int i = 0; i < iterationCount; i++)
+                  {
+                     publisher.publish(message, persistence, 4, 0);
+                  }
+
+                  session.close();
+               }
+               catch (Exception e)
+               {
+                  log.error("error", e);
+               }
+            }
+         };
+
+      TopicSession session = topicConnection.createTopicSession(false, Session.CLIENT_ACKNOWLEDGE);
+      Topic topic = (Topic)context.lookup(TEST_TOPIC);
+      TopicSubscriber subscriber = session.createSubscriber(topic);
+
+
+      MyMessageListener listener = new MyMessageListener(iterationCount, log);
+
+      queueConnection.start();
+      sendThread.start();
+      subscriber.setMessageListener(listener);
+      topicConnection.start();
+      sendSynchMessage();
+      synchronized (listener)
+      {
+         if (listener.i < iterationCount)
+            listener.wait(5000);
+         
+         assertEquals(iterationCount, listener.i);
+      }
+      sendThread.join();
+      topicConnection.close();
+      TopicConnectionFactory topicFactory = (TopicConnectionFactory)context.lookup(TOPIC_FACTORY);
+      topicConnection = topicFactory.createTopicConnection();
+      queueConnection.stop();
+      assertTrue("Topic should be empty", drainTopic() == 0);
+   }
+
+   /**
+    * #Description of the Method
+    *
+    * @param persistence    Description of Parameter
+    * @exception Exception  Description of Exception
+    */
+   public void runUnackedDurableTopic(final int persistence) throws Exception
+   {
+      drainQueue();
+      drainDurableTopic();
+
+      final int iterationCount = getIterationCount();
+      final Logger log = getLog();
+
+      Thread sendThread =
+         new Thread()
+         {
+            public void run()
+            {
+               try
+               {
+
+                  TopicSession session = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+                  Topic topic = (Topic)context.lookup(TEST_DURABLE_TOPIC);
+
+                  TopicPublisher publisher = session.createPublisher(topic);
+
+                  waitForSynchMessage();
+
+                  BytesMessage message = session.createBytesMessage();
+                  message.writeBytes(PAYLOAD);
+
+                  for (int i = 0; i < iterationCount; i++)
+                  {
+                     publisher.publish(message, persistence, 4, 0);
+                  }
+
+                  session.close();
+               }
+               catch (Exception e)
+               {
+                  log.error("error", e);
+               }
+            }
+         };
+
+      TopicSession session = topicDurableConnection.createTopicSession(false, Session.CLIENT_ACKNOWLEDGE);
+      Topic topic = (Topic)context.lookup(TEST_DURABLE_TOPIC);
+      TopicSubscriber subscriber = session.createDurableSubscriber(topic, "test");
+
+      MyMessageListener listener = new MyMessageListener(iterationCount, log);
+
+      queueConnection.start();
+      sendThread.start();
+      subscriber.setMessageListener(listener);
+      topicDurableConnection.start();
+      sendSynchMessage();
+      synchronized (listener)
+      {
+    	 System.out.println("Hello");
+         if (listener.i < iterationCount)
+         {
+            listener.wait(5000);
+         }
+         assertEquals(iterationCount, listener.i);
+      }
+      
+
+      sendThread.join();
+      topicDurableConnection.close();
+      TopicConnectionFactory topicFactory = (TopicConnectionFactory)context.lookup(TOPIC_FACTORY);
+      topicDurableConnection = topicFactory.createTopicConnection("john", "needle");
+      queueConnection.stop();
+      assertTrue("Topic should be full", drainDurableTopic() == iterationCount);
+   }
+
+   /**
+    * A unit test for JUnit
+    *
+    * @exception Exception  Description of Exception
+    */
+   public void testUnackedQueue() throws Exception
+   {
+
+      getLog().debug("Starting UnackedQueue test");
+
+      runUnackedQueue(DeliveryMode.NON_PERSISTENT);
+      runUnackedQueue(DeliveryMode.PERSISTENT);
+
+      getLog().debug("UnackedQueue passed");
+   }
+
+   /**
+    * A unit test for JUnit
+    *
+    * @exception Exception  Description of Exception
+    */
+   public void testUnackedMultipleSession() throws Exception
+   {
+
+      getLog().debug("Starting UnackedMultipleSession test");
+
+      runUnackedMultipleSession(DeliveryMode.NON_PERSISTENT);
+      runUnackedMultipleSession(DeliveryMode.PERSISTENT);
+
+      getLog().debug("UnackedMultipleSession passed");
+   }
+
+   /**
+    * A unit test for JUnit
+    *
+    * @exception Exception  Description of Exception
+    */
+   public void testUnackedMultipleConnection() throws Exception
+   {
+
+      getLog().debug("Starting UnackedMultipleConnection test");
+
+      runUnackedMultipleConnection(DeliveryMode.NON_PERSISTENT);
+      runUnackedMultipleConnection(DeliveryMode.PERSISTENT);
+
+      getLog().debug("UnackedMultipleConnection passed");
+   }
+
+   /**
+    * A unit test for JUnit
+    *
+    * @exception Exception  Description of Exception
+    */
+   public void testUnackedTopic() throws Exception
+   {
+
+      getLog().debug("Starting UnackedTopic test");
+
+      runUnackedTopic(DeliveryMode.NON_PERSISTENT);
+      runUnackedTopic(DeliveryMode.PERSISTENT);
+
+      getLog().debug("UnackedTopic passed");
+   }
+
+   /**
+    * A unit test for JUnit
+    *
+    * @exception Exception  Description of Exception
+    */
+   public void testUnackedDurableTopic() throws Exception
+   {
+
+      getLog().debug("Starting UnackedDurableTopic test");
+
+      runUnackedDurableTopic(DeliveryMode.NON_PERSISTENT);
+      runUnackedDurableTopic(DeliveryMode.PERSISTENT);
+
+      getLog().debug("UnackedDurableTopic passed");
+   }
+
+   /**
+    * A unit test for JUnit
+    *
+    * @exception Exception  Description of Exception
+    */
+   public void testDummyLast() throws Exception
+   {
+
+      TopicSession session = topicDurableConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+      session.unsubscribe("test");
+
+      queueConnection.close();
+      topicConnection.close();
+      topicDurableConnection.close();
+   }
+
+   /**
+    * The JUnit setup method
+    *
+    * @exception Exception  Description of Exception
+    */
+   protected void setUp() throws Exception
+   {
+       // call setUp() in superclass 
+       super.setUp() ;
+
+      if (context == null)
+      {
+         context = getInitialContext();
+      }
+
+      QueueConnectionFactory queueFactory = (QueueConnectionFactory)context.lookup(QUEUE_FACTORY);
+      queueConnection = queueFactory.createQueueConnection();
+
+      TopicConnectionFactory topicFactory = (TopicConnectionFactory)context.lookup(TOPIC_FACTORY);
+      topicConnection = topicFactory.createTopicConnection();
+      topicDurableConnection = topicFactory.createTopicConnection("john", "needle");
+   }
+   
+   protected void tearDown() throws Exception
+   {
+	   if (queueConnection != null)
+	   {
+		   queueConnection.close();
+		   queueConnection = null;
+	   }
+	   
+	   if (topicConnection != null)
+	   {
+		   topicConnection.close();
+		   topicConnection = null;
+	   }
+	   
+	   if (topicDurableConnection != null)
+	   {
+		   topicDurableConnection.close();
+		   topicDurableConnection = null;
+	   }
+   }
+
+   // Emptys out all the messages in a queue
+   private int drainQueue() throws Exception
+   {
+      getLog().debug("Draining Queue");
+      queueConnection.start();
+
+      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+      Queue queue = (Queue)context.lookup(TEST_QUEUE);
+
+      QueueReceiver receiver = session.createReceiver(queue);
+      Message message = receiver.receive(1000);
+      int c = 0;
+      while (message != null)
+      {
+         message = receiver.receive(1000);
+         c++;
+      }
+
+      getLog().debug("  Drained " + c + " messages from the queue");
+
+      session.close();
+
+      queueConnection.stop();
+
+      return c;
+   }
+
+   // Emptys out all the messages in a topic
+   private int drainTopic() throws Exception
+   {
+      getLog().debug("Draining Topic");
+      topicConnection.start();
+
+      final TopicSession session = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+      Topic topic = (Topic)context.lookup(TEST_TOPIC);
+      TopicSubscriber subscriber = session.createSubscriber(topic);
+
+      Message message = subscriber.receive(1000);
+      int c = 0;
+      while (message != null)
+      {
+         message = subscriber.receive(1000);
+         c++;
+      }
+
+      getLog().debug("  Drained " + c + " messages from the topic");
+
+      session.close();
+
+      topicConnection.stop();
+
+      return c;
+   }
+
+   // Emptys out all the messages in a durable topic
+   private int drainDurableTopic() throws Exception
+   {
+      getLog().debug("Draining Durable Topic");
+      topicDurableConnection.start();
+
+      final TopicSession session = topicDurableConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+      Topic topic = (Topic)context.lookup(TEST_DURABLE_TOPIC);
+      TopicSubscriber subscriber = session.createDurableSubscriber(topic, "test");
+
+      Message message = subscriber.receive(1000);
+      int c = 0;
+      while (message != null)
+      {
+         message = subscriber.receive(1000);
+         c++;
+      }
+
+      getLog().debug("  Drained " + c + " messages from the durable topic");
+
+      session.close();
+
+      topicDurableConnection.stop();
+
+      return c;
+   }
+
+   private void waitForSynchMessage() throws Exception
+   {
+      getLog().debug("Waiting for Synch Message");
+      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+      Queue queue = (Queue)context.lookup(TEST_QUEUE);
+
+      QueueReceiver receiver = session.createReceiver(queue);
+      receiver.receive();
+      session.close();
+      getLog().debug("Got Synch Message");
+   }
+
+   private void sendSynchMessage() throws Exception
+   {
+      getLog().debug("Sending Synch Message");
+      QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+      Queue queue = (Queue)context.lookup(TEST_QUEUE);
+
+      QueueSender sender = session.createSender(queue);
+
+      Message message = session.createMessage();
+      sender.send(message);
+
+      session.close();
+      getLog().debug("Sent Synch Message");
+   }
+
+   public class MyMessageListener
+      implements MessageListener
+   {
+      public int i = 0;
+
+      public int iterationCount;
+
+      public Logger log;
+
+      public MyMessageListener(int iterationCount, Logger log)
+      {
+         this.iterationCount = iterationCount;
+         this.log = log; 
+      }
+
+      public void onMessage(Message message)
+      {
+         synchronized (this)
+         {
+        	System.out.println("Listener:: Got message " + i);
+            i++;
+            log.debug("Got message " + i);
+            if (i >= iterationCount)
+               this.notifyAll();
+         }
+      }
+   }
+
+   public int getIterationCount()
+   {
+      return 200;
+   }
+}

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/XAResourceUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/test/XAResourceUnitTestCase.java	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/XAResourceUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,201 +0,0 @@
-/*
-  * 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.ConnectionFactory;
-import javax.jms.Message;
-import javax.jms.Topic;
-import javax.jms.TopicPublisher;
-import javax.jms.TopicSession;
-import javax.jms.TopicSubscriber;
-import javax.jms.XATopicConnection;
-import javax.jms.XATopicConnectionFactory;
-import javax.jms.XATopicSession;
-import javax.naming.InitialContext;
-import javax.transaction.xa.XAResource;
-import javax.transaction.xa.Xid;
-
-import org.jboss.test.jbossmessaging.JMSTestCase;
-
-/**
- * XAResource tests
- *
- * @author <a href="mailto:richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
- * @author
- * @version
- */
-public class XAResourceUnitTestCase extends JMSTestCase
-{
-   static String XA_TOPIC_FACTORY = "XAConnectionFactory";
-   static String FACTORY = "ConnectionFactory";
-
-   static String TEST_TOPIC = "topic/testTopic";
-
-   public XAResourceUnitTestCase(String name) throws Exception
-   {
-      super(name);
-   }
-
-   public void testXAResourceSuspendWorkCommit() throws Exception
-   {
-      InitialContext context = getInitialContext();
-      XATopicConnectionFactory factory = (XATopicConnectionFactory) context.lookup(XA_TOPIC_FACTORY);
-      Topic topic = (Topic) context.lookup(TEST_TOPIC);
-
-      XATopicConnection connection = factory.createXATopicConnection();
-      try
-      {
-         // Set up
-         XATopicSession xaSession = connection.createXATopicSession();
-         TopicSession session = xaSession.getTopicSession();
-         TopicPublisher publisher = session.createPublisher(topic);
-         Message message = session.createTextMessage();
-
-         // Add the xa resource to xid1
-         MyXid xid1 = new MyXid();
-         XAResource resource = xaSession.getXAResource();
-         resource.start(xid1, XAResource.TMNOFLAGS);
-
-         // Do some work
-         publisher.publish(message);
-
-         // Suspend the transaction
-         resource.end(xid1, XAResource.TMSUSPEND);
-
-         // Add the xa resource to xid2
-         MyXid xid2 = new MyXid();
-         resource.start(xid2, XAResource.TMNOFLAGS);
-
-         // Do some work in the new transaction
-         publisher.publish(message);
-
-         // Commit the first transaction and end the branch
-         resource.end(xid1, XAResource.TMSUCCESS);
-         resource.commit(xid1, true);
-
-         // Do some more work in the new transaction
-         publisher.publish(message);
-
-         // Commit the second transaction and end the branch
-         resource.end(xid2, XAResource.TMSUCCESS);
-         resource.commit(xid2, true);
-      }
-      finally
-      {
-         connection.close();
-      }
-   }
-
-   public void testXAResourceRollbackAfterPrepare() throws Exception
-   {
-      InitialContext context = getInitialContext();
-      XATopicConnectionFactory factory = (XATopicConnectionFactory) context.lookup(XA_TOPIC_FACTORY);
-      
-      Topic topic = (Topic) context.lookup(TEST_TOPIC);
-
-      XATopicConnection connection = factory.createXATopicConnection();
-      try
-      {
-         // Set up
-         XATopicSession xaSession = connection.createXATopicSession();
-
-         // Add the xa resource to xid1
-         MyXid xid1 = new MyXid();
-         XAResource resource = xaSession.getXAResource();
-         resource.start(xid1, XAResource.TMNOFLAGS);
-
-         TopicSession session = xaSession.getTopicSession();
-         TopicSubscriber subscriber = session.createSubscriber(topic);
-         connection.start();
-         TopicPublisher publisher = session.createPublisher(topic);
-         Message message = session.createTextMessage();
-
-         // Publish a message using "AutoAcknowledge"
-         publisher.publish(message);
-
-         resource.end(xid1, XAResource.TMSUCCESS);
-         resource.prepare(xid1);
-         // JBossMessaging only sends the message when a commit is done, while JBossMQ would send messages to consumers on the same session,
-         // doing something differently on the transaction isolation.
-         // Because of that this commit is necessary to complete this testcase.
-         resource.commit(xid1, false);
-
-         xid1 = new MyXid();
-         resource.start(xid1, XAResource.TMNOFLAGS);
-
-         // Receive the message
-         message = subscriber.receive(1000);
-         if (message == null)
-            fail("No message?");
-
-         // Prepare the transaction
-         resource.end(xid1, XAResource.TMSUCCESS);
-         resource.prepare(xid1);
-         
-         // Rollback
-         resource.rollback(xid1);
-
-         xid1 = new MyXid();
-         resource.start(xid1, XAResource.TMNOFLAGS);
-         // Receive the message using "AutoAcknowledge"
-         message = subscriber.receiveNoWait();
-         if (message == null)
-            fail("No message after rollback?");
-         resource.commit(xid1, true);
-
-      }
-      finally
-      {
-         connection.close();
-      }
-   }
-
-   public static class MyXid
-      implements Xid
-   {
-      static byte next = 0;
-
-      byte[] xid;
-      byte[] branch;
-
-      public MyXid()
-      {
-         xid = new byte[] { ++next };
-         branch = new byte[] { ++ next };
-      }
- 
-      public int getFormatId()
-      {
-         return 314;
-      }
-
-      public byte[] getGlobalTransactionId()
-      {
-         return xid;
-      }
-
-      public byte[] getBranchQualifier()
-      {
-         return branch;
-      }
-   }
-}

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/XAResourceUnitTestCase.java (from rev 64641, branches/JBPAPP_4_2/testsuite/src/main/org/jboss/test/jbossmessaging/test/XAResourceUnitTestCase.java)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/XAResourceUnitTestCase.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jbossmessaging/test/XAResourceUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,201 @@
+/*
+  * 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.ConnectionFactory;
+import javax.jms.Message;
+import javax.jms.Topic;
+import javax.jms.TopicPublisher;
+import javax.jms.TopicSession;
+import javax.jms.TopicSubscriber;
+import javax.jms.XATopicConnection;
+import javax.jms.XATopicConnectionFactory;
+import javax.jms.XATopicSession;
+import javax.naming.InitialContext;
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.Xid;
+
+import org.jboss.test.jbossmessaging.JMSTestCase;
+
+/**
+ * XAResource tests
+ *
+ * @author <a href="mailto:richard.achmatowicz at jboss.com">Richard Achmatowicz</a>
+ * @author
+ * @version
+ */
+public class XAResourceUnitTestCase extends JMSTestCase
+{
+   static String XA_TOPIC_FACTORY = "XAConnectionFactory";
+   static String FACTORY = "ConnectionFactory";
+
+   static String TEST_TOPIC = "topic/testTopic";
+
+   public XAResourceUnitTestCase(String name) throws Exception
+   {
+      super(name);
+   }
+
+   public void testXAResourceSuspendWorkCommit() throws Exception
+   {
+      InitialContext context = getInitialContext();
+      XATopicConnectionFactory factory = (XATopicConnectionFactory) context.lookup(XA_TOPIC_FACTORY);
+      Topic topic = (Topic) context.lookup(TEST_TOPIC);
+
+      XATopicConnection connection = factory.createXATopicConnection();
+      try
+      {
+         // Set up
+         XATopicSession xaSession = connection.createXATopicSession();
+         TopicSession session = xaSession.getTopicSession();
+         TopicPublisher publisher = session.createPublisher(topic);
+         Message message = session.createTextMessage();
+
+         // Add the xa resource to xid1
+         MyXid xid1 = new MyXid();
+         XAResource resource = xaSession.getXAResource();
+         resource.start(xid1, XAResource.TMNOFLAGS);
+
+         // Do some work
+         publisher.publish(message);
+
+         // Suspend the transaction
+         resource.end(xid1, XAResource.TMSUSPEND);
+
+         // Add the xa resource to xid2
+         MyXid xid2 = new MyXid();
+         resource.start(xid2, XAResource.TMNOFLAGS);
+
+         // Do some work in the new transaction
+         publisher.publish(message);
+
+         // Commit the first transaction and end the branch
+         resource.end(xid1, XAResource.TMSUCCESS);
+         resource.commit(xid1, true);
+
+         // Do some more work in the new transaction
+         publisher.publish(message);
+
+         // Commit the second transaction and end the branch
+         resource.end(xid2, XAResource.TMSUCCESS);
+         resource.commit(xid2, true);
+      }
+      finally
+      {
+         connection.close();
+      }
+   }
+
+   public void testXAResourceRollbackAfterPrepare() throws Exception
+   {
+      InitialContext context = getInitialContext();
+      XATopicConnectionFactory factory = (XATopicConnectionFactory) context.lookup(XA_TOPIC_FACTORY);
+      
+      Topic topic = (Topic) context.lookup(TEST_TOPIC);
+
+      XATopicConnection connection = factory.createXATopicConnection();
+      try
+      {
+         // Set up
+         XATopicSession xaSession = connection.createXATopicSession();
+
+         // Add the xa resource to xid1
+         MyXid xid1 = new MyXid();
+         XAResource resource = xaSession.getXAResource();
+         resource.start(xid1, XAResource.TMNOFLAGS);
+
+         TopicSession session = xaSession.getTopicSession();
+         TopicSubscriber subscriber = session.createSubscriber(topic);
+         connection.start();
+         TopicPublisher publisher = session.createPublisher(topic);
+         Message message = session.createTextMessage();
+
+         // Publish a message using "AutoAcknowledge"
+         publisher.publish(message);
+
+         resource.end(xid1, XAResource.TMSUCCESS);
+         resource.prepare(xid1);
+         // JBossMessaging only sends the message when a commit is done, while JBossMQ would send messages to consumers on the same session,
+         // doing something differently on the transaction isolation.
+         // Because of that this commit is necessary to complete this testcase.
+         resource.commit(xid1, false);
+
+         xid1 = new MyXid();
+         resource.start(xid1, XAResource.TMNOFLAGS);
+
+         // Receive the message
+         message = subscriber.receive(1000);
+         if (message == null)
+            fail("No message?");
+
+         // Prepare the transaction
+         resource.end(xid1, XAResource.TMSUCCESS);
+         resource.prepare(xid1);
+         
+         // Rollback
+         resource.rollback(xid1);
+
+         xid1 = new MyXid();
+         resource.start(xid1, XAResource.TMNOFLAGS);
+         // Receive the message using "AutoAcknowledge"
+         message = subscriber.receiveNoWait();
+         if (message == null)
+            fail("No message after rollback?");
+         resource.commit(xid1, true);
+
+      }
+      finally
+      {
+         connection.close();
+      }
+   }
+
+   public static class MyXid
+      implements Xid
+   {
+      static byte next = 0;
+
+      byte[] xid;
+      byte[] branch;
+
+      public MyXid()
+      {
+         xid = new byte[] { ++next };
+         branch = new byte[] { ++ next };
+      }
+ 
+      public int getFormatId()
+      {
+         return 314;
+      }
+
+      public byte[] getGlobalTransactionId()
+      {
+         return xid;
+      }
+
+      public byte[] getBranchQualifier()
+      {
+         return branch;
+      }
+   }
+}

Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jmsra/test/RaQueueUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jmsra/test/RaQueueUnitTestCase.java	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jmsra/test/RaQueueUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -48,6 +48,26 @@
 public class RaQueueUnitTestCase
        extends RaTest
 {
+   private static final ObjectName obj;
+   static
+   {
+	   try
+	   {
+		   if (System.getProperty("jbosstest.useJBM")!=null)
+		   {
+			   obj = new ObjectName("jboss.messaging.destination:service=Queue,name=testQueue");
+		   }
+		   else
+		   {
+			   obj = new ObjectName("jboss.mq.destination:service=Queue,name=testQueue");
+		   }
+	   }
+	   catch (Exception e)
+	   {
+		   
+		   throw new RuntimeException(e.toString(), e);
+	   }
+   }
    private final static String QUEUE_FACTORY = "ConnectionFactory";
    private final static String QUEUE = "queue/testQueue";
    private final static String JNDI = "TxPublisher";
@@ -94,7 +114,7 @@
                 // Remove the messages
                 getServer().invoke
                 (
-                   new ObjectName("jboss.mq.destination:service=Queue,name=testQueue"),
+                   obj,
                    "removeAllMessages",
                    new Object[0],
                    new String[0]

Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jmsra/test/RaSyncRecUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jmsra/test/RaSyncRecUnitTestCase.java	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jmsra/test/RaSyncRecUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -55,6 +55,28 @@
  */
 
 public class RaSyncRecUnitTestCase extends JBossTestCase {
+   private static final ObjectName obj;
+   static
+   {
+	   try
+	   {
+		   if (System.getProperty("jbosstest.useJBM")!=null)
+		   {
+			   obj = new ObjectName("jboss.messaging.destination:service=Queue,name=testQueue");
+		   }
+		   else
+		   {
+			   obj = new ObjectName("jboss.mq.destination:service=Queue,name=testQueue");
+		   }
+	   }
+	   catch (Exception e)
+	   {
+		   
+		   throw new RuntimeException(e.toString(), e);
+	   }
+   }
+
+	
    private final static String BEAN_JNDI = "QueueRec";
    private final static String QUEUE_FACTORY = "ConnectionFactory";
    private final static String QUEUE = "queue/A";
@@ -183,7 +205,7 @@
                 // Remove the messages
                 getServer().invoke
                 (
-                   new ObjectName("jboss.mq.destination:service=Queue,name=testQueue"),
+                   obj,
                    "removeAllMessages",
                    new Object[0],
                    new String[0]

Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jmsra/test/RaTopicUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jmsra/test/RaTopicUnitTestCase.java	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/jmsra/test/RaTopicUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -48,6 +48,30 @@
 public class RaTopicUnitTestCase
        extends RaTest
 {
+
+   private static final ObjectName obj;
+   static
+   {
+	   try
+	   {
+		   if (System.getProperty("jbosstest.useJBM")!=null)
+		   {
+			   obj = new ObjectName("jboss.messaging.destination:service=Queue,name=testQueue");
+		   }
+		   else
+		   {
+			   obj = new ObjectName("jboss.mq.destination:service=Queue,name=testQueue");
+		   }
+	   }
+	   catch (Exception e)
+	   {
+		   
+		   throw new RuntimeException(e.toString(), e);
+	   }
+   }
+
+	
+	
    private final static String TOPIC_FACTORY = "ConnectionFactory";
    private final static String TOPIC = "topic/testTopic";
    private final static String JNDI = "TxTopicPublisher";
@@ -94,7 +118,7 @@
                 // Remove the messages
                 getServer().invoke
                 (
-                   new ObjectName("jboss.mq.destination:service=Queue,name=testQueue"),
+                   obj,
                    "removeAllMessages",
                    new Object[0],
                    new String[0]

Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/mdb/test/MDBUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/mdb/test/MDBUnitTestCase.java	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/mdb/test/MDBUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -243,7 +243,9 @@
     */
    public static Test suite() throws Exception
    {
-      TestSuite suite = new TestSuite();
+      final boolean useJBM = (System.getProperty("jbosstest.useJBM") != null);
+
+	  TestSuite suite = new TestSuite();
       suite.addTest(new MDBUnitTestCase("testNoQueueConstructionForAlreadyExists", ""));
       suite.addTest(new MDBUnitTestCase("testNoTopicConstructionForAlreadyExists", ""));
       suite.addTest(new MDBUnitTestCase("testObjectMessage", ""));
@@ -255,14 +257,15 @@
       suite.addTest(new MDBUnitTestCase("testWaitForCompleation", ""));
       suite.addTest(new MDBUnitTestCase("testQueue", "queue/B"));
 
-      return new JBossTestSetup(getDeploySetup(suite, "mdb.jar"))
+      return new JBossTestSetup(getDeploySetup(suite, useJBM?"mdb4jbm.jar":"mdb.jar"))
       {
          protected void tearDown() throws Exception
          {
             super.tearDown();
+            
 
             // Remove the DLQ messages created by the TxTimeout test
-            getServer().invoke(new ObjectName("jboss.mq.destination:service=Queue,name=DLQ"), "removeAllMessages",
+            getServer().invoke(new ObjectName(useJBM?"jboss.messaging.destination:service=Queue,name=DLQ":"jboss.mq.destination:service=Queue,name=DLQ"), "removeAllMessages",
                   new Object[0], new String[0]);
 
             // Remove the durable subscription

Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/messagedriven/mbeans/TestMessageDrivenManagement.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/messagedriven/mbeans/TestMessageDrivenManagement.java	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/messagedriven/mbeans/TestMessageDrivenManagement.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -21,11 +21,16 @@
  */
 package org.jboss.test.messagedriven.mbeans;
 
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.Properties;
 
 import javax.jms.Message;
+import javax.jms.TextMessage;
 import javax.naming.InitialContext;
 import javax.transaction.Transaction;
 import javax.transaction.TransactionManager;
@@ -76,10 +81,10 @@
    {
       synchronized (messages)
       {
-         messages.add(message);
+         messages.add(cloneMessage(message));
       }
    }
-   
+
    public ArrayList getMessages()
    {
       synchronized (messages)
@@ -111,4 +116,29 @@
          System.setProperty("test.messagedriven." + key, props.getProperty(key));
       }
    }
+   
+   /**
+    * JBossMessage will resend the send message, and because of that the message needs to be cloned before being stored
+    * @param message
+    * @return
+    */
+   private Message cloneMessage(Message message) 
+   {
+		try
+		 {
+			 ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
+			 ObjectOutputStream cloneOut = new ObjectOutputStream(byteOut);
+			 cloneOut.writeObject(message);
+			 cloneOut.close();
+			 ObjectInputStream inputArray = new ObjectInputStream (new ByteArrayInputStream(byteOut.toByteArray()));
+			 message = (Message)inputArray.readObject();
+		 }
+		 catch (Exception e)
+		 {
+			 log.error(e.toString(), e);
+		 }
+		return message;
+	}
+	   
+
 }

Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/messagedriven/support/BasicMessageDrivenUnitTest.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/messagedriven/support/BasicMessageDrivenUnitTest.java	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/messagedriven/support/BasicMessageDrivenUnitTest.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -33,6 +33,7 @@
 import javax.jms.Message;
 import javax.jms.MessageProducer;
 import javax.jms.Session;
+import javax.jms.TextMessage;
 import javax.management.ObjectName;
 
 import org.jboss.mx.util.ObjectNameFactory;
@@ -51,17 +52,29 @@
    protected static final long WAIT_TIME = 5000L;
    protected static final long REPEATED_WAIT = 4;
 
-   protected static final ObjectName testQueue = ObjectNameFactory.create("jboss.mq.destination:service=Queue,name=testQueue");
-   protected static final Properties testQueueProps = new Properties();
+   protected static ObjectName testQueue = ObjectNameFactory.create("jboss.mq.destination:service=Queue,name=testQueue");
+   protected static Properties testQueueProps = new Properties();
    
-   protected static final ObjectName testTopic = ObjectNameFactory.create("jboss.mq.destination:service=Topic,name=testTopic");
-   protected static final Properties testTopicProps = new Properties();
+   protected static ObjectName testTopic = ObjectNameFactory.create("jboss.mq.destination:service=Topic,name=testTopic");
+   protected static Properties testTopicProps = new Properties();
    
-   protected static final ObjectName testDurableTopic = ObjectNameFactory.create("jboss.mq.destination:service=Topic,name=testDurableTopic");
-   protected static final Properties testDurableTopicProps = new Properties();
+   protected static ObjectName testDurableTopic = ObjectNameFactory.create("jboss.mq.destination:service=Topic,name=testDurableTopic");
+   protected static Properties testDurableTopicProps = new Properties();
+
+   protected static ObjectName dlqJMXDestination = ObjectNameFactory.create("jboss.mq.destination:service=Queue,name=DLQ");
    
    static
    {
+	   
+	   
+	  if (System.getProperty("jbosstest.useJBM") != null)
+	  {
+		   testQueue = ObjectNameFactory.create("jboss.messaging.destination:service=Queue,name=testQueue");
+		   testTopic = ObjectNameFactory.create("jboss.messaging.destination:service=Topic,name=testTopic");
+		   testDurableTopic = ObjectNameFactory.create("jboss.messaging.destination:service=Topic,name=testDurableTopic");
+		   dlqJMXDestination = ObjectNameFactory.create("jboss.messaging.destination:service=Queue,name=DLQ");
+	  }
+	   
       testQueueProps.put("destination", "queue/testQueue");
       testQueueProps.put("destinationType", "javax.jms.Queue");
 
@@ -84,7 +97,6 @@
    protected String mbeansar = "testmessagedriven.sar"; 
 
    protected ObjectName jmxDestination = ObjectNameFactory.create("does:not=exist"); 
-   protected ObjectName dlqJMXDestination = ObjectNameFactory.create("jboss.mq.destination:service=Queue,name=DLQ");
    protected String connectionFactoryJNDI = "ConnectionFactory";
    protected Destination destination;
    protected Destination dlqDestination;
@@ -209,9 +221,9 @@
       }
    }
    
-   public Message getTestMessage() throws Exception
+   public TextMessage getTestMessage() throws Exception
    {
-      return getSession().createMessage();
+      return getSession().createTextMessage();
    }
 
    protected void setUp() throws Exception

Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/messagedriven/support/CheckJMSDestinationOperation.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/messagedriven/support/CheckJMSDestinationOperation.java	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/messagedriven/support/CheckJMSDestinationOperation.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -21,7 +21,9 @@
  */
 package org.jboss.test.messagedriven.support;
 
+import javax.jms.Destination;
 import javax.jms.Message;
+import javax.jms.TextMessage;
 
 /**
  * Check a message property
@@ -32,9 +34,9 @@
 public class CheckJMSDestinationOperation extends Operation
 {
    protected int msgNo;
-   protected String destination;
+   protected Destination destination;
    
-   public CheckJMSDestinationOperation(BasicMessageDrivenUnitTest test, int msgNo, String destination)
+   public CheckJMSDestinationOperation(BasicMessageDrivenUnitTest test, int msgNo, Destination destination)
    {
       super(test);
       this.msgNo = msgNo;
@@ -43,9 +45,11 @@
 
    public void run() throws Exception
    {
-      Message message = (Message) test.getMessages().get(msgNo);
-      String actual = message.getJMSDestination().toString();
-      if (actual == null || actual.startsWith(destination) == false)
-         throw new Exception("For msgNo=" + msgNo + " destination=" + actual + " Expected=" + destination + " msg=" + message);
+      TextMessage message = (TextMessage) test.getMessages().get(msgNo);
+      Destination msgdest = message.getJMSDestination();
+      
+      if (message == null || !msgdest.equals(destination))
+         throw new Exception("**** For msgNo=" + msgNo + " destination=" + destination.toString() + " received=" + msgdest.toString());
+      
    }
 }

Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/messagedriven/support/SendMessageOperation.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/messagedriven/support/SendMessageOperation.java	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/messagedriven/support/SendMessageOperation.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -24,6 +24,7 @@
 import javax.jms.JMSException;
 import javax.jms.Message;
 import javax.jms.MessageProducer;
+import javax.jms.TextMessage;
 
 /**
  * Send a message
@@ -51,7 +52,8 @@
          try
          {
             MessageProducer producer = test.getMessageProducer();
-            Message message = test.getTestMessage();
+            TextMessage message = test.getTestMessage();
+            message.setText(id);
             message.setStringProperty(MESSAGEID, id);
             producer.send(message);
             // DONE

Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/messagedriven/support/SimpleMessageDrivenUnitTest.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/messagedriven/support/SimpleMessageDrivenUnitTest.java	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/messagedriven/support/SimpleMessageDrivenUnitTest.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -70,7 +70,7 @@
       {
          new SendMessageOperation(this, "1"),
          new CheckMessageSizeOperation(this, 1, 0),
-         new CheckJMSDestinationOperation(this, 0, getDestination().toString()),
+         new CheckJMSDestinationOperation(this, 0, getDestination()),
          new CheckMessageIDOperation(this, 0, "1"),
       };
    }
@@ -80,14 +80,14 @@
       return new Operation[]
       {
          new SendMessageOperation(this, "1"),
-         new CheckMessageSizeOperation(this, 7, 0),
-         new CheckJMSDestinationOperation(this, 0, getDestination().toString()),
-         new CheckJMSDestinationOperation(this, 1, getDestination().toString()),
-         new CheckJMSDestinationOperation(this, 2, getDestination().toString()),
-         new CheckJMSDestinationOperation(this, 3, getDestination().toString()),
-         new CheckJMSDestinationOperation(this, 4, getDestination().toString()),
-         new CheckJMSDestinationOperation(this, 5, getDestination().toString()),
-         new CheckJMSDestinationOperation(this, 6, getDLQDestination().toString()),
+         new CheckMessageSizeOperation(this, 7, 500),
+         new CheckJMSDestinationOperation(this, 0, getDestination()),
+         new CheckJMSDestinationOperation(this, 1, getDestination()),
+         new CheckJMSDestinationOperation(this, 2, getDestination()),
+         new CheckJMSDestinationOperation(this, 3, getDestination()),
+         new CheckJMSDestinationOperation(this, 4, getDestination()),
+         new CheckJMSDestinationOperation(this, 5, getDestination()),
+         new CheckJMSDestinationOperation(this, 6, getDLQDestination()),
          new CheckMessageIDOperation(this, 0, "1"),
          new CheckMessageIDOperation(this, 1, "1"),
          new CheckMessageIDOperation(this, 2, "1"),

Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/messagedriven/test/JMSContainerInvokerDurableTopicMessageDrivenUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/messagedriven/test/JMSContainerInvokerDurableTopicMessageDrivenUnitTestCase.java	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/messagedriven/test/JMSContainerInvokerDurableTopicMessageDrivenUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -57,14 +57,14 @@
          new ActivateOperation(this, mdbInvoker),
          new SendMessageOperation(this, "2"),
          new CheckMessageSizeOperation(this, 1, 0),
-         new CheckJMSDestinationOperation(this, 0, getDestination().toString()),
+         new CheckJMSDestinationOperation(this, 0, getDestination()),
          new CheckMessageIDOperation(this, 0, "2"),
          new DeactivateOperation(this, mdbInvoker),
          new SendMessageOperation(this, "3"),
          new CheckMessageSizeOperation(this, 1, 5000),
          new ActivateOperation(this, mdbInvoker),
          new CheckMessageSizeOperation(this, 2, 0),
-         new CheckJMSDestinationOperation(this, 1, getDestination().toString()),
+         new CheckJMSDestinationOperation(this, 1, getDestination()),
          new CheckMessageIDOperation(this, 1, "3"),
       };
    }

Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/messagedriven/test/JMSContainerInvokerQueueMessageDrivenUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/messagedriven/test/JMSContainerInvokerQueueMessageDrivenUnitTestCase.java	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/messagedriven/test/JMSContainerInvokerQueueMessageDrivenUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -52,19 +52,26 @@
    
    public void testRestartJMS() throws Exception
    {
-      Operation[] operations = new Operation[]
-      {
-         new SendMessageOperation(this, "1"),
-         new CheckMessageSizeOperation(this, 1, 0),
-         new CheckJMSDestinationOperation(this, 0, getDestination().toString()),
-         new CheckMessageIDOperation(this, 0, "1"),
-         new StopOperation(this, persistenceManager),
-         new StartOperation(this, persistenceManager),
-         new SendMessageOperation(this, "2"),
-         new CheckMessageSizeOperation(this, 2, 20000),
-         new CheckJMSDestinationOperation(this, 0, getDestination().toString()),
-      };
-      runTest(operations, defaultProps);
+	  if (System.getProperty("jbosstest.useJBM") == null)
+	  {
+	      Operation[] operations = new Operation[]
+	      {
+	         new SendMessageOperation(this, "1"),
+	         new CheckMessageSizeOperation(this, 1, 0),
+	         new CheckJMSDestinationOperation(this, 0, getDestination()),
+	         new CheckMessageIDOperation(this, 0, "1"),
+	         new StopOperation(this, persistenceManager),
+	         new StartOperation(this, persistenceManager),
+	         new SendMessageOperation(this, "2"),
+	         new CheckMessageSizeOperation(this, 2, 20000),
+	         new CheckJMSDestinationOperation(this, 0, getDestination()),
+	      };
+	      runTest(operations, defaultProps);
+	  }
+	  else
+	  {
+		  System.out.println("testRestartJMS doesn't make sense to be executed on JBM");
+	  }
    }
   
    public Operation[] getDeliveryActiveOperations() throws Exception
@@ -75,14 +82,14 @@
          new CheckMessageSizeOperation(this, 0, 5000),
          new ActivateOperation(this, mdbInvoker),
          new CheckMessageSizeOperation(this, 1, 0),
-         new CheckJMSDestinationOperation(this, 0, getDestination().toString()),
+         new CheckJMSDestinationOperation(this, 0, getDestination()),
          new CheckMessageIDOperation(this, 0, "1"),
          new DeactivateOperation(this, mdbInvoker),
          new SendMessageOperation(this, "2"),
          new CheckMessageSizeOperation(this, 1, 5000),
          new ActivateOperation(this, mdbInvoker),
          new CheckMessageSizeOperation(this, 2, 0),
-         new CheckJMSDestinationOperation(this, 1, getDestination().toString()),
+         new CheckJMSDestinationOperation(this, 1, getDestination()),
          new CheckMessageIDOperation(this, 1, "2"),
       };
    }

Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/messagedriven/test/JMSContainerInvokerTopicMessageDrivenUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/messagedriven/test/JMSContainerInvokerTopicMessageDrivenUnitTestCase.java	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/messagedriven/test/JMSContainerInvokerTopicMessageDrivenUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -58,7 +58,7 @@
          new CheckMessageSizeOperation(this, 0, 5000),
          new SendMessageOperation(this, "1"),
          new CheckMessageSizeOperation(this, 1, 0),
-         new CheckJMSDestinationOperation(this, 0, getDestination().toString()),
+         new CheckJMSDestinationOperation(this, 0, getDestination()),
          new CheckMessageIDOperation(this, 0, "1"),
          new DeactivateOperation(this, mdbInvoker),
          new SendMessageOperation(this, "2"),

Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/test/CustomSecurityManager.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/test/CustomSecurityManager.java	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/test/CustomSecurityManager.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -208,6 +208,8 @@
     */
    public boolean doesUserHaveRole(Principal principal, Set roles)
    { 
+      if(principal == null)
+        principal = new SimplePrincipal("guest");
       log.debug("[doesUserHaveRole:Principal="+principal+":rolesCheck="+roles+"]");
       Set containedSet = (Set)principalToRoleMap.get(principal);
       /**

Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/test/CustomSecurityManagerTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/test/CustomSecurityManagerTestCase.java	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/test/CustomSecurityManagerTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -101,18 +101,20 @@
       // Create an initializer for the test suite
       TestSetup wrapper = new JBossTestSetup(suite)
       {
+         boolean useJBM = System.getProperty("jbosstest.useJBM") != null;
+
          protected void setUp() throws Exception
          {
             super.setUp();
             Configuration.setConfiguration(new XMLLoginConfigImpl());
-            deploy(getResourceURL("security/custom-secmgr/queues-service.xml"));
+            deploy(getResourceURL(useJBM?"security/custom-secmgr/queues-jbm-service.xml":"security/custom-secmgr/queues-service.xml"));
             redeploy("custom-secmgrtests.ear"); 
             flushAuthCache();
          }
          protected void tearDown() throws Exception
          {
             undeploy("custom-secmgrtests.ear"); 
-            undeploy(getResourceURL("security/custom-secmgr/queues-service.xml"));
+            undeploy(getResourceURL(useJBM?"security/custom-secmgr/queues-jbm-service.xml":"security/custom-secmgr/queues-service.xml"));
             super.tearDown();
          
          }

Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/test/EJBSpecUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/test/EJBSpecUnitTestCase.java	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/test/EJBSpecUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -937,16 +937,18 @@
       // Create an initializer for the test suite
       TestSetup wrapper = new JBossTestSetup(suite)
       {
+         boolean useJBM = System.getProperty("jbosstest.useJBM") != null;
+
          protected void setUp() throws Exception
          {
             super.setUp();
             Configuration.setConfiguration(new XMLLoginConfigImpl());
-            redeploy("security-spec.jar");
+            redeploy(useJBM?"security-spec-jbm.jar":"security-spec.jar");
             flushAuthCache();
          }
          protected void tearDown() throws Exception
          {
-            undeploy("security-spec.jar");
+            undeploy(useJBM?"security-spec-jbm.jar":"security-spec.jar");
             super.tearDown();
          
          }

Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/web/test/WebIntegrationUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/web/test/WebIntegrationUnitTestCase.java	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/web/test/WebIntegrationUnitTestCase.java	2007-10-02 22:26:17 UTC (rev 65777)
@@ -513,6 +513,7 @@
     */
    public static Test suite() throws Exception
    {
+	  final boolean useJBM = System.getProperty("jbosstest.useJBM")!=null;
       TestSuite suite = new TestSuite();
       suite.addTest(new TestSuite(WebIntegrationUnitTestCase.class));
 
@@ -533,7 +534,8 @@
             // Remove all the messages created during this test
             getServer().invoke
             (
-               new ObjectName("jboss.mq.destination:service=Queue,name=testQueue"),
+               new ObjectName(useJBM?"jboss.messaging.destination:service=Queue,name=testQueue"
+            		           :"jboss.mq.destination:service=Queue,name=testQueue"),
                "removeAllMessages",
                new Object[0],
                new String[0]

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/jbossmessaging (from rev 64641, branches/JBPAPP_4_2/testsuite/src/resources/jbossmessaging)

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/jbossmessaging/provider.properties
===================================================================
--- branches/JBPAPP_4_2/testsuite/src/resources/jbossmessaging/provider.properties	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/jbossmessaging/provider.properties	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,34 +0,0 @@
-##
-# JORAM: Java(TM) Open Reliable Asynchronous Messaging
-# Copyright (C) 2002 INRIA
-# Contact: joram-team at objectweb.org
-#
-# This library 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 any later version.
-#
-# This library 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 library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
-# USA
-#
-# Initial developer(s): Jeff Mesnil (jmesnil at inrialpes.fr)
-# Contributor(s): ______________________________________.
-##
-
-##
-# This property is used to chose which provider is to be tested
-# Uncomment the chosen provider and comment the other ones
-##
-
-jms.provider.admin.class = org.jboss.test.jbossmessaging.JBossMessagingAdmin
-jms.provider.resources.dir = jbossmessaging
-#jms.provider.admin.class = org.jboss.test.jbossmq.JBossMQAdmin
-#jms.provider.resources.dir = jbossmq
-

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/jbossmessaging/provider.properties (from rev 64641, branches/JBPAPP_4_2/testsuite/src/resources/jbossmessaging/provider.properties)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/jbossmessaging/provider.properties	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/jbossmessaging/provider.properties	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,34 @@
+##
+# JORAM: Java(TM) Open Reliable Asynchronous Messaging
+# Copyright (C) 2002 INRIA
+# Contact: joram-team at objectweb.org
+#
+# This library 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 any later version.
+#
+# This library 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 library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+# USA
+#
+# Initial developer(s): Jeff Mesnil (jmesnil at inrialpes.fr)
+# Contributor(s): ______________________________________.
+##
+
+##
+# This property is used to chose which provider is to be tested
+# Uncomment the chosen provider and comment the other ones
+##
+
+jms.provider.admin.class = org.jboss.test.jbossmessaging.JBossMessagingAdmin
+jms.provider.resources.dir = jbossmessaging
+#jms.provider.admin.class = org.jboss.test.jbossmq.JBossMQAdmin
+#jms.provider.resources.dir = jbossmq
+

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/jbossmessaging/test-destinations-full-service.xml
===================================================================
--- branches/JBPAPP_4_2/testsuite/src/resources/jbossmessaging/test-destinations-full-service.xml	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/jbossmessaging/test-destinations-full-service.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,86 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<server>
-
-  <mbean code="org.jboss.jms.server.destination.TopicService"
-         name="jboss.messaging.destination:service=Topic,name=testTopic"
-         xmbean-dd="xmdesc/Topic-xmbean.xml">
-     <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-     <attribute name="SecurityConfig">
-        <security>
-           <role name="guest" read="true" write="true"/>
-           <role name="publisher" read="true" write="true" create="false"/>
-           <role name="durpublisher" read="true" write="true" create="true"/>
-        </security>
-     </attribute>
-  </mbean>
-
-  <mbean code="org.jboss.jms.server.destination.TopicService"
-         name="jboss.messaging.destination:service=Topic,name=securedTopic"
-         xmbean-dd="xmdesc/Topic-xmbean.xml">
-     <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-     <attribute name="SecurityConfig">
-        <security>
-           <role name="publisher" read="true" write="true" create="false"/>
-        </security>
-     </attribute>
-  </mbean>
-
-  <mbean code="org.jboss.jms.server.destination.TopicService"
-         name="jboss.messaging.destination:service=Topic,name=testDurableTopic"
-         xmbean-dd="xmdesc/Topic-xmbean.xml">
-     <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-     <attribute name="SecurityConfig">
-        <security>
-           <role name="guest" read="true" write="true"/>
-           <role name="publisher" read="true" write="true" create="false"/>
-           <role name="durpublisher" read="true" write="true" create="true"/>
-        </security>
-     </attribute>
-  </mbean>
-
-
-  <mbean code="org.jboss.jms.server.destination.QueueService"
-         name="jboss.messaging.destination:service=Queue,name=testQueue"
-         xmbean-dd="xmdesc/Queue-xmbean.xml">
-     <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-     <attribute name="SecurityConfig">
-        <security>
-           <role name="guest" read="true" write="true"/>
-           <role name="publisher" read="true" write="true" create="false"/>
-           <role name="noacc" read="false" write="false" create="false"/>
-        </security>
-     </attribute>
-  </mbean>
-
-  <mbean code="org.jboss.jms.server.destination.QueueService"
-         name="jboss.messaging.destination:service=Queue,name=A"
-         xmbean-dd="xmdesc/Queue-xmbean.xml">
-     <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-  </mbean>
-
-  <mbean code="org.jboss.jms.server.destination.QueueService"
-         name="jboss.messaging.destination:service=Queue,name=B"
-         xmbean-dd="xmdesc/Queue-xmbean.xml">
-     <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-  </mbean>
-
-  <mbean code="org.jboss.jms.server.destination.QueueService"
-         name="jboss.messaging.destination:service=Queue,name=C"
-         xmbean-dd="xmdesc/Queue-xmbean.xml">
-     <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-  </mbean>
-
-  <mbean code="org.jboss.jms.server.destination.QueueService"
-         name="jboss.messaging.destination:service=Queue,name=D"
-         xmbean-dd="xmdesc/Queue-xmbean.xml">
-     <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-  </mbean>
-
-  <mbean code="org.jboss.jms.server.destination.QueueService"
-         name="jboss.messaging.destination:service=Queue,name=ex"
-         xmbean-dd="xmdesc/Queue-xmbean.xml">
-     <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-  </mbean>
-
-</server>

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/jbossmessaging/test-destinations-full-service.xml (from rev 64641, branches/JBPAPP_4_2/testsuite/src/resources/jbossmessaging/test-destinations-full-service.xml)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/jbossmessaging/test-destinations-full-service.xml	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/jbossmessaging/test-destinations-full-service.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<server>
+
+  <mbean code="org.jboss.jms.server.destination.TopicService"
+         name="jboss.messaging.destination:service=Topic,name=testTopic"
+         xmbean-dd="xmdesc/Topic-xmbean.xml">
+     <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+     <attribute name="SecurityConfig">
+        <security>
+           <role name="guest" read="true" write="true"/>
+           <role name="publisher" read="true" write="true" create="false"/>
+           <role name="durpublisher" read="true" write="true" create="true"/>
+        </security>
+     </attribute>
+  </mbean>
+
+  <mbean code="org.jboss.jms.server.destination.TopicService"
+         name="jboss.messaging.destination:service=Topic,name=securedTopic"
+         xmbean-dd="xmdesc/Topic-xmbean.xml">
+     <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+     <attribute name="SecurityConfig">
+        <security>
+           <role name="publisher" read="true" write="true" create="false"/>
+        </security>
+     </attribute>
+  </mbean>
+
+  <mbean code="org.jboss.jms.server.destination.TopicService"
+         name="jboss.messaging.destination:service=Topic,name=testDurableTopic"
+         xmbean-dd="xmdesc/Topic-xmbean.xml">
+     <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+     <attribute name="SecurityConfig">
+        <security>
+           <role name="guest" read="true" write="true"/>
+           <role name="publisher" read="true" write="true" create="false"/>
+           <role name="durpublisher" read="true" write="true" create="true"/>
+        </security>
+     </attribute>
+  </mbean>
+
+
+  <mbean code="org.jboss.jms.server.destination.QueueService"
+         name="jboss.messaging.destination:service=Queue,name=testQueue"
+         xmbean-dd="xmdesc/Queue-xmbean.xml">
+     <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+     <attribute name="SecurityConfig">
+        <security>
+           <role name="guest" read="true" write="true"/>
+           <role name="publisher" read="true" write="true" create="false"/>
+           <role name="noacc" read="false" write="false" create="false"/>
+        </security>
+     </attribute>
+  </mbean>
+
+  <mbean code="org.jboss.jms.server.destination.QueueService"
+         name="jboss.messaging.destination:service=Queue,name=A"
+         xmbean-dd="xmdesc/Queue-xmbean.xml">
+     <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+  </mbean>
+
+  <mbean code="org.jboss.jms.server.destination.QueueService"
+         name="jboss.messaging.destination:service=Queue,name=B"
+         xmbean-dd="xmdesc/Queue-xmbean.xml">
+     <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+  </mbean>
+
+  <mbean code="org.jboss.jms.server.destination.QueueService"
+         name="jboss.messaging.destination:service=Queue,name=C"
+         xmbean-dd="xmdesc/Queue-xmbean.xml">
+     <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+  </mbean>
+
+  <mbean code="org.jboss.jms.server.destination.QueueService"
+         name="jboss.messaging.destination:service=Queue,name=D"
+         xmbean-dd="xmdesc/Queue-xmbean.xml">
+     <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+  </mbean>
+
+  <mbean code="org.jboss.jms.server.destination.QueueService"
+         name="jboss.messaging.destination:service=Queue,name=ex"
+         xmbean-dd="xmdesc/Queue-xmbean.xml">
+     <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+  </mbean>
+
+</server>

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/mdb4jbm (from rev 64641, branches/JBPAPP_4_2/testsuite/src/resources/mdb4jbm)

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/mdb4jbm/META-INF (from rev 64641, branches/JBPAPP_4_2/testsuite/src/resources/mdb4jbm/META-INF)

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/mdb4jbm/META-INF/ejb-jar.xml
===================================================================
--- branches/JBPAPP_4_2/testsuite/src/resources/mdb4jbm/META-INF/ejb-jar.xml	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/mdb4jbm/META-INF/ejb-jar.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,203 +0,0 @@
-<?xml version="1.0"?>
-
-<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/j2ee/dtds/ejb-jar_2_0.dtd">
-
-<ejb-jar>
-    <enterprise-beans>
-
-      <message-driven>
-	<ejb-name>ObjectMessageBean</ejb-name>
-	<ejb-class>org.jboss.test.mdb.bean.ObjectMessageBean</ejb-class>
-        <message-selector></message-selector>
-        <transaction-type>Bean</transaction-type>
-        <acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>
-         <message-driven-destination>
-            <destination-type>javax.jms.Queue</destination-type>
-            <subscription-durability>NonDurable</subscription-durability>
-        </message-driven-destination>
-      </message-driven>
-
-    <message-driven>
-	<ejb-name>BMTTXTimeOutBean</ejb-name>
-	    <ejb-class>org.jboss.test.mdb.bean.TXTimeOutBean</ejb-class>
-        <message-selector></message-selector>
-         <transaction-type>Bean</transaction-type>
-    	<acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>
-        <message-driven-destination>
-            <destination-type>javax.jms.Queue</destination-type>
-			<subscription-durability>NonDurable</subscription-durability>
-        </message-driven-destination>
-     </message-driven>
-
-    <message-driven>
-	<ejb-name>CMTTXTimeOutBean</ejb-name>
-	    <ejb-class>org.jboss.test.mdb.bean.TXTimeOutBean</ejb-class>
-        <message-selector></message-selector>
-         <transaction-type>Container</transaction-type>
-    	<acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>
-        <message-driven-destination>
-            <destination-type>javax.jms.Queue</destination-type>
-			<subscription-durability>NonDurable</subscription-durability>
-        </message-driven-destination>
-     </message-driven>
-
-
-      <message-driven>
-	<ejb-name>QueueBean</ejb-name>
-	<ejb-class>org.jboss.test.mdb.bean.QueueBean</ejb-class>
-<!--
-        <message-selector>JMSType='activityCompletion'</message-selector>
--->
-        <message-selector></message-selector>
-         <!-- We also have the acknowledge-mode - AUTO_ACKNOWLEDGE | DUPS_OK_AKNOWLEDGE - for bean managed transactions, and the subscription-durability for topic destination types -->
-         <transaction-type>Bean</transaction-type>
-    <acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>
-
-        <message-driven-destination>
-            <destination-type>javax.jms.Queue</destination-type>
-<!--
-Only with topic
-            <subscription-durability>Durable</subscription-durability>
--->
-<subscription-durability>NonDurable</subscription-durability>
-        </message-driven-destination>
-      </message-driven>
-      <message-driven>
-	<ejb-name>TopicBean</ejb-name>
-	<ejb-class>org.jboss.test.mdb.bean.TopicBean</ejb-class>
-<!--
-        <message-selector>JMSType='activityCompletion'</message-selector>
--->
-        <message-selector></message-selector>
-         <!-- We also have the acknowledge-mode - AUTO_ACKNOWLEDGE | DUPS_OK_AKNOWLEDGE - for bean managed transactions, and the subscription-durability for topic destination types -->
-         <transaction-type>Container</transaction-type>
-    <!-- <acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode> -->
-
-        <message-driven-destination>
-            <destination-type>javax.jms.Topic</destination-type>
-<!--
-Only with topic
-            <subscription-durability>Durable</subscription-durability>
--->
-<subscription-durability>NonDurable</subscription-durability>
-        </message-driven-destination>
-      </message-driven>
-      <message-driven>
-	<ejb-name>DurableTopicBean</ejb-name>
-	<ejb-class>org.jboss.test.mdb.bean.TopicBean</ejb-class>
-<!--
-        <message-selector>JMSType='activityCompletion'</message-selector>
--->
-        <message-selector></message-selector>
-         <!-- We also have the acknowledge-mode - AUTO_ACKNOWLEDGE | DUPS_OK_AKNOWLEDGE - for bean managed transactions, and the subscription-durability for topic destination types -->
-         <transaction-type>Container</transaction-type>
-    <!-- <acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode> -->
-
-        <message-driven-destination>
-            <destination-type>javax.jms.Topic</destination-type>
-<!--
-Only with topic
-            <subscription-durability>Durable</subscription-durability>
--->
-<subscription-durability>Durable</subscription-durability>
-        </message-driven-destination>
-      </message-driven>
-      <message-driven>
-	<ejb-name>ExQueueBean</ejb-name>
-	<ejb-class>org.jboss.test.mdb.bean.ExQueueBean</ejb-class>
-        <message-selector></message-selector>
-         <transaction-type>Container</transaction-type>
-
-        <message-driven-destination>
-            <destination-type>javax.jms.Queue</destination-type>
-            <subscription-durability>NonDurable</subscription-durability>
-        </message-driven-destination>
-      </message-driven>
-
-      <message-driven>
-	<ejb-name>QueueInADifferentContext</ejb-name>
-	<ejb-class>org.jboss.test.mdb.bean.ObjectMessageBean</ejb-class>
-        <message-selector></message-selector>
-        <transaction-type>Bean</transaction-type>
-        <acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>
-         <message-driven-destination>
-            <destination-type>javax.jms.Queue</destination-type>
-            <subscription-durability>NonDurable</subscription-durability>
-        </message-driven-destination>
-      </message-driven>
-
-      <message-driven>
-	<ejb-name>TopicInADifferentContext</ejb-name>
-	<ejb-class>org.jboss.test.mdb.bean.TopicBean</ejb-class>
-        <message-selector></message-selector>
-         <transaction-type>Container</transaction-type>
-        <message-driven-destination>
-            <destination-type>javax.jms.Topic</destination-type>
-            <subscription-durability>NonDurable</subscription-durability>
-        </message-driven-destination>
-      </message-driven>
-
-    </enterprise-beans>
-
-
-    <assembly-descriptor>
-     <container-transaction>
-
-       <method>
-
-         <ejb-name>TopicBean</ejb-name>
-
-         <method-name>onMessage</method-name>
-         <method-params>
-           <method-param>javax.jms.Message</method-param>
-         </method-params>
-
-       </method>
-     <!-- May also be NotSupported -->
-     <trans-attribute>Required</trans-attribute>
-
-     </container-transaction>
-          <container-transaction>
-
-       <method>
-
-         <ejb-name>DurableTopicBean</ejb-name>
-
-         <method-name>onMessage</method-name>
-
-       </method>
-     <!-- May also be NotSupported -->
-     <trans-attribute>Required</trans-attribute>
-
-     </container-transaction>
-
-     <container-transaction>
-       <method>
-         <ejb-name>BMTTXTimeOutBean</ejb-name>
-         <method-name>*</method-name>
-       </method>
-       <trans-attribute>Required</trans-attribute>
-     </container-transaction>
-
-     <container-transaction>
-       <method>
-         <ejb-name>CMTTXTimeOutBean</ejb-name>
-         <method-name>*</method-name>
-       </method>
-       <trans-attribute>NotSupported</trans-attribute>
-     </container-transaction>
-
-     <container-transaction>
-       <method>
-
-         <ejb-name>ExQueueBean</ejb-name>
-
-         <method-name>*</method-name>
-
-       </method>
-     <!-- May also be NotSupported -->
-     <trans-attribute>Required</trans-attribute>
-
-     </container-transaction>
-    </assembly-descriptor>
-  </ejb-jar>

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/mdb4jbm/META-INF/ejb-jar.xml (from rev 64641, branches/JBPAPP_4_2/testsuite/src/resources/mdb4jbm/META-INF/ejb-jar.xml)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/mdb4jbm/META-INF/ejb-jar.xml	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/mdb4jbm/META-INF/ejb-jar.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,203 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/j2ee/dtds/ejb-jar_2_0.dtd">
+
+<ejb-jar>
+    <enterprise-beans>
+
+      <message-driven>
+	<ejb-name>ObjectMessageBean</ejb-name>
+	<ejb-class>org.jboss.test.mdb.bean.ObjectMessageBean</ejb-class>
+        <message-selector></message-selector>
+        <transaction-type>Bean</transaction-type>
+        <acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>
+         <message-driven-destination>
+            <destination-type>javax.jms.Queue</destination-type>
+            <subscription-durability>NonDurable</subscription-durability>
+        </message-driven-destination>
+      </message-driven>
+
+    <message-driven>
+	<ejb-name>BMTTXTimeOutBean</ejb-name>
+	    <ejb-class>org.jboss.test.mdb.bean.TXTimeOutBean</ejb-class>
+        <message-selector></message-selector>
+         <transaction-type>Bean</transaction-type>
+    	<acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>
+        <message-driven-destination>
+            <destination-type>javax.jms.Queue</destination-type>
+			<subscription-durability>NonDurable</subscription-durability>
+        </message-driven-destination>
+     </message-driven>
+
+    <message-driven>
+	<ejb-name>CMTTXTimeOutBean</ejb-name>
+	    <ejb-class>org.jboss.test.mdb.bean.TXTimeOutBean</ejb-class>
+        <message-selector></message-selector>
+         <transaction-type>Container</transaction-type>
+    	<acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>
+        <message-driven-destination>
+            <destination-type>javax.jms.Queue</destination-type>
+			<subscription-durability>NonDurable</subscription-durability>
+        </message-driven-destination>
+     </message-driven>
+
+
+      <message-driven>
+	<ejb-name>QueueBean</ejb-name>
+	<ejb-class>org.jboss.test.mdb.bean.QueueBean</ejb-class>
+<!--
+        <message-selector>JMSType='activityCompletion'</message-selector>
+-->
+        <message-selector></message-selector>
+         <!-- We also have the acknowledge-mode - AUTO_ACKNOWLEDGE | DUPS_OK_AKNOWLEDGE - for bean managed transactions, and the subscription-durability for topic destination types -->
+         <transaction-type>Bean</transaction-type>
+    <acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>
+
+        <message-driven-destination>
+            <destination-type>javax.jms.Queue</destination-type>
+<!--
+Only with topic
+            <subscription-durability>Durable</subscription-durability>
+-->
+<subscription-durability>NonDurable</subscription-durability>
+        </message-driven-destination>
+      </message-driven>
+      <message-driven>
+	<ejb-name>TopicBean</ejb-name>
+	<ejb-class>org.jboss.test.mdb.bean.TopicBean</ejb-class>
+<!--
+        <message-selector>JMSType='activityCompletion'</message-selector>
+-->
+        <message-selector></message-selector>
+         <!-- We also have the acknowledge-mode - AUTO_ACKNOWLEDGE | DUPS_OK_AKNOWLEDGE - for bean managed transactions, and the subscription-durability for topic destination types -->
+         <transaction-type>Container</transaction-type>
+    <!-- <acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode> -->
+
+        <message-driven-destination>
+            <destination-type>javax.jms.Topic</destination-type>
+<!--
+Only with topic
+            <subscription-durability>Durable</subscription-durability>
+-->
+<subscription-durability>NonDurable</subscription-durability>
+        </message-driven-destination>
+      </message-driven>
+      <message-driven>
+	<ejb-name>DurableTopicBean</ejb-name>
+	<ejb-class>org.jboss.test.mdb.bean.TopicBean</ejb-class>
+<!--
+        <message-selector>JMSType='activityCompletion'</message-selector>
+-->
+        <message-selector></message-selector>
+         <!-- We also have the acknowledge-mode - AUTO_ACKNOWLEDGE | DUPS_OK_AKNOWLEDGE - for bean managed transactions, and the subscription-durability for topic destination types -->
+         <transaction-type>Container</transaction-type>
+    <!-- <acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode> -->
+
+        <message-driven-destination>
+            <destination-type>javax.jms.Topic</destination-type>
+<!--
+Only with topic
+            <subscription-durability>Durable</subscription-durability>
+-->
+<subscription-durability>Durable</subscription-durability>
+        </message-driven-destination>
+      </message-driven>
+      <message-driven>
+	<ejb-name>ExQueueBean</ejb-name>
+	<ejb-class>org.jboss.test.mdb.bean.ExQueueBean</ejb-class>
+        <message-selector></message-selector>
+         <transaction-type>Container</transaction-type>
+
+        <message-driven-destination>
+            <destination-type>javax.jms.Queue</destination-type>
+            <subscription-durability>NonDurable</subscription-durability>
+        </message-driven-destination>
+      </message-driven>
+
+      <message-driven>
+	<ejb-name>QueueInADifferentContext</ejb-name>
+	<ejb-class>org.jboss.test.mdb.bean.ObjectMessageBean</ejb-class>
+        <message-selector></message-selector>
+        <transaction-type>Bean</transaction-type>
+        <acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>
+         <message-driven-destination>
+            <destination-type>javax.jms.Queue</destination-type>
+            <subscription-durability>NonDurable</subscription-durability>
+        </message-driven-destination>
+      </message-driven>
+
+      <message-driven>
+	<ejb-name>TopicInADifferentContext</ejb-name>
+	<ejb-class>org.jboss.test.mdb.bean.TopicBean</ejb-class>
+        <message-selector></message-selector>
+         <transaction-type>Container</transaction-type>
+        <message-driven-destination>
+            <destination-type>javax.jms.Topic</destination-type>
+            <subscription-durability>NonDurable</subscription-durability>
+        </message-driven-destination>
+      </message-driven>
+
+    </enterprise-beans>
+
+
+    <assembly-descriptor>
+     <container-transaction>
+
+       <method>
+
+         <ejb-name>TopicBean</ejb-name>
+
+         <method-name>onMessage</method-name>
+         <method-params>
+           <method-param>javax.jms.Message</method-param>
+         </method-params>
+
+       </method>
+     <!-- May also be NotSupported -->
+     <trans-attribute>Required</trans-attribute>
+
+     </container-transaction>
+          <container-transaction>
+
+       <method>
+
+         <ejb-name>DurableTopicBean</ejb-name>
+
+         <method-name>onMessage</method-name>
+
+       </method>
+     <!-- May also be NotSupported -->
+     <trans-attribute>Required</trans-attribute>
+
+     </container-transaction>
+
+     <container-transaction>
+       <method>
+         <ejb-name>BMTTXTimeOutBean</ejb-name>
+         <method-name>*</method-name>
+       </method>
+       <trans-attribute>Required</trans-attribute>
+     </container-transaction>
+
+     <container-transaction>
+       <method>
+         <ejb-name>CMTTXTimeOutBean</ejb-name>
+         <method-name>*</method-name>
+       </method>
+       <trans-attribute>NotSupported</trans-attribute>
+     </container-transaction>
+
+     <container-transaction>
+       <method>
+
+         <ejb-name>ExQueueBean</ejb-name>
+
+         <method-name>*</method-name>
+
+       </method>
+     <!-- May also be NotSupported -->
+     <trans-attribute>Required</trans-attribute>
+
+     </container-transaction>
+    </assembly-descriptor>
+  </ejb-jar>

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/mdb4jbm/META-INF/jboss.xml
===================================================================
--- branches/JBPAPP_4_2/testsuite/src/resources/mdb4jbm/META-INF/jboss.xml	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/mdb4jbm/META-INF/jboss.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,88 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE jboss PUBLIC
-      "-//JBoss//DTD JBOSS 4.2//EN"
-      "http://www.jboss.org/j2ee/dtd/jboss_4_2.dtd">
-<jboss>
-   <invoker-proxy-bindings>
-      <invoker-proxy-binding>
-         <name>my-message-driven-bean</name>
-         <invoker-mbean>default</invoker-mbean>
-         <proxy-factory>org.jboss.ejb.plugins.jms.JMSContainerInvoker</proxy-factory>
-         <proxy-factory-config>
-            <JMSProviderAdapterJNDI>DefaultJMSProvider</JMSProviderAdapterJNDI>
-            <ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI>
-            <CreateDestination>true</CreateDestination>
-            <DestinationManager>jboss.messaging:service=ServerPeer</DestinationManager>
-            <CreateTopicMethod>deployTopic</CreateTopicMethod>
-            <CreateQueueMethod>deployQueue</CreateQueueMethod>
-            <MaximumSize>15</MaximumSize>
-            <MaxMessages>1</MaxMessages>
-            <MDBConfig>
-               <ReconnectIntervalSec>10</ReconnectIntervalSec>
-               <DLQConfig>
-                  <DestinationQueue>queue/DLQ</DestinationQueue>
-                  <MaxTimesRedelivered>10</MaxTimesRedelivered>
-                  <TimeToLive>0</TimeToLive>
-               </DLQConfig>
-            </MDBConfig>
-         </proxy-factory-config>
-      </invoker-proxy-binding>
-   </invoker-proxy-bindings>
-
-   <enterprise-beans>
-      <message-driven>
-         <ejb-name>ObjectMessageBean</ejb-name>
-         <configuration-name>Standard Message Driven Bean</configuration-name>
-         <destination-jndi-name>queue/testObjectMessage</destination-jndi-name>
-         <invoker-bindings>
-            <invoker>
-               <invoker-proxy-binding-name>my-message-driven-bean</invoker-proxy-binding-name>
-            </invoker>
-         </invoker-bindings>
-      </message-driven>
-      <message-driven>
-         <ejb-name>BMTTXTimeOutBean</ejb-name>
-         <configuration-name>Standard Message Driven Bean</configuration-name>
-         <destination-jndi-name>queue/A</destination-jndi-name>
-      </message-driven>
-      <message-driven>
-         <ejb-name>CMTTXTimeOutBean</ejb-name>
-         <configuration-name>Standard Message Driven Bean</configuration-name>
-         <destination-jndi-name>queue/B</destination-jndi-name>
-      </message-driven>
-      <message-driven>
-         <ejb-name>QueueBean</ejb-name>
-         <configuration-name>Standard Message Driven Bean</configuration-name>
-         <destination-jndi-name>queue/testQueue</destination-jndi-name>
-      </message-driven>
-      <message-driven>
-         <ejb-name>TopicBean</ejb-name>
-         <configuration-name>Standard Message Driven Bean</configuration-name>
-         <destination-jndi-name>topic/testTopic</destination-jndi-name>
-      </message-driven>
-      <message-driven>
-         <ejb-name>DurableTopicBean</ejb-name>
-         <configuration-name>Standard Message Driven Bean</configuration-name>
-         <destination-jndi-name>topic/testDurableTopic</destination-jndi-name>
-         <mdb-user>john</mdb-user>
-         <mdb-passwd>needle</mdb-passwd>
-         <mdb-subscription-id>DurableSubscriberExample</mdb-subscription-id>
-      </message-driven>
-      <message-driven>
-         <ejb-name>ExQueueBean</ejb-name>
-         <configuration-name>Standard Message Driven Bean</configuration-name>
-         <destination-jndi-name>queue/ex</destination-jndi-name>
-      </message-driven>
-
-      <message-driven>
-         <ejb-name>QueueInADifferentContext</ejb-name>
-         <configuration-name>Standard Message Driven Bean</configuration-name>
-         <destination-jndi-name>anotherContext/QueueInADifferentContext</destination-jndi-name>
-      </message-driven>
-      <message-driven>
-         <ejb-name>TopicInADifferentContext</ejb-name>
-         <configuration-name>Standard Message Driven Bean</configuration-name>
-         <destination-jndi-name>anotherContext/TopicInADifferentContext</destination-jndi-name>
-      </message-driven>
-   </enterprise-beans>
-</jboss>

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/mdb4jbm/META-INF/jboss.xml (from rev 64641, branches/JBPAPP_4_2/testsuite/src/resources/mdb4jbm/META-INF/jboss.xml)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/mdb4jbm/META-INF/jboss.xml	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/mdb4jbm/META-INF/jboss.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE jboss PUBLIC
+      "-//JBoss//DTD JBOSS 4.2//EN"
+      "http://www.jboss.org/j2ee/dtd/jboss_4_2.dtd">
+<jboss>
+   <invoker-proxy-bindings>
+      <invoker-proxy-binding>
+         <name>my-message-driven-bean</name>
+         <invoker-mbean>default</invoker-mbean>
+         <proxy-factory>org.jboss.ejb.plugins.jms.JMSContainerInvoker</proxy-factory>
+         <proxy-factory-config>
+            <JMSProviderAdapterJNDI>DefaultJMSProvider</JMSProviderAdapterJNDI>
+            <ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI>
+            <CreateDestination>true</CreateDestination>
+            <DestinationManager>jboss.messaging:service=ServerPeer</DestinationManager>
+            <CreateTopicMethod>deployTopic</CreateTopicMethod>
+            <CreateQueueMethod>deployQueue</CreateQueueMethod>
+            <MaximumSize>15</MaximumSize>
+            <MaxMessages>1</MaxMessages>
+            <MDBConfig>
+               <ReconnectIntervalSec>10</ReconnectIntervalSec>
+               <DLQConfig>
+                  <DestinationQueue>queue/DLQ</DestinationQueue>
+                  <MaxTimesRedelivered>10</MaxTimesRedelivered>
+                  <TimeToLive>0</TimeToLive>
+               </DLQConfig>
+            </MDBConfig>
+         </proxy-factory-config>
+      </invoker-proxy-binding>
+   </invoker-proxy-bindings>
+
+   <enterprise-beans>
+      <message-driven>
+         <ejb-name>ObjectMessageBean</ejb-name>
+         <configuration-name>Standard Message Driven Bean</configuration-name>
+         <destination-jndi-name>queue/testObjectMessage</destination-jndi-name>
+         <invoker-bindings>
+            <invoker>
+               <invoker-proxy-binding-name>my-message-driven-bean</invoker-proxy-binding-name>
+            </invoker>
+         </invoker-bindings>
+      </message-driven>
+      <message-driven>
+         <ejb-name>BMTTXTimeOutBean</ejb-name>
+         <configuration-name>Standard Message Driven Bean</configuration-name>
+         <destination-jndi-name>queue/A</destination-jndi-name>
+      </message-driven>
+      <message-driven>
+         <ejb-name>CMTTXTimeOutBean</ejb-name>
+         <configuration-name>Standard Message Driven Bean</configuration-name>
+         <destination-jndi-name>queue/B</destination-jndi-name>
+      </message-driven>
+      <message-driven>
+         <ejb-name>QueueBean</ejb-name>
+         <configuration-name>Standard Message Driven Bean</configuration-name>
+         <destination-jndi-name>queue/testQueue</destination-jndi-name>
+      </message-driven>
+      <message-driven>
+         <ejb-name>TopicBean</ejb-name>
+         <configuration-name>Standard Message Driven Bean</configuration-name>
+         <destination-jndi-name>topic/testTopic</destination-jndi-name>
+      </message-driven>
+      <message-driven>
+         <ejb-name>DurableTopicBean</ejb-name>
+         <configuration-name>Standard Message Driven Bean</configuration-name>
+         <destination-jndi-name>topic/testDurableTopic</destination-jndi-name>
+         <mdb-user>john</mdb-user>
+         <mdb-passwd>needle</mdb-passwd>
+         <mdb-subscription-id>DurableSubscriberExample</mdb-subscription-id>
+      </message-driven>
+      <message-driven>
+         <ejb-name>ExQueueBean</ejb-name>
+         <configuration-name>Standard Message Driven Bean</configuration-name>
+         <destination-jndi-name>queue/ex</destination-jndi-name>
+      </message-driven>
+
+      <message-driven>
+         <ejb-name>QueueInADifferentContext</ejb-name>
+         <configuration-name>Standard Message Driven Bean</configuration-name>
+         <destination-jndi-name>anotherContext/QueueInADifferentContext</destination-jndi-name>
+      </message-driven>
+      <message-driven>
+         <ejb-name>TopicInADifferentContext</ejb-name>
+         <configuration-name>Standard Message Driven Bean</configuration-name>
+         <destination-jndi-name>anotherContext/TopicInADifferentContext</destination-jndi-name>
+      </message-driven>
+   </enterprise-beans>
+</jboss>

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/mdb4jbm/client.policy
===================================================================
--- branches/JBPAPP_4_2/testsuite/src/resources/mdb4jbm/client.policy	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/mdb4jbm/client.policy	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,4 +0,0 @@
-grant {
-        // Allow everything for now
-        permission java.security.AllPermission;
-};

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/mdb4jbm/client.policy (from rev 64641, branches/JBPAPP_4_2/testsuite/src/resources/mdb4jbm/client.policy)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/mdb4jbm/client.policy	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/mdb4jbm/client.policy	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,4 @@
+grant {
+        // Allow everything for now
+        permission java.security.AllPermission;
+};

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/mdb4jbm/jboss-service.xml
===================================================================
--- branches/JBPAPP_4_2/testsuite/src/resources/mdb4jbm/jboss-service.xml	2007-08-16 21:42:11 UTC (rev 64641)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/mdb4jbm/jboss-service.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE server>
-
-<server>
-   <mbean code="org.jboss.jms.server.destination.QueueService"
-      name="jboss.messaging.destination:service=Queue,name=myMDBQueue"
-      xmbean-dd="xmdesc/Queue-xmbean.xml">
-      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-      <depends>jboss.messaging:service=PostOffice</depends>
-    <attribute name="SecurityConfig">
-      <security>
-        <role name="guest" read="true" write="true"/>
-        <role name="publisher" read="true" write="true" create="false"/>
-        <role name="noacc" read="false" write="false" create="false"/>
-      </security>
-    </attribute>
-   </mbean>
-   
-   <mbean code="org.jboss.jms.server.destination.TopicService"
-      name="jboss.messaging.destination:service=Topic,name=myMDBTopic"
-      xmbean-dd="xmdesc/Topic-xmbean.xml">
-      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-      <depends>jboss.messaging:service=PostOffice</depends>
-    <attribute name="SecurityConfig">
-      <security>
-        <role name="guest" read="true" write="true"/>
-        <role name="publisher" read="true" write="true" create="false"/>
-        <role name="durpublisher" read="true" write="true" create="true"/>
-      </security>
-    </attribute>
-   </mbean>
-   
-  <mbean code="org.jboss.naming.NamingAlias" 
-         name="jboss.test:test=mdb,alias=anotherContext/QueueInADifferentContext">
-     <attribute name="FromName">anotherContext/QueueInADifferentContext</attribute>
-     <attribute name="ToName">queue/myMDBQueue</attribute>
-  </mbean>
-  <mbean code="org.jboss.naming.NamingAlias" 
-         name="jboss.test:test=mdb,alias=anotherContext/TopicInADifferentContext">
-     <attribute name="FromName">anotherContext/TopicInADifferentContext</attribute>
-     <attribute name="ToName">topic/myMDBTopic</attribute>
-  </mbean>
-</server>
\ No newline at end of file

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/mdb4jbm/jboss-service.xml (from rev 64641, branches/JBPAPP_4_2/testsuite/src/resources/mdb4jbm/jboss-service.xml)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/mdb4jbm/jboss-service.xml	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/mdb4jbm/jboss-service.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE server>
+
+<server>
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=myMDBQueue"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+    <attribute name="SecurityConfig">
+      <security>
+        <role name="guest" read="true" write="true"/>
+        <role name="publisher" read="true" write="true" create="false"/>
+        <role name="noacc" read="false" write="false" create="false"/>
+      </security>
+    </attribute>
+   </mbean>
+   
+   <mbean code="org.jboss.jms.server.destination.TopicService"
+      name="jboss.messaging.destination:service=Topic,name=myMDBTopic"
+      xmbean-dd="xmdesc/Topic-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+    <attribute name="SecurityConfig">
+      <security>
+        <role name="guest" read="true" write="true"/>
+        <role name="publisher" read="true" write="true" create="false"/>
+        <role name="durpublisher" read="true" write="true" create="true"/>
+      </security>
+    </attribute>
+   </mbean>
+   
+  <mbean code="org.jboss.naming.NamingAlias" 
+         name="jboss.test:test=mdb,alias=anotherContext/QueueInADifferentContext">
+     <attribute name="FromName">anotherContext/QueueInADifferentContext</attribute>
+     <attribute name="ToName">queue/myMDBQueue</attribute>
+  </mbean>
+  <mbean code="org.jboss.naming.NamingAlias" 
+         name="jboss.test:test=mdb,alias=anotherContext/TopicInADifferentContext">
+     <attribute name="FromName">anotherContext/TopicInADifferentContext</attribute>
+     <attribute name="ToName">topic/myMDBTopic</attribute>
+  </mbean>
+</server>
\ No newline at end of file

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security/custom-secmgr/queues-jbm-service.xml (from rev 65765, branches/JBPAPP_4_2/testsuite/src/resources/security/custom-secmgr/queues-jbm-service.xml)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security/custom-secmgr/queues-jbm-service.xml	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security/custom-secmgr/queues-jbm-service.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<server>
+    <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=QueueA"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+   </mbean>
+
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=QueueB"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+   </mbean>
+   
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=QueueC"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+   </mbean>
+
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=QueueD"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+   </mbean>
+</server>

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security-spec/service-inf-jbm (from rev 65765, branches/JBPAPP_4_2/testsuite/src/resources/security-spec/service-inf-jbm)

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security-spec/service-inf-jbm/jboss-service.xml
===================================================================
--- branches/JBPAPP_4_2/testsuite/src/resources/security-spec/service-inf-jbm/jboss-service.xml	2007-10-02 17:21:48 UTC (rev 65765)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security-spec/service-inf-jbm/jboss-service.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<server>
-   <!-- The custom JAAS login configuration service that installs 
-       a Configuration capable of dynamically updating the
-       config settings
-   -->
-   <mbean code="org.jboss.security.auth.login.DynamicLoginConfig"
-         name="jboss.security.tests:service=SecuritySpecLoginConfig">
-      <attribute name="AuthConfig">META-INF/spec-test-config.xml</attribute>
-      <depends optional-attribute-name="LoginConfigService">
-         jboss.security:service=XMLLoginConfig
-      </depends>
-      <depends optional-attribute-name="SecurityManagerService">
-         jboss.security:service=JaasSecurityManager
-      </depends>
-   </mbean>
-
-   <!-- A JaasSecurityDomain setup to test that changes to the security
-   layer do not affect the ability to use this subclass of JaasSecurityManager
-   -->
-   <mbean code="org.jboss.security.plugins.JaasSecurityDomain"
-      name="jboss.security:service=JaasSecurityDomain,domain=spec-test-domain">
-      <constructor>
-         <arg type="java.lang.String" value="spec-test-domain"/>
-      </constructor>
-      <attribute name="KeyStoreURL">resource:tst.keystore</attribute>
-      <attribute name="KeyStorePass">unit-tests</attribute>
-      <attribute name="Salt">abcdefgh</attribute>
-      <attribute name="IterationCount">13</attribute>
-      <depends optional-attribute-name="ManagerServiceName">jboss.security:service=JaasSecurityManager</depends>
-   </mbean>
-
-
-   <mbean code="org.jboss.jms.server.destination.QueueService"
-      name="jboss.messaging.destination:service=Queue,name=QueueA"
-      xmbean-dd="xmdesc/Queue-xmbean.xml">
-      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-      <depends>jboss.messaging:service=PostOffice</depends>
-   </mbean>
-
-   <mbean code="org.jboss.jms.server.destination.QueueService"
-      name="jboss.messaging.destination:service=Queue,name=QueueB"
-      xmbean-dd="xmdesc/Queue-xmbean.xml">
-      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-      <depends>jboss.messaging:service=PostOffice</depends>
-   </mbean>
-   
-   <mbean code="org.jboss.jms.server.destination.QueueService"
-      name="jboss.messaging.destination:service=Queue,name=QueueC"
-      xmbean-dd="xmdesc/Queue-xmbean.xml">
-      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-      <depends>jboss.messaging:service=PostOffice</depends>
-   </mbean>
-
-   <mbean code="org.jboss.jms.server.destination.QueueService"
-      name="jboss.messaging.destination:service=Queue,name=QueueD"
-      xmbean-dd="xmdesc/Queue-xmbean.xml">
-      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
-      <depends>jboss.messaging:service=PostOffice</depends>
-   </mbean>
-
-</server>

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security-spec/service-inf-jbm/jboss-service.xml (from rev 65765, branches/JBPAPP_4_2/testsuite/src/resources/security-spec/service-inf-jbm/jboss-service.xml)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security-spec/service-inf-jbm/jboss-service.xml	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security-spec/service-inf-jbm/jboss-service.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<server>
+   <!-- The custom JAAS login configuration service that installs 
+       a Configuration capable of dynamically updating the
+       config settings
+   -->
+   <mbean code="org.jboss.security.auth.login.DynamicLoginConfig"
+         name="jboss.security.tests:service=SecuritySpecLoginConfig">
+      <attribute name="AuthConfig">META-INF/spec-test-config.xml</attribute>
+      <depends optional-attribute-name="LoginConfigService">
+         jboss.security:service=XMLLoginConfig
+      </depends>
+      <depends optional-attribute-name="SecurityManagerService">
+         jboss.security:service=JaasSecurityManager
+      </depends>
+   </mbean>
+
+   <!-- A JaasSecurityDomain setup to test that changes to the security
+   layer do not affect the ability to use this subclass of JaasSecurityManager
+   -->
+   <mbean code="org.jboss.security.plugins.JaasSecurityDomain"
+      name="jboss.security:service=JaasSecurityDomain,domain=spec-test-domain">
+      <constructor>
+         <arg type="java.lang.String" value="spec-test-domain"/>
+      </constructor>
+      <attribute name="KeyStoreURL">resource:tst.keystore</attribute>
+      <attribute name="KeyStorePass">unit-tests</attribute>
+      <attribute name="Salt">abcdefgh</attribute>
+      <attribute name="IterationCount">13</attribute>
+      <depends optional-attribute-name="ManagerServiceName">jboss.security:service=JaasSecurityManager</depends>
+   </mbean>
+
+
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=QueueA"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+   </mbean>
+
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=QueueB"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+   </mbean>
+   
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=QueueC"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+   </mbean>
+
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=QueueD"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+   </mbean>
+
+</server>

Deleted: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security-spec/service-inf-jbm/spec-test-config.xml
===================================================================
--- branches/JBPAPP_4_2/testsuite/src/resources/security-spec/service-inf-jbm/spec-test-config.xml	2007-10-02 17:21:48 UTC (rev 65765)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security-spec/service-inf-jbm/spec-test-config.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -1,36 +0,0 @@
-<?xml version='1.0'?>
-<!DOCTYPE policy PUBLIC
-      "-//JBoss//DTD JBOSS Security Config 3.0//EN"
-      "http://www.jboss.org/j2ee/dtd/security_config.dtd">
-
-<!-- The JAAS login configuration file for the java:/jaas/spec-test
-security domain used by the security-spec test case
--->
-<policy>
-
-    <application-policy name = "spec-test">
-       <authentication>
-          <login-module code = "org.jboss.security.auth.spi.UsersRolesLoginModule"
-             flag = "required">
-             <module-option name = "unauthenticatedIdentity">anonymous</module-option>
-          </login-module>
-       </authentication>
-    </application-policy>
-
-    <application-policy name = "spec-test-domain">
-       <authentication>
-          <login-module code = "org.jboss.security.auth.spi.UsersRolesLoginModule"
-             flag = "required">
-             <module-option name = "unauthenticatedIdentity">anonymous</module-option>
-          </login-module>
-       </authentication>
-    </application-policy>
-   <application-policy name = "spec-test-domain2">
-      <authentication>
-         <login-module code = "org.jboss.test.security.ejb.UsersRoles2LoginModule"
-            flag = "required">
-         </login-module>
-      </authentication>
-   </application-policy>
-
-</policy>

Copied: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security-spec/service-inf-jbm/spec-test-config.xml (from rev 65765, branches/JBPAPP_4_2/testsuite/src/resources/security-spec/service-inf-jbm/spec-test-config.xml)
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security-spec/service-inf-jbm/spec-test-config.xml	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/security-spec/service-inf-jbm/spec-test-config.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -0,0 +1,36 @@
+<?xml version='1.0'?>
+<!DOCTYPE policy PUBLIC
+      "-//JBoss//DTD JBOSS Security Config 3.0//EN"
+      "http://www.jboss.org/j2ee/dtd/security_config.dtd">
+
+<!-- The JAAS login configuration file for the java:/jaas/spec-test
+security domain used by the security-spec test case
+-->
+<policy>
+
+    <application-policy name = "spec-test">
+       <authentication>
+          <login-module code = "org.jboss.security.auth.spi.UsersRolesLoginModule"
+             flag = "required">
+             <module-option name = "unauthenticatedIdentity">anonymous</module-option>
+          </login-module>
+       </authentication>
+    </application-policy>
+
+    <application-policy name = "spec-test-domain">
+       <authentication>
+          <login-module code = "org.jboss.security.auth.spi.UsersRolesLoginModule"
+             flag = "required">
+             <module-option name = "unauthenticatedIdentity">anonymous</module-option>
+          </login-module>
+       </authentication>
+    </application-policy>
+   <application-policy name = "spec-test-domain2">
+      <authentication>
+         <login-module code = "org.jboss.test.security.ejb.UsersRoles2LoginModule"
+            flag = "required">
+         </login-module>
+      </authentication>
+   </application-policy>
+
+</policy>

Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/securitymgr/server.policy
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/securitymgr/server.policy	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/securitymgr/server.policy	2007-10-02 22:26:17 UTC (rev 65777)
@@ -37,7 +37,6 @@
    permission java.io.FilePermission "<<ALL FILES>>", "read,write,delete";
 };
 
-
 // Minimal permissions are allowed to everyone else
 grant {
    permission java.util.PropertyPermission "*", "read";
@@ -50,6 +49,7 @@
    permission java.lang.RuntimePermission "org.jboss.security.SecurityAssociation.getSubject";
    permission javax.management.MBeanServerPermission "findMBeanServer";
    permission javax.management.MBeanPermission "org.jboss.mx.modelmbean.XMBean#*[JMImplementation:type=MBeanRegistry]", "*";
+   permission javax.management.MBeanPermission "org.jboss.mx.modelmbean.XMBean#*[jboss*:*]", "*";
    permission javax.security.auth.AuthPermission "createLoginContext.*";
 };
 
@@ -60,4 +60,3 @@
 grant codeBase "file:/etc/jbossas/-" {
    permission java.security.AllPermission;
 };
-

Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/test-configs/jacc/conf/login-config.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/test-configs/jacc/conf/login-config.xml	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/test-configs/jacc/conf/login-config.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -34,6 +34,18 @@
     </authentication>
   </application-policy>
   
+  <application-policy name="messaging">
+      <authentication>
+         <login-module code = "org.jboss.security.auth.spi.DatabaseServerLoginModule"
+            flag = "required">
+            <module-option name = "unauthenticatedIdentity">guest</module-option>
+            <module-option name = "dsJndiName">java:/DefaultDS</module-option>
+            <module-option name = "principalsQuery">SELECT PASSWD FROM JBM_USER WHERE USER_ID=?</module-option>
+            <module-option name = "rolesQuery">SELECT ROLE_ID, 'Roles' FROM JBM_ROLE WHERE USER_ID=?</module-option>
+         </login-module>
+      </authentication>
+   </application-policy>
+  
   <!-- Security domain for JBossWS -->
   <application-policy name="JBossWS">
     <authentication>

Modified: branches/JBPAPP_4_2_0_GA_CP/tools/etc/buildmagic/modules.ent
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/tools/etc/buildmagic/modules.ent	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/tools/etc/buildmagic/modules.ent	2007-10-02 22:26:17 UTC (rev 65777)
@@ -108,10 +108,10 @@
   </path>
 
   <!-- Messaging -->
-  <property name="jboss.messaging.root" value="${project.root}/messaging/output"/>
-  <property name="jboss.messaging.lib" value="${jboss.messaging.root}/lib"/>
-  <path id="jboss.messaging.classpath">
-    <pathelement path="${jboss.messaging.lib}/jbossmq.jar"/>
+  <property name="jboss.messaging-mq.root" value="${project.root}/messaging/output"/>
+  <property name="jboss.messaging-mq.lib" value="${jboss.messaging-mq.root}/lib"/>
+  <path id="jboss.messaging-mq.classpath">
+    <pathelement path="${jboss.messaging-mq.lib}/jbossmq.jar"/>
   </path>
 
   <!-- Naming -->

Modified: branches/JBPAPP_4_2_0_GA_CP/tools/etc/buildmagic/modules.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/tools/etc/buildmagic/modules.xml	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/tools/etc/buildmagic/modules.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -107,10 +107,10 @@
   </path>
 
   <!-- Messaging -->
-  <property name="jboss.messaging.root" value="${project.root}/messaging/output"/>
-  <property name="jboss.messaging.lib" value="${jboss.messaging.root}/lib"/>
-  <path id="jboss.messaging.classpath">
-    <pathelement path="${jboss.messaging.lib}/jbossmq.jar"/>
+  <property name="jboss.messaging-mq.root" value="${project.root}/messaging/output"/>
+  <property name="jboss.messaging-mq.lib" value="${jboss.messaging-mq.root}/lib"/>
+  <path id="jboss.messaging-mq.classpath">
+    <pathelement path="${jboss.messaging-mq.lib}/jbossmq.jar"/>
   </path>
 
   <!-- Naming -->

Modified: branches/JBPAPP_4_2_0_GA_CP/varia/build.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/varia/build.xml	2007-10-02 21:55:12 UTC (rev 65776)
+++ branches/JBPAPP_4_2_0_GA_CP/varia/build.xml	2007-10-02 22:26:17 UTC (rev 65777)
@@ -109,7 +109,7 @@
       <path refid="jboss.server.classpath"/>
       <path refid="jboss.security.classpath"/>
       <path refid="jboss.transaction.classpath"/>
-      <path refid="jboss.messaging.classpath"/>
+      <path refid="jboss.messaging-mq.classpath"/>
       <path refid="jboss.remoting.classpath"/>
       <path refid="jboss.serialization.classpath"/>
     </path>




More information about the jboss-cvs-commits mailing list