diff --git a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/connections.js b/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/connections.js
index 2329552c37..b6041c27d1 100644
--- a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/connections.js
+++ b/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/connections.js
@@ -31,7 +31,7 @@ var ARTEMIS = (function(ARTEMIS) {
var method = 'listConnections(java.lang.String, int, int)';
var attributes = [
{
- field: 'iD',
+ field: 'connectionID',
displayName: 'ID',
width: '*'
},
@@ -46,7 +46,7 @@ var ARTEMIS = (function(ARTEMIS) {
width: '*'
},
{
- field: 'protocolName',
+ field: 'protocol',
displayName: 'Protocol',
width: '*'
},
@@ -63,7 +63,7 @@ var ARTEMIS = (function(ARTEMIS) {
width: '*'
},
{
- field: 'transportLocalAddress',
+ field: 'localAddress',
displayName: 'Local Address',
width: '*'
},
@@ -95,7 +95,7 @@ var ARTEMIS = (function(ARTEMIS) {
operation: "",
value: "",
sortOrder: "asc",
- sortBy: "iD"
+ sortBy: "connectionID"
}
};
@@ -142,8 +142,8 @@ var ARTEMIS = (function(ARTEMIS) {
currentPage: 1
};
$scope.sortOptions = {
- fields: ["iD"],
- columns: ["iD"],
+ fields: ["connectionID"],
+ columns: ["connectionID"],
directions: ["asc"]
};
var refreshed = false;
diff --git a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/consumers.js b/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/consumers.js
index ccc17a554f..c0e27a2084 100644
--- a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/consumers.js
+++ b/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/consumers.js
@@ -31,31 +31,31 @@ var ARTEMIS = (function(ARTEMIS) {
var method = 'listConsumers(java.lang.String, int, int)';
var attributes = [
{
- field: 'sequentialID',
+ field: 'id',
displayName: 'ID',
width: '*'
},
{
- field: 'sessionName',
+ field: 'session',
displayName: 'Session',
width: '*',
- cellTemplate: '
'
+ cellTemplate: ''
},
{
- field: 'connectionClientID',
+ field: 'clientID',
displayName: 'Client ID',
width: '*'
},
{
- field: 'connectionProtocolName',
+ field: 'protocol',
displayName: 'Protocol',
width: '*'
},
{
- field: 'queueName',
+ field: 'queue',
displayName: 'Queue',
width: '*',
- cellTemplate: ''
+ cellTemplate: ''
},
{
field: 'queueType',
@@ -63,18 +63,18 @@ var ARTEMIS = (function(ARTEMIS) {
width: '*'
},
{
- field: 'queueAddress',
+ field: 'address',
displayName: 'Address',
width: '*',
- cellTemplate: ''
+ cellTemplate: ''
},
{
- field: 'connectionRemoteAddress',
+ field: 'remoteAddress',
displayName: 'Remote Address',
width: '*'
},
{
- field: 'connectionLocalAddress',
+ field: 'localAddress',
displayName: 'Local Address',
width: '*'
},
@@ -105,7 +105,7 @@ var ARTEMIS = (function(ARTEMIS) {
operation: "",
value: "",
sortOrder: "asc",
- sortBy: "sequentialID"
+ sortBy: "id"
}
};
@@ -166,8 +166,8 @@ var ARTEMIS = (function(ARTEMIS) {
currentPage: 1
};
$scope.sortOptions = {
- fields: ["sequentialID"],
- columns: ["sequentialID"],
+ fields: ["id"],
+ columns: ["id"],
directions: ["asc"]
};
var refreshed = false;
diff --git a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/producers.js b/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/producers.js
index 4f3a3165a2..33f8e3e01e 100644
--- a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/producers.js
+++ b/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/producers.js
@@ -31,7 +31,7 @@ var ARTEMIS = (function(ARTEMIS) {
var method = 'listProducers(java.lang.String, int, int)';
var attributes = [
{
- field: 'iD',
+ field: 'id',
displayName: 'ID',
width: '*'
},
@@ -99,7 +99,7 @@ var ARTEMIS = (function(ARTEMIS) {
operation: "",
value: "",
sortOrder: "asc",
- sortBy: "iD"
+ sortBy: "id"
}
};
@@ -136,8 +136,8 @@ var ARTEMIS = (function(ARTEMIS) {
currentPage: 1
};
$scope.sortOptions = {
- fields: ["iD"],
- columns: ["iD"],
+ fields: ["id"],
+ columns: ["id"],
directions: ["asc"]
};
var refreshed = false;
diff --git a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/queues.js b/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/queues.js
index 7cd22ec42e..241e0d788f 100644
--- a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/queues.js
+++ b/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/queues.js
@@ -37,7 +37,7 @@ var ARTEMIS = (function(ARTEMIS) {
cellTemplate: ''
},
{
- field: 'iD',
+ field: 'id',
displayName: 'ID',
width: '*'
},
@@ -178,7 +178,7 @@ var ARTEMIS = (function(ARTEMIS) {
operation: "",
value: "",
sortOrder: "asc",
- sortBy: "iD"
+ sortBy: "id"
}
};
@@ -210,8 +210,8 @@ var ARTEMIS = (function(ARTEMIS) {
currentPage: 1
};
$scope.sortOptions = {
- fields: ["iD"],
- columns: ["iD"],
+ fields: ["id"],
+ columns: ["id"],
directions: ["asc"]
};
var refreshed = false;
diff --git a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/sessions.js b/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/sessions.js
index 14b84bfc9e..20aa7525a2 100644
--- a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/sessions.js
+++ b/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/sessions.js
@@ -31,7 +31,7 @@ var ARTEMIS = (function(ARTEMIS) {
var method = 'listSessions(java.lang.String, int, int)';
var attributes = [
{
- field: 'name',
+ field: 'id',
displayName: 'ID',
width: '*'
},
@@ -42,7 +42,7 @@ var ARTEMIS = (function(ARTEMIS) {
cellTemplate: ''
},
{
- field: 'username',
+ field: 'user',
displayName: 'User',
width: '*'
},
@@ -86,7 +86,7 @@ var ARTEMIS = (function(ARTEMIS) {
operation: "",
value: "",
sortOrder: "asc",
- sortBy: "name"
+ sortBy: "id"
}
};
// Configure Parent/Child click through relationships
@@ -161,8 +161,8 @@ var ARTEMIS = (function(ARTEMIS) {
currentPage: 1
};
$scope.sortOptions = {
- fields: ["name"],
- columns: ["name"],
+ fields: ["id"],
+ columns: ["id"],
directions: ["asc"]
};
var refreshed = false;
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
index 753d01b0fb..6e12766605 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
@@ -1737,8 +1737,12 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
try {
final Set addresses = server.getPostOffice().getAddresses();
List addressInfo = new ArrayList<>();
- for (SimpleString address:addresses) {
- addressInfo.add(server.getPostOffice().getAddressInfo(address));
+ for (SimpleString address : addresses) {
+ AddressInfo info = server.getPostOffice().getAddressInfo(address);
+ //ignore if no longer available
+ if (info != null) {
+ addressInfo.add(info);
+ }
}
AddressView view = new AddressView(server);
view.setCollection(addressInfo);
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/ConnectionView.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/ConnectionView.java
index ac7c4a4559..94ee4876f9 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/ConnectionView.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/ConnectionView.java
@@ -31,7 +31,7 @@ import org.apache.activemq.artemis.utils.StringUtil;
public class ConnectionView extends ActiveMQAbstractView {
- private static final String defaultSortColumn = "iD";
+ private static final String defaultSortColumn = "connectionID";
private final ActiveMQServer server;
@@ -57,7 +57,15 @@ public class ConnectionView extends ActiveMQAbstractView {
users.add(username);
}
- return JsonLoader.createObjectBuilder().add("iD", toString(connection.getID())).add("remoteAddress", toString(connection.getRemoteAddress())).add("users", StringUtil.joinStringList(users, ",")).add("creationTime", new Date(connection.getCreationTime()).toString()).add("implementation", toString(toString(connection.getClass().getSimpleName()))).add("protocolName", toString(connection.getProtocolName())).add("clientID", toString(connection.getClientID())).add("transportLocalAddress", toString(connection.getTransportLocalAddress())).add("sessionCount", server.getSessions(connection.getID().toString()).size());
+ return JsonLoader.createObjectBuilder().add("connectionID", toString(connection.getID()))
+ .add("remoteAddress", toString(connection.getRemoteAddress()))
+ .add("users", StringUtil.joinStringList(users, ","))
+ .add("creationTime", new Date(connection.getCreationTime()).toString())
+ .add("implementation", toString(toString(connection.getClass().getSimpleName())))
+ .add("protocol", toString(connection.getProtocolName()))
+ .add("clientID", toString(connection.getClientID()))
+ .add("localAddress", toString(connection.getTransportLocalAddress()))
+ .add("sessionCount", server.getSessions(connection.getID().toString()).size());
}
@Override
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/ConsumerView.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/ConsumerView.java
index 386425a1d1..4b1feb348d 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/ConsumerView.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/ConsumerView.java
@@ -27,7 +27,7 @@ import org.apache.activemq.artemis.utils.JsonLoader;
public class ConsumerView extends ActiveMQAbstractView {
- private static final String defaultSortColumn = "sequentialID";
+ private static final String defaultSortColumn = "id";
private final ActiveMQServer server;
@@ -51,16 +51,16 @@ public class ConsumerView extends ActiveMQAbstractView {
return null;
}
- JsonObjectBuilder obj = JsonLoader.createObjectBuilder().add("sequentialID", toString(consumer.getSequentialID()))
- .add("sessionName", toString(consumer.getSessionName()))
- .add("connectionClientID", toString(consumer.getConnectionClientID()))
+ JsonObjectBuilder obj = JsonLoader.createObjectBuilder().add("id", toString(consumer.getSequentialID()))
+ .add("session", toString(consumer.getSessionName()))
+ .add("clientID", toString(consumer.getConnectionClientID()))
.add("user", toString(session.getUsername()))
- .add("connectionProtocolName", toString(consumer.getConnectionProtocolName()))
- .add("queueName", toString(consumer.getQueueName()))
+ .add("protocol", toString(consumer.getConnectionProtocolName()))
+ .add("queue", toString(consumer.getQueueName()))
.add("queueType", toString(consumer.getQueueType()).toLowerCase())
- .add("queueAddress", toString(consumer.getQueueAddress().toString()))
- .add("connectionLocalAddress", toString(consumer.getConnectionLocalAddress()))
- .add("connectionRemoteAddress", toString(consumer.getConnectionRemoteAddress()))
+ .add("address", toString(consumer.getQueueAddress().toString()))
+ .add("localAddress", toString(consumer.getConnectionLocalAddress()))
+ .add("remoteAddress", toString(consumer.getConnectionRemoteAddress()))
.add("creationTime", new Date(consumer.getCreationTime()).toString());
return obj;
}
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/ProducerView.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/ProducerView.java
index 978722974e..e14ab6d9c1 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/ProducerView.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/ProducerView.java
@@ -44,7 +44,15 @@ public class ProducerView extends ActiveMQAbstractView {
@Override
public JsonObjectBuilder toJson(ServerProducer producer) {
ServerSession session = server.getSessionByID(producer.getSessionID());
- JsonObjectBuilder obj = JsonLoader.createObjectBuilder().add("iD", toString(producer.getID())).add("session", toString(session.getName())).add("clientID", toString(session.getRemotingConnection().getClientID())).add("user", toString(session.getUsername())).add("protocol", toString(session.getRemotingConnection().getProtocolName())).add("address", toString(producer.getAddress() != null ? producer.getAddress() : session.getDefaultAddress())).add("localAddress", toString(session.getRemotingConnection().getTransportConnection().getLocalAddress())).add("remoteAddress", toString(session.getRemotingConnection().getTransportConnection().getRemoteAddress())).add("creationTime", toString(producer.getCreationTime()));
+ JsonObjectBuilder obj = JsonLoader.createObjectBuilder().add("id", toString(producer.getID()))
+ .add("session", toString(session.getName()))
+ .add("clientID", toString(session.getRemotingConnection().getClientID()))
+ .add("user", toString(session.getUsername()))
+ .add("protocol", toString(session.getRemotingConnection().getProtocolName()))
+ .add("address", toString(producer.getAddress() != null ? producer.getAddress() : session.getDefaultAddress()))
+ .add("localAddress", toString(session.getRemotingConnection().getTransportConnection().getLocalAddress()))
+ .add("remoteAddress", toString(session.getRemotingConnection().getTransportConnection().getRemoteAddress()))
+ .add("creationTime", toString(producer.getCreationTime()));
return obj;
}
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/QueueView.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/QueueView.java
index cb80cc9df6..539ded99ec 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/QueueView.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/QueueView.java
@@ -45,7 +45,23 @@ public class QueueView extends ActiveMQAbstractView {
@Override
public JsonObjectBuilder toJson(QueueControl queue) {
Queue q = server.locateQueue(new SimpleString(queue.getName()));
- JsonObjectBuilder obj = JsonLoader.createObjectBuilder().add("iD", toString(queue.getID())).add("name", toString(queue.getName())).add("address", toString(queue.getAddress())).add("filter", toString(queue.getFilter())).add("rate", toString(q.getRate())).add("durable", toString(queue.isDurable())).add("paused", toString(q.isPaused())).add("temporary", toString(queue.isTemporary())).add("purgeOnNoConsumers", toString(queue.isPurgeOnNoConsumers())).add("consumerCount", toString(queue.getConsumerCount())).add("maxConsumers", toString(queue.getMaxConsumers())).add("autoCreated", toString(q.isAutoCreated())).add("user", toString(q.getUser())).add("routingType", toString(queue.getRoutingType())).add("messagesAdded", toString(queue.getMessagesAdded())).add("messageCount", toString(queue.getMessageCount())).add("messagesAcked", toString(queue.getMessagesAcknowledged())).add("deliveringCount", toString(queue.getDeliveringCount())).add("messagesKilled", toString(queue.getMessagesKilled())).add("deliverDeliver", toString(q.isDirectDeliver()));
+ JsonObjectBuilder obj = JsonLoader.createObjectBuilder().add("id", toString(queue.getID()))
+ .add("name", toString(queue.getName())).add("address", toString(queue.getAddress()))
+ .add("filter", toString(queue.getFilter())).add("rate", toString(q.getRate()))
+ .add("durable", toString(queue.isDurable())).add("paused", toString(q.isPaused()))
+ .add("temporary", toString(queue.isTemporary()))
+ .add("purgeOnNoConsumers", toString(queue.isPurgeOnNoConsumers()))
+ .add("consumerCount", toString(queue.getConsumerCount()))
+ .add("maxConsumers", toString(queue.getMaxConsumers()))
+ .add("autoCreated", toString(q.isAutoCreated()))
+ .add("user", toString(q.getUser()))
+ .add("routingType", toString(queue.getRoutingType()))
+ .add("messagesAdded", toString(queue.getMessagesAdded()))
+ .add("messageCount", toString(queue.getMessageCount()))
+ .add("messagesAcked", toString(queue.getMessagesAcknowledged()))
+ .add("deliveringCount", toString(queue.getDeliveringCount()))
+ .add("messagesKilled", toString(queue.getMessagesKilled()))
+ .add("deliverDeliver", toString(q.isDirectDeliver()));
return obj;
}
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/SessionView.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/SessionView.java
index c294993647..6a9386421f 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/SessionView.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/SessionView.java
@@ -25,7 +25,7 @@ import org.apache.activemq.artemis.utils.JsonLoader;
public class SessionView extends ActiveMQAbstractView {
- private static final String defaultSortColumn = "name";
+ private static final String defaultSortColumn = "id";
public SessionView() {
super();
@@ -39,7 +39,12 @@ public class SessionView extends ActiveMQAbstractView {
@Override
public JsonObjectBuilder toJson(ServerSession session) {
- JsonObjectBuilder obj = JsonLoader.createObjectBuilder().add("name", toString(session.getName())).add("username", toString(session.getUsername())).add("creationTime", new Date(session.getCreationTime()).toString()).add("consumerCount", session.getConsumerCount()).add("producerCount", session.getProducerCount()).add("connectionID", session.getConnectionID().toString());
+ JsonObjectBuilder obj = JsonLoader.createObjectBuilder().add("id", toString(session.getName()))
+ .add("user", toString(session.getUsername()))
+ .add("creationTime", new Date(session.getCreationTime()).toString())
+ .add("consumerCount", session.getConsumerCount())
+ .add("producerCount", session.getProducerCount())
+ .add("connectionID", session.getConnectionID().toString());
return obj;
}
diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ActiveMQServerControlMultiThreadTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ActiveMQServerControlMultiThreadTest.java
index 6f4b886ca9..609103a60d 100644
--- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ActiveMQServerControlMultiThreadTest.java
+++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ActiveMQServerControlMultiThreadTest.java
@@ -64,8 +64,8 @@ public class ActiveMQServerControlMultiThreadTest extends ManagementTestBase {
@Test
@BMRules(rules = {@BMRule(name = "Delay listAddress() by 2 secs ",
- targetClass = "org.apache.activemq.artemis.core.management.impl.view.AddressView ",
- targetMethod = "(org.apache.activemq.artemis.core.server.ActiveMQServer)",
+ targetClass = "org.apache.activemq.artemis.core.postoffice.impl.PostOfficeImpl",
+ targetMethod = "getAddressInfo(org.apache.activemq.artemis.api.core.SimpleString)",
targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.ActiveMQServerControlMultiThreadTest.delay(2)")})
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 8c2b6c25c1..55d7254e7e 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
@@ -1518,6 +1518,27 @@ public class ActiveMQServerControlTest extends ManagementTestBase {
array = (JsonArray) queuesAsJsonObject.get("data");
Assert.assertEquals("number of queues returned from query", 1, array.size());
+ //check all field names are available
+ Assert.assertNotEquals("name", "", array.getJsonObject(0).getString("name"));
+ Assert.assertNotEquals("id", "", array.getJsonObject(0).getString("id"));
+ Assert.assertNotEquals("address", "", array.getJsonObject(0).getString("address"));
+ Assert.assertEquals("filter", "", array.getJsonObject(0).getString("filter"));
+ Assert.assertNotEquals("rate", "", array.getJsonObject(0).getString("rate"));
+ Assert.assertEquals("durable", "false", array.getJsonObject(0).getString("durable"));
+ Assert.assertEquals("paused", "false", array.getJsonObject(0).getString("paused"));
+ Assert.assertNotEquals("temporary", "", array.getJsonObject(0).getString("temporary"));
+ Assert.assertEquals("purgeOnNoConsumers", "false", array.getJsonObject(0).getString("purgeOnNoConsumers"));
+ Assert.assertNotEquals("consumerCount", "", array.getJsonObject(0).getString("consumerCount"));
+ Assert.assertEquals("maxConsumers", "-1", array.getJsonObject(0).getString("maxConsumers"));
+ Assert.assertEquals("autoCreated", "false", array.getJsonObject(0).getString("autoCreated"));
+ Assert.assertEquals("user", "", array.getJsonObject(0).getString("user"));
+ Assert.assertNotEquals("routingType", "", array.getJsonObject(0).getString("routingType"));
+ Assert.assertEquals("messagesAdded", "0", array.getJsonObject(0).getString("messagesAdded"));
+ Assert.assertEquals("messageCount", "0", array.getJsonObject(0).getString("messageCount"));
+ Assert.assertEquals("messagesAcked", "0", array.getJsonObject(0).getString("messagesAcked"));
+ Assert.assertEquals("deliveringCount", "0", array.getJsonObject(0).getString("deliveringCount"));
+ Assert.assertEquals("messagesKilled", "0", array.getJsonObject(0).getString("messagesKilled"));
+ Assert.assertEquals("deliverDeliver", "true", array.getJsonObject(0).getString("deliverDeliver"));
}
@@ -1793,7 +1814,11 @@ public class ActiveMQServerControlTest extends ManagementTestBase {
array = (JsonArray) addressesAsJsonObject.get("data");
Assert.assertEquals("number of addresses returned from query", 1, array.size());
+ //check all field names
Assert.assertEquals("address name check", addressName1.toString(), array.getJsonObject(0).getString("name"));
+ Assert.assertNotEquals("id", "", array.getJsonObject(0).getString("id"));
+ Assert.assertTrue("routingTypes", array.getJsonObject(0).getString("routingTypes").contains(RoutingType.ANYCAST.name()));
+ Assert.assertEquals("queueCount", "1", array.getJsonObject(0).getString("queueCount"));
//test with empty filter - all addresses should be returned
filterString = createJsonFilter("", "", "");
@@ -1909,11 +1934,134 @@ public class ActiveMQServerControlTest extends ManagementTestBase {
Assert.assertEquals("address name in consumer", addressName2.toString(), jsonConsumer.getString("address"));
Assert.assertEquals("consumer protocol ", "CORE", jsonConsumer.getString("protocol"));
Assert.assertEquals("queue type", "anycast", jsonConsumer.getString("queueType"));
-
+ Assert.assertNotEquals("id", "", jsonConsumer.getString("id"));
+ Assert.assertNotEquals("session", "", jsonConsumer.getString("session"));
+ Assert.assertEquals("clientID", "", jsonConsumer.getString("clientID"));
+ Assert.assertEquals("user", "", jsonConsumer.getString("user"));
+ Assert.assertNotEquals("localAddress", "", jsonConsumer.getString("localAddress"));
+ Assert.assertNotEquals("remoteAddress", "", jsonConsumer.getString("remoteAddress"));
+ Assert.assertNotEquals("creationTime", "", jsonConsumer.getString("creationTime"));
}
}
+ @Test
+ public void testListSessions() throws Exception {
+ SimpleString queueName1 = new SimpleString("my_queue_one");
+ SimpleString addressName1 = new SimpleString("my_address_one");
+
+ ActiveMQServerControl serverControl = createManagementControl();
+
+ server.addAddressInfo(new AddressInfo(addressName1, RoutingType.ANYCAST));
+ server.createQueue(addressName1, RoutingType.ANYCAST, queueName1, null, false, false);
+
+ // create some consumers
+ try (ServerLocator locator = createInVMNonHALocator(); ClientSessionFactory csf = createSessionFactory(locator);) {
+
+ ClientSession session1 = csf.createSession();
+ ClientSession session2 = csf.createSession();
+
+ ClientConsumer consumer1_q1 = session1.createConsumer(queueName1);
+ ClientConsumer consumer2_q1 = session2.createConsumer(queueName1);
+
+ //bring back all sessions
+ String filterString = createJsonFilter("", "", "");
+ String sessionsAsJsonString = serverControl.listSessions(filterString, 1, 50);
+ JsonObject sessionsAsJsonObject = JsonUtil.readJsonObject(sessionsAsJsonString);
+ JsonArray array = (JsonArray) sessionsAsJsonObject.get("data");
+
+ Assert.assertTrue("number of sessions returned from query", 2 <= array.size());
+ JsonObject jsonSession = array.getJsonObject(0);
+
+ //check all fields
+ Assert.assertNotEquals("id", "", jsonSession.getString("id"));
+ Assert.assertEquals("user", "", jsonSession.getString("user"));
+ Assert.assertNotEquals("creationTime", "", jsonSession.getString("creationTime"));
+ Assert.assertEquals("consumerCount", 1, jsonSession.getInt("consumerCount"));
+ Assert.assertTrue("producerCount", 0 <= jsonSession.getInt("producerCount"));
+ Assert.assertNotEquals("connectionID", "", jsonSession.getString("connectionID"));
+ }
+ }
+
+ @Test
+ public void testListConnections() throws Exception {
+ SimpleString queueName1 = new SimpleString("my_queue_one");
+ SimpleString addressName1 = new SimpleString("my_address_one");
+
+ ActiveMQServerControl serverControl = createManagementControl();
+
+ server.addAddressInfo(new AddressInfo(addressName1, RoutingType.ANYCAST));
+ server.createQueue(addressName1, RoutingType.ANYCAST, queueName1, null, false, false);
+
+ // create some consumers
+ try (ServerLocator locator = createInVMNonHALocator(); ClientSessionFactory csf = createSessionFactory(locator);) {
+
+ ClientSession session1 = csf.createSession();
+
+ //bring back all connection
+ String filterString = createJsonFilter("", "", "");
+ String connectionsAsJsonString = serverControl.listConnections(filterString, 1, 50);
+ JsonObject connectionsAsJsonObject = JsonUtil.readJsonObject(connectionsAsJsonString);
+ JsonArray array = (JsonArray) connectionsAsJsonObject.get("data");
+
+ Assert.assertTrue("number of connections returned from query", 1 <= array.size());
+ JsonObject jsonConnection = array.getJsonObject(0);
+
+ //check all fields
+ Assert.assertNotEquals("connectionID", "", jsonConnection.getString("connectionID"));
+ Assert.assertNotEquals("remoteAddress", "", jsonConnection.getString("remoteAddress"));
+ Assert.assertEquals("users", "", jsonConnection.getString("users"));
+ Assert.assertNotEquals("creationTime", "", jsonConnection.getString("creationTime"));
+ Assert.assertNotEquals("implementation", "", jsonConnection.getString("implementation"));
+ Assert.assertNotEquals("protocol", "", jsonConnection.getString("protocol"));
+ Assert.assertEquals("clientID", "", jsonConnection.getString("clientID"));
+ Assert.assertNotEquals("localAddress", "", jsonConnection.getString("localAddress"));
+ Assert.assertEquals("sessionCount", 1, jsonConnection.getInt("sessionCount"));
+ }
+ }
+
+ @Test
+ public void testListProducers() throws Exception {
+ SimpleString queueName1 = new SimpleString("my_queue_one");
+ SimpleString addressName1 = new SimpleString("my_address_one");
+
+ ActiveMQServerControl serverControl = createManagementControl();
+
+ server.addAddressInfo(new AddressInfo(addressName1, RoutingType.ANYCAST));
+ server.createQueue(addressName1, RoutingType.ANYCAST, queueName1, null, false, false);
+
+ // create some consumers
+ try (ServerLocator locator = createInVMNonHALocator(); ClientSessionFactory csf = createSessionFactory(locator);) {
+
+ ClientSession session1 = csf.createSession();
+ ClientSession session2 = csf.createSession();
+
+ ClientProducer producer1 = session1.createProducer(addressName1);
+ ClientProducer producer2 = session1.createProducer(addressName1);
+
+ //bring back all producers
+ String filterString = createJsonFilter("", "", "");
+ String producersAsJsonString = serverControl.listProducers(filterString, 1, 50);
+ JsonObject producersAsJsonObject = JsonUtil.readJsonObject(producersAsJsonString);
+ 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"));
+
+ }
+ }
+
@Test
public void testMemoryUsagePercentage() throws Exception {
//messages size 100K
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java
index 4a9f861473..9351fee685 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java
@@ -994,7 +994,7 @@ public class ActiveMQServerControlUsingCoreTest extends ActiveMQServerControlTes
@Override
public String listConnections(String filter, int page, int pageSize) throws Exception {
- return (String) proxy.invokeOperation("listAddresses", filter, page, pageSize);
+ return (String) proxy.invokeOperation("listConnections", filter, page, pageSize);
}
@Override