fix test case after changes in https://issues.apache.org/jira/browse/AMQ-4237 broke the test's MBean lookup

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1428578 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Timothy A. Bish 2013-01-03 20:37:04 +00:00
parent 123a512370
commit 5ddc7d65c3
1 changed files with 15 additions and 13 deletions

View File

@ -33,14 +33,16 @@
package org.apache.activemq.usecases; package org.apache.activemq.usecases;
import java.net.URI; import java.net.URI;
import javax.jms.Connection; import javax.jms.Connection;
import javax.jms.ConnectionFactory; import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.MessageProducer; import javax.jms.MessageProducer;
import javax.jms.Session; import javax.jms.Session;
import javax.jms.TemporaryQueue; import javax.jms.TemporaryQueue;
import javax.management.ObjectName; import javax.management.ObjectName;
import junit.framework.Test; import junit.framework.Test;
import org.apache.activemq.ActiveMQConnection; import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.ActiveMQMessageConsumer; import org.apache.activemq.ActiveMQMessageConsumer;
@ -60,27 +62,27 @@ public class TwoBrokerTempQueueAdvisoryTest extends JmsMultipleBrokersTestSuppor
private void sendReceiveTempQueueMessage(String broker) throws Exception { private void sendReceiveTempQueueMessage(String broker) throws Exception {
ConnectionFactory factory = getConnectionFactory(broker); ConnectionFactory factory = getConnectionFactory(broker);
Connection conn = factory.createConnection(); Connection conn = factory.createConnection();
Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
Destination dest = session.createTemporaryQueue(); session.createTemporaryQueue();
conn.close(); conn.close();
} }
public void testTemporaryQueueAdvisory() throws Exception { public void testTemporaryQueueAdvisory() throws Exception {
LOG.info("Running testTemporaryQueueAdvisory()"); LOG.info("Running testTemporaryQueueAdvisory()");
bridgeBrokers("BrokerA", "BrokerB"); bridgeBrokers("BrokerA", "BrokerB");
bridgeBrokers("BrokerB", "BrokerA"); bridgeBrokers("BrokerB", "BrokerA");
startAllBrokers(); startAllBrokers();
waitForBridgeFormation(); waitForBridgeFormation();
waitForMinTopicRegionConsumerCount("BrokerB", 1); waitForMinTopicRegionConsumerCount("BrokerB", 1);
waitForMinTopicRegionConsumerCount("BrokerA", 1); waitForMinTopicRegionConsumerCount("BrokerA", 1);
final int iterations = 30; final int iterations = 30;
for (int i = 0; i < iterations; i++) { for (int i = 0; i < iterations; i++) {
sendReceiveTempQueueMessage("BrokerA"); sendReceiveTempQueueMessage("BrokerA");
} }
waitForMinTopicRegionConsumerCount("BrokerB", 1); waitForMinTopicRegionConsumerCount("BrokerB", 1);
@ -172,14 +174,14 @@ public class TwoBrokerTempQueueAdvisoryTest extends JmsMultipleBrokersTestSuppor
String domain = "org.apache.activemq"; String domain = "org.apache.activemq";
ObjectName name; ObjectName name;
if (type == ActiveMQDestination.QUEUE_TYPE) { if (type == ActiveMQDestination.QUEUE_TYPE) {
name = new ObjectName(domain + ":BrokerName=" + broker + ",Type=Queue,Destination=" + destination); name = new ObjectName(domain + ":type=Broker,brokerName=" + broker + ",destinationType=Queue,destinationName=" + destination);
} else { } else {
name = new ObjectName(domain + ":BrokerName=" + broker + ",Type=Topic,Destination=" + destination); name = new ObjectName(domain + ":type=Broker,brokerName=" + broker + ",destinationType=Topic,destinationName=" + destination);
} }
return (DestinationViewMBean) brokers.get(broker).broker.getManagementContext().newProxyInstance(name, DestinationViewMBean.class, return (DestinationViewMBean) brokers.get(broker).broker.getManagementContext().newProxyInstance(name, DestinationViewMBean.class, true);
true);
} }
@Override
public void setUp() throws Exception { public void setUp() throws Exception {
super.setAutoFail(true); super.setAutoFail(true);
super.setUp(); super.setUp();