[hornetq-commits] JBoss hornetq SVN: r8336 - trunk/tests/src/org/hornetq/tests/integration/cluster/failover.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Nov 20 07:47:18 EST 2009


Author: jmesnil
Date: 2009-11-20 07:47:17 -0500 (Fri, 20 Nov 2009)
New Revision: 8336

Modified:
   trunk/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java
Log:
fixed AsynchronousFailoverTest.testNonTransactional

* retried the consumer creation in case failover occurs when the consumer is created

Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java	2009-11-20 10:05:37 UTC (rev 8335)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java	2009-11-20 12:47:17 UTC (rev 8336)
@@ -241,8 +241,27 @@
             }
             while (retry);
          }
+         
+         // create the consumer with retry if failover occurs during createConsumer call
+         ClientConsumer consumer = null;
+         boolean retry = false;
+         do
+         {
+            try
+            {
+               consumer = session.createConsumer(ADDRESS);
+               
+               retry = false;
+            }
+            catch (HornetQException e)
+            {
+               log.info("exception when creating consumer");
+               assertEquals(e.getCode(), HornetQException.UNBLOCKED);
 
-         ClientConsumer consumer = session.createConsumer(ADDRESS);
+               retry = true;
+            }
+         }
+         while (retry);
 
          session.start();
 



More information about the hornetq-commits mailing list