Package org.apache.qpid.server.subscription.SubscriptionList

Examples of org.apache.qpid.server.subscription.SubscriptionList.SubscriptionNode


     * Traverses the list nodes in a non-mutating fashion, returning the first node which matches the given
     * Subscription, or null if none is found.
     */
    private SubscriptionNode getNodeForSubscription(final SubscriptionList list, final Subscription sub)
    {
        SubscriptionNode node = list.getHead();
        while (node != null && node.getSubscription() != sub)
        {
            node = node.nextNode();
        }

        return node;
    }
View Full Code Here


    /**
     * Counts the number of (non-head) nodes in the list.
     */
    private int countNodes(final SubscriptionList list)
    {
        SubscriptionNode node = list.getHead();
        int count;
        for(count = -1; node != null; count++)
        {
            node = node.nextNode();
        }

        return count;
    }
View Full Code Here

     * removal.
     */
    public void testDeletedMarkedNodeDoesntLeakSubsequentlyDeletedNodes()
    {
        //get the nodes out the list for the 1st and 3rd subscriptions
        SubscriptionNode sub1Node = getNodeForSubscription(_subList, _sub1);
        assertNotNull("Should have been a node present for the subscription", sub1Node);
        SubscriptionNode sub3Node = getNodeForSubscription(_subList, _sub3);
        assertNotNull("Should have been a node present for the subscription", sub3Node);

        //mark the first subscription node
        assertTrue("should have succeeded in updating the marked node",
                _subList.updateMarkedNode(_subList.getMarkedNode(), sub1Node));
View Full Code Here

     * 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());
View Full Code Here

TOP

Related Classes of org.apache.qpid.server.subscription.SubscriptionList.SubscriptionNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.