ARTEMIS-2625 testListConsumers failing on IBM JDK 8
Fix JmxServerControlTest.testListConsumers.
This commit is contained in:
parent
692e44d999
commit
de113e47ae
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package org.apache.activemq.artemis.tests.smoke.jmx2;
|
package org.apache.activemq.artemis.tests.smoke.jmx2;
|
||||||
|
|
||||||
|
import javax.jms.MessageConsumer;
|
||||||
import javax.jms.Session;
|
import javax.jms.Session;
|
||||||
import javax.json.JsonArray;
|
import javax.json.JsonArray;
|
||||||
import javax.json.JsonObject;
|
import javax.json.JsonObject;
|
||||||
|
@ -87,18 +88,22 @@ public class JmxServerControlTest extends SmokeTestBase {
|
||||||
activeMQServerControl.createQueue(addressName, queueName, RoutingType.ANYCAST.name());
|
activeMQServerControl.createQueue(addressName, queueName, RoutingType.ANYCAST.name());
|
||||||
String uri = "tcp://localhost:61616";
|
String uri = "tcp://localhost:61616";
|
||||||
try (ActiveMQConnectionFactory cf = ActiveMQJMSClient.createConnectionFactory(uri, null)) {
|
try (ActiveMQConnectionFactory cf = ActiveMQJMSClient.createConnectionFactory(uri, null)) {
|
||||||
cf.createConnection().createSession(true, Session.SESSION_TRANSACTED).createConsumer(new ActiveMQQueue(queueName));
|
MessageConsumer consumer = cf.createConnection().createSession(true, Session.SESSION_TRANSACTED).createConsumer(new ActiveMQQueue(queueName));
|
||||||
|
|
||||||
String options = JsonUtil.toJsonObject(ImmutableMap.of("field","queue", "operation", "EQUALS", "value", queueName)).toString();
|
try {
|
||||||
String consumersAsJsonString = activeMQServerControl.listConsumers(options, 1, 10);
|
String options = JsonUtil.toJsonObject(ImmutableMap.of("field","queue", "operation", "EQUALS", "value", queueName)).toString();
|
||||||
|
String consumersAsJsonString = activeMQServerControl.listConsumers(options, 1, 10);
|
||||||
|
|
||||||
JsonObject consumersAsJsonObject = JsonUtil.readJsonObject(consumersAsJsonString);
|
JsonObject consumersAsJsonObject = JsonUtil.readJsonObject(consumersAsJsonString);
|
||||||
JsonArray array = (JsonArray) consumersAsJsonObject.get("data");
|
JsonArray array = (JsonArray) consumersAsJsonObject.get("data");
|
||||||
|
|
||||||
Assert.assertEquals("number of consumers returned from query", 1, array.size());
|
Assert.assertEquals("number of consumers returned from query", 1, array.size());
|
||||||
JsonObject jsonConsumer = array.getJsonObject(0);
|
JsonObject jsonConsumer = array.getJsonObject(0);
|
||||||
Assert.assertEquals("queue name in consumer", queueName, jsonConsumer.getString("queue"));
|
Assert.assertEquals("queue name in consumer", queueName, jsonConsumer.getString("queue"));
|
||||||
Assert.assertEquals("address name in consumer", addressName, jsonConsumer.getString("address"));
|
Assert.assertEquals("address name in consumer", addressName, jsonConsumer.getString("address"));
|
||||||
|
} finally {
|
||||||
|
consumer.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
jmxConnector.close();
|
jmxConnector.close();
|
||||||
|
|
Loading…
Reference in New Issue