diff --git a/activemq-console/src/main/java/org/apache/activemq/console/command/PurgeCommand.java b/activemq-console/src/main/java/org/apache/activemq/console/command/PurgeCommand.java index 04e4bf981b..803c30ce1f 100644 --- a/activemq-console/src/main/java/org/apache/activemq/console/command/PurgeCommand.java +++ b/activemq-console/src/main/java/org/apache/activemq/console/command/PurgeCommand.java @@ -96,7 +96,7 @@ public class PurgeCommand extends AbstractJmxCommand { // Iterate through the queue names for (Iterator i = tokens.iterator(); i.hasNext();) { - List queueList = JmxMBeansUtil.queryMBeans(createJmxConnection(), "destinationType=Queue,destinationName=" + i.next() + ",*"); + List queueList = JmxMBeansUtil.queryMBeans(createJmxConnection(), "type=Broker,brokerName=*,destinationType=Queue,destinationName=" + i.next()); for (Iterator j = queueList.iterator(); j.hasNext();) { ObjectName queueName = ((ObjectInstance)j.next()).getObjectName(); diff --git a/activemq-console/src/main/java/org/apache/activemq/console/util/JmxMBeansUtil.java b/activemq-console/src/main/java/org/apache/activemq/console/util/JmxMBeansUtil.java index e6ab33f423..21ceb9be97 100644 --- a/activemq-console/src/main/java/org/apache/activemq/console/util/JmxMBeansUtil.java +++ b/activemq-console/src/main/java/org/apache/activemq/console/util/JmxMBeansUtil.java @@ -57,7 +57,7 @@ public final class JmxMBeansUtil { return (new MBeansAttributeQueryFilter(jmxConnection, attributes, new MBeansObjectNameQueryFilter(jmxConnection))).query("type=Broker,brokerName=" + brokerName); } - public static List queryMBeans(MBeanServerConnection jmxConnection, List queryList) throws Exception { + public static List x_queryMBeans(MBeanServerConnection jmxConnection, List queryList) throws Exception { // If there is no query defined get all mbeans if (queryList == null || queryList.size() == 0) { return createMBeansObjectNameQuery(jmxConnection).query(""); @@ -106,10 +106,7 @@ public final class JmxMBeansUtil { } public static QueryFilter createMBeansObjectNameQuery(MBeanServerConnection jmxConnection) { - // Let us be able to accept wildcard queries - // Use regular expressions to filter the query results - // Let us retrieve the mbeans object name specified by the query - return new WildcardToRegExTransformFilter(new MBeansRegExQueryFilter(new MBeansObjectNameQueryFilter(jmxConnection))); + return new MBeansObjectNameQueryFilter(jmxConnection); } public static QueryFilter createMBeansAttributeQuery(MBeanServerConnection jmxConnection, Set attributes) { diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/console/command/TestAMQ3410.java b/activemq-unit-tests/src/test/java/org/apache/activemq/console/command/AMQ3410Test.java similarity index 98% rename from activemq-unit-tests/src/test/java/org/apache/activemq/console/command/TestAMQ3410.java rename to activemq-unit-tests/src/test/java/org/apache/activemq/console/command/AMQ3410Test.java index 04a6708d5b..dadff34c8e 100644 --- a/activemq-unit-tests/src/test/java/org/apache/activemq/console/command/TestAMQ3410.java +++ b/activemq-unit-tests/src/test/java/org/apache/activemq/console/command/AMQ3410Test.java @@ -32,10 +32,10 @@ import org.slf4j.LoggerFactory; import org.springframework.context.support.AbstractApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; -public class TestAMQ3410 extends TestCase { +public class AMQ3410Test extends TestCase { @SuppressWarnings("unused") private static final Logger LOG = LoggerFactory - .getLogger(TestPurgeCommand.class); + .getLogger(PurgeCommandTest.class); private static final Collection DEFAULT_OPTIONS = Arrays .asList(new String[] { "--amqurl", "tcp://localhost:61616", }); diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/console/command/TestAMQ3411.java b/activemq-unit-tests/src/test/java/org/apache/activemq/console/command/AMQ3411Test.java similarity index 98% rename from activemq-unit-tests/src/test/java/org/apache/activemq/console/command/TestAMQ3411.java rename to activemq-unit-tests/src/test/java/org/apache/activemq/console/command/AMQ3411Test.java index 2dd19efe4f..8930b2c156 100644 --- a/activemq-unit-tests/src/test/java/org/apache/activemq/console/command/TestAMQ3411.java +++ b/activemq-unit-tests/src/test/java/org/apache/activemq/console/command/AMQ3411Test.java @@ -31,10 +31,10 @@ import org.slf4j.LoggerFactory; import org.springframework.context.support.AbstractApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; -public class TestAMQ3411 extends TestCase { +public class AMQ3411Test extends TestCase { @SuppressWarnings("unused") private static final Logger LOG = LoggerFactory - .getLogger(TestPurgeCommand.class); + .getLogger(AMQ3411Test.class); private static final Collection DEFAULT_OPTIONS = Arrays .asList(new String[] { "--amqurl", "tcp://localhost:61616", }); diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/console/command/TestPurgeCommand.java b/activemq-unit-tests/src/test/java/org/apache/activemq/console/command/PurgeCommandTest.java similarity index 97% rename from activemq-unit-tests/src/test/java/org/apache/activemq/console/command/TestPurgeCommand.java rename to activemq-unit-tests/src/test/java/org/apache/activemq/console/command/PurgeCommandTest.java index 400fbe0f4f..57fffa0dfb 100644 --- a/activemq-unit-tests/src/test/java/org/apache/activemq/console/command/TestPurgeCommand.java +++ b/activemq-unit-tests/src/test/java/org/apache/activemq/console/command/PurgeCommandTest.java @@ -51,9 +51,9 @@ import org.slf4j.LoggerFactory; import org.springframework.context.support.AbstractApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; -public class TestPurgeCommand extends TestCase { +public class PurgeCommandTest extends TestCase { private static final Logger LOG = LoggerFactory - .getLogger(TestPurgeCommand.class); + .getLogger(PurgeCommandTest.class); protected static final int MESSAGE_COUNT = 10; protected static final String PROPERTY_NAME = "XTestProperty"; @@ -155,11 +155,8 @@ public class TestPurgeCommand extends TestCase { @SuppressWarnings("unchecked") public void purgeAllMessages() throws IOException, Exception { - List tokens = Arrays.asList(new String[] { "*" }); - for (String token : tokens) { List queueList = JmxMBeansUtil.queryMBeans( - createJmxConnection(), "Type=Queue,Destination=" + token - + ",*"); + createJmxConnection(), "type=Broker,brokerName=localbroker,destinationType=Queue,destinationName=*"); for (ObjectInstance oi : queueList) { ObjectName queueName = oi.getObjectName(); LOG.info("Purging all messages in queue: " @@ -167,7 +164,6 @@ public class TestPurgeCommand extends TestCase { createJmxConnection().invoke(queueName, "purge", new Object[] {}, new String[] {}); } - } } public void addMessages() throws IOException, Exception { @@ -231,8 +227,8 @@ public class TestPurgeCommand extends TestCase { List tokens = Arrays.asList(new String[] { "*" }); for (String token : tokens) { List queueList = JmxMBeansUtil.queryMBeans( - createJmxConnection(), "Type=Queue,Destination=" - + token + ",*"); + createJmxConnection(), "type=Broker,brokerName=localbroker,destinationType=Queue,destinationName=" + + token); for (ObjectInstance queue : queueList) { ObjectName queueName = queue