use of org.apache.geode.DeltaTestImpl in project geode by apache.
the class DeltaPropagationDUnitTest method prepareErroneousDeltasForFromDelta.
public static void prepareErroneousDeltasForFromDelta() {
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].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].setDoubleVar(new Double(5));
deltaPut[4].setDoubleVar(new Double(5));
deltaPut[5].setDoubleVar(new Double(5));
deltaPut[4].setStr("str changed");
deltaPut[5].setStr(DeltaTestImpl.ERRONEOUS_STRING_FOR_FROM_DELTA);
deltaPut[5].setIntVar(100);
deltaPut[5].setTestObj(new TestObject1("CHANGED", 100));
}
use of org.apache.geode.DeltaTestImpl in project geode by apache.
the class DeltaPropagationStatsDUnitTest method putErrorDeltaForSender.
public static void putErrorDeltaForSender(Integer keys, Long updates, Long errors, Boolean doCreate) {
Region r = cache.getRegion(REGION_NAME);
assertTrue("Errors cannot be more than 1/3rd of total updates", (keys * updates) / 3 > errors);
if (doCreate) {
for (int i = 0; i < keys; i++) {
r.create(DELTA_KEY + i, new DeltaTestImpl());
}
}
for (int i = 0; i < keys; i++) {
for (long j = 0; j < updates; j++) {
DeltaTestImpl delta = new DeltaTestImpl();
if (j % 3 == 1) {
delta.setStr("one");
} else if (j % 3 == 2) {
delta.setIntVar(111);
if (errors != 0) {
delta.setIntVar(DeltaTestImpl.ERRONEOUS_INT_FOR_TO_DELTA);
errors--;
}
} else {
delta.setByteArr(new byte[] { 11, 22, 33, 44 });
delta.setDoubleVar(5.7);
}
try {
r.put(DELTA_KEY + i, delta);
assertTrue("Expected an InvalidDeltaException to be thrown, but it wasn't!", delta.getIntVar() != DeltaTestImpl.ERRONEOUS_INT_FOR_TO_DELTA);
} catch (InvalidDeltaException ide) {
assertTrue("InvalidDeltaException not expected.", delta.getIntVar() == DeltaTestImpl.ERRONEOUS_INT_FOR_TO_DELTA);
cache.getLoggerI18n().fine("Recieved InvalidDeltaException as expected.");
}
}
}
assertTrue("Error puts not exhausted", errors == 0);
}
use of org.apache.geode.DeltaTestImpl in project geode by apache.
the class DeltaPropagationDUnitTest method doPuts.
public static void doPuts(Integer num) {
try {
Region r = cache.getRegion("/" + regionName);
assertNotNull(r);
for (int i = 0; i < num; i++) {
DeltaTestImpl val = new DeltaTestImpl();
val.setStr("" + i);
r.put(DELTA_KEY, val);
}
r.put(LAST_KEY, "");
} catch (Exception ex) {
org.apache.geode.test.dunit.Assert.fail("failed in createDelta()", ex);
}
}
Aggregations