Package org.jgroups.util

Examples of org.jgroups.util.SeqnoTable


        MBR=Util.createRandomAddress();
    }


    public static void testInit() {
        SeqnoTable tab=new SeqnoTable(0);
        tab.add(MBR, 0);
        Assert.assertEquals(0, tab.getHighestReceived(MBR));
        Assert.assertEquals(1, tab.getNextToReceive(MBR));

        tab.clear();
        tab=new SeqnoTable(50);
        tab.add(MBR, 50);
        Assert.assertEquals(50, tab.getHighestReceived(MBR));
        Assert.assertEquals(51, tab.getNextToReceive(MBR));
    }
View Full Code Here


        Assert.assertEquals(51, tab.getNextToReceive(MBR));
    }


    public static void testAdd() {
        SeqnoTable tab=new SeqnoTable(0);
        tab.add(MBR, 0);
        tab.add(MBR, 1);
        tab.add(MBR, 2);
        Assert.assertEquals(2, tab.getHighestReceived(MBR));
        Assert.assertEquals(3, tab.getNextToReceive(MBR));
    }
View Full Code Here

        Assert.assertEquals(3, tab.getNextToReceive(MBR));
    }


    public static void testAddWithGaps() {
        SeqnoTable tab=new SeqnoTable(0);
        boolean rc=tab.add(MBR, 0);
        assert rc;
        rc=tab.add(MBR, 1);
        assert rc;
        rc=tab.add(MBR, 2);
        assert rc;
        rc=tab.add(MBR, 4);
        assert rc;
        rc=tab.add(MBR, 5);
        assert rc;
        System.out.println("tab: " + tab);
        Assert.assertEquals(5, tab.getHighestReceived(MBR));
        Assert.assertEquals(3, tab.getNextToReceive(MBR));

        rc=tab.add(MBR, 3);
        assert rc;
        System.out.println("tab: " + tab);
        Assert.assertEquals(5, tab.getHighestReceived(MBR));
        Assert.assertEquals(6, tab.getNextToReceive(MBR));
    }
View Full Code Here

        Assert.assertEquals(6, tab.getNextToReceive(MBR));
    }


    public static void testAddWithGaps2() {
        SeqnoTable tab=new SeqnoTable(0);
        boolean rc=tab.add(MBR, 5);
        System.out.println("tab: " + tab);
        assert rc;
        Assert.assertEquals(5, tab.getHighestReceived(MBR));
        Assert.assertEquals(0, tab.getNextToReceive(MBR));

        rc=tab.add(MBR, 4);
        System.out.println("tab: " + tab);
        assert rc;
        Assert.assertEquals(5, tab.getHighestReceived(MBR));
        Assert.assertEquals(0, tab.getNextToReceive(MBR));

        rc=tab.add(MBR, 3);
        System.out.println("tab: " + tab);
        assert rc;
        Assert.assertEquals(5, tab.getHighestReceived(MBR));
        Assert.assertEquals(0, tab.getNextToReceive(MBR));

        rc=tab.add(MBR, 2);
        System.out.println("tab: " + tab);
        assert rc;
        Assert.assertEquals(5, tab.getHighestReceived(MBR));
        Assert.assertEquals(0, tab.getNextToReceive(MBR));

        rc=tab.add(MBR, 1);
        System.out.println("tab: " + tab);
        assert rc;
        Assert.assertEquals(5, tab.getHighestReceived(MBR));
        Assert.assertEquals(0, tab.getNextToReceive(MBR));

        rc=tab.add(MBR, 0);
        System.out.println("tab: " + tab);
        assert rc;
        Assert.assertEquals(5, tab.getHighestReceived(MBR));
        Assert.assertEquals(6, tab.getNextToReceive(MBR));

    }
View Full Code Here

    }

   
    public static void testInsertionOfDuplicates() {
        SeqnoTable tab=new SeqnoTable(0);
        boolean rc=tab.add(MBR, 0);
        assert rc;
        rc=tab.add(MBR, 0);
        assert !(rc);

        rc=tab.add(MBR, 1);
        assert rc;
        rc=tab.add(MBR, 2);
        assert rc;
        rc=tab.add(MBR, 4);
        assert rc;
        rc=tab.add(MBR, 5);
        assert rc;
        System.out.println("tab: " + tab);

        rc=tab.add(MBR, 2);
        assert !rc;

        rc=tab.add(MBR, 3);
        assert rc;

        rc=tab.add(MBR, 3);
        assert !rc;
    }
View Full Code Here

        super.tearDown();
        tab.clear();
    }

    public void testInit() {
        tab=new SeqnoTable(0);
        tab.add(MBR, 0);
        assertEquals(0, tab.getHighestReceived(MBR));
        assertEquals(1, tab.getNextToReceive(MBR));

        tab.clear();
        tab=new SeqnoTable(50);
        tab.add(MBR, 50);
        assertEquals(50, tab.getHighestReceived(MBR));
        assertEquals(51, tab.getNextToReceive(MBR));
    }
View Full Code Here

        assertEquals(50, tab.getHighestReceived(MBR));
        assertEquals(51, tab.getNextToReceive(MBR));
    }

    public void testAdd() {
        tab=new SeqnoTable(0);
        tab.add(MBR, 0);
        tab.add(MBR, 1);
        tab.add(MBR, 2);
        assertEquals(2, tab.getHighestReceived(MBR));
        assertEquals(3, tab.getNextToReceive(MBR));
View Full Code Here

        assertEquals(2, tab.getHighestReceived(MBR));
        assertEquals(3, tab.getNextToReceive(MBR));
    }

    public void testAddWithGaps() {
        tab=new SeqnoTable(0);
        boolean rc=tab.add(MBR, 0);
        assertTrue(rc);
        rc=tab.add(MBR, 1);
        assertTrue(rc);
        rc=tab.add(MBR, 2);
View Full Code Here

        assertEquals(5, tab.getHighestReceived(MBR));
        assertEquals(6, tab.getNextToReceive(MBR));
    }

    public void testAddWithGaps2() {
        tab=new SeqnoTable(0);
        boolean rc=tab.add(MBR, 5);
        System.out.println("tab: " + tab);
        assertTrue(rc);
        assertEquals(5, tab.getHighestReceived(MBR));
        assertEquals(0, tab.getNextToReceive(MBR));
View Full Code Here

        assertEquals(6, tab.getNextToReceive(MBR));

    }

    public void testInsertionOfDuplicates() {
        tab=new SeqnoTable(0);
        boolean rc=tab.add(MBR, 0);
        assertTrue(rc);
        rc=tab.add(MBR, 0);
        assertFalse(rc);
View Full Code Here

TOP

Related Classes of org.jgroups.util.SeqnoTable

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.