This commit is contained in:
Clebert Suconic 2019-11-08 13:08:00 -05:00
commit fe7a842f4e
1 changed files with 7 additions and 2 deletions

View File

@ -17,6 +17,8 @@
package org.apache.activemq.artemis.tests.integration.openwire.cluster; package org.apache.activemq.artemis.tests.integration.openwire.cluster;
import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.api.core.RoutingType;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.utils.Wait;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@ -64,20 +66,23 @@ public class TemporaryQueueClusterTest extends OpenWireJMSClusteredTestBase {
Session session2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE); Session session2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
Queue targetQueue2 = session2.createQueue(QUEUE_NAME); Queue targetQueue2 = session2.createQueue(QUEUE_NAME);
this.waitForBindings(servers[0], QUEUE_NAME, true, 1, 0, 2000); this.waitForBindings(servers[0], QUEUE_NAME, true, 1, 0, 2000);
this.waitForBindings(servers[1], QUEUE_NAME, true, 1, 0, 2000); this.waitForBindings(servers[1], QUEUE_NAME, true, 1, 0, 2000);
this.waitForBindings(servers[1], QUEUE_NAME, false, 1, 0, 2000); this.waitForBindings(servers[1], QUEUE_NAME, false, 1, 0, 2000);
this.waitForBindings(servers[0], QUEUE_NAME, false, 1, 0, 2000); this.waitForBindings(servers[0], QUEUE_NAME, false, 1, 0, 2000);
MessageProducer prod1 = session1.createProducer(targetQueue1); MessageProducer prod1 = session1.createProducer(targetQueue1);
MessageConsumer cons2 = session2.createConsumer(targetQueue2); MessageConsumer cons2 = session2.createConsumer(targetQueue2);
this.waitForBindings(servers[0], QUEUE_NAME, false, 1, 1, 2000);
this.waitForBindings(servers[1], QUEUE_NAME, true, 1, 1, 2000);
TextMessage msg = session1.createTextMessage("hello"); TextMessage msg = session1.createTextMessage("hello");
prod1.send(msg); prod1.send(msg);
Wait.assertTrue(() -> getServer(1).locateQueue(SimpleString.toSimpleString(QUEUE_NAME)).getMessageCount() == 1, 5000, 100);
TextMessage msgReceived = (TextMessage) cons2.receive(5000); TextMessage msgReceived = (TextMessage) cons2.receive(5000);
assertNotNull(msgReceived); assertNotNull(msgReceived);