NO-JIRA make OpenWire test more robust

This commit is contained in:
Justin Bertram 2019-11-07 20:50:00 -06:00 committed by Clebert Suconic
parent 2dfb4f06ec
commit 566579f96f
1 changed files with 7 additions and 2 deletions

View File

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