https://issues.apache.org/jira/browse/AMQ-4333 - fix and ensure existing test is executed

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1449080 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2013-02-22 15:47:36 +00:00
parent d75e418c3d
commit bebffd0e8f
5 changed files with 12 additions and 19 deletions

View File

@ -96,7 +96,7 @@ public class PurgeCommand extends AbstractJmxCommand {
// Iterate through the queue names
for (Iterator<String> 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();

View File

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

View File

@ -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<String> DEFAULT_OPTIONS = Arrays
.asList(new String[] { "--amqurl", "tcp://localhost:61616", });

View File

@ -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<String> DEFAULT_OPTIONS = Arrays
.asList(new String[] { "--amqurl", "tcp://localhost:61616", });

View File

@ -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<String> tokens = Arrays.asList(new String[] { "*" });
for (String token : tokens) {
List<ObjectInstance> 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<String> tokens = Arrays.asList(new String[] { "*" });
for (String token : tokens) {
List<ObjectInstance> queueList = JmxMBeansUtil.queryMBeans(
createJmxConnection(), "Type=Queue,Destination="
+ token + ",*");
createJmxConnection(), "type=Broker,brokerName=localbroker,destinationType=Queue,destinationName="
+ token);
for (ObjectInstance queue : queueList) {
ObjectName queueName = queue