diff options
author | Gordon Sim <gsim@apache.org> | 2010-01-22 19:12:18 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2010-01-22 19:12:18 +0000 |
commit | 6d79c93d2d895e19acaf571f5eaf52202919e6b1 (patch) | |
tree | e87f84edeac78eeba420fcde4dc4e7f594257f37 | |
parent | d54b47125c334204835129556190767f6cedb06f (diff) | |
download | qpid-python-6d79c93d2d895e19acaf571f5eaf52202919e6b1.tar.gz |
QPID-2347 broke some java tests; I believe these make incorrect assumptions about durable subscriptions and have changed them accordingly.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@902231 13f79535-47bb-0310-9956-ffa450edef68
3 files changed, 5 insertions, 6 deletions
diff --git a/java/client/src/main/java/org/apache/qpid/client/AMQSession.java b/java/client/src/main/java/org/apache/qpid/client/AMQSession.java index 8a4fbe5a9b..fc1778f0a1 100644 --- a/java/client/src/main/java/org/apache/qpid/client/AMQSession.java +++ b/java/client/src/main/java/org/apache/qpid/client/AMQSession.java @@ -1664,6 +1664,7 @@ public abstract class AMQSession<C extends BasicMessageConsumer, P extends Basic TopicSubscriberAdaptor subscriber = _subscriptions.get(name); if (subscriber != null) { + subscriber.close(); // send a queue.delete for the subscription deleteQueue(AMQTopic.getDurableTopicQueueName(name, _connection)); _subscriptions.remove(name); diff --git a/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java b/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java index 2a44413ac8..fb49704afa 100644 --- a/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java +++ b/java/systests/src/main/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java @@ -97,6 +97,7 @@ public class DurableSubscriptionTest extends QpidTestCase _logger.info("Receive message on consumer 1 :expecting null"); assertEquals(null, msg); + consumer2.close(); _logger.info("Unsubscribe session2/consumer2"); session2.unsubscribe("MySubscription"); @@ -111,10 +112,6 @@ public class DurableSubscriptionTest extends QpidTestCase msg = consumer1.receive(NEGATIVE_RECEIVE_TIMEOUT); assertEquals(null, msg); - _logger.info("Receive message on consumer 2 :expecting null"); - msg = consumer2.receive(NEGATIVE_RECEIVE_TIMEOUT); - assertEquals(null, msg); - _logger.info("Close connection"); con.close(); } @@ -301,7 +298,6 @@ public class DurableSubscriptionTest extends QpidTestCase { assertTrue("Wrong type of exception thrown", e instanceof InvalidSelectorException); } - TopicSubscriber liveSubscriber = session.createDurableSubscriber(topic, "testDurableWithInvalidSelectorSub"); assertNotNull("Subscriber should have been created", liveSubscriber); @@ -311,6 +307,7 @@ public class DurableSubscriptionTest extends QpidTestCase assertNotNull ("Message should have been received", msg); assertEquals ("testDurableWithInvalidSelector2", ((TextMessage) msg).getText()); assertNull("Should not receive subsequent message", liveSubscriber.receive(200)); + liveSubscriber.close(); session.unsubscribe("testDurableWithInvalidSelectorSub"); } diff --git a/java/systests/src/main/java/org/apache/qpid/test/unit/topic/TopicSessionTest.java b/java/systests/src/main/java/org/apache/qpid/test/unit/topic/TopicSessionTest.java index 742e2ac518..b0484e20d7 100644 --- a/java/systests/src/main/java/org/apache/qpid/test/unit/topic/TopicSessionTest.java +++ b/java/systests/src/main/java/org/apache/qpid/test/unit/topic/TopicSessionTest.java @@ -126,12 +126,13 @@ public class TopicSessionTest extends QpidTestCase session1 = con.createTopicSession(true, AMQSession.NO_ACKNOWLEDGE); publisher = session1.createPublisher(null); } + sub.close(); TopicSubscriber sub2 = session1.createDurableSubscriber(topic2, "subscription0"); publisher.publish(topic, session1.createTextMessage("hello")); session1.commit(); if (!shutdown) { - m = (TextMessage) sub.receive(2000); + m = (TextMessage) sub2.receive(2000); assertNull(m); session1.commit(); } |