activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r1159168 - /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/OnePrefetchAsyncConsumerTest.java
Date Thu, 18 Aug 2011 11:14:49 GMT
Author: gtully
Date: Thu Aug 18 11:14:49 2011
New Revision: 1159168

URL: http://svn.apache.org/viewvc?rev=1159168&view=rev
Log:
add autofail

Modified:
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/OnePrefetchAsyncConsumerTest.java

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/OnePrefetchAsyncConsumerTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/OnePrefetchAsyncConsumerTest.java?rev=1159168&r1=1159167&r2=1159168&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/OnePrefetchAsyncConsumerTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/OnePrefetchAsyncConsumerTest.java
Thu Aug 18 11:14:49 2011
@@ -67,12 +67,14 @@ public class OnePrefetchAsyncConsumerTes
 
         // wait for test to complete and the test result to get set
         // this happens asynchronously since the messages are delivered asynchronously
+        long done = System.currentTimeMillis() + getMaxTestTime();
         synchronized (testMutex) {
-           while (!testMutex.testCompleted) {
+           while (!testMutex.testCompleted && System.currentTimeMillis() < done)
{
               testMutex.wait();
            }
         }
 
+         assertTrue("completed on time", testMutex.testCompleted);
         //test completed, result is ready
         assertTrue("Attempted to retrieve more than one ServerSession at a time", testMutex.testSuccessful);
     }
@@ -177,7 +179,7 @@ public class OnePrefetchAsyncConsumerTes
 
                      // let the test check if the test was completed
                      synchronized (testMutex) {
-                         testMutex.notify();
+                         testMutex.notifyAll();
                      }
                  }
               }.start();
@@ -197,6 +199,7 @@ public class OnePrefetchAsyncConsumerTes
                       if (!testMutex.testCompleted) {
                           testMutex.testSuccessful = true;
                           testMutex.testCompleted = true;
+                          testMutex.notifyAll();
                       }
                   }
                }



Mime
View raw message