use of org.apache.geode.DeltaTestImpl in project geode by apache.
the class PRDeltaPropagationDUnitTest method testDeltaPropagationClientEmptyPRAccessorAsBridgeServerWithDeltaException.
/**
* 1) Put delta objects on client feeder with data policy as empty, connected PR accessor bridge
* server. 2) From accessor to data store delta gets propagated as part of <code>PutMessage</code>
* delta. 3) Exception occurs when applying delta on datastore node. This invalid delta exception
* propagated back to client through accessor. 4) Client sends full object in response.
*/
@Test
public void testDeltaPropagationClientEmptyPRAccessorAsBridgeServerWithDeltaException() throws Exception {
Object[] args1 = new Object[] { REGION_NAME, new Integer(0), new Integer(0), new Integer(8), Boolean.FALSE, null };
Object[] args2 = new Object[] { REGION_NAME, new Integer(0), new Integer(50), new Integer(8), Boolean.FALSE, null };
Integer port2 = (Integer) dataStore2.invoke(PRDeltaPropagationDUnitTest.class, "createCacheServerWithPR", args2);
Integer port1 = (Integer) dataStore1.invoke(PRDeltaPropagationDUnitTest.class, "createCacheServerWithPR", args1);
createClientCache(port1, new Boolean(false), new Boolean(true), new Boolean(false));
client1.invoke(() -> PRDeltaPropagationDUnitTest.createClientCache(port2, new Boolean(true), new Boolean(false), new Boolean(false)));
// feed delta
DeltaTestImpl test = new DeltaTestImpl();
deltaPR.put(DELTA_KEY, test);
test.setIntVar(10);
deltaPR.put(DELTA_KEY, test);
// perform invalidate on accessor
dataStore2.invoke(() -> PRDeltaPropagationDUnitTest.invalidateDeltaKey());
test = new DeltaTestImpl();
test.setStr("DELTA");
deltaPR.put(DELTA_KEY, test);
deltaPR.put(LAST_KEY, "");
checkToDeltaCounter(new Integer(2));
client1.invoke(() -> PRDeltaPropagationDUnitTest.waitForLastKey());
client1.invoke(() -> PRDeltaPropagationDUnitTest.checkForFullObject());
}
use of org.apache.geode.DeltaTestImpl in project geode by apache.
the class PRDeltaPropagationDUnitTest method testClientOnAccessorReceivesCqEvents.
/**
* Topology: PR: Accessor, dataStore. client and client1 connected to PR accessor; client puts
* delta objects on dataStore via accessor Accessor gets adjunctMessage about put Verify on
* client1 that queryUpdate and queryDestroy are executed properly
*/
@Test
public void testClientOnAccessorReceivesCqEvents() throws Exception {
Object[] args1 = new Object[] { REGION_NAME, new Integer(1), new Integer(0), new Integer(8), Boolean.FALSE, null };
Object[] args2 = new Object[] { REGION_NAME, new Integer(1), new Integer(50), new Integer(8), Boolean.FALSE, null };
dataStore2.invoke(PRDeltaPropagationDUnitTest.class, "createCacheServerWithPR", args2);
Integer port1 = (Integer) dataStore1.invoke(PRDeltaPropagationDUnitTest.class, "createCacheServerWithPR", args1);
// both clients are attached to accessor
createClientCache(port1, new Boolean(false), new Boolean(true), new Boolean(false));
// no register interest but register cq
client1.invoke(() -> PRDeltaPropagationDUnitTest.createClientCache(port1, new Boolean(false), new Boolean(false), new Boolean(true)));
// feed delta
// This delta obj satisfies CQ
DeltaTestImpl test = new DeltaTestImpl(8, "");
deltaPR.put(DELTA_KEY, test);
// newValue does not satisfy CQ while oldValue does
test.setIntVar(10);
deltaPR.put(DELTA_KEY, test);
deltaPR.put(LAST_KEY, new DeltaTestImpl(8, ""));
client1.invoke(() -> PRDeltaPropagationDUnitTest.waitForLastKey());
boolean flag = ((Boolean) client1.invoke(() -> PRDeltaPropagationDUnitTest.verifyQueryUpdateExecuted())).booleanValue();
assertTrue("client update cq not executed properly", flag);
flag = ((Boolean) client1.invoke(() -> PRDeltaPropagationDUnitTest.verifyQueryDestroyExecuted())).booleanValue();
assertTrue("client destroy cq not executed properly", flag);
}
use of org.apache.geode.DeltaTestImpl in project geode by apache.
the class PRDeltaPropagationDUnitTest method putWithExpiry.
public static void putWithExpiry() throws Exception {
DeltaTestImpl test = new DeltaTestImpl();
deltaPR.put(DELTA_KEY, test);
test.setIntVar(10);
deltaPR.put(DELTA_KEY, test);
Thread.sleep(2000);
test = new DeltaTestImpl();
test.setStr("DELTA");
deltaPR.put(DELTA_KEY, test);
}
use of org.apache.geode.DeltaTestImpl in project geode by apache.
the class PRDeltaPropagationDUnitTest method testCQClientOnRedundantBucketReceivesCQEvents.
/**
* Toplogy: PR: Accessor,DataStore,Bridge server; configured for 2 buckets and redundancy 1
* DataStore has primary while BridgeServer has secondary of bucket. client connects to PR
* Accessor client1 connects to PR BridgeServer client1 registers CQ client puts delta objects on
* accessor Verify on client1 that queryUpdate and queryDestroy are executed properly
*/
@Test
public void testCQClientOnRedundantBucketReceivesCQEvents() throws Exception {
// args for accessor
Object[] args1 = new Object[] { REGION_NAME, new Integer(1), new Integer(0), new Integer(2), Boolean.FALSE, null };
// args for dataStore with 2 buckets
Object[] args2 = new Object[] { REGION_NAME, new Integer(1), new Integer(50), new Integer(2), Boolean.FALSE, null };
// dataStore2 is DataStore
// implicit put of DELTA_KEY creates primary bucket on dataStore2
dataStore2.invoke(PRDeltaPropagationDUnitTest.class, "createCacheServerWithPR", args2);
// dataStore3 is BridgeServer
// this has secondary bucket
Integer port3 = (Integer) dataStore3.invoke(PRDeltaPropagationDUnitTest.class, "createCacheServerWithPR", args2);
// dataStore1 is accessor
Integer port1 = (Integer) dataStore1.invoke(PRDeltaPropagationDUnitTest.class, "createCacheServerWithPR", args1);
// this client is attached to accessor - (port1)
createClientCache(port1, new Boolean(false), new Boolean(true), new Boolean(false));
// client1 is attached to BridgeServer dataStore3
// client1 does not registerInterest but registers cq
client1.invoke(() -> PRDeltaPropagationDUnitTest.createClientCache(port3, new Boolean(false), new Boolean(false), new Boolean(true)));
// create delta keys (1 primary 1 redundant bucket on each dataStore)
DeltaTestImpl test = new DeltaTestImpl(8, "");
deltaPR.put(DELTA_KEY, test);
test.setIntVar(10);
deltaPR.put(DELTA_KEY, test);
deltaPR.put(LAST_KEY, new DeltaTestImpl(8, ""));
client1.invoke(() -> PRDeltaPropagationDUnitTest.waitForLastKey());
// verify no delta is sent by server to client1
dataStore3.invoke(() -> PRDeltaPropagationDUnitTest.verifyDeltaSent(Integer.valueOf(1)));
boolean flag = ((Boolean) client1.invoke(() -> PRDeltaPropagationDUnitTest.verifyQueryUpdateExecuted())).booleanValue();
assertTrue("client update cq not executed properly", flag);
flag = ((Boolean) client1.invoke(() -> PRDeltaPropagationDUnitTest.verifyQueryDestroyExecuted())).booleanValue();
assertTrue("client destroy cq not executed properly", flag);
}
use of org.apache.geode.DeltaTestImpl in project geode by apache.
the class ClientToServerDeltaDUnitTest method putWithTODeltaERR.
/*
* put delta with some times toDelta fails to apply; client sends back full object
*/
private static void putWithTODeltaERR(String key) {
Region r = cache.getRegion(REGION_NAME);
DeltaTestImpl val = null;
for (int i = 0; i < NO_PUT_OPERATION; i++) {
switch(i) {
case 0:
val = new DeltaTestImpl(0, "0", new Double(0), new byte[0], new TestObject1("0", 0));
break;
case 1:
val = new DeltaTestImpl(0, "0", new Double(0), new byte[0], new TestObject1("0", 0));
val.setIntVar(((Integer) putDelta[3]).intValue());
break;
case 2:
val = new DeltaTestImpl(((Integer) putDelta[3]).intValue(), "0", new Double(0), new byte[0], new TestObject1("0", 0));
val.setStr((String) putDelta[0]);
break;
}
r.put(key, val);
}
}
Aggregations