From 215dd18196d4314d2b0d98b675fa32bfa3108496 Mon Sep 17 00:00:00 2001 From: Gary Tully Date: Tue, 11 Sep 2012 14:14:36 +0000 Subject: [PATCH] https://issues.apache.org/jira/browse/AMQ-3985 - fix up timeing issue in test post change to asyncDispatch for temp dest advisories git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1383426 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/activemq/JmsTempDestinationTest.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/activemq-core/src/test/java/org/apache/activemq/JmsTempDestinationTest.java b/activemq-core/src/test/java/org/apache/activemq/JmsTempDestinationTest.java index 0488eaceca..0dacb47ffc 100755 --- a/activemq-core/src/test/java/org/apache/activemq/JmsTempDestinationTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/JmsTempDestinationTest.java @@ -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 extends TestCase { * @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);