@Test public void testChangeSetForm() { try { RVVException.UseTreeSetsForTesting = true; // Create a bit set which matches the seen versions of vh1 BitSet bs1 = new BitSet(); bs1.set(1024); RegionVersionHolder vh1 = buildHolder(bs1); bs1.set(510); bs1.set(511); bs1.set(512); recordVersions(vh1, bs1); validateExceptions(vh1); compareWithBitSet(bs1, vh1); } finally { RVVException.UseTreeSetsForTesting = false; } }
/** * Test a case in 46522 where the received exceptions end up not being in the RVV interval. */ @Test public void testConsumeReceivedRevisions() { testConsumeReceivedRevisions(false); testConsumeReceivedRevisions(true); }
/** * Test the dominates relation between RegionVersionHolders. * * This test currently fails in the last case with two different holders with the same exception * list expressed differently. Hence it is disabled. * * See bug 47106 */ @Test public void testDominates() { testDominates(false); testDominates(true); }
/** * Construct a region version holder that matches the seen revisions passed in the bit set. * */ private RegionVersionHolder buildHolder(BitSet bs) { // Createa version holder RegionVersionHolder vh = new RegionVersionHolder(member); // Record all of the version in the holder recordVersions(vh, bs); // Make sure the holder looks matches the bitset. compareWithBitSet(bs, vh); return vh; }
bs1.set(50, 101); RegionVersionHolder vh1 = buildHolder(bs1); validateExceptions(vh1); compareWithBitSet(bs1, vh1); bs2.set(49, 101); RegionVersionHolder vh2 = buildHolder(bs2); validateExceptions(vh2); vh2.initializeFrom(vh1); compareWithBitSet(bs1, vh2); validateExceptions(vh2);
BitSet bs1 = new BitSet(); bs1.set(1, 100); recordVersions(vh1, bs1); recordVersions(vh2, bs2); assertFalse(vh1.dominates(vh2)); assertTrue(vh2.dominates(vh1)); recordVersions(vh1, bs1); recordVersions(vh2, bs2); bs1.set(1, 21); bs1.set(30, 101); recordVersions(vh1, bs1); recordVersions(vh2, bs2); assertFalse(dominates(bs2, bs1)); assertFalse(dominates(bs1, bs2)); bs1.set(30, 41); bs1.set(43, 101); recordVersions(vh1, bs1); recordVersions(vh1, bs1); bs2.set(30, 43); bs2.set(45, 101);
/** * Test merging two version holders */ @Test public void testInitializeFrom() { testInitializeFrom(false); testInitializeFrom(true); }
@Before public final void setUp() throws Exception { originalBitSetWidth = RegionVersionHolder.BIT_SET_WIDTH; member = new InternalDistributedMember(InetAddress.getLocalHost(), 12345); postSetUp(); }
bs.set(0, 8679); bs.set(8705, 8713); recordVersions(vh, bs); System.out.println("init:\t\t" + vh);
RegionVersionHolder vh1 = buildHolder(bs1); validateExceptions(vh1); compareWithBitSet(bs1, vh2); validateExceptions(vh2); bs2.set(1, 4); RegionVersionHolder vh2 = buildHolder(bs2); validateExceptions(vh2); vh2.initializeFrom(vh1); compareWithBitSet(bs1, vh2); compareWithBitSet(bs1, vh4); vh1.addException(100, 106); assertTrue(vh2.sameAs(vh1)); validateExceptions(vh2);