ARTEMIS-5173 Fix test failure due to NPE after Queue lookup
The lookup of the just created queues can return null on a very slow machine causing the test to fail, add Waits with queue queries to allow the Queues to get created on both brokers.
This commit is contained in:
parent
1066985149
commit
9620f8279e
|
@ -27,6 +27,7 @@ import java.util.HashMap;
|
|||
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.TransportConfiguration;
|
||||
import org.apache.activemq.artemis.core.config.DivertConfiguration;
|
||||
import org.apache.activemq.artemis.core.config.amqpBrokerConnectivity.AMQPBrokerConnectConfiguration;
|
||||
|
@ -113,12 +114,16 @@ public class AMQPMirrorOneSideDisconnectedTest extends ActiveMQTestBase {
|
|||
} catch (Exception ignored) {
|
||||
}
|
||||
|
||||
Wait.assertTrue(() -> serverA.queueQuery(SimpleString.of(queueName)).isExists(), 5000, 100);
|
||||
Wait.assertTrue(() -> serverB.queueQuery(SimpleString.of(queueName)).isExists(), 5000, 100);
|
||||
Wait.assertTrue(() -> serverA.queueQuery(SimpleString.of(divertedQueue)).isExists(), 5000, 100);
|
||||
Wait.assertTrue(() -> serverB.queueQuery(SimpleString.of(divertedQueue)).isExists(), 5000, 100);
|
||||
|
||||
Queue divertedQueueA = serverA.locateQueue(divertedQueue);
|
||||
Queue divertedQueueB = serverB.locateQueue(divertedQueue);
|
||||
Queue queueA = serverA.locateQueue(queueName);
|
||||
Queue queueB = serverB.locateQueue(queueName);
|
||||
|
||||
|
||||
long nmessages = 10;
|
||||
|
||||
ConnectionFactory factoryA = CFUtil.createConnectionFactory(randomProtocol(), "tcp://localhost:5671");
|
||||
|
@ -136,7 +141,6 @@ public class AMQPMirrorOneSideDisconnectedTest extends ActiveMQTestBase {
|
|||
Wait.assertEquals(nmessages, queueA::getMessageCount, 5000, 100);
|
||||
Wait.assertEquals(nmessages, queueB::getMessageCount, 5000, 100);
|
||||
|
||||
|
||||
Queue serverAMirrorSNF = serverA.locateQueue("$ACTIVEMQ_ARTEMIS_MIRROR_A_to_B");
|
||||
Wait.assertEquals(0L, serverAMirrorSNF::getMessageCount, 5000, 100);
|
||||
|
||||
|
|
Loading…
Reference in New Issue