Package org.jgroups.protocols.pbcast

Examples of org.jgroups.protocols.pbcast.Digest


        Vector members=new Vector();

        members.add(new IpAddress(1111));
        members.add(new IpAddress(2222));
        View v=new View(new IpAddress(1234), 322649, members);
        Digest d=new Digest(3);
        d.add(new IpAddress(3524), 1,2,3);
        d.add(new IpAddress(1324), 3,4,5);
        rsp=new JoinRsp();
        _testSize(rsp);
        rsp=new JoinRsp(v, d);
        _testSize(rsp);
        rsp=new JoinRsp("this is a failure");
View Full Code Here


        hdr=new STATE_TRANSFER.StateHeader(STATE_TRANSFER.StateHeader.STATE_REQ, addr, 322649, null, "my_state");
        _testSize(hdr);


        Digest digest=new Digest(2);
        digest.add(addr, 100, 200, 205);
        digest.add(new IpAddress(2314), 102, 104, 105);
        hdr=new STATE_TRANSFER.StateHeader(STATE_TRANSFER.StateHeader.STATE_RSP, addr, 322649, digest);
        _testSize(hdr);

        hdr=new STATE_TRANSFER.StateHeader(STATE_TRANSFER.StateHeader.STATE_RSP, addr, 322649, digest, "my_state");
        _testSize(hdr);
View Full Code Here

    }


    public void setUp() throws Exception {
        super.setUp();
        d=new Digest(3);
        a1=new IpAddress(5555);
        a2=new IpAddress(6666);
        a3=new IpAddress(7777);
        d.add(a1, 4, 500, 501);
        d.add(a2, 25, 26, 26);
View Full Code Here

        d.add(a2, 25, 26, 26);
        d.add(a3, 20, 25, 33);
    }

    public void testSize() {
        d2=new Digest(3);
        assertEquals(0, d2.size());
    }
View Full Code Here

        d.add(d2);
        assertEquals(3, d.size());
    }

    public void testAddDigest2() {
        d2=new Digest(4);
        d2.add(new IpAddress(1111), 1,2,3);
        d2.add(new IpAddress(2222), 1,2,3);
        d2.add(new IpAddress(5555), 1,2,3);
        d2.add(new IpAddress(6666), 1,2,3);
        d.add(d2);
View Full Code Here

        entry=d.get(a3);
        assertEquals(entry, new Digest.Entry(20,25,33));
    }

    public void testIncrementHighSeqno() {
        d2=new Digest(3);
        d2.add(a1, 1, 100);
        d2.add(a2, 3, 300);
        d2.add(a3, 7, 700);

        long tmp=d2.highSeqnoAt(a1);
View Full Code Here

        assertEquals(0, d.size());
    }


    public void testConstructor2() {
        Digest dd=new Digest(3);
        assertEquals(0, dd.size());
    }
View Full Code Here

        testResetAt();
    }


    public void testNonConflictingMerge() {
        Digest cons_d=new Digest(5);
        IpAddress ip1=new IpAddress(1111), ip2=new IpAddress(2222);

        cons_d.add(ip1, 1, 10, 10);
        cons_d.add(ip2, 2, 20, 20);
        // System.out.println("\ncons_d before: " + cons_d);
        cons_d.merge(d);

        assertEquals(5, cons_d.size());
        //System.out.println("\ncons_d after: " + cons_d);
        assertEquals(1, cons_d.lowSeqnoAt(ip1));
        assertEquals(2, cons_d.lowSeqnoAt(ip2));
        assertEquals(4, cons_d.lowSeqnoAt(a1));
        assertEquals(25, cons_d.lowSeqnoAt(a2));
        assertEquals(20, cons_d.lowSeqnoAt(a3));

        assertEquals(10, cons_d.highSeqnoAt(ip1));
        assertEquals(20, cons_d.highSeqnoAt(ip2));
        assertEquals(500, cons_d.highSeqnoAt(a1));
        assertEquals(26, cons_d.highSeqnoAt(a2));
        assertEquals(25, cons_d.highSeqnoAt(a3));

        assertEquals(10, cons_d.highSeqnoSeenAt(ip1));
        assertEquals(20, cons_d.highSeqnoSeenAt(ip2));
        assertEquals(501, cons_d.highSeqnoSeenAt(a1));
        assertEquals(26, cons_d.highSeqnoSeenAt(a2));
        assertEquals(33, cons_d.highSeqnoSeenAt(a3));
    }
View Full Code Here

        assertEquals(33, cons_d.highSeqnoSeenAt(a3));
    }


    public void testConflictingMerge() {
        Digest new_d=new Digest(2);
        new_d.add(a1, 5, 450, 501);
        new_d.add(a3, 18, 28, 35);
        //System.out.println("\nd before: " + d);
        //System.out.println("new_: " + new_d);
        d.merge(new_d);

        assertEquals(3, d.size());
View Full Code Here

    public void testSameSendersOtherIsNull() {
        assertFalse(d.sameSenders(null));
    }

    public void testSameSenders1MNullDifferentLenth() {
        d2=new Digest(1);
        assertFalse(d2.sameSenders(d));
    }
View Full Code Here

TOP

Related Classes of org.jgroups.protocols.pbcast.Digest

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.