This closes #662

This commit is contained in:
Clebert Suconic 2016-07-26 11:39:20 -04:00
commit fbfbef52be
9 changed files with 469 additions and 29 deletions

View File

@ -603,6 +603,82 @@ public interface ActiveMQServerControl {
String listProducersInfoAsJSON() throws Exception;
/**
* Lists all the connections connected to this server.
* The returned String is a JSON string containing details about each connection, e.g.:
* <pre>
* [
* {
* "creationTime": 1469240429671,
* "sessionCount": 1,
* "implementation": "RemotingConnectionImpl",
* "connectionID": "1648309901",
* "clientAddress": "\/127.0.0.1:57649"
* }
* ]
* </pre>
*/
@Operation(desc = "List all connections as a JSON string")
String listConnectionsAsJSON() throws Exception;
/**
* Lists all the consumers which belongs to the connection specified by the connectionID.
* The returned String is a JSON string containing details about each consumer, e.g.:
* <pre>
* [
* {
* "filter": "color = 'RED'",
* "queueName": "2ea5b050-28bf-4ee2-9b24-b73f5983192a",
* "creationTime": 1469239602459,
* "deliveringCount": 0,
* "consumerID": 1,
* "browseOnly": true,
* "connectionID": "1963ece3-507a-11e6-94ff-e8b1fc439540",
* "sessionID": "19676f55-507a-11e6-94ff-e8b1fc439540"
* }
* ]
* </pre>
*/
@Operation(desc = "List all consumers associated with a connection as a JSON string")
String listConsumersAsJSON(String connectionID) throws Exception;
/**
* Lists all the consumers connected to this server.
* The returned String is a JSON string containing details about each consumer, e.g.:
*<pre>
* [
* {
* "queueName": "fa87c64c-0a38-4697-8421-72e34d17429d",
* "creationTime": 1469235956168,
* "deliveringCount": 0,
* "consumerID": 0,
* "browseOnly": false,
* "connectionID": "9c0d42e7-5071-11e6-9e29-e8b1fc439540",
* "sessionID": "9c0d9109-5071-11e6-9e29-e8b1fc439540"
* }
* ]
* </pre>
*/
@Operation(desc = "List all consumers as a JSON string")
String listAllConsumersAsJSON() throws Exception;
/**
* Lists details about all the sessions for the specified connection ID.
* The returned String is a JSON string containing details about each session associated with the specified ID, e.g.:
* <pre>
* [
* {
* "principal": "myUser",
* "creationTime": 1469240773157,
* "consumerCount": 0,
* "sessionID": "d33d10db-507c-11e6-9e47-e8b1fc439540"
* }
* ]
* </pre>
*/
@Operation(desc = "List the sessions for the given connectionID as a JSON string", impact = MBeanOperationInfo.INFO)
String listSessionsAsJSON(@Parameter(desc = "a connection ID", name = "connectionID") String connectionID) throws Exception;
/**
* Lists all the sessions IDs for the specified connection ID.
*/

View File

@ -796,20 +796,12 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo
clearIO();
JsonArrayBuilder array = Json.createArrayBuilder();
try {
List<ServerSession> sessions = server.getActiveMQServer().getSessions(connectionID);
for (ServerSession sess : sessions) {
JsonObjectBuilder obj = Json.createObjectBuilder()
.add("sessionID", sess.getName())
.add("creationTime", sess.getCreationTime());
array.add(obj);
}
return server.listSessionsAsJSON(connectionID);
}
finally {
blockOnIO();
}
return array.toString();
}
@Override

View File

