[jboss-cvs] JBoss Messaging SVN: r1686 - in branches/Branch_1_0: . lib lib/jbossts src/main/org/jboss/jms src/main/org/jboss/jms/recovery src/main/org/jboss/jms/server src/main/org/jboss/jms/tx src/main/org/jboss/messaging/core/plugin src/main/org/jboss/messaging/core/plugin/contract src/main/org/jboss/messaging/core/tx tests tests/src/org/jboss/test/messaging/core tests/src/org/jboss/test/messaging/core/base tests/src/org/jboss/test/messaging/core/distributed/queue tests/src/org/jboss/test/messaging/core/local tests/src/org/jboss/test/messaging/core/paging tests/src/org/jboss/test/messaging/core/plugin tests/src/org/jboss/test/messaging/jms tests/src/org/jboss/test/messaging/util util

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Dec 2 09:14:29 EST 2006


Author: juha at jboss.org
Date: 2006-12-02 09:14:09 -0500 (Sat, 02 Dec 2006)
New Revision: 1686

Added:
   branches/Branch_1_0/lib/jbossts/
   branches/Branch_1_0/lib/jbossts/jboss-service.xml
   branches/Branch_1_0/lib/jbossts/jbossjta-properties.xml
   branches/Branch_1_0/src/main/org/jboss/jms/recovery/
   branches/Branch_1_0/src/main/org/jboss/jms/recovery/JMSProviderXAResourceRecovery.java
   branches/Branch_1_0/src/main/org/jboss/jms/recovery/MessagingXAResourceRecovery.java
   branches/Branch_1_0/src/main/org/jboss/messaging/core/tx/PreparedTxInfo.java
   branches/Branch_1_0/tests/src/org/jboss/test/messaging/util/TransactionManagerLocator.java
Removed:
   branches/Branch_1_0/lib/jbossts/jboss-service.xml
   branches/Branch_1_0/lib/jbossts/jbossjta-properties.xml
   branches/Branch_1_0/src/main/org/jboss/jms/recovery/JMSProviderXAResourceRecovery.java
   branches/Branch_1_0/src/main/org/jboss/jms/recovery/MessagingXAResourceRecovery.java
Modified:
   branches/Branch_1_0/build-messaging.xml
   branches/Branch_1_0/build-thirdparty.xml
   branches/Branch_1_0/src/main/org/jboss/jms/server/ServerPeer.java
   branches/Branch_1_0/src/main/org/jboss/jms/tx/MessagingXAResource.java
   branches/Branch_1_0/src/main/org/jboss/jms/tx/ResourceManager.java
   branches/Branch_1_0/src/main/org/jboss/jms/tx/TransactionRequest.java
   branches/Branch_1_0/src/main/org/jboss/messaging/core/plugin/JDBCPersistenceManager.java
   branches/Branch_1_0/src/main/org/jboss/messaging/core/plugin/contract/MessageStore.java
   branches/Branch_1_0/src/main/org/jboss/messaging/core/plugin/contract/PersistenceManager.java
   branches/Branch_1_0/src/main/org/jboss/messaging/core/tx/TransactionRepository.java
   branches/Branch_1_0/tests/build.xml
   branches/Branch_1_0/tests/src/org/jboss/test/messaging/core/SimpleDeliveryTest.java
   branches/Branch_1_0/tests/src/org/jboss/test/messaging/core/base/ChannelTestBase.java
   branches/Branch_1_0/tests/src/org/jboss/test/messaging/core/distributed/queue/RecoverableDistributedQueueTest.java
   branches/Branch_1_0/tests/src/org/jboss/test/messaging/core/local/RecoverableQueueTest.java
   branches/Branch_1_0/tests/src/org/jboss/test/messaging/core/local/RecoverableSubscriptionTest.java
   branches/Branch_1_0/tests/src/org/jboss/test/messaging/core/paging/PagingStateTestBase.java
   branches/Branch_1_0/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_ReloadTest.java
   branches/Branch_1_0/tests/src/org/jboss/test/messaging/core/plugin/JDBCPersistenceManagerTest.java
   branches/Branch_1_0/tests/src/org/jboss/test/messaging/jms/XARecoveryTest.java
   branches/Branch_1_0/tests/src/org/jboss/test/messaging/jms/XATest.java
   branches/Branch_1_0/util/release-admin.xml
Log:
merge Branch_1_0_XARecovery

Modified: branches/Branch_1_0/build-messaging.xml
===================================================================
--- branches/Branch_1_0/build-messaging.xml	2006-12-02 13:36:20 UTC (rev 1685)
+++ branches/Branch_1_0/build-messaging.xml	2006-12-02 14:14:09 UTC (rev 1686)
@@ -139,6 +139,7 @@
       <path refid="javassist.classpath"/>
       <path refid="jgroups.jgroups.classpath"/>
       <path refid="trove.trove.classpath"/>
+      <path refid="apache.logging.classpath"/>
    </path>
 
    <!--
@@ -155,6 +156,7 @@
       <path refid="jboss.aop.classpath"/>
       <path refid="jboss.remoting.classpath"/>
       <path refid="jboss.serialization.classpath"/>
+      <path refid="jboss.jbossts.classpath"/>
    </path>
 
    <!--
@@ -193,6 +195,13 @@
       <pathelement location="${project.root}/lib/jboss-jmx.jar"/>
    </path>
 
+   <!--
+       This is for compiling the JBossAS JBossTS driven JMS recovery code which uses XAResourceWrapper implementation
+   -->
+   <path id="jboss.classpath">
+      <pathelement location="${project.root}/lib/jboss.jar"/>
+   </path>
+   
    <property name="jboss.server.lib" value="${project.root}/lib/"/>
 
    <property name="jboss.naming.lib" value="${project.root}/lib/"/>
@@ -206,6 +215,7 @@
       <path refid="jboss.jmx.classpath"/>
       <path refid="jboss.remoting.classpath"/>
       <path refid="jboss.serialization.classpath"/>
+      <path refid="jboss.classpath"/>
    </path>
 
    <!--
@@ -400,13 +410,20 @@
 
       <mkdir dir="${build.lib}"/>
       <jar jarfile="${build.lib}/jboss-${module.name}.jar" manifest="${build.etc}/default.mf">
-         <fileset dir="${build.classes}" includes="**"/>
+         <fileset dir="${build.classes}" includes="**" excludes="org/jboss/jms/recovery/*.class"/>
          <fileset dir="${build.jar}">
             <exclude name="*-service.xml"/>
             <exclude name="*-ds.xml"/>
             <exclude name="messaging-*.properties"/>
          </fileset>
       </jar>
+
+      <!-- JBossTS integration layer for XA recovery -->
+      
+      <jar jarfile="${build.lib}/jboss-${module.name}-integration.jar" manifest="${build.etc}/default.mf">
+         <fileset dir="${build.classes}" includes="org/jboss/jms/recovery/*.class"/>
+      </jar>
+      
    </target>
 
    <target name="scoped-sar" depends="compile, jar, scoped-sar-structure, extract-server-dependencies">

Modified: branches/Branch_1_0/build-thirdparty.xml
===================================================================
--- branches/Branch_1_0/build-thirdparty.xml	2006-12-02 13:36:20 UTC (rev 1685)
+++ branches/Branch_1_0/build-thirdparty.xml	2006-12-02 14:14:09 UTC (rev 1686)
@@ -78,7 +78,7 @@
 
 
       <!--
-           Dependencies requrired to build the project.
+           Dependencies required to build the project.
       -->
       <componentref name="retrotranslator" version="0.9.6jboss"/>
       <componentref name="sun-javacc" version="3.2"/>
@@ -93,6 +93,7 @@
       <componentref name="jboss/aop" version="1.5.0.GA"/>
       <componentref name="jboss/serialization" version="1.0.3.GA"/>
       <componentref name="jboss/remoting" version="2.2.0.Alpha3"/>
+      <componentref name="jboss/jbossts" version="4.2.2.GA"/>
 
       <!-- Need this otherwise project doesn't build in Eclipse -->
       <componentref name="apache-logging" version="1.0.4.1jboss"/>

Copied: branches/Branch_1_0/lib/jbossts (from rev 1684, branches/Branch_1_0_XARecovery/lib/jbossts)

