From 982943550f85ae3dcc9514e767e02661bc0092f7 Mon Sep 17 00:00:00 2001 From: "Timothy A. Bish" Date: Wed, 2 Jan 2013 17:57:22 +0000 Subject: [PATCH] fix test cases after changes in https://issues.apache.org/jira/browse/AMQ-4237 broker the tests queue MBean lookup git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1427881 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/activemq/bugs/AMQ3157Test.java | 7 +++++-- .../java/org/apache/activemq/bugs/AMQ3405Test.java | 14 ++++++++++---- .../java/org/apache/activemq/bugs/AMQ3445Test.java | 7 ++++--- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ3157Test.java b/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ3157Test.java index baf3f8f979..f18af6ffc1 100644 --- a/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ3157Test.java +++ b/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ3157Test.java @@ -154,14 +154,17 @@ public class AMQ3157Test extends EmbeddedBrokerTestSupport { String domain = "org.apache.activemq"; ObjectName name; if (destination.isQueue()) { - name = new ObjectName(domain + ":BrokerName=localhost,Type=Queue,Destination=" + destination.getPhysicalName()); + name = new ObjectName(domain + ":type=Broker,brokerName=localhost," + + "destinationType=Queue,destinationName=" + destination.getPhysicalName()); } else { - name = new ObjectName(domain + ":BrokerName=localhost,Type=Topic,Destination=" + destination.getPhysicalName()); + name = new ObjectName(domain + ":type=Broker,brokerName=localhost," + + "destinationType=Topic,destinationName=" + destination.getPhysicalName()); } return name; } + @Override protected void tearDown() throws Exception { if (connection != null) { connection.close(); diff --git a/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ3405Test.java b/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ3405Test.java index 1589750af0..0b02755106 100644 --- a/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ3405Test.java +++ b/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ3405Test.java @@ -36,6 +36,7 @@ import javax.management.ObjectName; import org.apache.activemq.ActiveMQConnection; import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.RedeliveryPolicy; +import org.apache.activemq.TestSupport; import org.apache.activemq.broker.BrokerService; import org.apache.activemq.broker.jmx.QueueViewMBean; import org.apache.activemq.broker.region.policy.AbstractDeadLetterStrategy; @@ -43,7 +44,6 @@ import org.apache.activemq.broker.region.policy.DeadLetterStrategy; import org.apache.activemq.broker.region.policy.PolicyEntry; import org.apache.activemq.broker.region.policy.PolicyMap; import org.apache.activemq.command.ActiveMQQueue; -import org.apache.activemq.TestSupport; import org.apache.activemq.util.Wait; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -117,6 +117,7 @@ public class AMQ3405Test extends TestSupport { for (int i = 0; i < 2; ++i) { assertTrue("DLQ was not filled as expected", Wait.waitFor(new Wait.Condition() { + @Override public boolean isSatisified() throws Exception { return dlqView.getQueueSize() == messageCount; } @@ -137,6 +138,7 @@ public class AMQ3405Test extends TestSupport { dlqView.moveMatchingMessagesTo("", moveTo); assertTrue("DLQ was not emptied as expected", Wait.waitFor(new Wait.Condition() { + @Override public boolean isSatisified() throws Exception { return dlqView.getQueueSize() == 0; } @@ -163,6 +165,7 @@ public class AMQ3405Test extends TestSupport { dlqConsumer = dlqSession.createConsumer(dlqDestination); } + @Override protected void setUp() throws Exception { broker = createBroker(); broker.start(); @@ -177,6 +180,7 @@ public class AMQ3405Test extends TestSupport { dlqSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); } + @Override protected void tearDown() throws Exception { dlqConsumer.close(); dlqSession.close(); @@ -188,6 +192,7 @@ public class AMQ3405Test extends TestSupport { } }; + @Override protected ActiveMQConnectionFactory createConnectionFactory() throws Exception { ActiveMQConnectionFactory answer = super.createConnectionFactory(); @@ -226,9 +231,9 @@ public class AMQ3405Test extends TestSupport { } private QueueViewMBean getProxyToDLQ() throws MalformedObjectNameException, JMSException { - ObjectName queueViewMBeanName = new ObjectName("org.apache.activemq" - + ":Type=Queue,Destination=ActiveMQ.DLQ" - + ",BrokerName=localhost"); + ObjectName queueViewMBeanName = new ObjectName( + "org.apache.activemq:type=Broker,brokerName=localhost," + + "destinationType=Queue,destinationName=ActiveMQ.DLQ"); QueueViewMBean proxy = (QueueViewMBean) broker.getManagementContext() .newProxyInstance(queueViewMBeanName, QueueViewMBean.class, true); return proxy; @@ -256,6 +261,7 @@ public class AMQ3405Test extends TestSupport { deliveryCount = delvery; } + @Override public void onMessage(Message message) { try { int expectedMessageId = rollbacks.get() / deliveryCount; diff --git a/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ3445Test.java b/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ3445Test.java index d2a3130c98..73035e2221 100644 --- a/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ3445Test.java +++ b/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ3445Test.java @@ -16,7 +16,8 @@ */ package org.apache.activemq.bugs; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import javax.jms.Connection; import javax.jms.ConnectionFactory; @@ -121,8 +122,8 @@ public class AMQ3445Test { private QueueViewMBean getProxyToQueueViewMBean() throws Exception { ObjectName queueViewMBeanName = new ObjectName("org.apache.activemq" - + ":Type=Queue,Destination=" + queueName - + ",BrokerName=localhost"); + + ":destinationType=Queue,destinationName=" + queueName + + ",type=Broker,brokerName=localhost"); QueueViewMBean proxy = (QueueViewMBean) broker.getManagementContext() .newProxyInstance(queueViewMBeanName, QueueViewMBean.class, true); return proxy;