[hornetq-commits] JBoss hornetq SVN: r9999 - trunk/tests/src/org/hornetq/tests/integration/xa.

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Dec 6 05:41:00 EST 2010


Author: ataylor
Date: 2010-12-06 05:41:00 -0500 (Mon, 06 Dec 2010)
New Revision: 9999

Modified:
   trunk/tests/src/org/hornetq/tests/integration/xa/BasicXaTest.java
Log:
fixed xa test

Modified: trunk/tests/src/org/hornetq/tests/integration/xa/BasicXaTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/xa/BasicXaTest.java	2010-12-06 09:37:04 UTC (rev 9998)
+++ trunk/tests/src/org/hornetq/tests/integration/xa/BasicXaTest.java	2010-12-06 10:41:00 UTC (rev 9999)
@@ -95,6 +95,28 @@
             //
          }
       }
+      if(sessionFactory != null)
+      {
+         try
+         {
+            sessionFactory.close();
+         }
+         catch (Exception e)
+         {
+            //
+         }
+      }
+      if(locator != null)
+      {
+         try
+         {
+            locator.close();
+         }
+         catch (Exception e)
+         {
+            //
+         }
+      }
       if (messagingService != null && messagingService.isStarted())
       {
          try
@@ -390,7 +412,7 @@
       int numSessions = 100;
       ClientSession clientSession2 = sessionFactory.createSession(false, true, true);
       ClientProducer clientProducer = clientSession2.createProducer(atestq);
-      for (int i = 0; i < 10 * numSessions; i++)
+      for (int i = 0; i < numSessions; i++)
       {
          clientProducer.send(createTextMessage(clientSession2, "m" + i));
       }
@@ -410,7 +432,8 @@
          session.start();
       }
 
-      Assert.assertTrue(latch.await(10, TimeUnit.SECONDS));
+      boolean ok = latch.await(10, TimeUnit.SECONDS);
+      Assert.assertTrue(ok);
       for (TxMessageHandler messageHandler : handlers)
       {
          Assert.assertFalse(messageHandler.failedToAck);
@@ -419,6 +442,7 @@
       clientSession2.close();
       for (ClientSession session : clientSessions)
       {
+         session.stop();
          session.close();
       }
 
@@ -962,6 +986,8 @@
       }
    }
 
+   private static volatile int received = 0;
+
    class TxMessageHandler implements MessageHandler
    {
       boolean failedToAck = false;
@@ -970,6 +996,7 @@
 
       private final CountDownLatch latch;
 
+
       public TxMessageHandler(final ClientSession session, final CountDownLatch latch)
       {
          this.latch = latch;
@@ -993,6 +1020,7 @@
          try
          {
             message.acknowledge();
+            BasicXaTest.log.info("processed message " + (received++));
          }
          catch (HornetQException e)
          {



More information about the hornetq-commits mailing list