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

2017-03-10 Thread orpiske
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


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

2017-03-09 Thread orpiske
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(1);
--- 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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


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

2017-03-09 Thread mtaylor
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(1);
--- 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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


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

2017-03-09 Thread clebertsuconic
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(1);
--- 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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


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

2017-03-09 Thread clebertsuconic
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(1);
--- 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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


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

2017-03-08 Thread orpiske
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 
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---