Deleted: branches/Branch_1_0/lib/jbossts/jboss-service.xml
===================================================================
--- branches/Branch_1_0_XARecovery/lib/jbossts/jboss-service.xml	2006-12-02 05:55:38 UTC (rev 1684)
+++ branches/Branch_1_0/lib/jbossts/jboss-service.xml	2006-12-02 14:14:09 UTC (rev 1686)
@@ -1,535 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- $Id: jboss-service.xml 38992 2005-12-13 15:29:35Z jerrygauth $ -->
-
-<!-- ===================================================================== -->
-<!--  JBoss Server Configuration                                           -->
-<!-- ===================================================================== -->
-
-<server>
-
-   <!-- Load all jars from the JBOSS_DIST/server/<config>/lib directory. This
-     can be restricted to specific jars by specifying them in the archives
-     attribute.
-    -->
-   <classpath codebase="${jboss.server.lib.url:lib}" archives="*"/>
-
-   <!-- ==================================================================== -->
-   <!-- JSR-77 Single JBoss Server Management Domain                         -->
-   <!-- ==================================================================== -->
-   <mbean code="org.jboss.management.j2ee.LocalJBossServerDomain"
-      name="jboss.management.local:j2eeType=J2EEDomain,name=Manager">
-      <attribute name="MainDeployer">jboss.system:service=MainDeployer</attribute>
-      <attribute name="SARDeployer">jboss.system:service=ServiceDeployer</attribute>
-      <attribute name="EARDeployer">jboss.j2ee:service=EARDeployer</attribute>
-      <attribute name="EJBDeployer">jboss.ejb:service=EJBDeployer</attribute>
-      <attribute name="RARDeployer">jboss.jca:service=RARDeployer</attribute>
-      <attribute name="CMDeployer">jboss.jca:service=ConnectionFactoryDeployer</attribute>
-      <attribute name="WARDeployer">jboss.web:service=WebServer</attribute>
-      <attribute name="CARDeployer">jboss.j2ee:service=ClientDeployer</attribute>
-      <attribute name="MailService">jboss:service=Mail</attribute>
-      <attribute name="JMSService">jboss.mq:service=DestinationManager</attribute>
-      <attribute name="JNDIService">jboss:service=Naming</attribute>
-      <attribute name="JTAService">jboss:service=TransactionManager</attribute>
-      <attribute name="UserTransactionService">jboss:service=ClientUserTransaction</attribute>
-      <attribute name="RMI_IIOPService">jboss:service=CorbaORB</attribute>
-   </mbean>
-
-   <!-- ==================================================================== -->
-   <!-- XMBean Persistence                                                   -->
-   <!-- ==================================================================== -->   
-   <mbean code="org.jboss.system.pm.AttributePersistenceService"
-      name="jboss:service=AttributePersistenceService"
-      xmbean-dd="resource:xmdesc/AttributePersistenceService-xmbean.xml">
-      <!-- the AttributePersistenceService is persistent, itself -->
-           
-      <!--
-      <attribute name="AttributePersistenceManagerClass">org.jboss.system.pm.XMLAttributePersistenceManager</attribute>
-      <attribute name="AttributePersistenceManagerConfig">
-         <data-directory>data/xmbean-attrs</data-directory>
-      </attribute>      
-      <attribute name="ApmDestroyOnServiceStop">false</attribute>
-      <attribute name="VersionTag"></attribute>
-      -->
-   </mbean>
-
-   <!-- A Thread pool service -->
-   <mbean code="org.jboss.util.threadpool.BasicThreadPool"
-      name="jboss.system:service=ThreadPool">
-      <attribute name="Name">JBoss System Threads</attribute>
-      <attribute name="ThreadGroupName">System Threads</attribute>
-      <!-- How long a thread will live without any tasks in MS -->
-      <attribute name="KeepAliveTime">60000</attribute>
-      <!-- The max number of threads in the pool -->
-      <attribute name="MaximumPoolSize">10</attribute>
-      <!-- The max number of tasks before the queue is full -->
-      <attribute name="MaximumQueueSize">1000</attribute>
-      <!-- The behavior of the pool when a task is added and the queue is full.
-      abort - a RuntimeException is thrown
-      run - the calling thread executes the task
-      wait - the calling thread blocks until the queue has room
-      discard - the task is silently discarded without being run
-      discardOldest - check to see if a task is about to complete and enque
-         the new task if possible, else run the task in the calling thread
-      -->
-      <attribute name="BlockingMode">run</attribute>
-   </mbean>
-
-   <!-- Preload all custom editors for VMs that don't use the thread
-        context class loader when searching for PropertyEditors. Uncomment
-        if your JDK 1.3.0 VM fails to find JBoss PropertyEditors.
-   <mbean code="org.jboss.varia.property.PropertyEditorManagerService"
-     name="jboss:type=Service,name=BootstrapEditors">
-     <attribute name="BootstrapEditors">
-       java.math.BigDecimal=org.jboss.util.propertyeditor.BigDecimalEditor
-       java.lang.Boolean=org.jboss.util.propertyeditor.BooleanEditor
-       java.lang.Class=org.jboss.util.propertyeditor.ClassEditor
-       java.util.Date=org.jboss.util.propertyeditor.DateEditor
-       java.io.File=org.jboss.util.propertyeditor.FileEditor
-       java.net.InetAddress=org.jboss.util.propertyeditor.InetAddressEditor
-       java.lang.Integer=org.jboss.util.propertyeditor.IntegerEditor
-       javax.management.ObjectName=org.jboss.mx.util.propertyeditor.ObjectNameEditor
-       java.util.Properties=org.jboss.util.propertyeditor.PropertiesEditor
-       [Ljava.lang.String;=org.jboss.util.propertyeditor.StringArrayEditor
-       java.net.URL=org.jboss.util.propertyeditor.URLEditor
-     </attribute>
-   </mbean>
-   -->
-
-   <!-- ==================================================================== -->
-   <!-- Log4j Initialization                                                 -->
-   <!-- ==================================================================== -->
-
-   <mbean code="org.jboss.logging.Log4jService"
-      name="jboss.system:type=Log4jService,service=Logging"
-	  xmbean-dd="resource:xmdesc/Log4jService-xmbean.xml">
-      <attribute name="ConfigurationURL">resource:log4j.xml</attribute>
-      <!-- Set the org.apache.log4j.helpers.LogLog.setQuiteMode. As of log4j1.2.8
-      this needs to be set to avoid a possible deadlock on exception at the
-      appender level. See bug#696819.
-      -->
-      <attribute name="Log4jQuietMode">true</attribute>
-      <!-- How frequently in seconds the ConfigurationURL is checked for changes -->
-      <attribute name="RefreshPeriod">60</attribute>
-   </mbean>
-
-   <!-- ==================================================================== -->
-   <!-- Active Alarm Table                                                   -->
-   <!-- ==================================================================== -->
-
-   <!--
-      | The ActiveAlarmTable service is a simple JMX notification listener
-      | that maintains a table with the received notifications (alarms).
-      | The alarms can be acknowledged through the jmx or the web console.
-      | Modify the SubscriptionList below to subscribe for any notification
-      | in the system and treat it as an alarm.
-      | The JMXNotificationAppender is a log4j Appender that can be configured
-      | in log4j.xml, that trasforms logging events to JMX notification so they
-      | can be fed back into the table. By storing the WARN or higher level logging
-      | events you can have a quick view of important system faults.
-      |
-      | The following attributes may be set:
-      |
-      | MaxTableSize (default 1000)
-      |  - set an upper limit to the number of stored alarms
-      | LogLevel (default DEBUG)
-      |  - the log level to use for received notification, can be set to NONE
-      | ServerId (default jboss)
-      |  - used to construct unique alarm ids
-      | SubscriptionList
-      |  - subscribe for the notifications to be stored in the table
-
-   <mbean code="org.jboss.monitor.services.ActiveAlarmTable" 
-          name="jboss.monitor:service=ActiveAlarmTable">
-      <attribute name="SubscriptionList">
-         <subscription-list>
-            <mbean name="jboss.monitor:*">
-               <notification type="jboss.alarm"/>
-               <notification type="JBOSS_MONITOR_NOTIFICATION"/>               
-            </mbean>
-            <mbean name="jboss.system:service=Logging,type=JMXNotificationAppender"/>
-         </subscription-list>
-      </attribute>
-   </mbean>
-   -->
-  
-   <!-- ==================================================================== -->
-   <!-- JBoss RMI Classloader - only install when available                  -->
-   <!-- ==================================================================== -->
-   <mbean code="org.jboss.util.property.jmx.SystemPropertyClassValue"
-      name="jboss.rmi:type=RMIClassLoader">
-      <attribute name="Property">java.rmi.server.RMIClassLoaderSpi</attribute>
-      <attribute name="ClassName">org.jboss.system.JBossRMIClassLoader</attribute>
-   </mbean>
-
-   <!-- ==================================================================== -->
-   <!-- Service Binding                                                      -->
-   <!-- ==================================================================== -->
-
-   <!-- Automatically activated when generatting the clustering environment -->
-   <!-- @TESTSUITE_CLUSTER_CONFIG@ -->
-
-   <!--
-      | Binding service manager for port/host mapping. This is a sample
-      | config that demonstrates a JBoss instances with a server name 'ports-01'
-      | loading its bindings from an XML file using the ServicesStoreFactory
-      | implementation returned by the XMLServicesStoreFactory.
-      |
-      | ServerName: The unique name assigned to a JBoss server instance for
-      | lookup purposes. This allows a single ServicesStore to handle mulitiple
-      | JBoss servers.
-      |
-      | StoreURL: The URL string passed to org.jboss.services.binding.ServicesStore
-      | during initialization that specifies how to connect to the bindings store.
-      | StoreFactory: The org.jboss.services.binding.ServicesStoreFactory interface
-      | implementation to create to obtain the ServicesStore instance.
-
-   <mbean code="org.jboss.services.binding.ServiceBindingManager"
-     name="jboss.system:service=ServiceBindingManager">
-     <attribute name="ServerName">ports-01</attribute>
-     <attribute name="StoreURL">${jboss.home.url}/docs/examples/binding-manager/sample-bindings.xml</attribute>
-     <attribute name="StoreFactoryClassName">
-       org.jboss.services.binding.XMLServicesStoreFactory
-     </attribute>
-   </mbean>
-   -->
-
-   <!-- ==================================================================== -->
-   <!-- Class Loading                                                        -->
-   <!-- ==================================================================== -->
-
-   <mbean code="org.jboss.web.WebService"
-      name="jboss:service=WebService">
-      <attribute name="Port">8083</attribute>
-      <!-- Should non-EJB .class files be downloadable -->
-      <attribute name="DownloadServerClasses">true</attribute>
-      <!-- Should resources other than .class files be downloadable. Both
-         DownloadServerClasses and DownloadResources must be true for resources
-         to be downloadable. This is false by default because its generally a
-         bad idea as server configuration files that container security
-         information can be accessed.
-       -->
-      <attribute name="DownloadResources">false</attribute>
-      <attribute name="Host">${jboss.bind.address}</attribute>
-      <attribute name="BindAddress">${jboss.bind.address}</attribute>
-      <!-- Use the default thread pool for dynamic class loading -->
-      <depends optional-attribute-name="ThreadPool"
-         proxy-type="attribute">jboss.system:service=ThreadPool</depends>
-   </mbean>
-
-   <!-- ==================================================================== -->
-   <!-- JNDI                                                                 -->
-   <!-- ==================================================================== -->
-
-   <mbean code="org.jboss.naming.NamingService"
-      name="jboss:service=Naming"
-      xmbean-dd="resource:xmdesc/NamingService-xmbean.xml">
-      <!-- The call by value mode. true if all lookups are unmarshalled using
-      the caller's TCL, false if in VM lookups return the value by reference.
-      -->
-      <attribute name="CallByValue">false</attribute>
-      <!-- The listening port for the bootstrap JNP service. Set this to -1
-        to run the NamingService without the JNP invoker listening port.
-      -->
-      <attribute name="Port">1099</attribute>
-      <!-- The bootstrap JNP server bind address. This also sets the default
-      RMI service bind address. Empty == all addresses
-       -->
-      <attribute name="BindAddress">${jboss.bind.address}</attribute>
-      <!-- The port of the RMI naming service, 0 == anonymous -->
-      <attribute name="RmiPort">1098</attribute>
-      <!-- The RMI service bind address. Empty == all addresses
-       -->
-      <attribute name="RmiBindAddress">${jboss.bind.address}</attribute>
-      <!-- The thread pool service used to control the bootstrap lookups -->
-      <depends optional-attribute-name="LookupPool"
-         proxy-type="attribute">jboss.system:service=ThreadPool</depends>
-   </mbean>
-
-   <mbean code="org.jboss.naming.JNDIView"
-   	name="jboss:service=JNDIView"
-   	xmbean-dd="resource:xmdesc/JNDIView-xmbean.xml">
-   	<!-- The HANamingService service name -->
-   	<attribute name="HANamingService">jboss:service=HAJNDI</attribute>
-   </mbean>
-
-   <!-- ==================================================================== -->
-   <!-- Security                                                             -->
-   <!-- ==================================================================== -->
-
-   <mbean code="org.jboss.security.plugins.SecurityConfig"
-      name="jboss.security:service=SecurityConfig">
-      <attribute name="LoginConfig">jboss.security:service=XMLLoginConfig</attribute>
-   </mbean>
-   <mbean code="org.jboss.security.auth.login.XMLLoginConfig"
-      name="jboss.security:service=XMLLoginConfig">
-      <attribute name="ConfigResource">login-config.xml</attribute>
-   </mbean>
-
-   <!-- JAAS security manager and realm mapping -->
-   <mbean code="org.jboss.security.plugins.JaasSecurityManagerService"
-      name="jboss.security:service=JaasSecurityManager">
-      <!-- A flag which indicates whether the SecurityAssociation server mode
-      is set on service creation. This is true by default since the
-      SecurityAssociation should be thread local for multi-threaded server
-      operation.
-      -->
-      <attribute name="ServerMode">true</attribute>
-      <attribute name="SecurityManagerClassName">org.jboss.security.plugins.JaasSecurityManager</attribute>
-      <attribute name="DefaultUnauthenticatedPrincipal">anonymous</attribute>
-      <!-- DefaultCacheTimeout: Specifies the default timed cache policy timeout
-      in seconds.
-      If you want to disable caching of security credentials, set this to 0 to
-      force authentication to occur every time. This has no affect if the
-      AuthenticationCacheJndiName has been changed from the default value.
-      -->
-      <attribute name="DefaultCacheTimeout">1800</attribute>
-      <!-- DefaultCacheResolution: Specifies the default timed cache policy
-      resolution in seconds. This controls the interval at which the cache
-      current timestamp is updated and should be less than the DefaultCacheTimeout
-      in order for the timeout to be meaningful. This has no affect if the
-      AuthenticationCacheJndiName has been changed from the default value.
-      -->
-      <attribute name="DefaultCacheResolution">60</attribute>
-   </mbean>
-
-   <!-- ==================================================================== -->
-   <!-- Transactions                                                         -->
-   <!-- ==================================================================== -->
-   <!-- The configurable Xid factory.  For use with Oracle, set pad to true -->
-   <mbean code="org.jboss.tm.XidFactory"
-      name="jboss:service=XidFactory">
-      <!--attribute name="Pad">true</attribute-->
-   </mbean>
-
-   <!--
-      | The fast in-memory transaction manager.
-    
-   <mbean code="org.jboss.tm.TransactionManagerService"
-      name="jboss:service=TransactionManager"
-      xmbean-dd="resource:xmdesc/TransactionManagerService-xmbean.xml">
-      <attribute name="TransactionTimeout">300</attribute>
-      <!- set to false to disable transaction demarcation over IIOP ->
-      <attribute name="GlobalIdsEnabled">true</attribute>
-      <depends optional-attribute-name="XidFactory">jboss:service=XidFactory</depends>
-
-      <!- Transaction Integrity Checking ->
-      <!- Force a rollback if another thread is associated with the transaction at commit ->
-      <!-depends optional-attribute-name="TransactionIntegrityFactory" 
-               proxy-type="org.jboss.tm.integrity.TransactionIntegrityFactory">
-         <mbean code="org.jboss.tm.integrity.FailIncompleteTransaction"
-                name="jboss:service=TransactionManager,plugin=TransactionIntegrity"/>
-      </depends->
-   </mbean-->
-   
-   <mbean code="com.arjuna.ats.jbossatx.jta.TransactionManagerService"
-      name="jboss:service=TransactionManager">
-      <attribute name="TransactionTimeout">300</attribute>
-   </mbean>
-   
-   <!--
-      | UserTransaction support.
-    -->
-   <mbean code="org.jboss.tm.usertx.server.ClientUserTransactionService"
-      name="jboss:service=ClientUserTransaction"
-      xmbean-dd="resource:xmdesc/ClientUserTransaction-xmbean.xml">
-      <depends>
-         <mbean code="org.jboss.invocation.jrmp.server.JRMPProxyFactory"
-            name="jboss:service=proxyFactory,target=ClientUserTransactionFactory">
-            <attribute name="InvokerName">jboss:service=invoker,type=jrmp</attribute>
-            <attribute name="TargetName">jboss:service=ClientUserTransaction</attribute>
-            <attribute name="JndiName">UserTransactionSessionFactory</attribute>
-            <attribute name="ExportedInterface">org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory</attribute>
-            <attribute name="ClientInterceptors">
-               <interceptors>
-                  <interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor>
-                  <interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
-               </interceptors>
-            </attribute>
-            <depends>jboss:service=invoker,type=jrmp</depends>
-         </mbean>
-      </depends>
-      <depends optional-attribute-name="TxProxyName">
-         <mbean code="org.jboss.invocation.jrmp.server.JRMPProxyFactory"
-            name="jboss:service=proxyFactory,target=ClientUserTransaction">
-            <attribute name="InvokerName">jboss:service=invoker,type=jrmp</attribute>
-            <attribute name="TargetName">jboss:service=ClientUserTransaction</attribute>
-            <attribute name="JndiName"></attribute>
-            <attribute name="ExportedInterface">org.jboss.tm.usertx.interfaces.UserTransactionSession</attribute>
-            <attribute name="ClientInterceptors">
-               <interceptors>
-                  <interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor>
-                  <interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
-               </interceptors>
-            </attribute>
-            <depends>jboss:service=invoker,type=jrmp</depends>
-         </mbean>
-      </depends>
-   </mbean>
-
-   <!-- ==================================================================== -->
-   <!-- Invokers to the JMX node                                             -->
-   <!-- ==================================================================== -->
-
-   <!-- RMI/JRMP invoker -->
-   <mbean code="org.jboss.invocation.jrmp.server.JRMPInvoker"
-      name="jboss:service=invoker,type=jrmp">
-      <attribute name="RMIObjectPort">4444</attribute>
-      <attribute name="ServerAddress">${jboss.bind.address}</attribute>
-      <!--
-      <attribute name="RMIClientSocketFactory">custom</attribute>
-      <attribute name="RMIServerSocketFactory">custom</attribute>
-      <attribute name="RMIServerSocketAddr">custom</attribute>
-      <attribute name="SecurityDomain">ssl-domain-name</attribute>
-      -->
-      <depends>jboss:service=TransactionManager</depends>
-   </mbean>
-
-   <mbean code="org.jboss.invocation.local.LocalInvoker"
-      name="jboss:service=invoker,type=local">
-
-      <depends>jboss:service=TransactionManager</depends>
-   </mbean>
-
-   <mbean code="org.jboss.invocation.pooled.server.PooledInvoker"
-      name="jboss:service=invoker,type=pooled">
-      <attribute name="NumAcceptThreads">1</attribute>
-      <attribute name="MaxPoolSize">300</attribute>
-      <attribute name="ClientMaxPoolSize">300</attribute>
-      <attribute name="SocketTimeout">60000</attribute>
-      <attribute name="ServerBindAddress">${jboss.bind.address}</attribute>
-      <attribute name="ServerBindPort">4445</attribute>
-      <attribute name="ClientConnectAddress">${jboss.bind.address}</attribute>
-      <attribute name="ClientConnectPort">0</attribute>
-      <attribute name="ClientRetryCount">1</attribute>
-      <attribute name="EnableTcpNoDelay">false</attribute>
-
-      <!-- Customized socket factory attributes
-      <attribute name="ClientSocketFactoryName">custom.client.factory</attribute>
-      <attribute name="ServerSocketFactoryName">custom.server.factory</attribute>
-      <attribute name="SslDomain">java:/jaas/pooledInvoker</attribute>
-      -->
-      <depends optional-attribute-name="TransactionManagerService">jboss:service=TransactionManager</depends>
-   </mbean>
-
-   <!-- ==================================================================== -->
-   <!-- Monitoring and Management                                            -->
-   <!-- ==================================================================== -->
-
-   <!-- Uncomment to enable JMX monitoring of the bean cache
-   <mbean code="org.jboss.monitor.BeanCacheMonitor"
-          name="jboss.monitor:name=BeanCacheMonitor"/>
-   -->
-
-   <!-- Uncomment to enable JMX monitoring of the entity bean locking
-   <mbean code="org.jboss.monitor.EntityLockMonitor"
-          name="jboss.monitor:name=EntityLockMonitor"/>
-   -->
-
-   <!-- ==================================================================== -->
-   <!-- An MBean that is a registry for JDBC type-mapping metadata           -->
-   <!-- ==================================================================== -->
-
-   <mbean code="org.jboss.ejb.plugins.cmp.jdbc.metadata.MetaDataLibrary"
-      name="jboss.jdbc:service=metadata"/>
-
-   <!-- ==================================================================== -->
-   <!-- Deployment Scanning                                                  -->
-   <!-- ==================================================================== -->
-
-   <!-- An mbean for hot deployment/undeployment of archives.
-   -->
-   <mbean code="org.jboss.deployment.scanner.URLDeploymentScanner"
-      name="jboss.deployment:type=DeploymentScanner,flavor=URL">
-
-      <!-- Uncomment (and comment/remove version below) to enable usage of the
-        DeploymentCache
-      <depends optional-attribute-name="Deployer">jboss.deployment:type=DeploymentCache</depends>
-      -->
-      <depends optional-attribute-name="Deployer">jboss.system:service=MainDeployer</depends>
-
-      <!-- The URLComparator can be used to specify a deployment ordering
-           for deployments found in a scanned directory.  The class specified
-           must be an implementation of java.util.Comparator, it must be able
-           to compare two URL objects, and it must have a no-arg constructor.
-           Two deployment comparators are shipped with JBoss:
-             - org.jboss.deployment.DeploymentSorter
-               Sorts by file extension, as follows:
-                 "sar", "service.xml", "rar", "jar", "war", "wsr", "ear", "zip",
-                 "*"
-             - org.jboss.deployment.scanner.PrefixDeploymentSorter
-               If the name portion of the url begins with 1 or more digits, those
-               digits are converted to an int (ignoring leading zeroes), and
-               files are deployed in that order.  Files that do not start with
-               any digits will be deployed first, and they will be sorted by
-               extension as above with DeploymentSorter.
-      -->
-      <attribute name="URLComparator">org.jboss.deployment.DeploymentSorter</attribute>
-      
-      <!--
-      <attribute name="URLComparator">org.jboss.deployment.scanner.PrefixDeploymentSorter</attribute>
-      -->
-
-      <!-- The FilterInstance specifies a URLLister.URLFilter for scanned
-           directories. This DeploymentFilter is initialized with the given
-           prefixes, suffixes and matches that define which URLs should be
-           ignored.
-      -->
-      <attribute name="FilterInstance"
-         attributeClass="org.jboss.deployment.scanner.DeploymentFilter"
-         serialDataType="javaBean">
-         <!-- Files starting with theses strings are ignored -->
-         <property name="prefixes">#,%,\,,.,_$</property>
-         <!-- Files ending with theses strings are ignored -->
-         <property name="suffixes">#,$,%,~,\,v,.BAK,.bak,.old,.orig,.tmp,.rej,.sh</property>
-         <!-- Files matching with theses strings are ignored -->
-         <property name="matches">.make.state,.nse_depinfo,CVS,CVS.admin,RCS,RCSLOG,SCCS,TAGS,core,tags</property>
-      </attribute>
-
-      <!-- Frequency in milliseconds to rescan the URLs for changes -->
-      <attribute name="ScanPeriod">5000</attribute>
-      
-      <!-- A flag to disable the scans -->
-      <attribute name="ScanEnabled">true</attribute>
-
-      <!-- URLs are comma separated and resolve relative to the server home URL
-         unless the given path is absolute. If the URL ends in "/" it is
-         considered a collection and scanned, otherwise it is simply deployed;
-         this follows RFC2518 convention and allows discrimination between
-         collections and directories that are simply unpacked archives.
-
-         URLs may be local (file:) or remote (http:). Scanning is supported
-         for remote URLs but unpacked deployment units are not.
-
-         Example URLs:
-            deploy/
-                 scans ${jboss.server.url}/deploy/, which is local or remote
-                 depending on the URL used to boot the server
-            ${jboss.server.home}/deploy/
-                 scans ${jboss.server.home)/deploy, which is always local
-            file:/var/opt/myapp.ear
-                 deploy myapp.ear from a local location
-            file:/var/opt/apps/
-                 scans the specified directory
-            http://www.test.com/netboot/myapp.ear
-                 deploys myapp.ear from a remote location
-            http://www.test.com/netboot/apps/
-                 scans the specified WebDAV location
-       -->
-      <attribute name="URLs">
-         deploy/
-      </attribute>
-
-      <!-- Indicates if the scanner should recursively scan directories that
-      contain no "." in their names. This can be used to group applications
-      and services that must be deployed and that have the same
-      logical function in the same directory i.e.
-        deploy/JMX/
-        deploy/JMS/
-        ...
-      -->
-      <attribute name="RecursiveSearch">True</attribute>
-
-   </mbean>
-
-</server>

Copied: branches/Branch_1_0/lib/jbossts/jboss-service.xml (from rev 1684, branches/Branch_1_0_XARecovery/lib/jbossts/jboss-service.xml)

Deleted: branches/Branch_1_0/lib/jbossts/jbossjta-properties.xml
===================================================================
--- branches/Branch_1_0_XARecovery/lib/jbossts/jbossjta-properties.xml	2006-12-02 05:55:38 UTC (rev 1684)
+++ branches/Branch_1_0/lib/jbossts/jbossjta-properties.xml	2006-12-02 14:14:09 UTC (rev 1686)
@@ -1,278 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<transaction-service>
-    <properties depends="common" name="arjuna">
-        <!--
-        Transaction Reaper Timeout (default is 120000 microseconds).
-      -->
-        <property
-            name="com.arjuna.ats.arjuna.coordinator.txReaperTimeout" value="120000"/>
-        <!--
-        Transaction Reaper Mode, can be: NORMAL or DYNAMIC (default is NORMAL).
-      -->
-        <property name="com.arjuna.ats.arjuna.coordinator.txReaperMode" value="NORMAL"/>
-        <!--
-        (default is NO)
-      -->
-        <property name="com.arjuna.ats.arjuna.coordinator.asyncCommit" value="NO"/>
-        <!--
-        (default is NO)
-      -->
-        <property name="com.arjuna.ats.arjuna.coordinator.asyncPrepare" value="NO"/>
-        <!--
-        (default is YES)
-      -->
-        <property
-            name="com.arjuna.ats.arjuna.coordinator.commitOnePhase" value="YES"/>
-        <!--
-        (default is defaultStore)
-      -->
-        <property name="com.arjuna.ats.arjuna.objectstore.localOSRoot" value="defaultStore"/>
-        <!--
-        default is under user.home - must be writeable!)
-      -->
-        <property
-            name="com.arjuna.ats.arjuna.objectstore.objectStoreDir" value="PutObjectStoreDirHere"/>
-        <!--
-        (default is ON)
-      -->
-        <property
-            name="com.arjuna.ats.arjuna.objectstore.objectStoreSync" value="ON"/>
-        <!--
-        (default is ShadowNoFileLockStore)
-      -->
-        <property
-            name="com.arjuna.ats.arjuna.objectstore.objectStoreType" value="ShadowNoFileLockStore"/>
-        <!--
-        (default is 255)
-      -->
-        <property
-            name="com.arjuna.ats.arjuna.objectstore.hashedDirectories" value="255"/>
-        <!--
-        (default is ON)
-      -->
-        <property
-            name="com.arjuna.ats.arjuna.objectstore.transactionSync" value="ON"/>
-        <!--
-        (Must be unique across all Arjuna instances.)
-      -->
-        <property name="com.arjuna.ats.arjuna.xa.nodeIdentifier" value="1"/>
-        <!-- property
-        name="com.arjuna.ats.arjuna.coordinator.actionStore"
-		value="HashedActionStore"
-		value="JDBCActionStore"
-      -->
-        <!-- property
-        name="com.arjuna.ats.arjuna.objectstore.jdbcTxDbAccess"
-		value="JDBCAccess"
-      -->
-        <!-- property
-        name="com.arjuna.ats.arjuna.objectstore.objectStoreType"
-		value="ShadowNoFileLockStore"
-		value="JDBCStore"
-      -->
-        <!-- property
-        name="com.arjuna.ats.arjuna.objectstore.jdbcUserDbAccess"
-		value="JDBCAccess"
-      -->
-        <!-- property
-        name="com.arjuna.ats.arjuna.objectstore.jdbcPoolSizeInitial"
-		value="1"
-      -->
-        <!-- property
-        name="com.arjuna.ats.arjuna.objectstore.jdbcPoolSizeMaximum"
-		value="1"
-      -->
-        <!-- property
-        name="com.arjuna.ats.arjuna.objectstore.jdbcPoolPutConnections"
-		value="false"
-      -->
-        <!-- property
-        name="com.arjuna.ats.arjuna.internal.arjuna.objectstore.cacheStore.size"
-		value=""
-      -->
-        <!-- property
-        name="com.arjuna.ats.arjuna.internal.arjuna.objectstore.cacheStore.period"
-		value=""
-      -->
-        <!--
-        The location for creating temporary files, e.g., Uids.
-        Default is under user.home.
-        IMPORTANT: make sure the directory is lockable, e.g., /tmp on Unix
-        may not be!
-      -->
-        <!--
-        <property
-          name="com.arjuna.ats.arjuna.common.varDir"
-          value="var"/>
-      -->
-    </properties>
-    <properties depends="arjuna" name="recoverymanager">
-        <!--
-        Properties used only by the RecoveryManager.
-      -->
-        <!--
-        Periodic recovery settings.
-        Time values in this section are in seconds.
-      -->
-        <!--
-        Interval in seconds between initiating the periodic recovery modules.
-        Default is 120 seconds.
-      -->
-        <property
-            name="com.arjuna.ats.arjuna.recovery.periodicRecoveryPeriod" value="120"/>
-        <!--
-        Interval in seconds between first and second pass of periodic recovery.
-        Default is 10 seconds.
-      -->
-        <property
-            name="com.arjuna.ats.arjuna.recovery.recoveryBackoffPeriod" value="10"/>
-        
-        <!--
-        Expired entry removal
-      -->
-        <!--
-        Expiry scanners to use (order of invocation is random).
-        Names must begin with "com.arjuna.ats.arjuna.recovery.expiryScanner"
-      -->
-        <property
-            name="com.arjuna.ats.arjuna.recovery.expiryScannerTransactionStatusManager" value="com.arjuna.ats.internal.arjuna.recovery.ExpiredTransactionStatusManagerScanner"/>
-        <!--
-        Interval, in hours, between running the expiry scanners.
-        This can be quite long. The absolute value determines the interval -
-        if the value is negative, the scan will NOT be run until after one
-        interval has elapsed. If positive the first scan will be immediately
-        after startup. Zero will prevent any scanning.
-        Default  = 12 = run immediately, then every 12 hours.
-      -->
-        <property
-            name="com.arjuna.ats.arjuna.recovery.expiryScanInterval" value="12"/>
-        <!--
-        Age, in hours, for removal of transaction status manager item.
-        This should be longer than any ts-using process will remain running.
-        Zero = Never removed.  Default is 12.
-      -->
-        <property
-            name="com.arjuna.ats.arjuna.recovery.transactionStatusManagerExpiryTime" value="12"/>
-        <!--
-        Use this to fix the port on which the TransactionStatusManager listens,
-        The default behaviour is to use any free port.
-      -->
-        <property
-            name="com.arjuna.ats.arjuna.recovery.transactionStatusManagerPort" value="0"/>
-        <!--
-        Properties used only by the RecoveryManager.
-      -->
-        <!--
-        Periodic recovery settings.
-        Time values in this section are in seconds.
-      -->
-        <!--
-        Interval in seconds between initiating the periodic recovery modules.
-        Default is 120 seconds.
-      -->
-        <property
-            name="com.arjuna.ats.arjuna.recovery.periodicRecoveryPeriod" value="120"/>
-        <!--
-        Interval in seconds between first and second pass of periodic recovery.
-        Default is 10 seconds.
-      -->
-        <property
-            name="com.arjuna.ats.arjuna.recovery.recoveryBackoffPeriod" value="10"/>
-        <!--
-        Periodic recovery modules to use.  Invoked in sort-order of names.
-      -->
-        <property
-            name="com.arjuna.ats.arjuna.recovery.recoveryExtension1" value="com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule"/>
-        <!--
-        Expired entry removal
-      -->
-        <!--
-        Expiry scanners to use (order of invocation is random).
-        Names must begin with "com.arjuna.ats.arjuna.recovery.expiryScanner"
-      -->
-        <property
-            name="com.arjuna.ats.arjuna.recovery.expiryScannerTransactionStatusManager" value="com.arjuna.ats.internal.arjuna.recovery.ExpiredTransactionStatusManagerScanner"/>
-        <!--
-        Interval, in hours, between running the expiry scanners.
-        This can be quite long. The absolute value determines the interval -
-        if the value is negative, the scan will NOT be run until after one
-        interval has elapsed. If positive the first scan will be immediately
-        after startup. Zero will prevent any scanning.
-        Default  = 12 = run immediately, then every 12 hours.
-      -->
-        <property
-            name="com.arjuna.ats.arjuna.recovery.expiryScanInterval" value="12"/>
-        <!--
-        Age, in hours, for removal of transaction status manager item.
-        This should be longer than any ts-using process will remain running.
-        Zero = Never removed.  Default is 12.
-      -->
-        <property
-            name="com.arjuna.ats.arjuna.recovery.transactionStatusManagerExpiryTime" value="12"/>
-        <!--
-        Use this to fix the port on which the TransactionStatusManager listens,
-        The default behaviour is to use any free port.
-      -->
-        <property
-            name="com.arjuna.ats.arjuna.recovery.transactionStatusManagerPort" value="0"/>
-    </properties>
-    <properties name="common">
-        <!-- CLF 2.0 properties -->
-        <property name="com.arjuna.common.util.logging.DebugLevel"
-            type="System" value="0x00000000"/>
-        <property name="com.arjuna.common.util.logging.FacilityLevel"
-            type="System" value="0xffffffff"/>
-        <property name="com.arjuna.common.util.logging.VisibilityLevel"
-            type="System" value="0xffffffff"/>
-        <property name="com.arjuna.common.util.logger" type="System" value="log4j"/>
-    </properties>
-    <properties depends="arjuna" name="txoj">
-        <!--
-        (default is LockStore of installation - must be writeable!)
-      -->
-        <!--
-        <property
-          name="com.arjuna.ats.txoj.lockstore.lockStoreDir"
-          value="LockStore"/>
-      -->
-        <!--
-        (default is BasicLockStore)
-      -->
-        <property name="com.arjuna.ats.txoj.lockstore.lockStoreType" value="BasicLockStore"/>
-        <!--
-        (default is NO)
-      -->
-        <property name="com.arjuna.ats.txoj.lockstore.multipleLockStore" value="NO"/>
-        <!--
-        (default is YES)
-      -->
-        <property name="com.arjuna.ats.txoj.lockstore.singleLockStore" value="YES"/>
-        <!--
-        (default is YES)
-      -->
-        <property
-            name="com.arjuna.ats.txoj.lockstore.allowNestedLocking" value="YES"/>
-    </properties>
-    <properties depends="arjuna" name="jta">
-        <property
-            name="com.arjuna.ats.jta.recovery.XAResourceRecovery.JBMESSAGING" value="org.jboss.jms.recovery.JMSProviderXAResourceRecovery"/>
-        <!--
-        Support subtransactions in the JTA layer?
-        Default is NO.
-      -->
-        <property name="com.arjuna.ats.jta.supportSubtransactions" value="NO"/>
-        <property name="com.arjuna.ats.jta.jtaTMImplementation" value="com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple"/>
-        <!--
-			com.arjuna.ats.internal.jta.transaction.jts.TransactionManagerImple
-			-->
-        <property name="com.arjuna.ats.jta.jtaUTImplementation" value="com.arjuna.ats.internal.jta.transaction.arjunacore.UserTransactionImple"/>
-        <!--
-			com.arjuna.ats.internal.jta.transaction.jts.UserTransactionImple
-			-->
-    </properties>
-    <properties depends="jta" name="jdbc">
-        <!--
-           property name="com.arjuna.ats.jdbc.isolationLevel" value="TRANSACTION_SERIALIZABLE"/>
-        -->
-    </properties>
-</transaction-service>

