[hornetq-commits] JBoss hornetq SVN: r10505 - branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Apr 13 23:30:16 EDT 2011


Author: clebert.suconic at jboss.com
Date: 2011-04-13 23:30:16 -0400 (Wed, 13 Apr 2011)
New Revision: 10505

Modified:
   branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControl2Test.java
Log:
Fixing test (adding wait because of async calls) - after JBAPP-6300

Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControl2Test.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControl2Test.java	2011-04-13 22:39:12 UTC (rev 10504)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControl2Test.java	2011-04-14 03:30:16 UTC (rev 10505)
@@ -556,9 +556,23 @@
                                                        JMSServerControl2Test.PING_PERIOD);
          Connection connection = cf1.createConnection();
 
-         jsonStr = control.listConnectionsAsJSON();
-         assertNotNull(jsonStr);
-         infos = JMSConnectionInfo.from(jsonStr);
+         long timeout = System.currentTimeMillis() + 5000;
+
+         // Some of the send is asynchronous, so need to wait a few micro seconds eventually
+         while (System.currentTimeMillis() < timeout)
+         {
+            jsonStr = control.listConnectionsAsJSON();
+            assertNotNull(jsonStr);
+            infos = JMSConnectionInfo.from(jsonStr);
+            if (infos.length == 1)
+            {
+               break;
+            }
+            else
+            {
+               Thread.sleep(500);
+            }
+         }
          assertEquals(1, infos.length);
          for (JMSConnectionInfo info : infos)
          {
@@ -572,9 +586,25 @@
                                                        JMSServerControl2Test.PING_PERIOD);
          Connection connection2 = cf2.createConnection();
 
-         jsonStr = control.listConnectionsAsJSON();
-         assertNotNull(jsonStr);
-         infos = JMSConnectionInfo.from(jsonStr);
+         timeout = System.currentTimeMillis() + 5000;
+         
+         // Some of the send is asynchronous, so need to wait a few micro seconds eventually
+         while (System.currentTimeMillis() < timeout)
+         {
+            jsonStr = control.listConnectionsAsJSON();
+            assertNotNull(jsonStr);
+            infos = JMSConnectionInfo.from(jsonStr);
+            
+            if (infos.length == 2)
+            {
+               break;
+            }
+            else
+            {
+               Thread.sleep(500);
+            }
+         }
+         
          assertEquals(2, infos.length);
          for (JMSConnectionInfo info : infos)
          {



More information about the hornetq-commits mailing list