@ -292,6 +292,8 @@ public interface JMSServerManager extends ActiveMQComponent {
String[] listSessions(String connectionID) throws Exception;
String listSessionsAsJSON(String connectionID) throws Exception;
String listPreparedTransactionDetailsAsJSON() throws Exception;
String listPreparedTransactionDetailsAsHTML() throws Exception;

View File

@ -1328,6 +1328,12 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
return server.getActiveMQServerControl().listSessions(connectionID);
}
@Override
public String listSessionsAsJSON(final String connectionID) throws Exception {
checkInitialised();
return server.getActiveMQServerControl().listSessionsAsJSON(connectionID);
}
@Override
public String listPreparedTransactionDetailsAsJSON() throws Exception {
ResourceManager resourceManager = server.getResourceManager();

View File

@ -16,18 +16,6 @@
*/
package org.apache.activemq.artemis.core.management.impl;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.atomic.AtomicLong;
import javax.json.Json;
import javax.json.JsonArray;
import javax.json.JsonArrayBuilder;
@ -43,14 +31,25 @@ import javax.management.NotificationEmitter;
import javax.management.NotificationFilter;
import javax.management.NotificationListener;
import javax.transaction.xa.Xid;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.atomic.AtomicLong;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.management.ActiveMQServerControl;
import org.apache.activemq.artemis.api.core.management.AddressControl;
import org.apache.activemq.artemis.api.core.management.BridgeControl;
import org.apache.activemq.artemis.api.core.management.CoreNotificationType;
import org.apache.activemq.artemis.api.core.management.DivertControl;
import org.apache.activemq.artemis.api.core.management.ActiveMQServerControl;
import org.apache.activemq.artemis.api.core.management.QueueControl;
import org.apache.activemq.artemis.core.config.BridgeConfiguration;
import org.apache.activemq.artemis.core.config.Configuration;
@ -67,10 +66,10 @@ import org.apache.activemq.artemis.core.postoffice.impl.LocalQueueBinding;
import org.apache.activemq.artemis.core.remoting.server.RemotingService;
import org.apache.activemq.artemis.core.security.CheckType;
import org.apache.activemq.artemis.core.security.Role;
import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
import org.apache.activemq.artemis.core.server.Consumer;
import org.apache.activemq.artemis.core.server.ActiveMQMessageBundle;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
import org.apache.activemq.artemis.core.server.Consumer;
import org.apache.activemq.artemis.core.server.JournalType;
import org.apache.activemq.artemis.core.server.Queue;
import org.apache.activemq.artemis.core.server.ServerConsumer;
@ -1359,6 +1358,130 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
return producers.build().toString();
}
@Override
public String listConnectionsAsJSON() throws Exception {
checkStarted();
clearIO();
try {
JsonArrayBuilder array = Json.createArrayBuilder();
Set<RemotingConnection> connections = server.getRemotingService().getConnections();
for (RemotingConnection connection : connections) {
JsonObjectBuilder obj = Json.createObjectBuilder()
.add("connectionID", connection.getID().toString())
.add("clientAddress", connection.getRemoteAddress())
.add("creationTime", connection.getCreationTime())
.add("implementation", connection.getClass().getSimpleName())
.add("sessionCount", server.getSessions(connection.getID().toString()).size());
array.add(obj);
}
return array.build().toString();
}
finally {
blockOnIO();
}
}
@Override
public String listSessionsAsJSON(final String connectionID) throws Exception {
checkStarted();
clearIO();
JsonArrayBuilder array = Json.createArrayBuilder();
try {
List<ServerSession> sessions = server.getSessions(connectionID);
for (ServerSession sess : sessions) {
JsonObjectBuilder obj = Json.createObjectBuilder()
.add("sessionID", sess.getName())
.add("creationTime", sess.getCreationTime())
.add("principal", sess.getValidatedUser())
.add("consumerCount", sess.getServerConsumers().size());
array.add(obj);
}
}
finally {
blockOnIO();
}
return array.build().toString();
}
@Override
public String listConsumersAsJSON(String connectionID) throws Exception {
checkStarted();
clearIO();
try {
JsonArrayBuilder array = Json.createArrayBuilder();
Set<RemotingConnection> connections = server.getRemotingService().getConnections();
for (RemotingConnection connection : connections) {
if (connectionID.equals(connection.getID().toString())) {
List<ServerSession> sessions = server.getSessions(connectionID);
for (ServerSession session : sessions) {
Set<ServerConsumer> consumers = session.getServerConsumers();
for (ServerConsumer consumer : consumers) {
JsonObject obj = toJSONObject(consumer);
if (obj != null) {
array.add(obj);
}
}
}
}
}
return array.build().toString();
}
finally {
blockOnIO();
}
}
@Override
public String listAllConsumersAsJSON() throws Exception {
checkStarted();
clearIO();
try {
JsonArrayBuilder array = Json.createArrayBuilder();
Set<ServerSession> sessions = server.getSessions();
for (ServerSession session : sessions) {
Set<ServerConsumer> consumers = session.getServerConsumers();
for (ServerConsumer consumer : consumers) {
JsonObject obj = toJSONObject(consumer);
if (obj != null) {
array.add(obj);
}
}
}
return array.build().toString();
}
finally {
blockOnIO();
}
}
private JsonObject toJSONObject(ServerConsumer consumer) throws Exception {
JsonObjectBuilder obj = Json.createObjectBuilder()
.add("consumerID", consumer.getID())
.add("connectionID", consumer.getConnectionID().toString())
.add("sessionID", consumer.getSessionID())
.add("queueName", consumer.getQueue().getName().toString())
.add("browseOnly", consumer.isBrowseOnly())
.add("creationTime", consumer.getCreationTime())
.add("deliveringCount", consumer.getDeliveringMessages().size());
if (consumer.getFilter() != null) {
obj.add("filter", consumer.getFilter().getFilterString().toString());
}
return obj.build();
}
@Override
public Object[] getConnectors() throws Exception {
checkStarted();

View File

@ -186,4 +186,6 @@ public interface ServerSession extends SecurityAuth {
SimpleString filterString) throws Exception;
List<MessageReference> getInTXMessagesForConsumer(long consumerId);
String getValidatedUser();
}