Copied: branches/Branch_1_0/lib/jbossts/jbossjta-properties.xml (from rev 1684, branches/Branch_1_0_XARecovery/lib/jbossts/jbossjta-properties.xml)

Copied: branches/Branch_1_0/src/main/org/jboss/jms/recovery (from rev 1684, branches/Branch_1_0_XARecovery/src/main/org/jboss/jms/recovery)

Deleted: branches/Branch_1_0/src/main/org/jboss/jms/recovery/JMSProviderXAResourceRecovery.java
===================================================================
--- branches/Branch_1_0_XARecovery/src/main/org/jboss/jms/recovery/JMSProviderXAResourceRecovery.java	2006-12-02 05:55:38 UTC (rev 1684)
+++ branches/Branch_1_0/src/main/org/jboss/jms/recovery/JMSProviderXAResourceRecovery.java	2006-12-02 14:14:09 UTC (rev 1686)
@@ -1,100 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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.jms.recovery;
-
-import javax.transaction.xa.XAResource;
-
-import org.jboss.logging.Logger;
-
-import com.arjuna.ats.jta.recovery.XAResourceRecovery;
-
-/**
- * JMS Provider Adapter based recovery.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @author <a href="juha at jboss.com">Juha Lindfors</a>
- *
- * @version $Revision: 1.1 $
- */
-public class JMSProviderXAResourceRecovery implements XAResourceRecovery
-{
-   private boolean trace = log.isTraceEnabled();
-
-	private static final Logger log = Logger.getLogger(JMSProviderXAResourceRecovery.class);
-
-   /** The jms provider name */
-   private String providerName;
-
-   /** The delegate XAResource */
-   private XAResourceWrapper wrapper;
-
-   /** Whether the XAResource is working */
-   private boolean working = false;
-
-   public JMSProviderXAResourceRecovery()
-   {
-      if(trace)
-			log.trace("Constructing JMSProviderXAResourceRecovery..");
-   }
-
-   public boolean initialise(String p)
-   {
-      if(trace)
-			log.trace("Initialising JMSProviderXAResourceRecovery..");
-
-      this.providerName = p;
-      return true;
-   }
-
-   public boolean hasMoreResources()
-   {
-      // If the XAResource is already working
-      if (working)
-         return false;
-
-      // Have we initialized yet?
-      if (wrapper == null)
-      {
-         wrapper = new XAResourceWrapper();
-         wrapper.setProviderName(providerName);
-      }
-
-      // Test the connection
-      try
-      {
-         wrapper.getTransactionTimeout();
-         working = true;
-      }
-      catch (Exception ignored)
-      {
-         //System.out.println(ignored.getMessage());
-      }
-
-      // This will return false until we get a successful connection
-      return working;
-   }
-
-   public XAResource getXAResource()
-   {
-      return wrapper;
-   }
-}

Copied: branches/Branch_1_0/src/main/org/jboss/jms/recovery/JMSProviderXAResourceRecovery.java (from rev 1684, branches/Branch_1_0_XARecovery/src/main/org/jboss/jms/recovery/JMSProviderXAResourceRecovery.java)

Deleted: branches/Branch_1_0/src/main/org/jboss/jms/recovery/MessagingXAResourceRecovery.java
===================================================================
--- branches/Branch_1_0_XARecovery/src/main/org/jboss/jms/recovery/MessagingXAResourceRecovery.java	2006-12-02 05:55:38 UTC (rev 1684)
+++ branches/Branch_1_0/src/main/org/jboss/jms/recovery/MessagingXAResourceRecovery.java	2006-12-02 14:14:09 UTC (rev 1686)
@@ -1,133 +0,0 @@
-package org.jboss.jms.recovery;
-
-import java.sql.SQLException;
-import javax.jms.XAConnection;
-import javax.jms.XAConnectionFactory;
-import javax.jms.XASession;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.transaction.xa.XAResource;
-
-import org.jboss.logging.Logger;
-
-import com.arjuna.ats.jta.recovery.XAResourceRecovery;
-
-public class MessagingXAResourceRecovery implements XAResourceRecovery {
-
-	private boolean trace = log.isTraceEnabled();
-
-	private static final Logger log = Logger.getLogger(MessagingXAResourceRecovery.class);
-
-	private boolean working = false;
-
-	private XAResource xaRes = null;
-
-	private String xaConnFactory = null;
-
-	public MessagingXAResourceRecovery() {
-	}
-
-	public XAResource getXAResource() throws SQLException {
-		if(trace)
-			log.trace("returning the xaresource "+xaRes);
-		return xaRes;
-	}
-
-	/**
-	 * This method returns the Messaging XAResource reference.
-	 * You have to pass the jndi name of the XAConnectionFactory
-	 * via the JBossTS RecoveryManager's properties
-	 * @return
-	 */
-	public XAResource initXAResource() {
-		if(trace)
-			log.trace("Initialising xaresource..");
-		try {
-			Context ctx = new InitialContext();
-
-			XAConnectionFactory cf = (XAConnectionFactory) ctx
-					.lookup(xaConnFactory);
-
-			XAConnection xaConn = cf.createXAConnection();
-
-			XASession session = xaConn.createXASession();
-			xaRes = session.getXAResource();
-
-			if(trace)
-				log.trace("Found the xares: "+xaRes);
-
-		} catch (Exception e) {
-			// You may get this exception when the messaging server
-			// is not fully booted up. Nothing to worry, it'll keep
-			// trying until successful.
-			log.warn("XAConnectionFactory is not found. \n" +
-					"The messaging server is not yet initialized.\n" +
-					"we'll try again once server is fully back");
-
-		}
-
-		return xaRes;
-	}
-
-	/**
-	 * This method is used to pass any
-	 * intialisation parameters to this
-	 * class
-	 * @param param
-	 * @return
-	 * @throws SQLException
-	 */
-	public boolean initialise(String param) throws SQLException
-  {
-		if(trace)
-			log.trace("Passed in parameter: "+param);
-
-		if(param != null)
-		{
-			// parama is in the form of name=value
-			String value = param.substring(param.indexOf("=")+1);
-
-			if(trace)
-				log.trace("The connection factory is "+value);
-
-      xaConnFactory = value;
-		}
-		else
-		{
-			log.debug("The XA connection factory parameter is null. " +
-					"Using the default 'XAConnectionFactory'");
-
-      xaConnFactory = "XAConnectionFactory";
-		}
-		return true;
-	}
-
-	/**
-	 * This method checks whether there's an xa resource available
-	 *
-	 * @return
-	 */
-	public boolean hasMoreResources() {
-
-		if (working)
-			return false;
-
-		if (xaRes == null) {
-			xaRes = initXAResource();
-		}
-
-		// test the resource
-		try {
-
-			xaRes.getTransactionTimeout();
-
-			working = true;
-
-		} catch (Exception ignored) {
-
-			// ignore this exception
-		}
-
-		return working;
-	}
-}

Copied: branches/Branch_1_0/src/main/org/jboss/jms/recovery/MessagingXAResourceRecovery.java (from rev 1684, branches/Branch_1_0_XARecovery/src/main/org/jboss/jms/recovery/MessagingXAResourceRecovery.java)

Modified: branches/Branch_1_0/src/main/org/jboss/jms/server/ServerPeer.java
===================================================================
--- branches/Branch_1_0/src/main/org/jboss/jms/server/ServerPeer.java	2006-12-02 13:36:20 UTC (rev 1685)
+++ branches/Branch_1_0/src/main/org/jboss/jms/server/ServerPeer.java	2006-12-02 14:14:09 UTC (rev 1686)
@@ -69,6 +69,8 @@
  *
  * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:juha at jboss.org">Juha Lindfors</a>
+ * 
  * @version <tt>$Revision$</tt>
  *
  * $Id$
@@ -218,7 +220,7 @@
          destinationJNDIMapper.start();
          securityStore.start();
          connFactoryJNDIMapper.start();
-         txRepository.start(persistenceManagerDelegate);
+         txRepository.start(persistenceManagerDelegate, messageStoreDelegate);
          txRepository.loadPreparedTransactions();
          
          //TODO Make block size configurable

Modified: branches/Branch_1_0/src/main/org/jboss/jms/tx/MessagingXAResource.java
===================================================================
--- branches/Branch_1_0/src/main/org/jboss/jms/tx/MessagingXAResource.java	2006-12-02 13:36:20 UTC (rev 1685)
+++ branches/Branch_1_0/src/main/org/jboss/jms/tx/MessagingXAResource.java	2006-12-02 14:14:09 UTC (rev 1686)
@@ -28,6 +28,7 @@
 import org.jboss.jms.client.state.SessionState;
 import org.jboss.jms.delegate.ConnectionDelegate;
 import org.jboss.logging.Logger;
