ARTEMIS-2333 Making tests more reliable

This commit is contained in:
Clebert Suconic 2019-05-08 21:10:05 -04:00
parent 3f08e7f359
commit 7f7194f779
2 changed files with 24 additions and 12 deletions

View File

@ -66,7 +66,7 @@ public class MQTTConnection implements RemotingConnection {
@Override @Override
public boolean isWritable(ReadyListener callback) { public boolean isWritable(ReadyListener callback) {
return transportConnection.isWritable(callback); return transportConnection.isWritable(callback) && transportConnection.isOpen();
} }
@Override @Override

View File

@ -2612,7 +2612,16 @@ public class ActiveMQServerControlTest extends ManagementTestBase {
JsonArray array = (JsonArray) producersAsJsonObject.get("data"); JsonArray array = (JsonArray) producersAsJsonObject.get("data");
Assert.assertTrue("number of producers returned from query", 2 <= array.size()); Assert.assertTrue("number of producers returned from query", 2 <= array.size());
JsonObject jsonSession = array.getJsonObject(0);
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 //check all fields
Assert.assertNotEquals("id", "", jsonSession.getString("id")); Assert.assertNotEquals("id", "", jsonSession.getString("id"));
@ -2624,7 +2633,10 @@ public class ActiveMQServerControlTest extends ManagementTestBase {
Assert.assertNotEquals("localAddress", "", jsonSession.getString("localAddress")); Assert.assertNotEquals("localAddress", "", jsonSession.getString("localAddress"));
Assert.assertNotEquals("remoteAddress", "", jsonSession.getString("remoteAddress")); Assert.assertNotEquals("remoteAddress", "", jsonSession.getString("remoteAddress"));
Assert.assertNotEquals("creationTime", "", jsonSession.getString("creationTime")); Assert.assertNotEquals("creationTime", "", jsonSession.getString("creationTime"));
}
Assert.assertTrue("Valid session not found", foundElement);
} }
} }