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
This commit is contained in:
Gary Tully 2012-09-11 14:14:36 +00:00
parent 170b86a861
commit 215dd18196
1 changed files with 11 additions and 2 deletions

View File

@ -44,6 +44,7 @@ import javax.jms.TextMessage;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.apache.activemq.transport.TransportListener; import org.apache.activemq.transport.TransportListener;
import org.apache.activemq.transport.vm.VMTransport; import org.apache.activemq.transport.vm.VMTransport;
import org.apache.activemq.util.Wait;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -246,16 +247,24 @@ public class JmsTempDestinationTest extends TestCase {
* @throws JMSException * @throws JMSException
* @throws InterruptedException * @throws InterruptedException
*/ */
public void testPublishFailsForDestoryedTempDestination() throws JMSException, InterruptedException { public void testPublishFailsForDestroyedTempDestination() throws Exception {
Connection tempConnection = factory.createConnection(); Connection tempConnection = factory.createConnection();
connections.add(tempConnection); connections.add(tempConnection);
Session tempSession = tempConnection.createSession(false, Session.AUTO_ACKNOWLEDGE); 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); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
connection.start(); 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 // This message delivery should work since the temp connection is still
// open. // open.
MessageProducer producer = session.createProducer(queue); MessageProducer producer = session.createProducer(queue);