+import org.jboss.messaging.core.tx.XidImpl;
 
 /**
  * An XAResource implementation.
@@ -38,6 +39,7 @@
  * 
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
  * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @author <a href="mailto:juha at jboss.org">Juha Lindfors</a>
  * 
  * Parts based on JBoss MQ XAResource implementation by:
  * 
@@ -112,7 +114,12 @@
    public void commit(Xid xid, boolean onePhase) throws XAException
    {
       if (trace) { log.trace(this + " committing " + xid + (onePhase ? " (one phase)" : " (two phase)")); }
-      
+
+      // Recreate Xid. See JBMESSAGING-661 [JPL]
+
+      if (!(xid instanceof XidImpl))
+         xid = new XidImpl(xid.getBranchQualifier(), xid.getFormatId(), xid.getGlobalTransactionId());
+
       rm.commit(xid, onePhase, connection);
 
       // leave the session in a 'clean' state, the currentTxId will be set when the XAResource will
@@ -125,6 +132,11 @@
    {
       if (trace) { log.trace(this + " ending " + xid + ", flags: " + flags); }
 
+      // Recreate Xid. See JBMESSAGING-661 [JPL]
+
+      if (!(xid instanceof XidImpl))
+         xid = new XidImpl(xid.getBranchQualifier(), xid.getFormatId(), xid.getGlobalTransactionId());
+
       synchronized (this)
       {
          switch (flags)
@@ -148,11 +160,22 @@
    public void forget(Xid xid) throws XAException
    {
       if (trace) { log.trace(this + " forgetting " + xid + " (currently an NOOP)"); }
+
+      // Recreate Xid. See JBMESSAGING-661 [JPL]
+
+      if (!(xid instanceof XidImpl))
+         xid = new XidImpl(xid.getBranchQualifier(), xid.getFormatId(), xid.getGlobalTransactionId());
    }
 
    public int prepare(Xid xid) throws XAException
    {
       if (trace) { log.trace(this + " preparing " + xid); }
+
+      // Recreate Xid. See JBMESSAGING-661 [JPL]
+
+      if (!(xid instanceof XidImpl))
+         xid = new XidImpl(xid.getBranchQualifier(), xid.getFormatId(), xid.getGlobalTransactionId());
+
       return rm.prepare(xid, connection);
    }
 
@@ -167,6 +190,11 @@
    {
       if (trace) { log.trace(this + " rolling back " + xid); }
 
+      // Recreate Xid. See JBMESSAGING-661 [JPL]
+
+      if (!(xid instanceof XidImpl))
+         xid = new XidImpl(xid.getBranchQualifier(), xid.getFormatId(), xid.getGlobalTransactionId());
+
       // TODO Hmmm on rollback should we also stop and start the consumers to remove any transient
       // messages, like we do on local session rollback??
       
@@ -177,6 +205,11 @@
    {
       if (trace) { log.trace(this + " starting " + xid + ", flags: " + flags); }
       
+      // Recreate Xid. See JBMESSAGING-661 [JPL]
+
+      if (!(xid instanceof XidImpl))
+         xid = new XidImpl(xid.getBranchQualifier(), xid.getFormatId(), xid.getGlobalTransactionId());
+
       boolean convertTx = false;
       
       if (sessionState.getCurrentTxId() != null)

Modified: branches/Branch_1_0/src/main/org/jboss/jms/tx/ResourceManager.java
===================================================================
--- branches/Branch_1_0/src/main/org/jboss/jms/tx/ResourceManager.java	2006-12-02 13:36:20 UTC (rev 1685)
+++ branches/Branch_1_0/src/main/org/jboss/jms/tx/ResourceManager.java	2006-12-02 14:14:09 UTC (rev 1686)
@@ -49,7 +49,9 @@
  * This is one instance of ResourceManager per JMS server. The ResourceManager instances are managed
  * by ResourceManagerFactory.
  * 
- * @author <a href="mailto:tim.fox at jboss.com>Tim Fox</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:Konda.Madhu at uk.mizuho-sc.com">Madhu Konda</a>
+ * @author <a href="mailto:juha at jboss.org">Juha Lindfors</a>
  * 
  * Parts adapted from SpyXAResourceManager by:
  *
@@ -127,8 +129,6 @@
     * 
     * @param xid - The id of the transaction to add the message to
     * @param ackInfo Information describing the acknowledgement
-    * @param sessionState - the session the ack is in - we need this so on rollback we can tell each session
-    * to redeliver it's messages
     */
    public void addAck(Object xid, AckInfo ackInfo) throws JMSException
    {
@@ -452,6 +452,17 @@
          try
          {
             Xid[] txs = conn.getPreparedTransactions();
+
+            //populate with TxState --MK
+            for(int i = 0; i < txs.length;i++)
+            {
+               TxState tx = new TxState();
+
+               tx.setState(TxState.TX_PREPARED);
+
+               transactions.put(txs[i], tx);
+            }
+
             return txs;
          }
          catch (JMSException e)

Modified: branches/Branch_1_0/src/main/org/jboss/jms/tx/TransactionRequest.java
===================================================================
--- branches/Branch_1_0/src/main/org/jboss/jms/tx/TransactionRequest.java	2006-12-02 13:36:20 UTC (rev 1685)
+++ branches/Branch_1_0/src/main/org/jboss/jms/tx/TransactionRequest.java	2006-12-02 14:14:09 UTC (rev 1686)
@@ -31,7 +31,7 @@
 import org.jboss.messaging.core.tx.XidImpl;
 
 /**
- * This class contians all the data needed to perform a JMS transaction.
+ * This class contains all the data needed to perform a JMS transaction.
  * 
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
  * 

Modified: branches/Branch_1_0/src/main/org/jboss/messaging/core/plugin/JDBCPersistenceManager.java
===================================================================
--- branches/Branch_1_0/src/main/org/jboss/messaging/core/plugin/JDBCPersistenceManager.java	2006-12-02 13:36:20 UTC (rev 1685)
+++ branches/Branch_1_0/src/main/org/jboss/messaging/core/plugin/JDBCPersistenceManager.java	2006-12-02 14:14:09 UTC (rev 1686)
@@ -66,6 +66,7 @@
 import org.jboss.messaging.core.tx.Transaction;
 import org.jboss.messaging.core.tx.TxCallback;
 import org.jboss.messaging.core.tx.XidImpl;
+import org.jboss.messaging.core.tx.PreparedTxInfo;
 import org.jboss.messaging.util.Util;
 import org.jboss.serial.io.JBossObjectInputStream;
 import org.jboss.serial.io.JBossObjectOutputStream;
@@ -81,6 +82,8 @@
  * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
  * @author <a href="mailto:adrian at jboss.org">Adrian Brock</a>
+ * @author <a href="mailto:Konda.Madhu at uk.mizuho-sc.com">Madhu Konda</a>
+ * @author <a href="mailto:juha at jboss.org">Juha Lindfors</a>
  *
  * @version <tt>1.1</tt>
  *
@@ -210,7 +213,16 @@
    
    protected String selectAllChannels = "SELECT DISTINCT(CHANNELID) FROM JMS_MESSAGE_REFERENCE";
    
-        
+   //RECOVERY --MK
+   protected String selectMessageIdForRef = "SELECT MESSAGEID FROM JMS_MESSAGE_REFERENCE "
+	      + "WHERE TRANSACTIONID = ? AND STATE = '+' ";
+
+   protected String selectMessageIdForAck = "SELECT MESSAGEID FROM JMS_MESSAGE_REFERENCE "
+	      + "WHERE TRANSACTIONID = ? AND STATE = '-' ";
+
+   protected String selectChannelId = "SELECT CHANNELLID FROM JMS_MESSAGE_REFERENCE "
+	      + "WHERE TRANSACTIONID = ?";
+
    // Static --------------------------------------------------------
    
    // Attributes ----------------------------------------------------
@@ -619,8 +631,117 @@
       }
    }
    
-   
-   
+   public ChannelMapper getChannelMapperReference()
+   {
+	   return cm;
+   }
+
+   public long getMessageIdForRef(long transactionId) throws Exception
+   {
+	   return getId(selectMessageIdForRef, transactionId, 1);
+   }
+   public long getMessageIdForAck(long transactionId) throws Exception
+   {
+	   return getId(selectMessageIdForAck, transactionId, 1);
+   }
+
+   public long getChannelId(long transactionId) throws Exception
+   {
+	   return getId(selectChannelId, transactionId, 1);
+   }
+
+
+   /**
+    * This method associates a TransactionCallback to the
+    * resurrected transaction. This method is called from
+    * the TransactionRepository once a transaction object
+    * is resurrected.
+    */
+   public void associateTxCallbackToPreparedTx(Transaction tx)
+   {
+	  TransactionCallback callback = (TransactionCallback) tx.getKeyedCallback(this);
+
+      if (callback == null)
+      {
+         callback = new TransactionCallback(tx);
+
+         tx.addKeyedCallback(callback, this);
+      }
+   }
+
+   /**
+    * MK
+    * Load the message refs for the corresponding tx id
+    */
+   public long getId(String sqlQuery, long transactionId, int index) throws Exception
+   {
+      if (trace) { log.trace("loading references for tx [" + transactionId + "]"); }
+
+      Connection conn = null;
+      PreparedStatement ps = null;
+      ResultSet rs = null;
+      TransactionWrapper wrap = new TransactionWrapper();
+      long messageId = 0;
+
+      try
+      {
+         conn = ds.getConnection();
+
+         ps = conn.prepareStatement(sqlQuery);
+
+         ps.setLong(1, transactionId);
+
+         rs = ps.executeQuery();
+
+         while(rs.next())
+         {
+        	   messageId = rs.getLong(index);
+         }
+
+         return messageId;
+      }
+      catch (Exception e)
+      {
+         wrap.exceptionOccurred();
+         throw e;
+      }
+      finally
+      {
+         if (rs != null)
+         {
+            try
+            {
+               rs.close();
+            }
+            catch (Throwable e)
+            {
+            }
+         }
+         if (ps != null)
+         {
+            try
+            {
+               ps.close();
+            }
+            catch (Throwable e)
+            {
+            }
+         }
+         if (conn != null)
+         {
+            try
+            {
+               conn.close();
+            }
+            catch (Throwable e)
+            {
+            }
+         }
+         wrap.end();
+      }
+   }
+
+
    /*
     * Retrieve a List of messages corresponding to the specified List of message ids.
     * The implementation here for HSQLDB does this by using a PreparedStatment with an IN clause
@@ -2030,35 +2151,43 @@
 //   }
    
    
-   
    public List retrievePreparedTransactions() throws Exception
    {
+      /* Note the API change for 1.0.2 XA Recovery -- List now contains instances of PreparedTxInfo<TxId, Xid>
+       * instead of direct Xids [JPL] */
+
       Connection conn = null;
       Statement st = null;
       ResultSet rs = null;
+      PreparedTxInfo txInfo = null;
       TransactionWrapper wrap = new TransactionWrapper();
-      
+
       try
       {
          List transactions = new ArrayList();
-         
+
          conn = ds.getConnection();
-         
+
          st = conn.createStatement();
          rs = st.executeQuery(selectPreparedTransactions);
-         
+
          while (rs.next())
          {
+           	//get the existing tx id --MK START
+            long txId = rs.getLong(1);
+
             byte[] branchQual = rs.getBytes(2);
             int formatId = rs.getInt(3);
             byte[] globalTxId = rs.getBytes(4);
             Xid xid = new XidImpl(branchQual, formatId, globalTxId);
-            
-            transactions.add(xid);
+
+            // create a tx info object with the result set detailsdetails
+            txInfo = new PreparedTxInfo(txId, xid);
+            transactions.add(txInfo);
          }
-         
+
          return transactions;
-         
+
       }
       catch (Exception e)
       {
@@ -2100,35 +2229,35 @@
          wrap.end();
       }
    }
-   
+
    /*
-    
+
     Reference counting code commented out until 1.2
-    
+
     public int getMessageReferenceCount(Serializable messageID) throws Exception
     {
     Connection conn = null;
     PreparedStatement ps = null;
     ResultSet rs = null;
     TransactionWrapper wrap = new TransactionWrapper();
-    
+
     try
     {
     conn = ds.getConnection();
-    
+
     ps = conn.prepareStatement(selectReferenceCount);
     ps.setString(1, (String)messageID);
-    
+
     rs = ps.executeQuery();
-    
+
     int count = 0;
     if (rs.next())
     {
     count = rs.getInt(1);
     }
-    
+
     if (trace) { log.trace(JDBCUtil.statementToString(selectReferenceCount, messageID) + " returned " + (count == 0 ? "no rows" : Integer.toString(count))); }
-    
+
     return count;
     }
     catch (Exception e)
@@ -2168,7 +2297,7 @@
     wrap.end();
     }
     }
-    
+
     */
    
    // Public --------------------------------------------------------
@@ -2497,6 +2626,11 @@
       
       //Other
       selectAllChannels = sqlProperties.getProperty("SELECT_ALL_CHANNELS", selectAllChannels);
+
+      //recovery
+      selectMessageIdForRef = sqlProperties.getProperty("SELECT_MESSAGEID_FOR_REFS",selectMessageIdForRef);
+      selectMessageIdForAck = sqlProperties.getProperty("SELECT_MESSAGEID_FOR_ACKS",selectMessageIdForAck);
+      selectChannelId  = sqlProperties.getProperty("SELECT_CHANNEL_ID",selectChannelId );
    }
    
    protected TransactionCallback getCallback(Transaction tx)
@@ -3817,9 +3951,8 @@
          ps.setBytes(2, xid.getBranchQualifier());
          ps.setInt(3, formatID);
          ps.setBytes(4, xid.getGlobalTransactionId());
-         
+
          rows = ps.executeUpdate();
-         
       }
       finally
       {

Modified: branches/Branch_1_0/src/main/org/jboss/messaging/core/plugin/contract/MessageStore.java
===================================================================
--- branches/Branch_1_0/src/main/org/jboss/messaging/core/plugin/contract/MessageStore.java	2006-12-02 13:36:20 UTC (rev 1685)
+++ branches/Branch_1_0/src/main/org/jboss/messaging/core/plugin/contract/MessageStore.java	2006-12-02 14:14:09 UTC (rev 1686)
@@ -29,7 +29,7 @@
    /**
     * A non-recoverable message store cannot guarantee recoverability for reliable messages so by
     * default it won't accept reliable messages. If specifically configured to do so, it must
-    * unequivocally indicates that it accepts reliable messages by returning true as result of this
+    * unequivocally indicate that it accepts reliable messages by returning true as result of this
     * method.
     *
     * A recoverable message store must always accept reliable messages, so this method must always

Modified: branches/Branch_1_0/src/main/org/jboss/messaging/core/plugin/contract/PersistenceManager.java
===================================================================
--- branches/Branch_1_0/src/main/org/jboss/messaging/core/plugin/contract/PersistenceManager.java	2006-12-02 13:36:20 UTC (rev 1685)
+++ branches/Branch_1_0/src/main/org/jboss/messaging/core/plugin/contract/PersistenceManager.java	2006-12-02 14:14:09 UTC (rev 1686)
@@ -25,23 +25,33 @@
 
 import org.jboss.messaging.core.MessageReference;
 import org.jboss.messaging.core.tx.Transaction;
+import org.jboss.jms.server.plugin.contract.ChannelMapper;
 
 /**
  * The interface to the persistence manager
  *
  * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:Konda.Madhu at uk.mizuho-sc.com">Madhu Konda</a>
+ *
  * @version <tt>1.1</tt>
  *
  * PersistenceManager.java,v 1.1 2006/02/22 17:33:42 timfox Exp
  */
 public interface PersistenceManager extends ServerPlugin
 {
-   /*
-    * Currently unused but will be used for XA recovery
-    */
    List retrievePreparedTransactions() throws Exception;
-      
+
+   ChannelMapper getChannelMapperReference();
+
+   long getMessageIdForRef(long transactionId) throws Exception;
+
+   long getMessageIdForAck(long transactionId) throws Exception;
+
+   long getChannelId(long transactionId) throws Exception;
+
+	void associateTxCallbackToPreparedTx(Transaction tx);
+
    void resetLoadedStatus(long channelID) throws Exception;
       
    void addReference(long channelID, MessageReference ref, Transaction tx) throws Exception;

Copied: branches/Branch_1_0/src/main/org/jboss/messaging/core/tx/PreparedTxInfo.java (from rev 1684, branches/Branch_1_0_XARecovery/src/main/org/jboss/messaging/core/tx/PreparedTxInfo.java)

Modified: branches/Branch_1_0/src/main/org/jboss/messaging/core/tx/TransactionRepository.java
===================================================================
--- branches/Branch_1_0/src/main/org/jboss/messaging/core/tx/TransactionRepository.java	2006-12-02 13:36:20 UTC (rev 1685)
+++ branches/Branch_1_0/src/main/org/jboss/messaging/core/tx/TransactionRepository.java	2006-12-02 14:14:09 UTC (rev 1686)
@@ -25,11 +25,20 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-
 import javax.transaction.xa.Xid;
 
+import org.jboss.jms.destination.JBossDestination;
+import org.jboss.jms.server.plugin.JDBCChannelMapper;
+import org.jboss.jms.server.plugin.contract.ChannelMapper;
 import org.jboss.logging.Logger;
+import org.jboss.messaging.core.Delivery;
+import org.jboss.messaging.core.DeliveryObserver;
+import org.jboss.messaging.core.Message;
+import org.jboss.messaging.core.MessageReference;
+import org.jboss.messaging.core.SimpleDelivery;
+import org.jboss.messaging.core.local.CoreDestination;
 import org.jboss.messaging.core.plugin.IdManager;
+import org.jboss.messaging.core.plugin.contract.MessageStore;
 import org.jboss.messaging.core.plugin.contract.PersistenceManager;
 
 import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap;
@@ -39,6 +48,9 @@
  * This class maintains JMS Server local transactions.
  * 
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:Konda.Madhu at uk.mizuho-sc.com">Madhu Konda</a>
+ * @author <a href="mailto:juha at jboss.org">Juha Lindfors</a>
+ *
  * @version $Revision 1.1 $
  *
  * $Id$
@@ -56,7 +68,9 @@
    protected Map globalToLocalMap;     
    
    protected PersistenceManager persistenceManager;
-   
+
+   protected MessageStore messageStore;
+
    protected IdManager idManager;
 
    // Static --------------------------------------------------------
@@ -70,10 +84,11 @@
    
    // Public --------------------------------------------------------
 
-   public void start(PersistenceManager persistenceManager) throws Exception
+   public void start(PersistenceManager persistenceManager, MessageStore store) throws Exception
    {
       this.persistenceManager = persistenceManager;
-      
+      this.messageStore = store;
+
       //TODO make this configurable
       idManager = new IdManager("TRANSACTION_ID", 4096, persistenceManager);
    }
@@ -82,48 +97,77 @@
    {
    }
 
-   public List getPreparedTransactions()
+	public List getPreparedTransactions()
    {
-      ArrayList prepared = new ArrayList();
-      Iterator iter = globalToLocalMap.values().iterator();
-      while (iter.hasNext())
+		ArrayList prepared = new ArrayList();
+
+		Iterator iter = globalToLocalMap.values().iterator();
+
+		while (iter.hasNext())
       {
-         Transaction tx = (Transaction)iter.next();
-         if (tx.xid != null && tx.getState() == Transaction.STATE_PREPARED)
+			Transaction tx = (Transaction) iter.next();
+
+			if (tx.xid != null && tx.getState() == Transaction.STATE_PREPARED)
          {
-            prepared.add(tx.getXid());
-         }
-      }
-      return prepared;
-   }
-   
-   /*
-    * Load any prepared transactions into the repository so they can be recovered
-    */
-   public void loadPreparedTransactions() throws Exception
+            try
+            {
+               if(trace)
+                  log.trace("Loading and handling refs and acks to the Tx "+tx);
+
+               handleReferences(tx, tx.getId());
+               handleAcks(tx, tx.getId());
+            }
+            catch (Exception e)
+            {
+               log.debug("Exception in replaying a prepared transaction.", e);
+            }
+
+				prepared.add(tx.getXid());
+			}
+		}
+
+		return prepared;
+	}
+
+	/*
+	 * Load any prepared transactions into the repository so they can be
+	 * recovered
+	 */
+	public void loadPreparedTransactions() throws Exception
    {
-      List prepared = null;
-            
-      prepared = persistenceManager.retrievePreparedTransactions();
-      
-      if (prepared != null)
-      {         
-         Iterator iter = prepared.iterator();
-         
-         while (iter.hasNext())
-         {
-            Xid xid = (Xid)iter.next();
-            Transaction tx = createTransaction(xid);            
-            tx.state = Transaction.STATE_PREPARED;
-            
-            //Load the references for this transaction
-         }
-      }
-   }
-         
+		List prepared = null;
+
+		prepared = persistenceManager.retrievePreparedTransactions();
+
+		if (prepared != null) {
+			Iterator iter = prepared.iterator();
+
+			while (iter.hasNext()) {
+				PreparedTxInfo txInfo = (PreparedTxInfo) iter.next();
+
+				Transaction tx = createTransaction(txInfo);
+				tx.state = Transaction.STATE_PREPARED;
+
+				// // we have to associate a callback to the prepared
+				// transaction
+				// // --MK
+				persistenceManager.associateTxCallbackToPreparedTx(tx);
+				// log.info(">>>ASSOCIATING THE MEMCALLBACK <<<");
+
+            // TODO: [JPL] needs to be completed.
+
+            // associateInMemoryCallbackToPreparedTx(tx);
+				// Load the references for this transaction
+
+			}
+		}
+	}
+
+
    public Transaction getPreparedTx(Xid xid) throws Exception
    {
       Transaction tx = (Transaction)globalToLocalMap.get(xid);
+
       if (tx == null)
       {
          throw new TransactionException("Cannot find local tx for xid:" + xid);
@@ -150,7 +194,7 @@
 		   throw new TransactionException("Transaction with xid " + id + " can't be removed as it's not yet commited or rolledback: (Current state is " + Transaction.stateToString(state));
 	   }
 	   
-	   globalToLocalMap.remove(id);  
+	   globalToLocalMap.remove(id);
    }
    
    public Transaction createTransaction(Xid xid) throws Exception
@@ -175,8 +219,8 @@
 
       return tx;
    }
-   
-   
+
+
    /** To be used only by testcases */
    public int getNumberOfRegisteredTransactions()
    {
@@ -188,7 +232,138 @@
    // Protected -----------------------------------------------------         
    
    // Private -------------------------------------------------------
-   
+
+	/**
+	 * Load the references and invoke the channel to handle those refs
+	 */
+	private void handleReferences(Transaction tx, long txId) throws Exception {
+
+		long messageId = persistenceManager.getMessageIdForRef(txId);
+
+		List refsList = getRefs(messageId);
+
+		// now we got all the refs
+		// for each ref loaded, we'll invoke channel.handle
+		for (Iterator iter = refsList.iterator(); iter.hasNext();)
+		{
+			CoreDestination d = getChannel(persistenceManager.getChannelId(txId), txId);
+
+         if (trace)
+			   log.trace("Handling the channel");
+
+         d.handle(null, (MessageReference) iter.next(), tx);
+		}
+	}
+
+	/**
+	 * Load the acks and acknowledge them
+	 */
+	private void handleAcks(Transaction tx, long txId) throws Exception {
+
+		long messageId = persistenceManager.getMessageIdForAck(txId);
+
+		List refsList = getRefs(messageId);
+
+		for (Iterator iter = refsList.iterator(); iter.hasNext();)
+		{
+			Delivery del = new SimpleDelivery(null, (MessageReference) iter.next());
+
+			try
+         {
+				if(trace)
+					log.trace("Acknowledging..");
+
+				((DeliveryObserver)del).acknowledge(del, tx);
+			}
+         catch (Throwable e)
+         {
+				log.debug("Acknowledgement failed.", e);
+			}
+		}
+	}
+
+	/**
+	 * Get the message references based on the messageId from database
+	 */
+	private List getRefs(long messageId) throws Exception
+	{
+		List noRefsList = new ArrayList();
+		List refsList = new ArrayList();
+
+		// and message reference from store
+		MessageReference ref = messageStore.reference(messageId);
+
+		// Store, sometime, does'nt know about the message referece
+		// and the above ref may be null. Hence we need to load actual message
+		// by goind back to the database and loading them based on id
+
+		if (ref == null)
+		{
+			noRefsList.add(new Long(messageId));
+		}
+		else
+		{
+			refsList.add(ref);
+		}
+
+		// ask the pm to get the messages from messageId list
+		List messagesList = persistenceManager.getMessages(noRefsList);
+
+		for (Iterator iter = messagesList.iterator(); iter.hasNext();)
+		{
+			Message m = (Message) iter.next();
+			MessageReference r = messageStore.reference(m);
+			refsList.add(r);
+		}
+
+		return refsList;
+	}
+
+	/**
+	 * This method returns a core destination representation based on
+	 * the channel id and transaction id
+	 */
+	private CoreDestination getChannel(long channelId, long txId)
+			throws Exception {
+
+		// first get the reference to the channel mapper
+		ChannelMapper mapper = persistenceManager.getChannelMapperReference();
+
+		// find out the destination from channelId
+		JBossDestination destn = ((JDBCChannelMapper)mapper).getJBossDestination(channelId);
+
+		// get the core destination from jbossdestination
+		return mapper.getCoreDestination(destn);
+
+	}
+
+	/**
+	 * Creates a prepared transaction
+	 *
+	 * @param txInfo
+	 * @return
+	 * @throws Exception
+	 */
+	private Transaction createTransaction(PreparedTxInfo txInfo) throws Exception
+   {
+		if (globalToLocalMap.containsKey(txInfo.getXid()))
+      {
+			throw new TransactionException(
+					"There is already a local tx for global tx "	+ txInfo.getXid());
+		}
+
+		// Resurrected tx
+		Transaction tx = new Transaction(txInfo.getTxId(), txInfo.getXid(), this);
+
+		if (trace) {
+			log.trace("created transaction " + tx);
+		}
+
+		globalToLocalMap.put(txInfo.getXid(), tx);
+
+		return tx;
+	}
+
    // Inner classes -------------------------------------------------
    
 }
