diff options
| author | Robert Gemmell <robbie@apache.org> | 2011-07-31 20:54:23 +0000 |
|---|---|---|
| committer | Robert Gemmell <robbie@apache.org> | 2011-07-31 20:54:23 +0000 |
| commit | 629866cfa5ae7994dc0a3430fa154d8df31d2a40 (patch) | |
| tree | cee5f7edc9e16f1056d8d1a16751d90429ec3040 /java/broker/src/test | |
| parent | 4e89b04c9886ec55c0f268b472f40d727c9bd222 (diff) | |
| download | qpid-python-629866cfa5ae7994dc0a3430fa154d8df31d2a40.tar.gz | |
QPID-3064, QPID-3157: ensure that if the node marker is pointing at the tail node when it is removed, the marker is still subsequently able to find new subscriptions at the end of the list
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1152633 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/broker/src/test')
| -rw-r--r-- | java/broker/src/test/java/org/apache/qpid/server/subscription/SubscriptionListTest.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/java/broker/src/test/java/org/apache/qpid/server/subscription/SubscriptionListTest.java b/java/broker/src/test/java/org/apache/qpid/server/subscription/SubscriptionListTest.java index a9acfccd8e..c4d1a1e614 100644 --- a/java/broker/src/test/java/org/apache/qpid/server/subscription/SubscriptionListTest.java +++ b/java/broker/src/test/java/org/apache/qpid/server/subscription/SubscriptionListTest.java @@ -303,6 +303,40 @@ public class SubscriptionListTest extends QpidTestCase } /** + * Test that the marked node 'findNext' behaviour is as expected after a subscription is added + * to the list following the tail subscription node being removed while it is the marked node. + * That is, that the new subscriptions node is returned by getMarkedNode().findNext(). + */ + public void testMarkedNodeFindsNewSubscriptionAfterRemovingTailWhilstMarked() + { + //get the node out the list for the 3rd subscription + SubscriptionNode sub3Node = getNodeForSubscription(_subList, _sub3); + assertNotNull("Should have been a node present for the subscription", sub3Node); + + //mark the 3rd subscription node + assertTrue("should have succeeded in updating the marked node", + _subList.updateMarkedNode(_subList.getMarkedNode(), sub3Node)); + + //verify calling findNext on the marked node returns null, i.e. the end of the list has been reached + assertEquals("Unexpected node after marked node", null, _subList.getMarkedNode().findNext()); + + //remove the 3rd(marked) subscription from the list + assertTrue("Removing subscription node should have succeeded", _subList.remove(_sub3)); + + //add a new 4th subscription to the list + Subscription sub4 = new MockSubscription(); + _subList.add(sub4); + + //get the node out the list for the 4th subscription + SubscriptionNode sub4Node = getNodeForSubscription(_subList, sub4); + assertNotNull("Should have been a node present for the subscription", sub4Node); + + //verify the marked node (which is now a dummy substitute for the 3rd subscription) returns + //the 4th subscriptions node as the next non-deleted node. + assertEquals("Unexpected next node", sub4Node, _subList.getMarkedNode().findNext()); + } + + /** * Test that setting the marked node to null doesn't cause problems during remove operations */ public void testRemoveWithNullMarkedNode() |
