activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [activemq-artemis] branch master updated: ARTEMIS-2333 Making tests more reliable
Date Thu, 09 May 2019 01:13:56 GMT
This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/master by this push:
     new 7f7194f  ARTEMIS-2333 Making tests more reliable
7f7194f is described below

commit 7f7194f77900f8b53675abeeea4cd3242d4ae021
Author: Clebert Suconic <clebertsuconic@apache.org>
AuthorDate: Wed May 8 21:10:05 2019 -0400

    ARTEMIS-2333 Making tests more reliable
---
 .../artemis/core/protocol/mqtt/MQTTConnection.java |  2 +-
 .../management/ActiveMQServerControlTest.java      | 34 +++++++++++++++-------
 2 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTConnection.java
b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTConnection.java
index 26c1369..1f31692 100644
--- a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTConnection.java
+++ b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTConnection.java
@@ -66,7 +66,7 @@ public class MQTTConnection implements RemotingConnection {
 
    @Override
    public boolean isWritable(ReadyListener callback) {
-      return transportConnection.isWritable(callback);
+      return transportConnection.isWritable(callback) && transportConnection.isOpen();
    }
 
    @Override
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java
index 9d6310a..22c1834 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java
@@ -2612,19 +2612,31 @@ public class ActiveMQServerControlTest extends ManagementTestBase
{
          JsonArray array = (JsonArray) producersAsJsonObject.get("data");
 
          Assert.assertTrue("number of producers returned from query", 2 <= array.size());
-         JsonObject jsonSession = array.getJsonObject(0);
 
-         //check all fields
-         Assert.assertNotEquals("id", "", jsonSession.getString("id"));
-         Assert.assertNotEquals("session", "", jsonSession.getString("session"));
-         Assert.assertEquals("clientID", "", jsonSession.getString("clientID"));
-         Assert.assertEquals("user", "", jsonSession.getString("user"));
-         Assert.assertNotEquals("protocol", "", jsonSession.getString("protocol"));
-         Assert.assertEquals("address", "", jsonSession.getString("address"));
-         Assert.assertNotEquals("localAddress", "", jsonSession.getString("localAddress"));
-         Assert.assertNotEquals("remoteAddress", "", jsonSession.getString("remoteAddress"));
-         Assert.assertNotEquals("creationTime", "", jsonSession.getString("creationTime"));
+         boolean foundElement = false;
+         for (int i = 0; i < array.size(); i++) {
+
+            JsonObject jsonSession = array.getJsonObject(i);
+            if (jsonSession.getString("address").equals("activemq.management")) {
+               continue;
+            }
+
+            foundElement = true;
+
+            //check all fields
+            Assert.assertNotEquals("id", "", jsonSession.getString("id"));
+            Assert.assertNotEquals("session", "", jsonSession.getString("session"));
+            Assert.assertEquals("clientID", "", jsonSession.getString("clientID"));
+            Assert.assertEquals("user", "", jsonSession.getString("user"));
+            Assert.assertNotEquals("protocol", "", jsonSession.getString("protocol"));
+            Assert.assertEquals("address", "", jsonSession.getString("address"));
+            Assert.assertNotEquals("localAddress", "", jsonSession.getString("localAddress"));
+            Assert.assertNotEquals("remoteAddress", "", jsonSession.getString("remoteAddress"));
+            Assert.assertNotEquals("creationTime", "", jsonSession.getString("creationTime"));
+         }
+
 
+         Assert.assertTrue("Valid session not found", foundElement);
       }
    }
 


Mime
View raw message