\ No newline at end of file

Modified: branches/Branch_1_0/tests/build.xml
===================================================================
--- branches/Branch_1_0/tests/build.xml	2006-12-02 13:36:20 UTC (rev 1685)
+++ branches/Branch_1_0/tests/build.xml	2006-12-02 14:14:09 UTC (rev 1686)
@@ -176,6 +176,7 @@
       <path refid="test.compilation.classpath"/>
       <path refid="dom4j.dom4j.classpath"/>
       <path refid="apache.log4j.classpath"/>
+      <path refid="apache.logging.classpath"/>
       <path refid="apache.xerces.classpath"/>
       <path refid="jboss.mbeans.classpath"/>
       <path refid="jboss.naming.classpath"/>

Modified: branches/Branch_1_0/tests/src/org/jboss/test/messaging/core/SimpleDeliveryTest.java
===================================================================
--- branches/Branch_1_0/tests/src/org/jboss/test/messaging/core/SimpleDeliveryTest.java	2006-12-02 13:36:20 UTC (rev 1685)
+++ branches/Branch_1_0/tests/src/org/jboss/test/messaging/core/SimpleDeliveryTest.java	2006-12-02 14:14:09 UTC (rev 1686)
@@ -26,6 +26,7 @@
 import org.jboss.messaging.core.DeliveryObserver;
 import org.jboss.messaging.core.SimpleDelivery;
 import org.jboss.messaging.core.plugin.JDBCPersistenceManager;
+import org.jboss.messaging.core.plugin.SimpleMessageStore;
 import org.jboss.messaging.core.plugin.contract.PersistenceManager;
 import org.jboss.messaging.core.tx.Transaction;
 import org.jboss.messaging.core.tx.TransactionRepository;
@@ -95,7 +96,7 @@
       
       TransactionRepository tr = new TransactionRepository();
       
-      tr.start(pm);
+      tr.start(pm, new SimpleMessageStore("test.store"));
       
       Transaction tx = tr.createTransaction();
       

Modified: branches/Branch_1_0/tests/src/org/jboss/test/messaging/core/base/ChannelTestBase.java
===================================================================
--- branches/Branch_1_0/tests/src/org/jboss/test/messaging/core/base/ChannelTestBase.java	2006-12-02 13:36:20 UTC (rev 1685)
+++ branches/Branch_1_0/tests/src/org/jboss/test/messaging/core/base/ChannelTestBase.java	2006-12-02 14:14:09 UTC (rev 1686)
@@ -106,10 +106,11 @@
       
       ((JDBCPersistenceManager)msPersistenceManagerDelegate).start();
       
-      tr.start(this.msPersistenceManagerDelegate);
-      
       ms = new SimpleMessageStore("s47");
 
+      tr.start(this.msPersistenceManagerDelegate, ms);
+      
+
    }
 
    public void tearDown() throws Exception

Modified: branches/Branch_1_0/tests/src/org/jboss/test/messaging/core/distributed/queue/RecoverableDistributedQueueTest.java
===================================================================
--- branches/Branch_1_0/tests/src/org/jboss/test/messaging/core/distributed/queue/RecoverableDistributedQueueTest.java	2006-12-02 13:36:20 UTC (rev 1685)
+++ branches/Branch_1_0/tests/src/org/jboss/test/messaging/core/distributed/queue/RecoverableDistributedQueueTest.java	2006-12-02 14:14:09 UTC (rev 1686)
@@ -83,7 +83,7 @@
       channel3 = new DistributedQueue("test", ms3, tl3, dispatcher3);
 
       // initialize the transaction repository with the new transaction log
-      tr.start(tl);
+      tr.start(tl, ms);
 
       log.debug("setup done");
    }

Modified: branches/Branch_1_0/tests/src/org/jboss/test/messaging/core/local/RecoverableQueueTest.java
===================================================================
--- branches/Branch_1_0/tests/src/org/jboss/test/messaging/core/local/RecoverableQueueTest.java	2006-12-02 13:36:20 UTC (rev 1685)
+++ branches/Branch_1_0/tests/src/org/jboss/test/messaging/core/local/RecoverableQueueTest.java	2006-12-02 14:14:09 UTC (rev 1686)
@@ -61,7 +61,7 @@
       channel = new Queue(1, ms, pm, null, true, 100, 20, 10, new QueuedExecutor());
 
       
-      tr.start(pm);
+      tr.start(pm, ms);
    }
 
    public void tearDown() throws Exception

Modified: branches/Branch_1_0/tests/src/org/jboss/test/messaging/core/local/RecoverableSubscriptionTest.java
===================================================================
--- branches/Branch_1_0/tests/src/org/jboss/test/messaging/core/local/RecoverableSubscriptionTest.java	2006-12-02 13:36:20 UTC (rev 1685)
+++ branches/Branch_1_0/tests/src/org/jboss/test/messaging/core/local/RecoverableSubscriptionTest.java	2006-12-02 14:14:09 UTC (rev 1686)
@@ -63,7 +63,7 @@
 
       ms = new SimpleMessageStore("s20");
 
-      tr.start(tl);
+      tr.start(tl, ms);
    
       channel = new CoreSubscription(123, null, ms, tl, null, true, 100, 20, 10, new QueuedExecutor(), null);
       

Modified: branches/Branch_1_0/tests/src/org/jboss/test/messaging/core/paging/PagingStateTestBase.java
===================================================================
--- branches/Branch_1_0/tests/src/org/jboss/test/messaging/core/paging/PagingStateTestBase.java	2006-12-02 13:36:20 UTC (rev 1685)
+++ branches/Branch_1_0/tests/src/org/jboss/test/messaging/core/paging/PagingStateTestBase.java	2006-12-02 14:14:09 UTC (rev 1686)
@@ -56,6 +56,8 @@
  * A PagingStateTestBase.
  * 
  * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:juha at jboss.org">Juha Lindfors</a>
+ * 
  * @version 1.1
  *
  * PagingStateTestBase.java,v 1.1 2006/03/22 10:23:35 timfox Exp
@@ -107,7 +109,7 @@
       
       tr = new TransactionRepository();
       
-      tr.start(pm);
+      tr.start(pm, ms);
       
    }
    

Modified: branches/Branch_1_0/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_ReloadTest.java
===================================================================
--- branches/Branch_1_0/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_ReloadTest.java	2006-12-02 13:36:20 UTC (rev 1685)
+++ branches/Branch_1_0/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_ReloadTest.java	2006-12-02 14:14:09 UTC (rev 1686)
@@ -40,6 +40,8 @@
  * A PagingTest_Reload.
  * 
  * @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:juha at jboss.org">Juha Lindfors</a>
+ * 
  * @version 1.1
  *
  * SingleChannel_Reload.java,v 1.1 2006/03/22 10:23:35 timfox Exp
@@ -124,7 +126,7 @@
       
       tr = new TransactionRepository();
       
-      tr.start(pm);
+      tr.start(pm, ms);
          
       ChannelSupport queue2 = new Queue(1, ms, pm, null, true, 100, 20, 10, new QueuedExecutor());
       
@@ -213,7 +215,7 @@
       
       tr = new TransactionRepository();
       
-      tr.start(pm);
+      tr.start(pm, ms);
          
       ChannelSupport queue2 = new Queue(1, ms, pm, null, false, 100, 20, 10, new QueuedExecutor());
       

Modified: branches/Branch_1_0/tests/src/org/jboss/test/messaging/core/plugin/JDBCPersistenceManagerTest.java
===================================================================
--- branches/Branch_1_0/tests/src/org/jboss/test/messaging/core/plugin/JDBCPersistenceManagerTest.java	2006-12-02 13:36:20 UTC (rev 1685)
+++ branches/Branch_1_0/tests/src/org/jboss/test/messaging/core/plugin/JDBCPersistenceManagerTest.java	2006-12-02 14:14:09 UTC (rev 1686)
@@ -46,6 +46,7 @@
 import org.jboss.messaging.core.plugin.contract.PersistenceManager;
 import org.jboss.messaging.core.tx.Transaction;
 import org.jboss.messaging.core.tx.TransactionRepository;
+import org.jboss.messaging.core.tx.PreparedTxInfo;
 import org.jboss.test.messaging.MessagingTestCase;
 import org.jboss.test.messaging.core.SimpleChannel;
 import org.jboss.test.messaging.tools.ServerManagement;
@@ -56,6 +57,8 @@
 
 /**
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:juha at jboss.org">Juha Lindfors</a>
+ *
  * @version <tt>1.1</tt>
  *
  * JDBCPersistenceManagerTest.java,v 1.1 2006/02/22 17:33:44 timfox Exp
@@ -1024,7 +1027,7 @@
       Channel channel = new SimpleChannel(0, ms);
       
       TransactionRepository txRep = new TransactionRepository();
-      txRep.start(pm);
+      txRep.start(pm, ms);
 
       Message[] messages = createMessages(10);
       
@@ -1043,11 +1046,16 @@
       List txList = pm.retrievePreparedTransactions();
       assertNotNull(txList);
       assertEquals(messages.length, txList.size());
-      
+
+      List retrievedXids = new ArrayList();
+
       for (int i = 0; i < xids.length; i++)
+         retrievedXids.add(((PreparedTxInfo)txList.get(i)).getXid());
+
+      for (int i = 0; i < xids.length; i++)
       {
          Xid xid = xids[i];
-         assertTrue(txList.contains(xid));
+         assertTrue(retrievedXids.contains(xid));
       }
       
       //rollback the txs
@@ -1378,7 +1386,7 @@
 
       Channel channel = new SimpleChannel(0, ms);
       TransactionRepository txRep = new TransactionRepository();
-      txRep.start(pm);
+      txRep.start(pm, ms);
 
       log.debug("transaction log started");
 
@@ -1485,7 +1493,7 @@
 
       Channel channel = new SimpleChannel(0, ms);
       TransactionRepository txRep = new TransactionRepository();
-      txRep.start(pm);
+      txRep.start(pm, ms);
  
       Message[] messages = createMessages(10);     
       

Modified: branches/Branch_1_0/tests/src/org/jboss/test/messaging/jms/XARecoveryTest.java
===================================================================
--- branches/Branch_1_0/tests/src/org/jboss/test/messaging/jms/XARecoveryTest.java	2006-12-02 13:36:20 UTC (rev 1685)
+++ branches/Branch_1_0/tests/src/org/jboss/test/messaging/jms/XARecoveryTest.java	2006-12-02 14:14:09 UTC (rev 1686)
@@ -21,16 +21,32 @@
   */
 package org.jboss.test.messaging.jms;
 
+import javax.jms.Connection;
 import javax.jms.Destination;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.XAConnection;
+import javax.jms.XASession;
 import javax.naming.InitialContext;
+import javax.transaction.TransactionManager;
+import javax.transaction.UserTransaction;
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.Xid;
 
 import org.jboss.jms.client.JBossConnectionFactory;
+import org.jboss.messaging.core.tx.XidImpl;
 import org.jboss.test.messaging.MessagingTestCase;
 import org.jboss.test.messaging.tools.ServerManagement;
+import org.jboss.test.messaging.util.TransactionManagerLocator;
 
+import com.arjuna.ats.jta.xa.XidImple;
+import com.arjuna.ats.arjuna.common.Uid;
+
 /**
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- *
+ * @author <a href="mailto:juha at jboss.org">Juha Lindfors</a>
  */
 public class XARecoveryTest extends MessagingTestCase
 {
@@ -43,8 +59,10 @@
    protected InitialContext initialContext;
    
    protected JBossConnectionFactory cf;
-   protected Destination queue;   
+   protected Destination queue;
 
+   TransactionManager tm;
+
    // Constructors --------------------------------------------------
 
    public XARecoveryTest(String name)
@@ -64,7 +82,7 @@
       cf = (JBossConnectionFactory)initialContext.lookup("/ConnectionFactory");
       
       
-      //if (!ServerManagement.isRemote()) tm = TransactionManagerLocator.getInstance().locate();
+      if (!ServerManagement.isRemote()) tm = TransactionManagerLocator.getInstance().locate();
       
       ServerManagement.undeployQueue("Queue");
       ServerManagement.deployQueue("Queue");
@@ -82,114 +100,306 @@
 
    // Public --------------------------------------------------------
    
-   //TODO Re-enable when we complete XA Recovery
-   
-   public void testNoop()
+
+   public void testJBossTSCoordinator() throws Exception
    {
-      
+      UserTransaction ut = com.arjuna.ats.jta.UserTransaction.userTransaction();
+
+      ut.begin();
+
+
+      ut.commit();
    }
-   
-//
-//   public void test1() throws Exception
-//   {
-//      
-//      XAConnection conn1 = cf.createXAConnection();
-//      
-//      XAConnection conn2 = cf.createXAConnection();
-//      
-//      XASession sess1 = conn1.createXASession();
-//      
-//      XASession sess2 = conn2.createXASession();
-//      
-//      XAResource res1 = sess1.getXAResource();
-//      
-//      XAResource res2 = sess2.getXAResource();
-//      
-//      //Pretend to be a transaction manager by interacting through the XAResources
-//      Xid xid1 = new XidImpl("bq1".getBytes(), 123, "gbtxid1".getBytes());
-//      Xid xid2 = new XidImpl("bq2".getBytes(), 124, "gbtxid2".getBytes());
-//      
-//      
-////    Send a message in each tx
-//      
-//      
-//      res1.start(xid1, XAResource.TMNOFLAGS);
-//      
-//      MessageProducer prod1 = sess1.createProducer(queue);
-//      
-//      TextMessage tm1 = sess1.createTextMessage("testing1");
-//      
-//      prod1.send(tm1);
-//      
-//      res1.end(xid1, XAResource.TMSUCCESS);
-//      
-//      
-//      
-//      
-//      res2.start(xid2, XAResource.TMNOFLAGS);
-//      
-//      MessageProducer prod2 = sess2.createProducer(queue);
-//      
-//      TextMessage tm2 = sess2.createTextMessage("testing2");
-//      
-//      prod2.send(tm2);
-//      
-//      res2.end(xid2, XAResource.TMSUCCESS);
-//      
-//      //prepare both txs
-//      
-//      
-//      res1.prepare(xid1);      
-//      res2.prepare(xid2);
-//      
-//      //Now "crash" the server
-//      
-//      ServerManagement.stopServerPeer();
-//
-//      ServerManagement.startServerPeer();
-//
-//      //Now lookup the recoverable in JNDI
-//      InitialContext ic = new InitialContext();
-//      JMSRecoverable recoverable = (JMSRecoverable)ic.lookup("/" +
-//            ServerPeer.RECOVERABLE_CTX_NAME + "/"+ ServerManagement.getServerPeer().getServerPeerID());
-//      
-//      XAResource res = recoverable.getResource();
-//      
-//      Xid[] xids = res.recover(XAResource.TMSTARTRSCAN);
-//      assertEquals(2, xids.length);
-//      
-//      Xid[] xids2 = res.recover(XAResource.TMENDRSCAN);
-//      assertEquals(0, xids2.length);
-//      
-//      assertTrue(xids[0].equals(xid1) || xids[1].equals(xid1));
-//      assertTrue(xids[0].equals(xid2) || xids[1].equals(xid2));
-//      
-//      res.commit(xid1, false);
-//      
-//      res.commit(xid2, false);
-//      
-//      recoverable.cleanUp();
-//      
-//      ServerManagement.deployQueue("Queue");
-//            
-//      Connection conn3 = cf.createConnection();
-//      
-//      Session sessRec = conn3.createSession(false, Session.AUTO_ACKNOWLEDGE);
-//      MessageConsumer cons = sessRec.createConsumer(queue);
-//      conn3.start();
-//      
-//      TextMessage m2 = (TextMessage)cons.receiveNoWait();
-//      assertNotNull(m2);
-//      assertEquals("testing1", m2.getText());
-//      
-//      
-//      TextMessage m3 = (TextMessage)cons.receiveNoWait();
-//      assertNotNull(m3);
-//      assertEquals("testing2", m3.getText());
-//      
-//      conn3.close();
-//
-//   }
- 
+
+
+   public void testMockCoordinatorRecovery() throws Exception
+   {
+
+      XAConnection conn1 = cf.createXAConnection();
+
+      XAConnection conn2 = cf.createXAConnection();
+
+      XASession sess1 = conn1.createXASession();
+
+      XASession sess2 = conn2.createXASession();
+
+      XAResource res1 = sess1.getXAResource();
+
+      XAResource res2 = sess2.getXAResource();
+
+      //Pretend to be a transaction manager by interacting through the XAResources
+      Xid xid1 = new XidImpl("bq1".getBytes(), 123, "gbtxid1".getBytes());
+      Xid xid2 = new XidImpl("bq2".getBytes(), 124, "gbtxid2".getBytes());
+
+      //    Send a message in each tx
+
+      res1.start(xid1, XAResource.TMNOFLAGS);
+
+      MessageProducer prod1 = sess1.createProducer(queue);
+
+      TextMessage tm1 = sess1.createTextMessage("testing1");
+
+      prod1.send(tm1);
+
+      res1.end(xid1, XAResource.TMSUCCESS);
+
+
+      res2.start(xid2, XAResource.TMNOFLAGS);
+
+      MessageProducer prod2 = sess2.createProducer(queue);
+
+      TextMessage tm2 = sess2.createTextMessage("testing2");
+
+      prod2.send(tm2);
+
+      res2.end(xid2, XAResource.TMSUCCESS);
+
+      //prepare both txs
+
+
+      res1.prepare(xid1);
+      res2.prepare(xid2);
+
+      //Now "crash" the server
+
+      ServerManagement.stopServerPeer();
+
+      ServerManagement.startServerPeer();
+
+
+      XAResource res = cf.createXAConnection().createXASession().getXAResource();
+
+      Xid[] xids = res.recover(XAResource.TMSTARTRSCAN);
+      assertEquals(2, xids.length);
+
+      Xid[] xids2 = res.recover(XAResource.TMENDRSCAN);
+      assertEquals(0, xids2.length);
+
+      assertTrue(xids[0].equals(xid1) || xids[1].equals(xid1));
+      assertTrue(xids[0].equals(xid2) || xids[1].equals(xid2));
+
+      res.commit(xid1, false);
+
+      res.commit(xid2, false);
+
+      ServerManagement.deployQueue("Queue");
+
+      Connection conn3 = cf.createConnection();
+
+      Session sessRec = conn3.createSession(false, Session.AUTO_ACKNOWLEDGE);
+      MessageConsumer cons = sessRec.createConsumer(queue);
+      conn3.start();
+
+      TextMessage m1 = (TextMessage)cons.receiveNoWait();
+      assertNotNull(m1);
+      assertEquals("testing1", m1.getText());
+
+      TextMessage m2 = (TextMessage)cons.receiveNoWait();
+      assertNotNull(m2);
+
+      assertEquals("testing2", m2.getText());
+
+      conn3.close();
+
+   }
+
+
+   public void testMockCoordinatorRecoveryWithJBossTSXids() throws Exception
+   {
+
+      XAConnection conn1 = cf.createXAConnection();
+
+      XAConnection conn2 = cf.createXAConnection();
+
+      XASession sess1 = conn1.createXASession();
+
+      XASession sess2 = conn2.createXASession();
+
+      XAResource res1 = sess1.getXAResource();
+
+      XAResource res2 = sess2.getXAResource();
+
+      //Pretend to be a transaction manager by interacting through the XAResources
+      Xid xid1 = new XidImple(new Uid("gbtxid1"), new Uid("bq1"), 123);
+      Xid xid2 = new XidImple(new Uid("gbtxid2"), new Uid("bq2"), 124);
+
+
+      //    Send a message in each tx
+
+      res1.start(xid1, XAResource.TMNOFLAGS);
+
+      MessageProducer prod1 = sess1.createProducer(queue);
+
+      TextMessage tm1 = sess1.createTextMessage("testing1");
+
+      prod1.send(tm1);
+
+      res1.end(xid1, XAResource.TMSUCCESS);
+
+
+      res2.start(xid2, XAResource.TMNOFLAGS);
+
+      MessageProducer prod2 = sess2.createProducer(queue);
+
+      TextMessage tm2 = sess2.createTextMessage("testing2");
+
+      prod2.send(tm2);
+
+      res2.end(xid2, XAResource.TMSUCCESS);
+
+      //prepare both txs
+
+
+      res1.prepare(xid1);
+      res2.prepare(xid2);
+
+      //Now "crash" the server
+
+      ServerManagement.stopServerPeer();
+
+      ServerManagement.startServerPeer();
+
+
+      XAResource res = cf.createXAConnection().createXASession().getXAResource();
+
+      Xid[] xids = res.recover(XAResource.TMSTARTRSCAN);
+      assertEquals(2, xids.length);
+
+      Xid[] xids2 = res.recover(XAResource.TMENDRSCAN);
+      assertEquals(0, xids2.length);
+
+      assertTrue(xids[0].equals(xid1) || xids[1].equals(xid1));
+      assertTrue(xids[0].equals(xid2) || xids[1].equals(xid2));
+
+
+      res.commit(xid1, false);
+
+      res.commit(xid2, false);
+
+      ServerManagement.deployQueue("Queue");
+
+      Connection conn3 = cf.createConnection();
+
+      Session sessRec = conn3.createSession(false, Session.AUTO_ACKNOWLEDGE);
+      MessageConsumer cons = sessRec.createConsumer(queue);
+      conn3.start();
+
+      TextMessage m1 = (TextMessage)cons.receiveNoWait();
+      assertNotNull(m1);
+      assertEquals("testing1", m1.getText());
+
+      TextMessage m2 = (TextMessage)cons.receiveNoWait();
+      assertNotNull(m2);
+
+      assertEquals("testing2", m2.getText());
+
+      conn3.close();
+
+   }
+/*
+   public void testMockCoordinatorRecovery3() throws Exception
+   {
+
+      XAConnection conn1 = cf.createXAConnection();
+
+      XAConnection conn2 = cf.createXAConnection();
+
+      XASession sess1 = conn1.createXASession();
+
+      XASession sess2 = conn2.createXASession();
+
+      XAResource res1 = sess1.getXAResource();
+
+      XAResource res2 = sess2.getXAResource();
+
+      //Pretend to be a transaction manager by interacting through the XAResources
+      Xid xid1 = new XidImpl("bq1".getBytes(), 123, "gbtxid1".getBytes());
+      Xid xid2 = new XidImpl("bq2".getBytes(), 124, "gbtxid2".getBytes());
+
+      //    Send a message in each tx
+
+      res1.start(xid1, XAResource.TMNOFLAGS);
+
+      MessageProducer prod1 = sess1.createProducer(queue);
+
+      TextMessage tm1 = sess1.createTextMessage("testing1");
+
+      prod1.send(tm1);
+
+      res1.end(xid1, XAResource.TMSUCCESS);
+
+
+      res2.start(xid2, XAResource.TMNOFLAGS);
+
+      MessageProducer prod2 = sess2.createProducer(queue);
+
+      TextMessage tm2 = sess2.createTextMessage("testing2");
+
+      prod2.send(tm2);
+
+      res2.end(xid2, XAResource.TMSUCCESS);
+
+      //prepare both txs
+
+
+      res1.prepare(xid1);
+      res2.prepare(xid2);
+
+      //Now "crash" the server
+
+      ServerManagement.stopServerPeer();
+
+      ServerManagement.startServerPeer();
+
+      XAResource res = cf.createXAConnection().createXASession().getXAResource();
+
+      Xid[] xids = res.recover(XAResource.TMSTARTRSCAN);
+      assertEquals(2, xids.length);
+
+      Xid[] xids2 = res.recover(XAResource.TMENDRSCAN);
+      assertEquals(0, xids2.length);
+
+      assertTrue(xids[0].equals(xid1) || xids[1].equals(xid1));
+      assertTrue(xids[0].equals(xid2) || xids[1].equals(xid2));
+
+      res.commit(xids[0], false);
+
+      res.commit(xids[1], false);
+
+      ServerManagement.deployQueue("Queue");
+
+      Connection conn3 = cf.createConnection();
+
+      Session sessRec = conn3.createSession(false, Session.AUTO_ACKNOWLEDGE);
+      MessageConsumer cons = sessRec.createConsumer(queue);
+      conn3.start();
+
+      TextMessage m1 = (TextMessage)cons.receiveNoWait();
+      assertNotNull(m1);
+      assertEquals("testing1", m1.getText());
+
+      TextMessage m2 = (TextMessage)cons.receiveNoWait();
+      assertNotNull(m2);
+
+      assertEquals("testing2", m2.getText());
+
+      conn3.close();
+
+   }
+*/
+   public void testXidEquals()
+   {
+      Xid xid1 = new XidImple(new Uid("gbtxid1"), new Uid("bq1"), 123);
+      Xid xid2 = new XidImpl("bq1".getBytes(), 123, "gbtxid1".getBytes());
+
+      try
+      {
+         assertEquals(xid1, xid2);
+      }
+      catch (Throwable t)
+      {
+         // different xid impls are not expected to equal
+      }
+   }
 }
 

