activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r1383426 - /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTempDestinationTest.java
Date Tue, 11 Sep 2012 14:14:36 GMT
Author: gtully
Date: Tue Sep 11 14:14:36 2012
New Revision: 1383426

URL: http://svn.apache.org/viewvc?rev=1383426&view=rev
Log:
https://issues.apache.org/jira/browse/AMQ-3985 - fix up timeing issue in test post change
to asyncDispatch for temp dest advisories

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

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTempDestinationTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTempDestinationTest.java?rev=1383426&r1=1383425&r2=1383426&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTempDestinationTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTempDestinationTest.java
Tue Sep 11 14:14:36 2012
@@ -44,6 +44,7 @@ import javax.jms.TextMessage;
 import junit.framework.TestCase;
 import org.apache.activemq.transport.TransportListener;
 import org.apache.activemq.transport.vm.VMTransport;
+import org.apache.activemq.util.Wait;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -246,16 +247,24 @@ public class JmsTempDestinationTest exte
      * @throws JMSException
      * @throws InterruptedException
      */
-    public void testPublishFailsForDestoryedTempDestination() throws JMSException, InterruptedException
{
+    public void testPublishFailsForDestroyedTempDestination() throws Exception {
 
         Connection tempConnection = factory.createConnection();
         connections.add(tempConnection);
         Session tempSession = tempConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-        TemporaryQueue queue = tempSession.createTemporaryQueue();
+        final TemporaryQueue queue = tempSession.createTemporaryQueue();
 
         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
         connection.start();
 
+        final ActiveMQConnection activeMQConnection = (ActiveMQConnection) connection;
+        assertTrue("creation advisory received in time with async dispatch", Wait.waitFor(new
Wait.Condition() {
+            @Override
+            public boolean isSatisified() throws Exception {
+                return activeMQConnection.activeTempDestinations.containsKey(queue);
+            }
+        }));
+
         // This message delivery should work since the temp connection is still
         // open.
         MessageProducer producer = session.createProducer(queue);



Mime
View raw message