use of org.jgroups.util.MutableDigest in project JGroups by belaban.
the class DigestTest method testConflictingMerge.
public void testConflictingMerge() {
MutableDigest new_d = new MutableDigest(members);
new_d.set(a1, 450, 501);
new_d.set(a3, 28, 35);
md = new MutableDigest(d);
md.merge(new_d);
Assert.assertEquals(md.capacity(), 3);
Assert.assertEquals(md.get(a1)[0], 500);
Assert.assertEquals(md.get(a1)[1], 501);
Assert.assertEquals(md.get(a2)[0], 26);
Assert.assertEquals(md.get(a2)[1], 26);
Assert.assertEquals(md.get(a3)[0], 28);
Assert.assertEquals(md.get(a3)[1], 35);
}
use of org.jgroups.util.MutableDigest in project JGroups by belaban.
the class DigestTest method beforeMethod.
@BeforeMethod
void beforeMethod() {
d = new Digest(members, new long[] { 500, 501, 26, 26, 25, 33 });
md = new MutableDigest(members);
}
use of org.jgroups.util.MutableDigest in project JGroups by belaban.
the class DigestTest method testNonConflictingMerge.
public void testNonConflictingMerge() {
Address ip1 = Util.createRandomAddress("x"), ip2 = Util.createRandomAddress("y");
View tmp_view = View.create(a1, 1, a1, a2, a3, ip1, ip2);
MutableDigest cons_d = new MutableDigest(tmp_view.getMembersRaw());
cons_d.set(ip1, 10, 10);
cons_d.set(ip2, 20, 20);
cons_d.merge(d);
Assert.assertEquals(cons_d.capacity(), 5);
Assert.assertEquals(cons_d.get(ip1)[0], 10);
Assert.assertEquals(cons_d.get(ip2)[0], 20);
Assert.assertEquals(cons_d.get(a1)[0], 500);
Assert.assertEquals(cons_d.get(a2)[0], 26);
Assert.assertEquals(cons_d.get(a3)[0], 25);
Assert.assertEquals(cons_d.get(ip1)[1], 10);
Assert.assertEquals(cons_d.get(ip2)[1], 20);
Assert.assertEquals(cons_d.get(a1)[1], 501);
Assert.assertEquals(cons_d.get(a2)[1], 26);
Assert.assertEquals(cons_d.get(a3)[1], 33);
}
use of org.jgroups.util.MutableDigest in project JGroups by belaban.
the class DigestTest method testSetHighestDeliveredAndSeenSeqnoAt.
public void testSetHighestDeliveredAndSeenSeqnoAt() {
md = new MutableDigest(d);
Assert.assertEquals(md.get(a1)[0], 500);
Assert.assertEquals(md.get(a1)[1], 501);
md.set(a1, 10, 20);
Assert.assertEquals(md.get(a1)[0], 10);
Assert.assertEquals(md.get(a1)[1], 20);
}
use of org.jgroups.util.MutableDigest in project JGroups by belaban.
the class SequencerMergeTest method getDigest.
protected static Digest getDigest(final View view, JChannel... channels) {
MutableDigest digest = new MutableDigest(view.getMembersRaw());
for (JChannel ch : channels) {
Protocol nak = ch.getProtocolStack().findProtocol(NAKACK2.class);
Digest tmp = (Digest) nak.down(new Event(Event.GET_DIGEST, ch.getAddress()));
if (tmp != null)
digest.set(tmp);
}
return digest;
}
Aggregations