You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by orpiske <gi...@git.apache.org> on 2017/03/08 14:35:26 UTC

[GitHub] activemq-artemis pull request #1071: Add a test for MQTT will message with n...

GitHub user orpiske opened a pull request:

    https://github.com/apache/activemq-artemis/pull/1071

    Add a test for MQTT will message with non-retain flag

    This patch adds a new test that verifies if the broker is able to send
    a will message if the retain flag is set to false.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/orpiske/activemq-artemis will-message-with-non-retain

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/activemq-artemis/pull/1071.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1071
    
----
commit a194c24c4077d980cfa9e3411026109fc7da0682
Author: Otavio Rodolfo Piske <op...@redhat.com>
Date:   2017-03-08T14:28:36Z

    Add a test for MQTT will message with non-retain flag
    
    This patch adds a new test that verifies if the broker is able to send
    a will message if the retain flag is set to false.

----


---
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.
---

[GitHub] activemq-artemis pull request #1071: Add a test for MQTT will message with n...

Posted by orpiske <gi...@git.apache.org>.
Github user orpiske closed the pull request at:

    https://github.com/apache/activemq-artemis/pull/1071


---
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.
---

[GitHub] activemq-artemis pull request #1071: Add a test for MQTT will message with n...

Posted by clebertsuconic <gi...@git.apache.org>.
Github user clebertsuconic commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/1071#discussion_r105169685
  
    --- Diff: tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTest.java ---
    @@ -1067,6 +1067,43 @@ public boolean isSatisfied() throws Exception {
     
     
        @Test(timeout = 60 * 1000)
    +   public void testWillMessageIsReceivedWithNonRetain() throws Exception {
    +      getServer().createQueue(SimpleString.toSimpleString("will"), RoutingType.MULTICAST, SimpleString.toSimpleString("will"), null, true, false);
    +
    +      MQTT mqtt = createMQTTConnection("1", false);
    +      mqtt.setKeepAlive((short) 1);
    +      mqtt.setWillMessage("test message with non-retain");
    +      mqtt.setWillTopic("will");
    +      mqtt.setWillQos(QoS.AT_LEAST_ONCE);
    +      mqtt.setWillRetain(false);
    +
    +      final BlockingConnection connection = mqtt.blockingConnection();
    +      connection.connect();
    +      Wait.waitFor(new Wait.Condition() {
    +         @Override
    +         public boolean isSatisfied() throws Exception {
    +            return connection.isConnected();
    +         }
    +      });
    +
    +      // kill transport
    +      connection.kill();
    +
    +      Thread.sleep(10000);
    --- End diff --
    
    no no no no no no no no no!!!!!!!!!!!!!!!! :)
    
    10 seconds on a test.. that's an eternety.. I have been trying to get rid of sleeps on the testsuite, not the opposite :)


---
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.
---

[GitHub] activemq-artemis issue #1071: Add a test for MQTT will message with non-reta...

Posted by mtaylor <gi...@git.apache.org>.
Github user mtaylor commented on the issue:

    https://github.com/apache/activemq-artemis/pull/1071
  
    @orpiske The test is not valid.  If you are sending WILL non retained, then the consumer must be subscribed **before** the connection is killed.  I moved the kill connection statement to after the client subscription and the test passes.


---
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.
---

[GitHub] activemq-artemis pull request #1071: Add a test for MQTT will message with n...

Posted by mtaylor <gi...@git.apache.org>.
Github user mtaylor commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/1071#discussion_r105178355
  
    --- Diff: tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTest.java ---
    @@ -1067,6 +1067,43 @@ public boolean isSatisfied() throws Exception {
     
     
        @Test(timeout = 60 * 1000)
    +   public void testWillMessageIsReceivedWithNonRetain() throws Exception {
    +      getServer().createQueue(SimpleString.toSimpleString("will"), RoutingType.MULTICAST, SimpleString.toSimpleString("will"), null, true, false);
    +
    +      MQTT mqtt = createMQTTConnection("1", false);
    +      mqtt.setKeepAlive((short) 1);
    +      mqtt.setWillMessage("test message with non-retain");
    +      mqtt.setWillTopic("will");
    +      mqtt.setWillQos(QoS.AT_LEAST_ONCE);
    +      mqtt.setWillRetain(false);
    +
    +      final BlockingConnection connection = mqtt.blockingConnection();
    +      connection.connect();
    +      Wait.waitFor(new Wait.Condition() {
    +         @Override
    +         public boolean isSatisfied() throws Exception {
    +            return connection.isConnected();
    +         }
    +      });
    +
    +      // kill transport
    +      connection.kill();
    +
    +      Thread.sleep(10000);
    --- End diff --
    
    @orpiske Any change you could change the sleep to use a latch.  There was a conditional latch added recently that will exit once a condition is met.  See the ProtonTest for an example.
    
    Thanks


---
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.
---

[GitHub] activemq-artemis issue #1071: Add a test for MQTT will message with non-reta...

Posted by orpiske <gi...@git.apache.org>.
Github user orpiske commented on the issue:

    https://github.com/apache/activemq-artemis/pull/1071
  
    @clebertsuconic / @mtaylor Sure thing. That should be fine. I basically just copied the TC above this one to reproduce the issue. I will take a look and update it accordingly.


---
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.
---

[GitHub] activemq-artemis pull request #1071: Add a test for MQTT will message with n...

Posted by orpiske <gi...@git.apache.org>.
Github user orpiske commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/1071#discussion_r105194247
  
    --- Diff: tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTest.java ---
    @@ -1067,6 +1067,43 @@ public boolean isSatisfied() throws Exception {
     
     
        @Test(timeout = 60 * 1000)
    +   public void testWillMessageIsReceivedWithNonRetain() throws Exception {
    +      getServer().createQueue(SimpleString.toSimpleString("will"), RoutingType.MULTICAST, SimpleString.toSimpleString("will"), null, true, false);
    +
    +      MQTT mqtt = createMQTTConnection("1", false);
    +      mqtt.setKeepAlive((short) 1);
    +      mqtt.setWillMessage("test message with non-retain");
    +      mqtt.setWillTopic("will");
    +      mqtt.setWillQos(QoS.AT_LEAST_ONCE);
    +      mqtt.setWillRetain(false);
    +
    +      final BlockingConnection connection = mqtt.blockingConnection();
    +      connection.connect();
    +      Wait.waitFor(new Wait.Condition() {
    +         @Override
    +         public boolean isSatisfied() throws Exception {
    +            return connection.isConnected();
    +         }
    +      });
    +
    +      // kill transport
    +      connection.kill();
    +
    +      Thread.sleep(10000);
    --- End diff --
    
    @clebertsuconic / @mtaylor Sure thing. That should be fine. I basically just copied the TC above this one to reproduce the issue. I will take a look and update it accordingly.


---
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.
---

[GitHub] activemq-artemis issue #1071: Add a test for MQTT will message with non-reta...

Posted by orpiske <gi...@git.apache.org>.
Github user orpiske commented on the issue:

    https://github.com/apache/activemq-artemis/pull/1071
  
    After some discussions w/ the developers, this code does not properly reproduce the issue raised on the C code and, among other things, is wrong. Therefore, closing the PR.


---
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.
---

[GitHub] activemq-artemis pull request #1071: Add a test for MQTT will message with n...

Posted by clebertsuconic <gi...@git.apache.org>.
Github user clebertsuconic commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/1071#discussion_r105169899
  
    --- Diff: tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTest.java ---
    @@ -1067,6 +1067,43 @@ public boolean isSatisfied() throws Exception {
     
     
        @Test(timeout = 60 * 1000)
    +   public void testWillMessageIsReceivedWithNonRetain() throws Exception {
    +      getServer().createQueue(SimpleString.toSimpleString("will"), RoutingType.MULTICAST, SimpleString.toSimpleString("will"), null, true, false);
    +
    +      MQTT mqtt = createMQTTConnection("1", false);
    +      mqtt.setKeepAlive((short) 1);
    +      mqtt.setWillMessage("test message with non-retain");
    +      mqtt.setWillTopic("will");
    +      mqtt.setWillQos(QoS.AT_LEAST_ONCE);
    +      mqtt.setWillRetain(false);
    +
    +      final BlockingConnection connection = mqtt.blockingConnection();
    +      connection.connect();
    +      Wait.waitFor(new Wait.Condition() {
    +         @Override
    +         public boolean isSatisfied() throws Exception {
    +            return connection.isConnected();
    +         }
    +      });
    +
    +      // kill transport
    +      connection.kill();
    +
    +      Thread.sleep(10000);
    --- End diff --
    
    We should rather have a Wait clause here.


---
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.
---