activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] clebertsuconic commented on a change in pull request #2518: NO-JIRA fix race condition in QueueQueryTest
Date Thu, 24 Jan 2019 19:33:15 GMT
clebertsuconic commented on a change in pull request #2518: NO-JIRA fix race condition in QueueQueryTest
URL: https://github.com/apache/activemq-artemis/pull/2518#discussion_r250747842
 
 

 ##########
 File path: tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/QueueQueryTest.java
 ##########
 @@ -155,19 +156,20 @@ public void testQueueQueryOnAutoCreatedQueueWithFQQN() throws Exception
{
       SimpleString addressName = SimpleString.toSimpleString(UUID.randomUUID().toString());
       SimpleString queueName = SimpleString.toSimpleString(UUID.randomUUID().toString());
       SimpleString fqqn = addressName.concat("::").concat(queueName);
-      JMSContext c = new ActiveMQConnectionFactory("vm://0").createContext();
-      c.createProducer().send(c.createQueue(fqqn.toString()), c.createMessage());
-      QueueQueryResult queueQueryResult = server.queueQuery(fqqn);
-      assertEquals(queueName, queueQueryResult.getName());
-      assertEquals(addressName, queueQueryResult.getAddress());
-      assertEquals(1, queueQueryResult.getMessageCount());
-      queueQueryResult = server.queueQuery(queueName);
-      assertEquals(queueName, queueQueryResult.getName());
-      assertEquals(addressName, queueQueryResult.getAddress());
-      assertEquals(1, queueQueryResult.getMessageCount());
-      c.createProducer().send(c.createQueue(addressName.toString()), c.createMessage());
-      assertEquals(2, server.queueQuery(fqqn).getMessageCount());
-      assertEquals(2, server.queueQuery(queueName).getMessageCount());
+      try (JMSContext c = new ActiveMQConnectionFactory("vm://0").createContext()) {
+         c.createProducer().send(c.createQueue(fqqn.toString()), c.createMessage());
+         QueueQueryResult queueQueryResult = server.queueQuery(fqqn);
+         assertEquals(queueName, queueQueryResult.getName());
+         assertEquals(addressName, queueQueryResult.getAddress());
+         Wait.assertEquals(1, () -> server.queueQuery(fqqn).getMessageCount());
+         queueQueryResult = server.queueQuery(queueName);
+         assertEquals(queueName, queueQueryResult.getName());
+         assertEquals(addressName, queueQueryResult.getAddress());
+         assertEquals(1, queueQueryResult.getMessageCount());
+         c.createProducer().send(c.createQueue(addressName.toString()), c.createMessage());
+         Wait.assertEquals(2, () -> server.queueQuery(fqqn).getMessageCount());
 
 Review comment:
   merged.. however I ammended this change

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message