Package org.jgroups.util

Examples of org.jgroups.util.Digest$Entry


     *     the new view
     * </ol>
     */
    private void sendMergeView(Vector<Address> coords, MergeData combined_merge_data) {                     
        View v;
        Digest d;

        if(coords == null || combined_merge_data == null)
            return;

        v=combined_merge_data.view;
View Full Code Here


        d=new Digest(map);
        md=new MutableDigest(map);
    }

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

      a2=new IpAddress(6666);
      a3=new IpAddress(7777);
      map.put(a1, new Digest.Entry(4, 500, 501));
      map.put(a2, new Digest.Entry(25, 26, 26));
      map.put(a3, new Digest.Entry(20, 25, 33));
      Digest digest =new Digest(map);
      
      Map<Address, Digest.Entry> map2=new HashMap<Address, Digest.Entry>();      
      map2.put(a1, new Digest.Entry(4, 500, 501));
      map2.put(a2, new Digest.Entry(25, 26, 26));
      map2.put(a3, new Digest.Entry(20, 37, 33));
      Digest digest2 =new Digest(map2);
      
      assertNotSame(digest, digest2);
     
      Digest diff = digest2.difference(digest);
      System.out.println(diff);
      assertTrue(diff.contains(a3));
        assertEquals(1, diff.size());
     
     
      Map<Address, Digest.Entry> map3=new HashMap<Address, Digest.Entry>();
      map3.put(a1, new Digest.Entry(4, 500, 501));
      map3.put(a2, new Digest.Entry(25, 26, 26));
      map3.put(a3, new Digest.Entry(20, 37, 33));
      map3.put(new IpAddress(8888), new Digest.Entry(1, 2, 3));
      Digest digest3 =new Digest(map3);
     
      diff = digest3.difference(digest);
      System.out.println(diff);
        assertEquals(2, diff.size());
     
      diff = digest3.difference(digest2);
      System.out.println(diff);
        assertEquals(1, diff.size());
     
      Digest diff2 = digest2.difference(digest3);
      System.out.println(diff2);
        assertEquals(1, diff2.size());
        assertEquals(diff, diff2);
    }
View Full Code Here

    public void testIsGreaterThanOrEqual() {
        Map<Address, Digest.Entry> map=new HashMap<Address, Digest.Entry>();
        map.put(a1, new Digest.Entry(4, 500, 501));
        map.put(a2, new Digest.Entry(25, 26, 26));
        map.put(a3, new Digest.Entry(20, 25, 33));
        Digest my=new Digest(map);

        System.out.println("\nd: " + d + "\nmy: " + my);
        assertTrue(my.isGreaterThanOrEqual(d));

        map.remove(a3);
        map.put(a3, new Digest.Entry(20, 26, 33));
        my=new Digest(map);
        System.out.println("\nd: " + d + "\nmy: " + my);
        assertTrue(my.isGreaterThanOrEqual(d));

        map.remove(a3);
        map.put(a3, new Digest.Entry(20, 22, 32));
        my=new Digest(map);
        System.out.println("\nd: " + d + "\nmy: " + my);
        assertFalse(my.isGreaterThanOrEqual(d));
    }
View Full Code Here

        assertFalse(d.equals(md));
    }


    public void testMutability() {
        Digest md2=md;
        assertEquals(md, md2);
        md.incrementHighestDeliveredSeqno(a2);
        assertEquals(md, md2);
    }
View Full Code Here

        assertFalse(d.equals(tmp));
    }


    public void testImmutability2() {
        Digest tmp=d.copy();
        assertEquals(d, tmp);
    }
View Full Code Here

        Digest tmp=d.copy();
        assertEquals(d, tmp);
    }

    public void testImmutability3() {
        Digest tmp=new Digest(d);
        assertEquals(tmp, d);
    }
View Full Code Here

        Digest tmp=new Digest(d);
        assertEquals(tmp, d);
    }

    public void testImmutability4() {
        Digest copy=md.copy();
        assertEquals(copy, md);
        md.incrementHighestDeliveredSeqno(a1);
        assertFalse(copy.equals(md));
    }
View Full Code Here

        md.add(new IpAddress(14526), 1,2,3);
        assertEquals(4, md.size());
    }

    public void testAddDigest() {
        Digest tmp=md.copy();
        md.add(tmp);
        assertEquals(3, md.size());
    }
View Full Code Here

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


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

TOP

Related Classes of org.jgroups.util.Digest$Entry

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.