From 95f58fa7c4e26b5b2d73a80bd8e1cb2bee8ebf47 Mon Sep 17 00:00:00 2001 From: "Christopher L. Shannon (cshannon)" Date: Wed, 25 Nov 2015 19:13:24 +0000 Subject: [PATCH] https://issues.apache.org/jira/browse/AMQ-6027 Adding back in test case now that AMQ-5898 is resolved --- .../network/VirtualConsumerDemandTest.java | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/network/VirtualConsumerDemandTest.java b/activemq-unit-tests/src/test/java/org/apache/activemq/network/VirtualConsumerDemandTest.java index ad22b0736e..bff069b461 100644 --- a/activemq-unit-tests/src/test/java/org/apache/activemq/network/VirtualConsumerDemandTest.java +++ b/activemq-unit-tests/src/test/java/org/apache/activemq/network/VirtualConsumerDemandTest.java @@ -273,6 +273,56 @@ public class VirtualConsumerDemandTest extends DynamicNetworkTestSupport { } + /** + * Test that dynamic flow works for virtual destinations when a second composite + * topic is included that forwards to the same queue, but is excluded from + * being forwarded from the remote broker + * + * @throws Exception + */ + @Test(timeout = 60 * 1000) + public void testSecondNonIncludedCompositeTopicForwardSameQueue() throws Exception { + Assume.assumeTrue(isUseVirtualDestSubsOnCreation); + + doSetUp(true, null); + + MessageConsumer advisoryConsumer = getVirtualDestinationAdvisoryConsumer(testTopicName); + + //configure a composite topic that isn't included + CompositeTopic compositeTopic = createCompositeTopic("include.test.bar2", + new ActiveMQQueue("include.test.bar.bridge")); + + runtimeBroker.setVirtualDestinations(new VirtualDestination[] {compositeTopic}, true); + + Thread.sleep(2000); + + //add one that is included + CompositeTopic compositeTopic2 = createCompositeTopic(testTopicName, + new ActiveMQQueue("include.test.bar.bridge")); + + runtimeBroker.setVirtualDestinations(new VirtualDestination[] {compositeTopic, compositeTopic2}, true); + + Thread.sleep(2000); + MessageProducer includedProducer = localSession.createProducer(included); + Message test = localSession.createTextMessage("test"); + + final DestinationStatistics destinationStatistics = localBroker.getDestination(included).getDestinationStatistics(); + final DestinationStatistics remoteDestStatistics = remoteBroker.getDestination( + new ActiveMQQueue("include.test.bar.bridge")).getDestinationStatistics(); + + waitForConsumerCount(destinationStatistics, 1); + + includedProducer.send(test); + + waitForDispatchFromLocalBroker(destinationStatistics, 1); + assertLocalBrokerStatistics(destinationStatistics, 1); + assertEquals("remote dest messages", 1, remoteDestStatistics.getMessages().getCount()); + + assertRemoteAdvisoryCount(advisoryConsumer, 1); + assertAdvisoryBrokerCounts(2,2,2); + + } + /** * Test that dynamic flow works for virtual destinations when a second composite * topic is included, but is excluded from