Modified: branches/Branch_1_0/tests/src/org/jboss/test/messaging/jms/XATest.java
===================================================================
--- branches/Branch_1_0/tests/src/org/jboss/test/messaging/jms/XATest.java	2006-12-02 13:36:20 UTC (rev 1685)
+++ branches/Branch_1_0/tests/src/org/jboss/test/messaging/jms/XATest.java	2006-12-02 14:14:09 UTC (rev 1686)
@@ -42,10 +42,11 @@
 import org.jboss.jms.tx.MessagingXAResource;
 import org.jboss.test.messaging.MessagingTestCase;
 import org.jboss.test.messaging.tools.ServerManagement;
-import org.jboss.tm.TransactionManagerLocator;
+import org.jboss.tm.TxUtils;
 
 /**
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:juha at jboss.org">Juha Lindfors</a>
  *
  * $Id$
  */
@@ -83,13 +84,20 @@
       initialContext = new InitialContext(ServerManagement.getJNDIEnvironment());
       cf = (JBossConnectionFactory)initialContext.lookup("/ConnectionFactory");
             
-      if (!ServerManagement.isRemote()) tm = TransactionManagerLocator.getInstance().locate();
-      
+      if (!ServerManagement.isRemote())
+      {
+         tm = org.jboss.test.messaging.util.TransactionManagerLocator.getInstance().locate();
+      }
+
       ServerManagement.undeployQueue("Queue");
       ServerManagement.deployQueue("Queue");
       queue = (Destination)initialContext.lookup("/queue/Queue");
-      
-      if (!ServerManagement.isRemote()) suspendedTx = tm.suspend();
+
+
+      if (!ServerManagement.isRemote())
+      {
+         suspendedTx = tm.suspend();
+      }
    }
 
    public void tearDown() throws Exception
@@ -98,11 +106,17 @@
       
       if (!ServerManagement.isRemote())
       {
-         if (tm.getTransaction() != null)
+         if (TxUtils.isUncommitted(tm))
          {
             //roll it back
             tm.rollback();
          }
+         if (tm.getTransaction() != null)
+         {
+            Transaction tx = tm.suspend();
+            if (tx != null)
+               log.warn("Transaction still associated with thread " + tx + " at status " + TxUtils.getStatusAsString(tx.getStatus()));
+         }
       }
       
       if (suspendedTx != null)
@@ -151,7 +165,7 @@
          m = sess.createTextMessage("XATest2");
          prod.send(queue, m);
          
-         tx.commit();
+         tm.commit();
          
          conn2 = cf.createConnection();
          conn2.start();
@@ -177,42 +191,44 @@
       }
 
    }
-   
+
+
+
    public void test2PCSendCommit() throws Exception
    {
       if (ServerManagement.isRemote()) return;
-      
+
       XAConnection conn = null;
       Connection conn2 = null;
-      
+
       try
       {
-      
+
          conn = cf.createXAConnection();
-         
+
          tm.begin();
-         
+
          XASession sess = conn.createXASession();
-         
-         MessagingXAResource res = (MessagingXAResource)sess.getXAResource();         
+
+         MessagingXAResource res = (MessagingXAResource)sess.getXAResource();
          XAResource res2 = new DummyXAResource();
-         
+
          //To prevent 1PC optimization being used
          res.setPreventJoining(true);
-         
+
          Transaction tx = tm.getTransaction();
          tx.enlistResource(res);
          tx.enlistResource(res2);
-         
+
          MessageProducer prod = sess.createProducer(queue);
          prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
          Message m = sess.createTextMessage("XATest1");
          prod.send(queue, m);
          m = sess.createTextMessage("XATest2");
          prod.send(queue, m);
-         
-         tx.commit();
-         
+
+         tm.commit();
+
          conn2 = cf.createConnection();
          conn2.start();
          Session sessReceiver = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -237,47 +253,47 @@
       }
 
    }
-   
-   
+
+
    public void test2PCSendRollback1PCOptimization() throws Exception
    {
       if (ServerManagement.isRemote()) return;
-      
+
       //Since both resources have some RM, TM will probably use 1PC optimization
-      
+
       XAConnection conn = null;
       Connection conn2 = null;
       try
       {
          conn = cf.createXAConnection();
-         
+
          tm.begin();
-         
+
          XASession sess = conn.createXASession();
          XAResource res = sess.getXAResource();
-         
+
          XAResource res2 = new DummyXAResource();
-         
+
          Transaction tx = tm.getTransaction();
          tx.enlistResource(res);
          tx.enlistResource(res2);
-         
+
          MessageProducer prod = sess.createProducer(queue);
          prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
          Message m = sess.createTextMessage("XATest1");
-         prod.send(queue, m);   
+         prod.send(queue, m);
          m = sess.createTextMessage("XATest2");
          prod.send(queue, m);
-         
-         tx.rollback();
-         
+
+         tm.rollback();
+
          conn2 = cf.createConnection();
          conn2.start();
          Session sessReceiver = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
          MessageConsumer cons = sessReceiver.createConsumer(queue);
          Message m2 = cons.receive(1000);
          assertNull(m2);
-   
+
       }
       finally
       {
@@ -291,59 +307,61 @@
          }
       }
    }
-   
-   
+
+
    public void test2PCSendFailOnPrepare() throws Exception
    {
       if (ServerManagement.isRemote()) return;
-      
+
       XAConnection conn = null;
       Connection conn2 = null;
       try
       {
          conn = cf.createXAConnection();
-         
+
          tm.begin();
-         
+
          XASession sess = conn.createXASession();
          MessagingXAResource res = (MessagingXAResource)sess.getXAResource();
-         
+
          //prevent 1Pc optimisation
          res.setPreventJoining(true);
-         
+
          XAResource res2 = new DummyXAResource(true);
          XAResource res3 = new DummyXAResource();
          XAResource res4 = new DummyXAResource();
-         
+
          Transaction tx = tm.getTransaction();
          tx.enlistResource(res);
          tx.enlistResource(res2);
          tx.enlistResource(res3);
          tx.enlistResource(res4);
-         
+
          MessageProducer prod = sess.createProducer(queue);
          prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
          Message m = sess.createTextMessage("XATest1");
-         prod.send(queue, m);   
+         prod.send(queue, m);
          m = sess.createTextMessage("XATest2");
          prod.send(queue, m);
-         
+
          try
          {
-            tx.commit();         
+            tm.commit();
+
+            fail("should not get here");
          }
          catch (Exception e)
          {
             //We should expect this
          }
-         
+
          conn2 = cf.createConnection();
          conn2.start();
          Session sessReceiver = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
          MessageConsumer cons = sessReceiver.createConsumer(queue);
          Message m2 = cons.receive(1000);
          assertNull(m2);
-   
+
       }
       finally
       {
@@ -357,47 +375,47 @@
          }
       }
    }
-   
+
    public void test2PCSendRollback() throws Exception
    {
       if (ServerManagement.isRemote()) return;
-      
+
       XAConnection conn = null;
       Connection conn2 = null;
       try
       {
          conn = cf.createXAConnection();
-         
+
          tm.begin();
-         
+
          XASession sess = conn.createXASession();
          MessagingXAResource res = (MessagingXAResource)sess.getXAResource();
-         
+
          //prevent 1Pc optimisation
          res.setPreventJoining(true);
-         
+
          XAResource res2 = new DummyXAResource();
-         
+
          Transaction tx = tm.getTransaction();
          tx.enlistResource(res);
          tx.enlistResource(res2);
-         
+
          MessageProducer prod = sess.createProducer(queue);
          prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
          Message m = sess.createTextMessage("XATest1");
-         prod.send(queue, m);   
+         prod.send(queue, m);
          m = sess.createTextMessage("XATest2");
          prod.send(queue, m);
-         
-         tx.rollback();
-         
+
+         tm.rollback();
+
          conn2 = cf.createConnection();
          conn2.start();
          Session sessReceiver = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
          MessageConsumer cons = sessReceiver.createConsumer(queue);
          Message m2 = cons.receive(1000);
          assertNull(m2);
-   
+
       }
       finally
       {
@@ -415,12 +433,12 @@
    public void test2PCReceiveCommit1PCOptimization() throws Exception
    {
       if (ServerManagement.isRemote()) return;
-            
+
       //Since both resources have some RM, TM will probably use 1PC optimization
-      
+
       XAConnection conn = null;
       Connection conn2 = null;
-      
+
       try
       {
          conn2 = cf.createConnection();
@@ -431,49 +449,49 @@
          prod.send(m);
          m = sessProducer.createTextMessage("XATest2");
          prod.send(m);
-         
+
          conn = cf.createXAConnection();
          conn.start();
-         
+
          tm.begin();
-         
+
          XASession sess = conn.createXASession();
          XAResource res = sess.getXAResource();
-         
+
          XAResource res2 = new DummyXAResource();
-         
+
          Transaction tx = tm.getTransaction();
          tx.enlistResource(res);
          tx.enlistResource(res2);
-         
+
          MessageConsumer cons = sess.createConsumer(queue);
-         
 
+
          TextMessage m2 = (TextMessage)cons.receive(1000);
-         
+
          assertNotNull(m2);
          assertEquals("XATest1", m2.getText());
-         
+
          m2 = (TextMessage)cons.receive(1000);
-         
+
          assertNotNull(m2);
          assertEquals("XATest2", m2.getText());
-         
-         tx.commit();
-         
+
+         tm.commit();
+
          //New tx
          tm.begin();
          tx = tm.getTransaction();
          tx.enlistResource(res);
          tx.enlistResource(res2);
-         
+
          Message m3 = cons.receive(1000);
-         
+
          assertNull(m3);
-         
+
          tm.commit();
-         
 
+
       }
       finally
       {
@@ -486,16 +504,16 @@
             conn2.close();
          }
       }
-      
+
    }
-   
+
    public void test2PCReceiveCommit() throws Exception
    {
       if (ServerManagement.isRemote()) return;
-            
+
       XAConnection conn = null;
       Connection conn2 = null;
-      
+
       try
       {
          conn2 = cf.createConnection();
@@ -506,50 +524,50 @@
          prod.send(m);
          m = sessProducer.createTextMessage("XATest2");
          prod.send(m);
-         
+
          conn = cf.createXAConnection();
          conn.start();
-         
+
          tm.begin();
-         
+
          XASession sess = conn.createXASession();
          MessagingXAResource res = (MessagingXAResource)sess.getXAResource();
          res.setPreventJoining(true);
-         
+
          XAResource res2 = new DummyXAResource();
-         
+
          Transaction tx = tm.getTransaction();
          tx.enlistResource(res);
          tx.enlistResource(res2);
-         
+
          MessageConsumer cons = sess.createConsumer(queue);
-         
 
+
          TextMessage m2 = (TextMessage)cons.receive(1000);
-         
+
          assertNotNull(m2);
          assertEquals("XATest1", m2.getText());
-         
+
          m2 = (TextMessage)cons.receive(1000);
-         
+
          assertNotNull(m2);
          assertEquals("XATest2", m2.getText());
-         
-         tx.commit();
-         
+
+         tm.commit();
+
          //New tx
          tm.begin();
          tx = tm.getTransaction();
          tx.enlistResource(res);
          tx.enlistResource(res2);
-         
+
          Message m3 = cons.receive(1000);
-         
+
          assertNull(m3);
-         
+
          tm.commit();
-         
 
+
       }
       finally
       {
@@ -562,18 +580,18 @@
             conn2.close();
          }
       }
-      
+
    }
-   
+
    public void test2PCReceiveRollback1PCOptimization() throws Exception
    {
       if (ServerManagement.isRemote()) return;
-      
+
       //Since both resources have some RM, TM will probably use 1PC optimization
-      
+
       XAConnection conn = null;
       Connection conn2 = null;
-      
+
       try
       {
          conn2 = cf.createConnection();
@@ -581,54 +599,54 @@
          MessageProducer prod  = sessProducer.createProducer(queue);
          Message m = sessProducer.createTextMessage("XATest1");
          prod.send(m);
-         
+
          m = sessProducer.createTextMessage("XATest2");
          prod.send(m);
-         
-         
+
+
          conn = cf.createXAConnection();
-         conn.start();   
-         
+         conn.start();
+
          tm.begin();
-         
+
          XASession sess = conn.createXASession();
          XAResource res = sess.getXAResource();
-         
+
          XAResource res2 = new DummyXAResource();
-         
+
          Transaction tx = tm.getTransaction();
          tx.enlistResource(res);
          tx.enlistResource(res2);
-         
+
          MessageConsumer cons = sess.createConsumer(queue);
-         
 
-         TextMessage m2 = (TextMessage)cons.receive(1000);         
+
+         TextMessage m2 = (TextMessage)cons.receive(1000);
          assertNotNull(m2);
          assertEquals("XATest1", m2.getText());
-         m2 = (TextMessage)cons.receive(1000);         
+         m2 = (TextMessage)cons.receive(1000);
          assertNotNull(m2);
          assertEquals("XATest2", m2.getText());
-         
-         tx.rollback();
-         
+
+         tm.rollback();
+
          //Message should be redelivered
-         
+
          //New tx
          tm.begin();
          tx = tm.getTransaction();
          tx.enlistResource(res);
          tx.enlistResource(res2);
-         
-         TextMessage m3 = (TextMessage)cons.receive(1000);         
+
+         TextMessage m3 = (TextMessage)cons.receive(1000);
          assertNotNull(m3);
          assertEquals("XATest1", m3.getText());
-         m3 = (TextMessage)cons.receive(1000);         
+         m3 = (TextMessage)cons.receive(1000);
          assertNotNull(m3);
          assertEquals("XATest2", m3.getText());
-         
+
          assertTrue(m3.getJMSRedelivered());
-         
+
          tm.commit();
 
       }
@@ -643,16 +661,16 @@
             conn2.close();
          }
       }
