NO-JIRA fixed minor regression(reverted JSON field names) and NullPointer in ActiveMQServerControlImpl

This commit is contained in:
Pat Fox 2017-12-07 20:49:25 +01:00 committed by Michael Pearce
parent c1bc7a30e7
commit b39c556784
14 changed files with 243 additions and 54 deletions

View File

@ -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;

View File

@ -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: '<div class="ngCellText"><a ng-click="selectSession(row)">{{row.entity.sessionName}}</a></div>'
cellTemplate: '<div class="ngCellText"><a ng-click="selectSession(row)">{{row.entity.session}}</a></div>'
},
{
field: 'connectionClientID',
field: 'clientID',
displayName: 'Client ID',
width: '*'
},
{
field: 'connectionProtocolName',
field: 'protocol',
displayName: 'Protocol',
width: '*'
},
{
field: 'queueName',
field: 'queue',
displayName: 'Queue',
width: '*',
cellTemplate: '<div class="ngCellText"><a ng-click="selectQueue(row)">{{row.entity.queueName}}</a></div>'
cellTemplate: '<div class="ngCellText"><a ng-click="selectQueue(row)">{{row.entity.queue}}</a></div>'
},
{
field: 'queueType',
@ -63,18 +63,18 @@ var ARTEMIS = (function(ARTEMIS) {
width: '*'
},
{
field: 'queueAddress',
field: 'address',
displayName: 'Address',
width: '*',
cellTemplate: '<div class="ngCellText"><a ng-click="selectAddress(row)">{{row.entity.queueAddress}}</a></div>'
cellTemplate: '<div class="ngCellText"><a ng-click="selectAddress(row)">{{row.entity.address}}</a></div>'
},
{
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;

View File

@ -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;

View File

@ -37,7 +37,7 @@ var ARTEMIS = (function(ARTEMIS) {
cellTemplate: '<div class="ngCellText"><a ng-click="navigateToQueueAtts(row)">attributes</a>&nbsp;<a ng-click="navigateToQueueOps(row)">operations</a></div>'
},
{
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;

View File

@ -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: '<div class="ngCellText"><a ng-click="selectConnection(row)">{{row.entity.connectionID}}</a></div>'
},
{
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;

View File

@ -1737,8 +1737,12 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
try {
final Set<SimpleString> addresses = server.getPostOffice().getAddresses();
List<AddressInfo> 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);

View File

@ -31,7 +31,7 @@ import org.apache.activemq.artemis.utils.StringUtil;
public class ConnectionView extends ActiveMQAbstractView<RemotingConnection> {
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<RemotingConnection> {
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

View File

@ -27,7 +27,7 @@ import org.apache.activemq.artemis.utils.JsonLoader;
public class ConsumerView extends ActiveMQAbstractView<ServerConsumer> {
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<ServerConsumer> {
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;
}

View File

@ -44,7 +44,15 @@ public class ProducerView extends ActiveMQAbstractView<ServerProducer> {
@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;
}

View File

@ -45,7 +45,23 @@ public class QueueView extends ActiveMQAbstractView<QueueControl> {
@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;
}

View File

@ -25,7 +25,7 @@ import org.apache.activemq.artemis.utils.JsonLoader;
public class SessionView extends ActiveMQAbstractView<ServerSession> {
private static final String defaultSortColumn = "name";
private static final String defaultSortColumn = "id";
public SessionView() {
super();
@ -39,7 +39,12 @@ public class SessionView extends ActiveMQAbstractView<ServerSession> {
@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;
}

View File

@ -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 = "<init>(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)")})

View File

@ -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,9 +1934,132 @@ 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

View File

@ -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