activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [1/2] activemq-artemis git commit: NO-JIRA fix race in OpenWire temp queue test
Date Fri, 04 May 2018 01:43:34 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 3c0f3cf52 -> acc34d908


NO-JIRA fix race in OpenWire temp queue test


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/bd7ec8cc
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/bd7ec8cc
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/bd7ec8cc

Branch: refs/heads/master
Commit: bd7ec8cca5abad555032596ebb139b2c72ab499f
Parents: 3c0f3cf
Author: Justin Bertram <jbertram@apache.org>
Authored: Thu May 3 18:51:57 2018 -0500
Committer: Justin Bertram <jbertram@apache.org>
Committed: Thu May 3 18:58:14 2018 -0500

----------------------------------------------------------------------
 .../tests/integration/openwire/SimpleOpenWireTest.java    | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bd7ec8cc/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java
index 7a86e8c..59c2e93 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java
@@ -1606,11 +1606,10 @@ public class SimpleOpenWireTest extends BasicOpenWireTest {
    public void testTempQueueSendAfterConnectionClose() throws Exception {
 
       Connection connection1 = null;
-      Connection connection2 = null;
+      final Connection connection2 = factory.createConnection();
 
       try {
          connection1 = factory.createConnection();
-         connection2 = factory.createConnection();
          connection1.start();
          connection2.start();
 
@@ -1619,6 +1618,10 @@ public class SimpleOpenWireTest extends BasicOpenWireTest {
 
          Session session2 = connection2.createSession(false, Session.AUTO_ACKNOWLEDGE);
          MessageProducer producer = session2.createProducer(tempQueue);
+
+         // need to wait here because the ActiveMQ client's temp destination map is updated
asynchronously, not waiting can introduce a race
+         assertTrue(Wait.waitFor(() -> ((ActiveMQConnection)connection2).activeTempDestinations.size()
== 1, 2000, 100));
+
          producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
          TextMessage m = session2.createTextMessage("Hello temp queue");
          producer.send(m);
@@ -1631,6 +1634,9 @@ public class SimpleOpenWireTest extends BasicOpenWireTest {
          //close first connection, let temp queue die
          connection1.close();
 
+         // need to wait here because the ActiveMQ client's temp destination map is updated
asynchronously, not waiting can introduce a race
+         assertTrue(Wait.waitFor(() -> ((ActiveMQConnection)connection2).activeTempDestinations.size()
== 0, 2000, 100));
+
          waitForBindings(this.server, tempQueue.getQueueName(), true, 0, 0, 5000);
          //send again
          try {


Mime
View raw message