activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuconic <...@git.apache.org>
Subject [GitHub] activemq-artemis pull request #1092: NO-JIRA fix race in TopicControlCluster...
Date Tue, 14 Mar 2017 13:33:47 GMT
Github user clebertsuconic commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/1092#discussion_r105907994
  
    --- Diff: tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/TopicControlClusterTest.java
---
    @@ -50,16 +49,22 @@ public void testClusteredSubscriptionCount() throws Exception {
              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() {
    --- End diff --
    
    We should start using java8 things here.. much cleaner:
    
    For example, expressions
    ```java
             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(() -> topicControl2.getQueueNames().length == 3, 2000));
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message