mirror of https://github.com/apache/activemq.git
updated for topics too
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@646664 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b2fd5d6456
commit
85ebf3616e
|
@ -17,10 +17,14 @@
|
||||||
package org.apache.activemq.advisory;
|
package org.apache.activemq.advisory;
|
||||||
|
|
||||||
import javax.jms.Connection;
|
import javax.jms.Connection;
|
||||||
|
import javax.jms.MessageConsumer;
|
||||||
|
import javax.jms.MessageProducer;
|
||||||
import javax.jms.Session;
|
import javax.jms.Session;
|
||||||
|
import javax.jms.TemporaryQueue;
|
||||||
|
import javax.jms.TemporaryTopic;
|
||||||
|
|
||||||
import org.apache.activemq.EmbeddedBrokerTestSupport;
|
import org.apache.activemq.EmbeddedBrokerTestSupport;
|
||||||
import org.apache.activemq.command.ActiveMQTempQueue;
|
import org.apache.activemq.broker.region.RegionBroker;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @version $Revision: 397249 $
|
* @version $Revision: 397249 $
|
||||||
|
@ -31,22 +35,55 @@ public class TempDestLoadTest extends EmbeddedBrokerTestSupport implements
|
||||||
protected int consumerCounter;
|
protected int consumerCounter;
|
||||||
private Connection connection;
|
private Connection connection;
|
||||||
private Session session;
|
private Session session;
|
||||||
private ActiveMQTempQueue tempQueue;
|
private static final int MESSAGE_COUNT = 2000;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void testLoadTempAdvisoryQueues() throws Exception {
|
public void testLoadTempAdvisoryQueues() throws Exception {
|
||||||
|
|
||||||
int count = 100;
|
for (int i = 0; i < MESSAGE_COUNT; i++) {
|
||||||
for (int i = 0; i < count; i++) {
|
TemporaryQueue tempQueue = session.createTemporaryQueue();
|
||||||
tempQueue = (ActiveMQTempQueue) session.createTemporaryQueue();
|
MessageConsumer consumer = session.createConsumer(tempQueue);
|
||||||
|
MessageProducer producer = session.createProducer(tempQueue);
|
||||||
|
consumer.close();
|
||||||
|
producer.close();
|
||||||
tempQueue.delete();
|
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 ab = (AdvisoryBroker) broker.getBroker().getAdaptor(
|
||||||
AdvisoryBroker.class);
|
AdvisoryBroker.class);
|
||||||
assertTrue(ab.getAdvisoryDestinations().size() == 0);
|
assertTrue(ab.getAdvisoryDestinations().size() == 0);
|
||||||
assertTrue(ab.getAdvisoryConsumers().size() == 0);
|
assertTrue(ab.getAdvisoryConsumers().size() == 0);
|
||||||
assertTrue(ab.getAdvisoryProducers().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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue