mirror of https://github.com/apache/activemq.git
ensure async dispatches temp advisory is present before verfication of temp usage
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1391392 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f677d1a2c5
commit
591c1a549c
|
@ -208,16 +208,24 @@ public class JmsTempDestinationTest extends TestCase {
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
* @throws URISyntaxException
|
* @throws URISyntaxException
|
||||||
*/
|
*/
|
||||||
public void testPublishFailsForClosedConnection() throws JMSException, InterruptedException, URISyntaxException {
|
public void testPublishFailsForClosedConnection() 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);
|
||||||
|
|
Loading…
Reference in New Issue