Package org.jgroups.util

Examples of org.jgroups.util.SeqnoList$SeqnoListIterator


        for(int i: Arrays.asList(2,5,10,11,12,13,15,20,28,30))
            buf.add(i, i);
        System.out.println("buf = " + buf);
        int missing=buf.missing();
        System.out.println("missing=" + missing);
        SeqnoList missing_list=buf.getMissing();
        System.out.println("missing_list = " + missing_list);
        assert missing_list.size() == missing;
    }
View Full Code Here


    }

    public void testGetMissing2() {
        RingBuffer<Integer> buf=new RingBuffer<Integer>(10, 0);
        buf.add(1,1);
        SeqnoList missing=buf.getMissing();
        System.out.println("missing = " + missing);
        assert missing == null && buf.missing() == 0;

        buf=new RingBuffer<Integer>(10, 0);
        buf.add(10,10);
        missing=buf.getMissing();
        System.out.println("missing = " + missing);
        assert buf.missing() == missing.size();

        buf=new RingBuffer<Integer>(10, 0);
        buf.add(5,5);
        missing=buf.getMissing();
        System.out.println("missing = " + missing);
        assert buf.missing() == missing.size();

        buf=new RingBuffer<Integer>(10, 0);
        buf.add(5,7);
        missing=buf.getMissing();
        System.out.println("missing = " + missing);
        assert buf.missing() == missing.size();
    }
View Full Code Here

*/
@Test(groups=Global.FUNCTIONAL)
public class SeqnoListTest {

    public void testAddition() {
        SeqnoList list=new SeqnoList(16, 5000);
        list.add(5001).add(5005,5010).add(5015);
        System.out.println("list = " + list);
        assert list.size() == 8;
        assert list.getLast() == 5015;
    }
View Full Code Here

        assert list.size() == 8;
        assert list.getLast() == 5015;
    }

    public void testAddWithOffset() {
        SeqnoList list=new SeqnoList(100, 300000);
        list.add(300000,300050);
        assert list.size() == 51;
        assert list.getLast() == 300050;
        list.removeHigherThan(300020);
        assert list.size() == 21;
    }
View Full Code Here

        assert list.size() == 21;
    }

    public void testAdd2() {
        long first_seqno=500, last_seqno=500;
        SeqnoList list=new SeqnoList((int)(last_seqno - first_seqno +1), first_seqno);
        list.add(first_seqno, last_seqno);
        System.out.println("list = " + list);
        assert list.size() == 1;
    }
View Full Code Here

        System.out.println("list = " + list);
        assert list.size() == 1;
    }

    public void testGetLast() {
        SeqnoList list=new SeqnoList(20);
        assert list.getLast() == -1;
        list.add(0);
        assert list.getLast() == 0;
        list.add(5,7);
        assert list.getLast() == 7;
        list.add(15,19);
        assert list.getLast() == 19;

        list=new SeqnoList(15).add(3).add(5,10);
        assert list.getLast() == 10;
    }
View Full Code Here

        assert list.getLast() == 10;
    }


    public void testRemoveHigherThan() {
        SeqnoList list=new SeqnoList(20).add(1).add(10, 15);
        list.removeHigherThan(15);
        assert list.size() == 7;

        list.removeHigherThan(14);
        assert list.size() == 6;

        list.removeHigherThan(3);
        assert list.size() ==1;
    }
View Full Code Here

        list.removeHigherThan(3);
        assert list.size() ==1;
    }

    public void testRemoveHigherThan2() {
        SeqnoList list=new SeqnoList(20).add(1).add(10, 15);
        list.removeHigherThan(10);
        assert list.size() == 2;
    }
View Full Code Here

        assert list.size() == 2;
    }


    public void testIteration() {
        SeqnoList list=new SeqnoList(16).add(1).add(5,10).add(15);
        List<Long> expected=Arrays.asList(1L,5L,6L,7L,8L,9L,10L,15L);
        _testIteration(list, expected);
    }
View Full Code Here

        _testIteration(list, expected);
    }


    public static void testIteration2() {
        _testIteration(new SeqnoList(15).add(5,10), Arrays.asList(5L,6L,7L,8L,9L,10L));
    }
View Full Code Here

TOP

Related Classes of org.jgroups.util.SeqnoList$SeqnoListIterator

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.