-      
+
    }
-   
+
    public void test2PCReceiveRollback() throws Exception
    {
       if (ServerManagement.isRemote()) return;
-      
+
       XAConnection conn = null;
       Connection conn2 = null;
-      
+
       try
       {
          conn2 = cf.createConnection();
@@ -660,55 +678,55 @@
          MessageProducer prod  = sessProducer.createProducer(queue);
          Message m = sessProducer.createTextMessage("XATest1");
          prod.send(m);
-         
+
          m = sessProducer.createTextMessage("XATest2");
          prod.send(m);
-         
-         
+
+
          conn = cf.createXAConnection();
-         conn.start();   
-         
+         conn.start();
+
          tm.begin();
-         
+
          XASession sess = conn.createXASession();
          MessagingXAResource res = (MessagingXAResource)sess.getXAResource();
          res.setPreventJoining(true);
-         
+
          XAResource res2 = new DummyXAResource();
-         
+
          Transaction tx = tm.getTransaction();
          tx.enlistResource(res);
          tx.enlistResource(res2);
-         
+
          MessageConsumer cons = sess.createConsumer(queue);
-         
 
-         TextMessage m2 = (TextMessage)cons.receive(1000);         
+
+         TextMessage m2 = (TextMessage)cons.receive(1000);
          assertNotNull(m2);
          assertEquals("XATest1", m2.getText());
-         m2 = (TextMessage)cons.receive(1000);         
+         m2 = (TextMessage)cons.receive(1000);
          assertNotNull(m2);
          assertEquals("XATest2", m2.getText());
-         
-         tx.rollback();
-         
+
+         tm.rollback();
+
          //Message should be redelivered
-         
+
          //New tx
          tm.begin();
          tx = tm.getTransaction();
          tx.enlistResource(res);
          tx.enlistResource(res2);
-         
-         TextMessage m3 = (TextMessage)cons.receive(1000);         
+
+         TextMessage m3 = (TextMessage)cons.receive(1000);
          assertNotNull(m3);
          assertEquals("XATest1", m3.getText());
-         m3 = (TextMessage)cons.receive(1000);         
+         m3 = (TextMessage)cons.receive(1000);
          assertNotNull(m3);
          assertEquals("XATest2", m3.getText());
-         
+
          assertTrue(m3.getJMSRedelivered());
-         
+
          tm.commit();
 
       }
@@ -723,41 +741,41 @@
             conn2.close();
          }
       }
-      
+
    }
-   
-   
+
+
    public void test1PCSendCommit() throws Exception
    {
       if (ServerManagement.isRemote()) return;
-      
+
       XAConnection conn = null;
       Connection conn2 = null;
-      
+
       try
       {
-      
+
          conn = cf.createXAConnection();
-         
+
          tm.begin();
-         
+
          XASession sess = conn.createXASession();
          XAResource res = sess.getXAResource();
-         
-         
+
+
          Transaction tx = tm.getTransaction();
          tx.enlistResource(res);
 
-         
+
          MessageProducer prod = sess.createProducer(queue);
          prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
          Message m = sess.createTextMessage("XATest1");
          prod.send(queue, m);
          m = sess.createTextMessage("XATest2");
          prod.send(queue, m);
-         
-         tx.commit();
-         
+
+         tm.commit();
+
          conn2 = cf.createConnection();
          conn2.start();
          Session sessReceiver = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -782,20 +800,20 @@
       }
 
    }
-   
-   
+
+
    public void test1PCSendRollback() throws Exception
    {
       if (ServerManagement.isRemote()) return;
-      
+
       XAConnection conn = null;
       Connection conn2 = null;
       try
       {
          conn = cf.createXAConnection();
-         
+
          tm.begin();
-         
+
          XASession sess = conn.createXASession();
          XAResource res = sess.getXAResource();
 
@@ -805,19 +823,19 @@
          MessageProducer prod = sess.createProducer(queue);
          prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
          Message m = sess.createTextMessage("XATest1");
-         prod.send(queue, m); 
+         prod.send(queue, m);
          m = sess.createTextMessage("XATest2");
-         prod.send(queue, m); 
-         
-         tx.rollback();
-         
+         prod.send(queue, m);
+
+         tm.rollback();
+
          conn2 = cf.createConnection();
          conn2.start();
          Session sessReceiver = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
          MessageConsumer cons = sessReceiver.createConsumer(queue);
          Message m2 = cons.receive(1000);
          assertNull(m2);
-   
+
       }
       finally
       {
@@ -835,10 +853,10 @@
    public void test1PCReceiveCommit() throws Exception
    {
       if (ServerManagement.isRemote()) return;
-      
+
       XAConnection conn = null;
       Connection conn2 = null;
-      
+
       try
       {
          conn2 = cf.createConnection();
@@ -849,44 +867,44 @@
          prod.send(m);
          m = sessProducer.createTextMessage("XATest2");
          prod.send(m);
-         
+
          conn = cf.createXAConnection();
          conn.start();
-         
+
          tm.begin();
-         
+
          XASession sess = conn.createXASession();
          XAResource res = sess.getXAResource();
-         
+
          Transaction tx = tm.getTransaction();
          tx.enlistResource(res);
-         
+
          MessageConsumer cons = sess.createConsumer(queue);
-         
 
+
          TextMessage m2 = (TextMessage)cons.receive(1000);
-         
+
          assertNotNull(m2);
          assertEquals("XATest1", m2.getText());
          m2 = (TextMessage)cons.receive(1000);
-         
+
          assertNotNull(m2);
          assertEquals("XATest2", m2.getText());
-         
-         tx.commit();
-         
+
+         tm.commit();
+
          //New tx
          tm.begin();
          tx = tm.getTransaction();
          tx.enlistResource(res);
-         
+
          Message m3 = cons.receive(1000);
-         
+
          assertNull(m3);
-         
+
          tm.commit();
-         
 
+
       }
       finally
       {
@@ -899,16 +917,16 @@
             conn2.close();
          }
       }
-      
+
    }
-   
+
    public void test1PCReceiveRollback() throws Exception
    {
       if (ServerManagement.isRemote()) return;
-      
+
       XAConnection conn = null;
       Connection conn2 = null;
-      
+
       try
       {
          conn2 = cf.createConnection();
@@ -918,53 +936,53 @@
          prod.send(m);
          m = sessProducer.createTextMessage("XATest2");
          prod.send(m);
-         
-         
+
+
          conn = cf.createXAConnection();
-         conn.start();   
-         
+         conn.start();
+
          tm.begin();
-         
+
          XASession sess = conn.createXASession();
          XAResource res = sess.getXAResource();
-         
+
          Transaction tx = tm.getTransaction();
          tx.enlistResource(res);
 
          MessageConsumer cons = sess.createConsumer(queue);
-         
 
+
          TextMessage m2 = (TextMessage)cons.receive(1000);
-         
+
          assertNotNull(m2);
          assertEquals("XATest1", m2.getText());
-         
+
          m2 = (TextMessage)cons.receive(1000);
-         
+
          assertNotNull(m2);
          assertEquals("XATest2", m2.getText());
-         
-         tx.rollback();
-         
+
+         tm.rollback();
+
          //Message should be redelivered
-         
+
          //New tx
          tm.begin();
          tx = tm.getTransaction();
          tx.enlistResource(res);
-         
+
          TextMessage m3 = (TextMessage)cons.receive(1000);
-         
+
          assertNotNull(m3);
          assertEquals("XATest1", m3.getText());
-         
+
          m3 = (TextMessage)cons.receive(1000);
-         
+
          assertNotNull(m3);
          assertEquals("XATest2", m3.getText());
-         
+
          assertTrue(m3.getJMSRedelivered());
-         
+
          tm.commit();
 
       }
@@ -979,18 +997,18 @@
             conn2.close();
          }
       }
-      
+
    }
-   
+
    public void testMultipleSessionsOneTxCommitAcknowledge1PCOptimization() throws Exception
    {
       if (ServerManagement.isRemote()) return;
-      
+
       XAConnection conn = null;
       Connection conn2 = null;
-      
+
       //Since both resources have some RM, TM will probably use 1PC optimization
-      
+
       try
       {
          //First send 2 messages
@@ -1001,50 +1019,50 @@
          prod.send(m);
          m = sessProducer.createTextMessage("jellyfish2");
          prod.send(m);
-         
-         
+
+
          conn = cf.createXAConnection();
-         conn.start();   
-         
+         conn.start();
+
          tm.begin();
-         
+
          //Create 2 sessions and enlist them
          XASession sess1 = conn.createXASession();
          XAResource res1 = sess1.getXAResource();
          XASession sess2 = conn.createXASession();
          XAResource res2 = sess2.getXAResource();
-         
+
          Transaction tx = tm.getTransaction();
          tx.enlistResource(res1);
          tx.enlistResource(res2);
-         
+
          //Receive the messages, one on each consumer
          MessageConsumer cons1 = sess1.createConsumer(queue);
          TextMessage r1 = (TextMessage)cons1.receive(1000);
-         
+
          assertNotNull(r1);
          assertEquals("jellyfish1", r1.getText());
-                  
+
          cons1.close();
-         
+
          MessageConsumer cons2 = sess2.createConsumer(queue);
          TextMessage r2 = (TextMessage)cons2.receive(1000);
-         
+
          assertNotNull(r2);
          assertEquals("jellyfish2", r2.getText());
-         
-         //commit        
-         tx.commit();
-         
+
+         //commit
+         tm.commit();
+
          Session sess = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
          MessageConsumer cons = sess.createConsumer(queue);
          conn2.start();
-         
+
          TextMessage r3 = (TextMessage)cons.receive(1000);
          assertNull(r3);
-       
-         
 
+
+
       }
       finally
       {
@@ -1057,16 +1075,16 @@
             conn2.close();
          }
       }
-      
+
    }
-   
+
    public void testMultipleSessionsOneTxCommitAcknowledge() throws Exception
    {
       if (ServerManagement.isRemote()) return;
-      
+
       XAConnection conn = null;
       Connection conn2 = null;
-      
+
       try
       {
          //First send 2 messages
@@ -1077,13 +1095,13 @@
          prod.send(m);
          m = sessProducer.createTextMessage("jellyfish2");
          prod.send(m);
-         
-         
+
+
          conn = cf.createXAConnection();
-         conn.start();   
-         
+         conn.start();
+
          tm.begin();
-         
+
          //Create 2 sessions and enlist them
          XASession sess1 = conn.createXASession();
          MessagingXAResource res1 = (MessagingXAResource)sess1.getXAResource();
@@ -1091,36 +1109,36 @@
          MessagingXAResource res2 = (MessagingXAResource)sess2.getXAResource();
          res1.setPreventJoining(true);
          res2.setPreventJoining(true);
-         
+
          Transaction tx = tm.getTransaction();
          tx.enlistResource(res1);
          tx.enlistResource(res2);
-         
+
          //Receive the messages, one on each consumer
          MessageConsumer cons1 = sess1.createConsumer(queue);
          TextMessage r1 = (TextMessage)cons1.receive(1000);
-         
+
          assertNotNull(r1);
          assertEquals("jellyfish1", r1.getText());
-                  
+
          cons1.close();
-         
+
          MessageConsumer cons2 = sess2.createConsumer(queue);
          TextMessage r2 = (TextMessage)cons2.receive(1000);
-         
+
          assertNotNull(r2);
          assertEquals("jellyfish2", r2.getText());
-         
-         //commit        
-         tx.commit();
-         
+
+         //commit
+         tm.commit();
+
          Session sess = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
          MessageConsumer cons = sess.createConsumer(queue);
          conn2.start();
-         
+
          TextMessage r3 = (TextMessage)cons.receive(1000);
          assertNull(r3);
-       
+
       }
       finally
       {
@@ -1133,19 +1151,19 @@
             conn2.close();
          }
       }
-      
+
    }
-   
-   
+
+
    public void testMultipleSessionsOneTxRollbackAcknowledge1PCOptimization() throws Exception
    {
       if (ServerManagement.isRemote()) return;
-      
+
       XAConnection conn = null;
       Connection conn2 = null;
-      
+
       //Since both resources have some RM, TM will probably use 1PC optimization
-      
+
       try
       {
          //First send 2 messages
@@ -1160,75 +1178,75 @@
          prod.send(m);
          m = sessProducer.createTextMessage("jellyfish4");
          prod.send(m);
-         
-         
+
+
          conn = cf.createXAConnection();
-         conn.start();   
-         
+         conn.start();
+
          tm.begin();
-         
+
          //Create 2 sessions and enlist them
          XASession sess1 = conn.createXASession();
          MessagingXAResource res1 = (MessagingXAResource)sess1.getXAResource();
          XASession sess2 = conn.createXASession();
          MessagingXAResource res2 = (MessagingXAResource)sess2.getXAResource();
- 
+
          Transaction tx = tm.getTransaction();
          tx.enlistResource(res1);
          tx.enlistResource(res2);
-         
+
          //Receive the messages, two on each consumer
          MessageConsumer cons1 = sess1.createConsumer(queue);
          TextMessage r1 = (TextMessage)cons1.receive(1000);
-         
+
          assertNotNull(r1);
          assertEquals("jellyfish1", r1.getText());
-         
+
          r1 = (TextMessage)cons1.receive(1000);
-         
+
          assertNotNull(r1);
          assertEquals("jellyfish2", r1.getText());
-                  
+
          cons1.close();
-      
+
          MessageConsumer cons2 = sess2.createConsumer(queue);
          TextMessage r2 = (TextMessage)cons2.receive(1000);
-         
+
          assertNotNull(r2);
          assertEquals("jellyfish3", r2.getText());
-         
+
          r2 = (TextMessage)cons2.receive(1000);
-         
+
          assertNotNull(r2);
          assertEquals("jellyfish4", r2.getText());
-         
-         cons2.close();            
-         
-         //rollback                          
-         
-         tx.rollback();
-         
+
+         cons2.close();
+
+         //rollback
+
+         tm.rollback();
+
          Session sess = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
          MessageConsumer cons = sess.createConsumer(queue);
          conn2.start();
-         
-         TextMessage r3 = (TextMessage)cons.receive(1000);         
+
+         TextMessage r3 = (TextMessage)cons.receive(1000);
          assertNotNull(r3);
          assertEquals("jellyfish1", r3.getText());
-         
-         r3 = (TextMessage)cons.receive(1000);         
+
+         r3 = (TextMessage)cons.receive(1000);
          assertNotNull(r3);
          assertEquals("jellyfish2", r3.getText());
 
-         TextMessage r4 = (TextMessage)cons.receive(1000);         
+         TextMessage r4 = (TextMessage)cons.receive(1000);
          assertNotNull(r4);
          assertEquals("jellyfish3", r4.getText());
 
-         r4 = (TextMessage)cons.receive(1000);         
+         r4 = (TextMessage)cons.receive(1000);
          assertNotNull(r4);
          assertEquals("jellyfish4", r4.getText());
-         
 
+
       }
       finally
       {
@@ -1241,13 +1259,13 @@
             conn2.close();
          }
       }
-      
+
    }
-   
+
    public void testMultipleSessionsOneTxRollbackAcknowledge() throws Exception
    {
       if (ServerManagement.isRemote()) return;
-      
+
       XAConnection conn = null;
       Connection conn2 = null;
 
@@ -1265,13 +1283,13 @@
          prod.send(m);
          m = sessProducer.createTextMessage("jellyfish4");
          prod.send(m);
-         
-         
+
+
          conn = cf.createXAConnection();
-         conn.start();   
-         
+         conn.start();
+
          tm.begin();
-         
+
          //Create 2 sessions and enlist them
          XASession sess1 = conn.createXASession();
          MessagingXAResource res1 = (MessagingXAResource)sess1.getXAResource();
@@ -1279,69 +1297,69 @@
          MessagingXAResource res2 = (MessagingXAResource)sess2.getXAResource();
          res1.setPreventJoining(true);
          res2.setPreventJoining(true);
-         
+
          Transaction tx = tm.getTransaction();
          tx.enlistResource(res1);
          tx.enlistResource(res2);
-         
+
          //Receive the messages, two on each consumer
          MessageConsumer cons1 = sess1.createConsumer(queue);
          TextMessage r1 = (TextMessage)cons1.receive(1000);
-         
+
          assertNotNull(r1);
          assertEquals("jellyfish1", r1.getText());
-         
+
          r1 = (TextMessage)cons1.receive(1000);
-         
+
          assertNotNull(r1);
          assertEquals("jellyfish2", r1.getText());
-                  
+
          cons1.close();
-         
+
          MessageConsumer cons2 = sess2.createConsumer(queue);
          TextMessage r2 = (TextMessage)cons2.receive(1000);
-         
+
          assertNotNull(r2);
          assertEquals("jellyfish3", r2.getText());
-         
+
          r2 = (TextMessage)cons2.receive(1000);
-         
+
          assertNotNull(r2);
          assertEquals("jellyfish4", r2.getText());
-         
-         //rollback                 
-         
+
+         //rollback
+
          cons2.close();
-         
-         tx.rollback();
-         
+
+         tm.rollback();
+
          Session sess = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
          MessageConsumer cons = sess.createConsumer(queue);
          conn2.start();
-         
+
          //NOTE
          //The order here is actually probably dependent on the transaction manager implementation
          //In this case, rollback will be called on each session, but whether it is called first on res1
          //or res2 determines the order the messages are put back in the queue
          //This test assumes it is called in order res1, res2
-         
-         TextMessage r3 = (TextMessage)cons.receive(1000);         
+
+         TextMessage r3 = (TextMessage)cons.receive(1000);
          assertNotNull(r3);
          assertEquals("jellyfish3", r3.getText());
-         
-         r3 = (TextMessage)cons.receive(1000);         
+
+         r3 = (TextMessage)cons.receive(1000);
          assertNotNull(r3);
          assertEquals("jellyfish4", r3.getText());
 
-         TextMessage r4 = (TextMessage)cons.receive(1000);         
+         TextMessage r4 = (TextMessage)cons.receive(1000);
          assertNotNull(r4);
          assertEquals("jellyfish1", r4.getText());
-  
-         r4 = (TextMessage)cons.receive(1000);         
+
+         r4 = (TextMessage)cons.receive(1000);
          assertNotNull(r4);
          assertEquals("jellyfish2", r4.getText());
-         
 
+
       }
       finally
       {
@@ -1354,13 +1372,13 @@
             conn2.close();
          }
       }
-      
+
    }
-   
+
    public void testMultipleSessionsOneTxRollbackAcknowledgeForceFailureInCommit() throws Exception
    {
       if (ServerManagement.isRemote()) return;
-      
+
       XAConnection conn = null;
       Connection conn2 = null;
 
@@ -1378,79 +1396,80 @@
          prod.send(m);
          m = sessProducer.createTextMessage("jellyfish4");
          prod.send(m);
-         
-         
+
+
          conn = cf.createXAConnection();
-         conn.start();   
-         
+         conn.start();
+
          tm.begin();
-         
+
          XASession sess1 = conn.createXASession();
          MessagingXAResource res1 = (MessagingXAResource)sess1.getXAResource();
          DummyXAResource res2 = new DummyXAResource(true);
          res1.setPreventJoining(true);
-                  
+
          Transaction tx = tm.getTransaction();
          tx.enlistResource(res1);
          tx.enlistResource(res2);
-         
+
          MessageConsumer cons1 = sess1.createConsumer(queue);
          TextMessage r1 = (TextMessage)cons1.receive(1000);
-         
+
          assertNotNull(r1);
          assertEquals("jellyfish1", r1.getText());
-         
+
          r1 = (TextMessage)cons1.receive(1000);
-         
+
          assertNotNull(r1);
          assertEquals("jellyfish2", r1.getText());
-         
+
          r1 = (TextMessage)cons1.receive(1000);
-         
+
          assertNotNull(r1);
          assertEquals("jellyfish3", r1.getText());
-         
+
          r1 = (TextMessage)cons1.receive(1000);
-         
+
          assertNotNull(r1);
          assertEquals("jellyfish4", r1.getText());
-                  
+
          cons1.close();
-         
-         
-         
+
+
+
          //try and commit - and we're going to make the dummyxaresource throw an exception on commit,
          //which should cause rollback to be called on the other resource
          try
          {
-            tx.commit();
+            tm.commit();
+            fail("should not get here");
          }
          catch (Exception e)
          {
             //We should expect this
          }
-         
+
          Session sess = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
          MessageConsumer cons = sess.createConsumer(queue);
          conn2.start();
-          
-         TextMessage r3 = (TextMessage)cons.receive(1000);         
+
+         TextMessage r3 = (TextMessage)cons.receive(1000);
          assertNotNull(r3);
          assertEquals("jellyfish1", r3.getText());
-         
-         r3 = (TextMessage)cons.receive(1000);         
+
+         r3 = (TextMessage)cons.receive(1000);
          assertNotNull(r3);
          assertEquals("jellyfish2", r3.getText());
-  
-         TextMessage r4 = (TextMessage)cons.receive(1000);         
+
+         TextMessage r4 = (TextMessage)cons.receive(1000);
          assertNotNull(r4);
          assertEquals("jellyfish3", r4.getText());
-      
-         r4 = (TextMessage)cons.receive(1000);         
+
+         r4 = (TextMessage)cons.receive(1000);
          assertNotNull(r4);
          assertEquals("jellyfish4", r4.getText());
-         
 
+
       }
       finally
       {
@@ -1463,59 +1482,59 @@
             conn2.close();
          }
       }
-      
+
    }
-   
+
    public void testMultipleSessionsOneTxCommitSend1PCOptimization() throws Exception
    {
       if (ServerManagement.isRemote()) return;
-      
+
       //Since both resources have some RM, TM will probably use 1PC optimization
-      
+
       XAConnection conn = null;
-      
+
       Connection conn2 = null;
-      
+
       try
       {
-         
+
          conn = cf.createXAConnection();
-         conn.start();   
-         
+         conn.start();
+
          tm.begin();
-         
+
          //Create 2 sessions and enlist them
          XASession sess1 = conn.createXASession();
          XAResource res1 = sess1.getXAResource();
          XASession sess2 = conn.createXASession();
          XAResource res2 = sess2.getXAResource();
-         
+
          Transaction tx = tm.getTransaction();
          tx.enlistResource(res1);
          tx.enlistResource(res2);
-         
+
          // Send 2 messages - one from each session
-         
+
          MessageProducer prod1 = sess1.createProducer(queue);
          MessageProducer prod2 = sess2.createProducer(queue);
-         
+
          prod1.send(sess1.createTextMessage("echidna1"));
          prod2.send(sess2.createTextMessage("echidna2"));
-         
+
          //commit
-         tx.commit();
-         
+         tm.commit();
+
          //Messages should be in queue
-         
+
          conn2 = cf.createConnection();
          Session sess = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
          MessageConsumer cons = sess.createConsumer(queue);
          conn2.start();
-         
+
          TextMessage r1 = (TextMessage)cons.receive(1000);
          assertNotNull(r1);
          assertEquals("echidna1", r1.getText());
-         
+
          TextMessage r2 = (TextMessage)cons.receive(1000);
          assertNotNull(r2);
          assertEquals("echidna2", r2.getText());
@@ -1533,27 +1552,27 @@
          }
 
       }
-      
+
    }
-   
+
    public void testMultipleSessionsOneTxCommitSend() throws Exception
    {
       if (ServerManagement.isRemote()) return;
-      
+
       //Since both resources have some RM, TM will probably use 1PC optimization
-      
+
       XAConnection conn = null;
-      
+
       Connection conn2 = null;
-      
+
       try
       {
-         
+
          conn = cf.createXAConnection();
-         conn.start();   
-         
+         conn.start();
+
          tm.begin();
-         
+
          //Create 2 sessions and enlist them
          XASession sess1 = conn.createXASession();
          MessagingXAResource res1 = (MessagingXAResource)sess1.getXAResource();
@@ -1561,33 +1580,33 @@
          MessagingXAResource res2 = (MessagingXAResource)sess2.getXAResource();
          res1.setPreventJoining(true);
          res2.setPreventJoining(true);
-         
+
          Transaction tx = tm.getTransaction();
          tx.enlistResource(res1);
          tx.enlistResource(res2);
-         
+
          // Send 2 messages - one from each session
-         
+
          MessageProducer prod1 = sess1.createProducer(queue);
          MessageProducer prod2 = sess2.createProducer(queue);
-         
+
          prod1.send(sess1.createTextMessage("echidna1"));
          prod2.send(sess2.createTextMessage("echidna2"));
-         
+
          //commit
-         tx.commit();
-         
+         tm.commit();
+
          //Messages should be in queue
-         
+
          conn2 = cf.createConnection();
          Session sess = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
          MessageConsumer cons = sess.createConsumer(queue);
          conn2.start();
-         
+
          TextMessage r1 = (TextMessage)cons.receive(1000);
          assertNotNull(r1);
          assertEquals("echidna1", r1.getText());
-         
+
          TextMessage r2 = (TextMessage)cons.receive(1000);
          assertNotNull(r2);
          assertEquals("echidna2", r2.getText());
@@ -1605,60 +1624,60 @@
          }
 
       }
-      
+
    }
-   
-   
+
+
    public void testMultipleSessionsOneTxRollbackSend1PCOptimization() throws Exception
    {
       if (ServerManagement.isRemote()) return;
-      
+
       //Since both resources have some RM, TM will probably use 1PC optimization
-      
+
       XAConnection conn = null;
-      
+
       Connection conn2 = null;
-      
+
       try
       {
-         
+
          conn = cf.createXAConnection();
-         conn.start();   
-         
+         conn.start();
+
          tm.begin();
-         
+
          //Create 2 sessions and enlist them
          XASession sess1 = conn.createXASession();
          XAResource res1 = sess1.getXAResource();
          XASession sess2 = conn.createXASession();
          XAResource res2 = sess2.getXAResource();
-         
+
          Transaction tx = tm.getTransaction();
          tx.enlistResource(res1);
          tx.enlistResource(res2);
-         
+
          // Send 2 messages - one from each session
-         
+
          MessageProducer prod1 = sess1.createProducer(queue);
          MessageProducer prod2 = sess2.createProducer(queue);
-         
+
          prod1.send(sess1.createTextMessage("echidna1"));
          prod2.send(sess2.createTextMessage("echidna2"));
-         
+
          //rollback
-         tx.rollback();
-         
+         tm.rollback();
+
          //Messages should not be in queue
-         
+
          conn2 = cf.createConnection();
          Session sess = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
          MessageConsumer cons = sess.createConsumer(queue);
          conn2.start();
-         
+
          TextMessage r1 = (TextMessage)cons.receive(1000);
          assertNull(r1);
-         
 
+
       }
       finally
       {
@@ -1672,25 +1691,25 @@
          }
 
       }
-      
+
    }
-   
+
    public void testMultipleSessionsOneTxRollbackSend() throws Exception
    {
       if (ServerManagement.isRemote()) return;
-      
+
       XAConnection conn = null;
-      
+
       Connection conn2 = null;
-      
+
       try
       {
-         
+
          conn = cf.createXAConnection();
-         conn.start();   
-         
+         conn.start();
+
          tm.begin();
-         
+
          //Create 2 sessions and enlist them
          XASession sess1 = conn.createXASession();
          MessagingXAResource res1 = (MessagingXAResource)sess1.getXAResource();
@@ -1698,33 +1717,33 @@
          MessagingXAResource res2 = (MessagingXAResource)sess2.getXAResource();
          res1.setPreventJoining(true);
          res2.setPreventJoining(true);
-         
+
          Transaction tx = tm.getTransaction();
          tx.enlistResource(res1);
          tx.enlistResource(res2);
-         
+
          // Send 2 messages - one from each session
-         
+
          MessageProducer prod1 = sess1.createProducer(queue);
          MessageProducer prod2 = sess2.createProducer(queue);
-         
+
          prod1.send(sess1.createTextMessage("echidna1"));
          prod2.send(sess2.createTextMessage("echidna2"));
-         
+
          //rollback
-         tx.rollback();
-         
+         tm.rollback();
+
          //Messages should not be in queue
-         
+
          conn2 = cf.createConnection();
          Session sess = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
          MessageConsumer cons = sess.createConsumer(queue);
          conn2.start();
-         
+
          TextMessage r1 = (TextMessage)cons.receive(1000);
          assertNull(r1);
-         
 
+
       }
       finally
       {
@@ -1738,20 +1757,20 @@
          }
 
       }
-      
+
    }
-   
- 
+
+
    public void testOneSessionTwoTransactionsCommitAcknowledge() throws Exception
    {
       if (ServerManagement.isRemote()) return;
-      
+
       XAConnection conn = null;
-      
+
       Connection conn2 = null;
-      
+
       try
-      {         
+      {
          //First send 2 messages
          conn2 = cf.createConnection();
          Session sessProducer = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -1760,43 +1779,43 @@
          prod.send(m);
          m = sessProducer.createTextMessage("jellyfish2");
          prod.send(m);
-         
+
          conn = cf.createXAConnection();
 
          //Create a session
          XASession sess1 = conn.createXASession();
          XAResource res1 = sess1.getXAResource();
-                  
+
          conn.start();
          MessageConsumer cons1 = sess1.createConsumer(queue);
-                  
+
          tm.begin();
-         
+
          Transaction tx1 = tm.getTransaction();
          tx1.enlistResource(res1);
-         
+
          //Receive one message in one tx
-         
+
          TextMessage r1 = (TextMessage)cons1.receive(1000);
          assertNotNull(r1);
          assertEquals("jellyfish1", r1.getText());
-         
+
          //suspend the tx
          Transaction suspended = tm.suspend();
-         
+
          tm.begin();
-                  
+
          Transaction tx2 = tm.getTransaction();
          tx2.enlistResource(res1);
-         
+
          //Receive 2nd message in a different tx
          TextMessage r2 = (TextMessage)cons1.receive(1000);
          assertNotNull(r2);
          assertEquals("jellyfish2", r2.getText());
-         
+
          //commit this transaction
-         tx2.commit();
-         
+         tm.commit();
+
          //verify that no messages are available
          conn2 = cf.createConnection();
          Session sess = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -1804,12 +1823,12 @@
          MessageConsumer cons = sess.createConsumer(queue);
          TextMessage r3 = (TextMessage)cons.receive(1000);
          assertNull(r3);
-         
+
          //now resume the first tx and then commit it
          tm.resume(suspended);
-         suspended.commit();
-         
+         tm.commit();
 
+
       }
       finally
       {
@@ -1823,20 +1842,20 @@
          }
 
       }
-      
+
    }
-   
-   
+
+
    public void testOneSessionTwoTransactionsRollbackAcknowledge() throws Exception
    {
       if (ServerManagement.isRemote()) return;
-       
+
       XAConnection conn = null;
-      
+
       Connection conn2 = null;
-      
+
       try
-      {         
+      {
          //First send 2 messages
          conn2 = cf.createConnection();
          Session sessProducer = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -1845,45 +1864,45 @@
          prod.send(m);
          m = sessProducer.createTextMessage("jellyfish2");
          prod.send(m);
-         
+
          conn = cf.createXAConnection();
 
          //Create a session
          XASession sess1 = conn.createXASession();
          XAResource res1 = sess1.getXAResource();
-                  
+
          conn.start();
          MessageConsumer cons1 = sess1.createConsumer(queue);
-                  
+
          tm.begin();
-         
+
          Transaction tx1 = tm.getTransaction();
          tx1.enlistResource(res1);
-         
+
          //Receive one message in one tx
-         
+
          TextMessage r1 = (TextMessage)cons1.receive(1000);
          assertNotNull(r1);
          assertEquals("jellyfish1", r1.getText());
-         
+
          //suspend the tx
          Transaction suspended = tm.suspend();
-         
+
          tm.begin();
-                  
+
          Transaction tx2 = tm.getTransaction();
          tx2.enlistResource(res1);
-         
+
          //Receive 2nd message in a different tx
          TextMessage r2 = (TextMessage)cons1.receive(1000);
          assertNotNull(r2);
          assertEquals("jellyfish2", r2.getText());
-         
+
          cons1.close();
-         
+
          //rollback this transaction
-         tx2.rollback();
-     
+         tm.rollback();
+
          //verify that second message is available
          conn2 = cf.createConnection();
          Session sess = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -1896,19 +1915,19 @@
          assertEquals("jellyfish2", r3.getText());
          r3 = (TextMessage)cons.receive(1000);
          assertNull(r3);
-         
-         
+
+
          //rollback the other tx
          tm.resume(suspended);
-         suspended.rollback();
-       
+         tm.rollback();
+
          //Verify the first message is now available
          r3 = (TextMessage)cons.receive(1000);
          assertNotNull(r3);
          assertEquals("jellyfish1", r3.getText());
          r3 = (TextMessage)cons.receive(1000);
          assertNull(r3);
-         
+
       }
       finally
       {
@@ -1922,52 +1941,52 @@
          }
 
       }
-      
+
    }
-   
 
+
    public void testOneSessionTwoTransactionsCommitSend() throws Exception
    {
       if (ServerManagement.isRemote()) return;
-      
+
       XAConnection conn = null;
-      
+
       Connection conn2 = null;
-      
+
       try
       {
-         
+
          conn = cf.createXAConnection();
 
          //Create a session
          XASession sess1 = conn.createXASession();
          XAResource res1 = sess1.getXAResource();
-         
+
          MessageProducer prod1 = sess1.createProducer(queue);
-                  
+
          tm.begin();
-         
+
          Transaction tx1 = tm.getTransaction();
          tx1.enlistResource(res1);
-         
+
          //Send a message
          prod1.send(sess1.createTextMessage("kangaroo1"));
-         
+
          //suspend the tx
          Transaction suspended = tm.suspend();
-         
+
          tm.begin();
-         
+
          //Send another message in another tx using the same session
          Transaction tx2 = tm.getTransaction();
          tx2.enlistResource(res1);
-         
+
          //Send a message
          prod1.send(sess1.createTextMessage("kangaroo2"));
-         
+
          //commit this transaction
-         tx2.commit();
-         
+         tm.commit();
+
          //verify only kangaroo2 message is sent
          conn2 = cf.createConnection();
          Session sess = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -1978,16 +1997,16 @@
          assertEquals("kangaroo2", r1.getText());
          TextMessage r2 = (TextMessage)cons.receive(1000);
          assertNull(r2);
-         
+
          //now resume the first tx and then commit it
          tm.resume(suspended);
-         suspended.commit();
-         
+         tm.commit();
+
          //verify that the first text message is received
          TextMessage r3 = (TextMessage)cons.receive(1000);
          assertNotNull(r3);
          assertEquals("kangaroo1", r3.getText());
-         
+
       }
       finally
       {
@@ -2001,70 +2020,71 @@
          }
 
       }
-      
+
    }
-   
-   
+
+
    public void testOneSessionTwoTransactionsRollbackSend() throws Exception
    {
       if (ServerManagement.isRemote()) return;
-      
+
       XAConnection conn = null;
-      
+
       Connection conn2 = null;
-      
+
       try
       {
-         
+
          conn = cf.createXAConnection();
 
          //Create a session
          XASession sess1 = conn.createXASession();
          XAResource res1 = sess1.getXAResource();
-         
+
          MessageProducer prod1 = sess1.createProducer(queue);
-                  
+
          tm.begin();
-         
+
          Transaction tx1 = tm.getTransaction();
          tx1.enlistResource(res1);
-         
+
          //Send a message
          prod1.send(sess1.createTextMessage("kangaroo1"));
-         
+
          //suspend the tx
          Transaction suspended = tm.suspend();
-         
+
          tm.begin();
-         
+
          //Send another message in another tx using the same session
          Transaction tx2 = tm.getTransaction();
          tx2.enlistResource(res1);
-         
+
          //Send a message
          prod1.send(sess1.createTextMessage("kangaroo2"));
-         
+
          //rollback this transaction
-         tx2.rollback();
-         
+         tm.rollback();
+
          //verify no messages are sent
          conn2 = cf.createConnection();
          Session sess = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
          conn2.start();
          MessageConsumer cons = sess.createConsumer(queue);
          TextMessage r1 = (TextMessage)cons.receive(1000);
+
          assertNull(r1);
-         
-         
+
+
          //now resume the first tx and then commit it
          tm.resume(suspended);
-         suspended.commit();
-         
+         tm.commit();
+
          //verify that the first text message is received
          TextMessage r3 = (TextMessage)cons.receive(1000);
          assertNotNull(r3);
          assertEquals("kangaroo1", r3.getText());
-         
+
       }
       finally
       {
@@ -2078,9 +2098,9 @@
          }
 
       }
-      
+
    }
-   
+
    // Package protected ---------------------------------------------
    
    // Protected -----------------------------------------------------

Copied: branches/Branch_1_0/tests/src/org/jboss/test/messaging/util/TransactionManagerLocator.java (from rev 1684, branches/Branch_1_0_XARecovery/tests/src/org/jboss/test/messaging/util/TransactionManagerLocator.java)

Modified: branches/Branch_1_0/util/release-admin.xml
===================================================================
--- branches/Branch_1_0/util/release-admin.xml	2006-12-02 13:36:20 UTC (rev 1685)
+++ branches/Branch_1_0/util/release-admin.xml	2006-12-02 14:14:09 UTC (rev 1686)
@@ -18,8 +18,12 @@
    <property name="jboss.home" value="${ENV.JBOSS_HOME}"/>
    <property name="messaging.config.name" value="messaging"/>
    <property name="standalone.messaging.config.name" value="standalone-messaging"/>
+   <property name="thirdparty.home" value="../thirdparty"/>
+   <property name="thirdparty.jbossts.home" value="${thirdparty.home}/jboss/jbossts"/>
+   <property name="lib.home" value="../lib"/>
+   <property name="lib.jbossts.home" value="${lib.home}/jbossts"/>
+   <property name="output.lib.home" value="../output/lib"/>
 
-
    <!-- DO NOT change this value here, otherwise the installation script won't work. Change it in
         do-not-distribute.properties.
    -->
@@ -85,6 +89,22 @@
          <substitution expression="&lt;category name=&quot;org.jboss.serial&quot;&gt;&#013;&#010;      &lt;priority value=&quot;INFO&quot;/&gt;&#013;&#010;   &lt;/category&gt;&#013;&#010;&#013;&#010;   \1"/>
       </replaceregexp>
 
+      <!-- Replace local TM with JBossTS -->
+      
+      <copy file="${thirdparty.jbossts.home}/lib/jbossjta.jar"
+            todir="${jboss.home}/server/${messaging.config.name}/lib"/>
+      <copy file="${thirdparty.jbossts.home}/lib/jbossjta-integration.jar"
+            todir="${jboss.home}/server/${messaging.config.name}/lib"/>
+      <copy file="${thirdparty.jbossts.home}/lib/jbossts-common.jar"
+            todir="${jboss.home}/server/${messaging.config.name}/lib"/>
+      <copy file="${lib.jbossts.home}/jbossjta-properties.xml"
+            todir="${jboss.home}/server/${messaging.config.name}/conf"/>
+      <copy overwrite="true" 
+            file="${lib.jbossts.home}/jboss-service.xml"
+            todir="${jboss.home}/server/${messaging.config.name}/conf"/>
+      <copy file="${output.lib.home}/jboss-messaging-integration.jar"
+            todir="${jboss.home}/server/${messaging.config.name}/lib"/>
+            
       <!-- copy the scoped sar
       <copy todir="${jboss.home}/server/${messaging.config.name}/deploy"
             file="${relative.sar.location}/${messaging.sar.name}"/>




More information about the jboss-cvs-commits mailing list