From 85ebf3616ebdf99bb60ebb573ee950c11f94b622 Mon Sep 17 00:00:00 2001 From: Robert Davies Date: Thu, 10 Apr 2008 06:31:06 +0000 Subject: [PATCH] updated for topics too git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@646664 13f79535-47bb-0310-9956-ffa450edef68 --- .../activemq/advisory/TempDestLoadTest.java | 49 ++++++++++++++++--- 1 file changed, 43 insertions(+), 6 deletions(-) diff --git a/activemq-core/src/test/java/org/apache/activemq/advisory/TempDestLoadTest.java b/activemq-core/src/test/java/org/apache/activemq/advisory/TempDestLoadTest.java index 42a61697f3..104ec87dd1 100644 --- a/activemq-core/src/test/java/org/apache/activemq/advisory/TempDestLoadTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/advisory/TempDestLoadTest.java @@ -17,10 +17,14 @@ package org.apache.activemq.advisory; import javax.jms.Connection; +import javax.jms.MessageConsumer; +import javax.jms.MessageProducer; import javax.jms.Session; +import javax.jms.TemporaryQueue; +import javax.jms.TemporaryTopic; import org.apache.activemq.EmbeddedBrokerTestSupport; -import org.apache.activemq.command.ActiveMQTempQueue; +import org.apache.activemq.broker.region.RegionBroker; /** * @version $Revision: 397249 $ @@ -31,23 +35,56 @@ public class TempDestLoadTest extends EmbeddedBrokerTestSupport implements protected int consumerCounter; private Connection connection; private Session session; - private ActiveMQTempQueue tempQueue; + private static final int MESSAGE_COUNT = 2000; + public void testLoadTempAdvisoryQueues() throws Exception { - int count = 100; - for (int i = 0; i < count; i++) { - tempQueue = (ActiveMQTempQueue) session.createTemporaryQueue(); + for (int i = 0; i < MESSAGE_COUNT; i++) { + TemporaryQueue tempQueue = session.createTemporaryQueue(); + MessageConsumer consumer = session.createConsumer(tempQueue); + MessageProducer producer = session.createProducer(tempQueue); + consumer.close(); + producer.close(); tempQueue.delete(); } + AdvisoryBroker ab = (AdvisoryBroker) broker.getBroker().getAdaptor( + AdvisoryBroker.class); + + assertTrue(ab.getAdvisoryDestinations().size() == 0); + assertTrue(ab.getAdvisoryConsumers().size() == 0); + assertTrue(ab.getAdvisoryProducers().size() == 0); + + RegionBroker rb = (RegionBroker) broker.getBroker().getAdaptor( + RegionBroker.class); + //there should be 3 destinations - advisories - + //1 for the connection + 2 generic ones + assertTrue(rb.getDestinationMap().size()==3); + } + + public void testLoadTempAdvisoryTopics() throws Exception { + for (int i = 0; i < MESSAGE_COUNT; i++) { + TemporaryTopic tempTopic = session.createTemporaryTopic(); + MessageConsumer consumer = session.createConsumer(tempTopic); + MessageProducer producer = session.createProducer(tempTopic); + consumer.close(); + producer.close(); + tempTopic.delete(); + } + AdvisoryBroker ab = (AdvisoryBroker) broker.getBroker().getAdaptor( AdvisoryBroker.class); assertTrue(ab.getAdvisoryDestinations().size() == 0); assertTrue(ab.getAdvisoryConsumers().size() == 0); assertTrue(ab.getAdvisoryProducers().size() == 0); - + RegionBroker rb = (RegionBroker) broker.getBroker().getAdaptor( + RegionBroker.class); + //there should be 3 destinations - advisories - + //1 for the connection + 2 generic ones + assertTrue(rb.getDestinationMap().size()==3); + } protected void setUp() throws Exception {