use of org.apache.geode.DeltaTestImpl in project geode by apache.
the class P2PDeltaPropagationDUnitTest method getOnDeltaEnabledWithInvalidate.
public static void getOnDeltaEnabledWithInvalidate() throws Exception {
Region r1 = cache.getRegion(Region.SEPARATOR + REGION_NAME);
assertTrue(((DeltaTestImpl) r1.getEntry("KEY").getValue()).getIntVar() == NEW_INT);
assertTrue(((DeltaTestImpl) r1.getEntry("KEY").getValue()).getStr().equals(NEW_STR));
}
use of org.apache.geode.DeltaTestImpl in project geode by apache.
the class P2PDeltaPropagationDUnitTest method put.
public static void put() throws Exception {
Region r1 = cache.getRegion(Region.SEPARATOR + REGION_NAME);
DeltaTestImpl test = new DeltaTestImpl();
r1.put("KEY", test);
test = new DeltaTestImpl();
test.setIntVar(NEW_INT);
r1.put("KEY", test);
test = new DeltaTestImpl();
test.setStr(NEW_STR);
r1.put("KEY", test);
}
use of org.apache.geode.DeltaTestImpl in project geode by apache.
the class P2PDeltaPropagationDUnitTest method getOnDeltaEnabledWithDestroy.
public static void getOnDeltaEnabledWithDestroy() throws Exception {
Region r1 = cache.getRegion(Region.SEPARATOR + REGION_NAME);
assertNull(((DeltaTestImpl) r1.getEntry("KEY")));
}
use of org.apache.geode.DeltaTestImpl in project geode by apache.
the class DeltaPropagationDUnitTest method testC2S2SDeltaPropagation.
/**
* Tests that an update on a server with full Delta object causes distribution of the full Delta
* instance, and not its delta bits, to other peers, even if that instance's
* <code>hasDelta()</code> returns true.
*
* @throws Exception
*/
@Test
public void testC2S2SDeltaPropagation() throws Exception {
prepareDeltas();
VM0.invoke(() -> DeltaPropagationDUnitTest.prepareDeltas());
VM1.invoke(() -> DeltaPropagationDUnitTest.prepareDeltas());
DeltaTestImpl val = deltaPut[1];
VM0.invoke(() -> DeltaPropagationDUnitTest.closeCache());
PORT1 = ((Integer) VM0.invoke(() -> DeltaPropagationDUnitTest.createServerCache(HARegionQueue.HA_EVICTION_POLICY_MEMORY, new Integer(1), new Integer(C2S2S_SERVER_LISTENER)))).intValue();
PORT2 = ((Integer) VM1.invoke(() -> DeltaPropagationDUnitTest.createServerCache(HARegionQueue.HA_EVICTION_POLICY_MEMORY, new Integer(1), new Integer(C2S2S_SERVER_LISTENER)))).intValue();
createClientCache(new Integer(PORT1), new Integer(-1), "0", new Integer(NO_LISTENER));
Region r = cache.getRegion("/" + regionName);
assertNotNull(r);
r.create(DELTA_KEY, deltaPut[0]);
// Invalidate the value at both the servers.
VM0.invoke(() -> DeltaPropagationDUnitTest.doLocalOp(INVALIDATE, regionName, DELTA_KEY));
VM1.invoke(() -> DeltaPropagationDUnitTest.doLocalOp(INVALIDATE, regionName, DELTA_KEY));
VM0.invoke(() -> DeltaPropagationDUnitTest.assertOp(INVALIDATE, new Integer(1)));
VM1.invoke(() -> DeltaPropagationDUnitTest.assertOp(INVALIDATE, new Integer(1)));
r.put(DELTA_KEY, val);
Thread.sleep(5000);
// Assert that VM0 distributed val as full value to VM1.
VM1.invoke(() -> DeltaPropagationDUnitTest.assertValue(regionName, DELTA_KEY, val));
assertTrue("Delta Propagation feature used.", !((Boolean) VM0.invoke(() -> DeltaTestImpl.deltaFeatureUsed())).booleanValue());
assertTrue("Delta Propagation feature used.", !((Boolean) VM1.invoke(() -> DeltaTestImpl.deltaFeatureUsed())).booleanValue());
assertTrue("Delta Propagation feature NOT used.", DeltaTestImpl.deltaFeatureUsed());
}
use of org.apache.geode.DeltaTestImpl in project geode by apache.
the class DeltaPropagationDUnitTest method prepareDeltas.
public static void prepareDeltas() {
for (int i = 0; i < EVENTS_SIZE; i++) {
deltaPut[i] = new DeltaTestImpl(0, "0", new Double(0), new byte[0], new TestObject1("0", 0));
}
deltaPut[1].setIntVar(5);
deltaPut[2].setIntVar(5);
deltaPut[3].setIntVar(5);
deltaPut[4].setIntVar(5);
deltaPut[5].setIntVar(5);
deltaPut[2].resetDeltaStatus();
deltaPut[2].setByteArr(new byte[] { 1, 2, 3, 4, 5 });
deltaPut[3].setByteArr(new byte[] { 1, 2, 3, 4, 5 });
deltaPut[4].setByteArr(new byte[] { 1, 2, 3, 4, 5 });
deltaPut[5].setByteArr(new byte[] { 1, 2, 3, 4, 5 });
deltaPut[3].resetDeltaStatus();
deltaPut[3].setDoubleVar(new Double(5));
deltaPut[4].setDoubleVar(new Double(5));
deltaPut[5].setDoubleVar(new Double(5));
deltaPut[4].resetDeltaStatus();
deltaPut[4].setStr("str changed");
deltaPut[5].setStr("str changed");
deltaPut[5].resetDeltaStatus();
deltaPut[5].setIntVar(100);
deltaPut[5].setTestObj(new TestObject1("CHANGED", 100));
}
Aggregations