modifying the tests so we can verify that all proxy consumers are closed

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@794240 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Bosanac Dejan 2009-07-15 11:56:39 +00:00
parent ca242f4a34
commit 11e407ea45
1 changed files with 23 additions and 3 deletions

View File

@ -468,7 +468,7 @@ public class ThreeBrokerQueueNetworkTest extends JmsMultipleBrokersTestSupport {
// Setup consumers
String brokerName = "BrokerA";
createConsumer(brokerName, dest);
MessageConsumer consumer = createConsumer(brokerName, dest);
// wait for advisories
Thread.sleep(2000);
@ -479,8 +479,18 @@ public class ThreeBrokerQueueNetworkTest extends JmsMultipleBrokersTestSupport {
BrokerService broker = i.next().broker;
verifyConsumerCount(broker, 1, dest);
}
consumer.close();
// wait for advisories
Thread.sleep(2000);
// verify there is no more consumers
for (Iterator<BrokerItem> i = brokerList.iterator(); i.hasNext();) {
BrokerService broker = i.next().broker;
verifyConsumerCount(broker, 0, dest);
}
}
public void testNoDuplicateQueueSubsHasLowestPriority() throws Exception {
@ -552,7 +562,7 @@ public class ThreeBrokerQueueNetworkTest extends JmsMultipleBrokersTestSupport {
// Setup consumers
String brokerName = "BrokerA";
createConsumer(brokerName, dest);
MessageConsumer consumer = createConsumer(brokerName, dest);
// wait for advisories
Thread.sleep(2000);
@ -569,6 +579,16 @@ public class ThreeBrokerQueueNetworkTest extends JmsMultipleBrokersTestSupport {
verifyConsumePriority(broker, ConsumerInfo.NORMAL_PRIORITY, dest);
}
}
consumer.close();
// wait for advisories
Thread.sleep(2000);
for (Iterator<BrokerItem> i = brokerList.iterator(); i.hasNext();) {
BrokerService broker = i.next().broker;
verifyConsumerCount(broker, 0, dest);
}
}
private void verifyConsumerCount(BrokerService broker, int count, final Destination dest) throws Exception {