[jboss-cvs] JBoss Messaging SVN: r6103 - trunk/tests/src/org/jboss/messaging/tests/integration/xa.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Mar 17 19:26:42 EDT 2009


Author: clebert.suconic at jboss.com
Date: 2009-03-17 19:26:42 -0400 (Tue, 17 Mar 2009)
New Revision: 6103

Modified:
   trunk/tests/src/org/jboss/messaging/tests/integration/xa/BasicXaTest.java
Log:
https://jira.jboss.org/jira/browse/JBMESSAGING-1548 - Adding test that replicate the Empty rollback issue

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/xa/BasicXaTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/xa/BasicXaTest.java	2009-03-17 20:33:44 UTC (rev 6102)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/xa/BasicXaTest.java	2009-03-17 23:26:42 UTC (rev 6103)
@@ -26,21 +26,16 @@
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
 import javax.transaction.xa.XAException;
 import javax.transaction.xa.XAResource;
 import javax.transaction.xa.Xid;
 
-import com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple;
-
 import org.jboss.messaging.core.client.ClientConsumer;
 import org.jboss.messaging.core.client.ClientMessage;
 import org.jboss.messaging.core.client.ClientProducer;
 import org.jboss.messaging.core.client.ClientSession;
 import org.jboss.messaging.core.client.ClientSessionFactory;
 import org.jboss.messaging.core.client.MessageHandler;
-import org.jboss.messaging.core.client.impl.ClientSessionImpl;
 import org.jboss.messaging.core.config.Configuration;
 import org.jboss.messaging.core.exception.MessagingException;
 import org.jboss.messaging.core.logging.Logger;
@@ -134,7 +129,7 @@
       validateRM(nettyFactory, sessionFactory);
    }
 
-   private void validateRM(ClientSessionFactory factory1, ClientSessionFactory factory2) throws Exception
+   private void validateRM(final ClientSessionFactory factory1, final ClientSessionFactory factory2) throws Exception
    {
       ClientSession session1 = factory1.createSession(true, false, false);
       ClientSession session2 = factory2.createSession(true, false, false);
@@ -331,7 +326,38 @@
 
       session.close();
    }
+   
+   public void testEmptyXID() throws Exception
+   {
+      Xid xid = newXID();
+      ClientSession session = sessionFactory.createSession(true, false, false);
+      session.start(xid, XAResource.TMNOFLAGS);
+      session.end(xid, XAResource.TMSUCCESS);
+      session.rollback(xid);
 
+      session.close();
+      
+      messagingService.stop();
+      
+      // Enable this when https://jira.jboss.org/jira/browse/JBMESSAGING-1548 is done
+      
+//      // do the same test with a file persistence now
+//      messagingService = createService(true, configuration, addressSettings);
+//      
+//      messagingService.start();
+//      
+//      sessionFactory = createInVMFactory();
+//      
+//      xid = newXID();
+//      session = sessionFactory.createSession(true, false, false);
+//      session.start(xid, XAResource.TMNOFLAGS);
+//      session.end(xid, XAResource.TMSUCCESS);
+//      session.rollback(xid);
+      
+
+   }
+
+
    public void testForget() throws Exception
    {
       clientSession.forget(newXID());
@@ -339,8 +365,6 @@
 
    public void testSimpleJoin() throws Exception
    {
-      sessionFactory.setBlockOnPersistentSend(true);
-
       SimpleString ADDRESS1 = new SimpleString("Address-1");
       SimpleString ADDRESS2 = new SimpleString("Address-2");
 
@@ -408,11 +432,11 @@
     * @throws MessagingException
     * @throws XAException
     */
-   protected void multipleQueuesInternalTest(boolean createQueues,
-                                             boolean suspend,
-                                             boolean recreateSession,
-                                             boolean isJoinSession,
-                                             boolean onePhase) throws Exception
+   protected void multipleQueuesInternalTest(final boolean createQueues,
+                                             final boolean suspend,
+                                             final boolean recreateSession,
+                                             final boolean isJoinSession,
+                                             final boolean onePhase) throws Exception
    {
       int NUMBER_OF_MSGS = 100;
       int NUMBER_OF_QUEUES = 10;
@@ -603,23 +627,15 @@
       }
    }
 
-   /**
-    * @return
-    */
-   private XidImpl newXID()
-   {
-      return new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
-   }
-
    class TxMessageHandler implements MessageHandler
    {
       boolean failedToAck = false;
 
       final ClientSession session;
 
-      private CountDownLatch latch;
+      private final CountDownLatch latch;
 
-      public TxMessageHandler(ClientSession session, CountDownLatch latch)
+      public TxMessageHandler(final ClientSession session, final CountDownLatch latch)
       {
          this.latch = latch;
          this.session = session;




More information about the jboss-cvs-commits mailing list