Quantcast

[1/3] activemq-artemis git commit: NO-JIRA fix race in TopicControlClusterTest

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[1/3] activemq-artemis git commit: NO-JIRA fix race in TopicControlClusterTest

clebertsuconic-2
Repository: activemq-artemis
Updated Branches:
  refs/heads/master c54dfd305 -> b58381f20


NO-JIRA fix race in TopicControlClusterTest

Test didn't account for "remote" queue bindings from other cluster
member which caused a race condition.


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

Branch: refs/heads/master
Commit: bf5ca678eef70b885b433e6200a94c54935f7982
Parents: c54dfd3
Author: Justin Bertram <[hidden email]>
Authored: Mon Mar 13 12:40:51 2017 -0500
Committer: Justin Bertram <[hidden email]>
Committed: Mon Mar 13 12:46:20 2017 -0500

----------------------------------------------------------------------
 .../management/TopicControlClusterTest.java     | 41 +++++++++++---------
 1 file changed, 23 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bf5ca678/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/TopicControlClusterTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/TopicControlClusterTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/TopicControlClusterTest.java
index 8cb1dc3..5b858b8 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/TopicControlClusterTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/TopicControlClusterTest.java
@@ -24,24 +24,23 @@ import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.api.core.management.AddressControl;
 import org.apache.activemq.artemis.tests.integration.management.ManagementControlHelper;
 import org.apache.activemq.artemis.tests.util.JMSClusteredTestBase;
+import org.apache.activemq.artemis.tests.util.Wait;
 import org.junit.Test;
 
 public class TopicControlClusterTest extends JMSClusteredTestBase {
 
    @Test
    public void testClusteredSubscriptionCount() throws Exception {
-      Connection conn1 = cf1.createConnection();
+      final String topicName = "t1";
+      final SimpleString simpleTopicName = SimpleString.toSimpleString(topicName);
 
-      conn1.setClientID("someClient1");
+      try (Connection conn1 = cf1.createConnection(); Connection conn2 = cf2.createConnection()) {
+         conn1.setClientID("someClient1");
+         conn2.setClientID("someClient2");
 
-      Connection conn2 = cf2.createConnection();
+         Topic topic1 = createTopic(topicName);
 
-      conn2.setClientID("someClient2");
-
-      try {
-         Topic topic1 = createTopic("t1");
-
-         Topic topic2 = (Topic) context2.lookup("/topic/t1");
+         Topic topic2 = (Topic) context2.lookup("/topic/" + topicName);
 
          Session session1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
          session1.createDurableSubscriber(topic1, "sub1_1");
@@ -50,16 +49,22 @@ public class TopicControlClusterTest extends JMSClusteredTestBase {
          Session session2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
          session2.createDurableSubscriber(topic2, "sub2");
 
-         SimpleString add1 = new SimpleString(topic1.getTopicName());
-         SimpleString add2 = new SimpleString(topic2.getTopicName());
-         AddressControl topicControl1 = ManagementControlHelper.createAddressControl(add1, mBeanServer1);
-         AddressControl topicControl2 = ManagementControlHelper.createAddressControl(add2, mBeanServer2);
+         AddressControl topicControl1 = ManagementControlHelper.createAddressControl(simpleTopicName, mBeanServer1);
+         AddressControl topicControl2 = ManagementControlHelper.createAddressControl(simpleTopicName, mBeanServer2);
+
+         assertTrue("There should be 3 subscriptions on the topic, 2 local and 1 remote.", Wait.waitFor(new Wait.Condition() {
+            @Override
+            public boolean isSatisfied() throws Exception {
+               return topicControl1.getQueueNames().length == 3;
+            }
+         }, 2000));
 
-         assertEquals(2, topicControl1.getQueueNames().length);
-         assertEquals(1, topicControl2.getQueueNames().length);
-      } finally {
-         conn1.close();
-         conn2.close();
+         assertTrue("There should be 3 subscriptions on the topic, 1 local and 2 remote.", Wait.waitFor(new Wait.Condition() {
+            @Override
+            public boolean isSatisfied() throws Exception {
+               return topicControl2.getQueueNames().length == 3;
+            }
+         }, 2000));
       }
 
       jmsServer1.destroyTopic("t1");

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[2/3] activemq-artemis git commit: NO-JIRA: Changing TopicControlClusterTest to expression

clebertsuconic-2
NO-JIRA: Changing TopicControlClusterTest to expression


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

Branch: refs/heads/master
Commit: 8cf3119767cd930c4fa4b054cd8497bf4c5fea5e
Parents: bf5ca67
Author: Clebert Suconic <[hidden email]>
Authored: Tue Mar 14 09:42:49 2017 -0400
Committer: Clebert Suconic <[hidden email]>
Committed: Tue Mar 14 09:42:49 2017 -0400

----------------------------------------------------------------------
 .../server/management/TopicControlClusterTest.java  | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/8cf31197/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/TopicControlClusterTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/TopicControlClusterTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/TopicControlClusterTest.java
index 5b858b8..5db6575 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/TopicControlClusterTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/TopicControlClusterTest.java
@@ -52,19 +52,11 @@ public class TopicControlClusterTest extends JMSClusteredTestBase {
          AddressControl topicControl1 = ManagementControlHelper.createAddressControl(simpleTopicName, mBeanServer1);
          AddressControl topicControl2 = ManagementControlHelper.createAddressControl(simpleTopicName, mBeanServer2);
 
-         assertTrue("There should be 3 subscriptions on the topic, 2 local and 1 remote.", Wait.waitFor(new Wait.Condition() {
-            @Override
-            public boolean isSatisfied() throws Exception {
-               return topicControl1.getQueueNames().length == 3;
-            }
-         }, 2000));
+         assertTrue("There should be 3 subscriptions on the topic, 2 local and 1 remote.",
+                    Wait.waitFor(() -> topicControl1.getQueueNames().length == 3, 2000));
 
-         assertTrue("There should be 3 subscriptions on the topic, 1 local and 2 remote.", Wait.waitFor(new Wait.Condition() {
-            @Override
-            public boolean isSatisfied() throws Exception {
-               return topicControl2.getQueueNames().length == 3;
-            }
-         }, 2000));
+         assertTrue("There should be 3 subscriptions on the topic, 1 local and 2 remote.",
+                    Wait.waitFor(() -> topicControl2.getQueueNames().length == 3, 2000));
       }
 
       jmsServer1.destroyTopic("t1");

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[3/3] activemq-artemis git commit: This closes #1092

clebertsuconic-2
In reply to this post by clebertsuconic-2
This closes #1092


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

Branch: refs/heads/master
Commit: b58381f20efda9bd9e951576fd177e354e103d33
Parents: c54dfd3 8cf3119
Author: Clebert Suconic <[hidden email]>
Authored: Tue Mar 14 09:47:59 2017 -0400
Committer: Clebert Suconic <[hidden email]>
Committed: Tue Mar 14 09:47:59 2017 -0400

----------------------------------------------------------------------
 .../management/TopicControlClusterTest.java     | 33 +++++++++-----------
 1 file changed, 15 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


Loading...