View File

@ -1423,6 +1423,11 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
}
}
@Override
public String getValidatedUser() {
return validatedUser;
}
@Override
public String toString() {
StringBuffer buffer = new StringBuffer();

View File

@ -20,8 +20,13 @@ import javax.json.JsonArray;
import javax.json.JsonObject;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.UUID;
import org.apache.activemq.artemis.api.core.JsonUtil;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
@ -35,19 +40,24 @@ import org.apache.activemq.artemis.api.core.management.ActiveMQServerControl;
import org.apache.activemq.artemis.api.core.management.AddressSettingsInfo;
import org.apache.activemq.artemis.api.core.management.BridgeControl;
import org.apache.activemq.artemis.api.core.management.DivertControl;
import org.apache.activemq.artemis.api.core.JsonUtil;
import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder;
import org.apache.activemq.artemis.api.core.management.QueueControl;
import org.apache.activemq.artemis.api.core.management.RoleInfo;
import org.apache.activemq.artemis.core.client.impl.ClientSessionImpl;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.config.impl.SecurityConfiguration;
import org.apache.activemq.artemis.core.messagecounter.impl.MessageCounterManagerImpl;
import org.apache.activemq.artemis.core.remoting.impl.invm.InVMAcceptorFactory;
import org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants;
import org.apache.activemq.artemis.core.security.Role;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.core.settings.impl.SlowConsumerPolicy;
import org.apache.activemq.artemis.core.transaction.impl.XidImpl;
import org.apache.activemq.artemis.jlibaio.LibaioContext;
import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
import org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.utils.RandomUtil;
import org.apache.activemq.artemis.utils.UUIDGenerator;
import org.junit.Assert;
@ -402,7 +412,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase {
String addressMatch = "test.#";
String exactAddress = "test.whatever";
assertEquals(0, serverControl.getRoles(addressMatch).length);
assertEquals(1, serverControl.getRoles(addressMatch).length);
serverControl.addSecuritySettings(addressMatch, "foo", "foo, bar", "foo", "bar", "foo, bar", "", "", "bar");
// Restart the server. Those settings should be persisted
@ -443,7 +453,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase {
assertTrue(barRole.isBrowse());
serverControl.removeSecuritySettings(addressMatch);
assertEquals(0, serverControl.getRoles(exactAddress).length);
assertEquals(1, serverControl.getRoles(exactAddress).length);
}
@Test
@ -1069,6 +1079,198 @@ public class ActiveMQServerControlTest extends ManagementTestBase {
locator.close();
}
@Test
public void testListConnectionsAsJSON() throws Exception {
ActiveMQServerControl serverControl = createManagementControl();
List<ClientSessionFactory> factories = new ArrayList<>();
ServerLocator locator = createInVMNonHALocator();
factories.add(createSessionFactory(locator));
factories.add(createSessionFactory(locator));
addClientSession(factories.get(1).createSession());
String jsonString = serverControl.listConnectionsAsJSON();
IntegrationTestLogger.LOGGER.info(jsonString);
Assert.assertNotNull(jsonString);
JsonArray array = JsonUtil.readJsonArray(jsonString);
Assert.assertEquals(2, array.size());
JsonObject first;
JsonObject second;
if (array.getJsonObject(0).getJsonNumber("creationTime").longValue() < array.getJsonObject(1).getJsonNumber("creationTime").longValue()) {
first = array.getJsonObject(0);
second = array.getJsonObject(1);
}
else {
first = array.getJsonObject(1);
second = array.getJsonObject(0);
}
Assert.assertTrue(first.getString("connectionID").length() > 0);
Assert.assertTrue(first.getString("clientAddress").length() > 0);
Assert.assertTrue(first.getJsonNumber("creationTime").longValue() > 0);
Assert.assertEquals(0, first.getJsonNumber("sessionCount").longValue());
Assert.assertTrue(second.getString("connectionID").length() > 0);
Assert.assertTrue(second.getString("clientAddress").length() > 0);
Assert.assertTrue(second.getJsonNumber("creationTime").longValue() > 0);
Assert.assertEquals(1, second.getJsonNumber("sessionCount").longValue());
}
@Test
public void testListConsumersAsJSON() throws Exception {
SimpleString queueName = new SimpleString(UUID.randomUUID().toString());
final String filter = "x = 1";
ActiveMQServerControl serverControl = createManagementControl();
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory factory = createSessionFactory(locator);
ClientSession session = addClientSession(factory.createSession());
server.createQueue(queueName, queueName, null, false, false);
addClientConsumer(session.createConsumer(queueName));
addClientConsumer(session.createConsumer(queueName, SimpleString.toSimpleString(filter), true));
String jsonString = serverControl.listConsumersAsJSON(factory.getConnection().getID().toString());
IntegrationTestLogger.LOGGER.info(jsonString);
Assert.assertNotNull(jsonString);
JsonArray array = JsonUtil.readJsonArray(jsonString);
Assert.assertEquals(2, array.size());
JsonObject first;
JsonObject second;
if (array.getJsonObject(0).getJsonNumber("creationTime").longValue() < array.getJsonObject(1).getJsonNumber("creationTime").longValue()) {
first = array.getJsonObject(0);
second = array.getJsonObject(1);
}
else {
first = array.getJsonObject(1);
second = array.getJsonObject(0);
}
Assert.assertNotNull(first.getJsonNumber("consumerID").longValue());
Assert.assertTrue(first.getString("connectionID").length() > 0);
Assert.assertEquals(factory.getConnection().getID().toString(), first.getString("connectionID"));
Assert.assertTrue(first.getString("sessionID").length() > 0);
Assert.assertEquals(((ClientSessionImpl)session).getName(), first.getString("sessionID"));
Assert.assertTrue(first.getString("queueName").length() > 0);
Assert.assertEquals(queueName.toString(), first.getString("queueName"));
Assert.assertEquals(false, first.getBoolean("browseOnly"));
Assert.assertTrue(first.getJsonNumber("creationTime").longValue() > 0);
Assert.assertEquals(0, first.getJsonNumber("deliveringCount").longValue());
Assert.assertNotNull(second.getJsonNumber("consumerID").longValue());
Assert.assertTrue(second.getString("connectionID").length() > 0);
Assert.assertEquals(factory.getConnection().getID().toString(), second.getString("connectionID"));
Assert.assertTrue(second.getString("sessionID").length() > 0);
Assert.assertEquals(((ClientSessionImpl)session).getName(), second.getString("sessionID"));
Assert.assertTrue(second.getString("queueName").length() > 0);
Assert.assertEquals(queueName.toString(), second.getString("queueName"));
Assert.assertEquals(true, second.getBoolean("browseOnly"));
Assert.assertTrue(second.getJsonNumber("creationTime").longValue() > 0);
Assert.assertEquals(0, second.getJsonNumber("deliveringCount").longValue());
Assert.assertTrue(second.getString("filter").length() > 0);
Assert.assertEquals(filter, second.getString("filter"));
}
@Test
public void testListAllConsumersAsJSON() throws Exception {
SimpleString queueName = new SimpleString(UUID.randomUUID().toString());
ActiveMQServerControl serverControl = createManagementControl();
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory factory = createSessionFactory(locator);
ClientSession session = addClientSession(factory.createSession());
ServerLocator locator2 = createInVMNonHALocator();
ClientSessionFactory factory2 = createSessionFactory(locator2);
ClientSession session2 = addClientSession(factory2.createSession());
server.createQueue(queueName, queueName, null, false, false);
addClientConsumer(session.createConsumer(queueName));
addClientConsumer(session2.createConsumer(queueName));
String jsonString = serverControl.listAllConsumersAsJSON();
IntegrationTestLogger.LOGGER.info(jsonString);
Assert.assertNotNull(jsonString);
JsonArray array = JsonUtil.readJsonArray(jsonString);
Assert.assertEquals(2, array.size());
JsonObject first;
JsonObject second;
if (array.getJsonObject(0).getJsonNumber("creationTime").longValue() < array.getJsonObject(1).getJsonNumber("creationTime").longValue()) {
first = array.getJsonObject(0);
second = array.getJsonObject(1);
}
else {
first = array.getJsonObject(1);
second = array.getJsonObject(0);
}
Assert.assertTrue(first.getJsonNumber("creationTime").longValue() > 0);
Assert.assertNotNull(first.getJsonNumber("consumerID").longValue());
Assert.assertTrue(first.getString("connectionID").length() > 0);
Assert.assertEquals(factory.getConnection().getID().toString(), first.getString("connectionID"));
Assert.assertTrue(first.getString("sessionID").length() > 0);
Assert.assertEquals(((ClientSessionImpl)session).getName(), first.getString("sessionID"));
Assert.assertTrue(first.getString("queueName").length() > 0);
Assert.assertEquals(queueName.toString(), first.getString("queueName"));
Assert.assertEquals(false, first.getBoolean("browseOnly"));
Assert.assertEquals(0, first.getJsonNumber("deliveringCount").longValue());
Assert.assertTrue(second.getJsonNumber("creationTime").longValue() > 0);
Assert.assertNotNull(second.getJsonNumber("consumerID").longValue());
Assert.assertTrue(second.getString("connectionID").length() > 0);
Assert.assertEquals(factory2.getConnection().getID().toString(), second.getString("connectionID"));
Assert.assertTrue(second.getString("sessionID").length() > 0);
Assert.assertEquals(((ClientSessionImpl)session2).getName(), second.getString("sessionID"));
Assert.assertTrue(second.getString("queueName").length() > 0);
Assert.assertEquals(queueName.toString(), second.getString("queueName"));
Assert.assertEquals(false, second.getBoolean("browseOnly"));
Assert.assertEquals(0, second.getJsonNumber("deliveringCount").longValue());
}
@Test
public void testListSessionsAsJSON() throws Exception {
SimpleString queueName = new SimpleString(UUID.randomUUID().toString());
server.createQueue(queueName, queueName, null, false, false);
ActiveMQServerControl serverControl = createManagementControl();
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory factory = createSessionFactory(locator);
ClientSession session1 = addClientSession(factory.createSession());
Thread.sleep(5);
ClientSession session2 = addClientSession(factory.createSession("myUser", "myPass", false, false, false, false, 0));
session2.createConsumer(queueName);
String jsonString = serverControl.listSessionsAsJSON(factory.getConnection().getID().toString());
IntegrationTestLogger.LOGGER.info(jsonString);
Assert.assertNotNull(jsonString);
JsonArray array = JsonUtil.readJsonArray(jsonString);
Assert.assertEquals(2, array.size());
JsonObject first;
JsonObject second;
if (array.getJsonObject(0).getJsonNumber("creationTime").longValue() < array.getJsonObject(1).getJsonNumber("creationTime").longValue()) {
first = array.getJsonObject(0);
second = array.getJsonObject(1);
}
else {
first = array.getJsonObject(1);
second = array.getJsonObject(0);
}
Assert.assertTrue(first.getString("sessionID").length() > 0);
Assert.assertEquals(((ClientSessionImpl)session1).getName(), first.getString("sessionID"));
Assert.assertTrue(first.getString("principal").length() > 0);
Assert.assertEquals("guest", first.getString("principal"));
Assert.assertTrue(first.getJsonNumber("creationTime").longValue() > 0);
Assert.assertEquals(0, first.getJsonNumber("consumerCount").longValue());
Assert.assertTrue(second.getString("sessionID").length() > 0);
Assert.assertEquals(((ClientSessionImpl)session2).getName(), second.getString("sessionID"));
Assert.assertTrue(second.getString("principal").length() > 0);
Assert.assertEquals("myUser", second.getString("principal"));
Assert.assertTrue(second.getJsonNumber("creationTime").longValue() > 0);
Assert.assertEquals(1, second.getJsonNumber("consumerCount").longValue());
}
protected void scaleDown(ScaleDownHandler handler) throws Exception {
SimpleString address = new SimpleString("testQueue");
HashMap<String, Object> params = new HashMap<>();
@ -1119,9 +1321,21 @@ public class ActiveMQServerControlTest extends ManagementTestBase {
connectorConfig = new TransportConfiguration(INVM_CONNECTOR_FACTORY);
conf = createDefaultInVMConfig().setJMXManagementEnabled(true).addConnectorConfiguration(connectorConfig.getName(), connectorConfig);
server = addServer(ActiveMQServers.newActiveMQServer(conf, mbeanServer, true));
conf = createDefaultNettyConfig().setJMXManagementEnabled(true).addConnectorConfiguration(connectorConfig.getName(), connectorConfig);
conf.setSecurityEnabled(true);
SecurityConfiguration securityConfiguration = new SecurityConfiguration();
securityConfiguration.addUser("guest", "guest");
securityConfiguration.addUser("myUser", "myPass");
securityConfiguration.addRole("guest", "guest");
securityConfiguration.addRole("myUser", "guest");
securityConfiguration.setDefaultUser("guest");
ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager(InVMLoginModule.class.getName(), securityConfiguration);
server = addServer(ActiveMQServers.newActiveMQServer(conf, mbeanServer, securityManager, true));
server.start();
HashSet<Role> role = new HashSet<>();
role.add(new Role("guest", true, true, true, true, true, true, true, true));
server.getSecurityRepository().addMatch("#", role);
}
protected ActiveMQServerControl createManagementControl() throws Exception {

View File

@ -705,6 +705,26 @@ public class ActiveMQServerControlUsingCoreTest extends ActiveMQServerControlTes
public String listProducersInfoAsJSON() throws Exception {
return (String) proxy.invokeOperation("listProducersInfoAsJSON");
}
@Override
public String listConsumersAsJSON(String connectionID) throws Exception {
return (String) proxy.invokeOperation("listConsumersAsJSON");
}
@Override
public String listAllConsumersAsJSON() throws Exception {
return (String) proxy.invokeOperation("listAllConsumersAsJSON");
}
@Override
public String listConnectionsAsJSON() throws Exception {
return (String) proxy.invokeOperation("listConnectionsAsJSON");
}
@Override
public String listSessionsAsJSON(@Parameter(desc = "a connection ID", name = "connectionID") String connectionID) throws Exception {
return (String) proxy.invokeOperation("listSessionsAsJSON");
}
};
}