use of org.apache.geode.internal.cache.PartitionedRegionLocalMaxMemoryDUnitTest.TestObject1 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));
}
use of org.apache.geode.internal.cache.PartitionedRegionLocalMaxMemoryDUnitTest.TestObject1 in project geode by apache.
the class ClientToServerDeltaDUnitTest method putDelta.
/*
* put delta ; not previous deltas
*/
private static void putDelta(String key) {
Region r = cache.getRegion(REGION_NAME);
DeltaTestImpl val = null;
for (int i = 0; i < NO_PUT_OPERATION; i++) {
val = new DeltaTestImpl(0, "0", new Double(0), new byte[0], new TestObject1("0", 0));
switch(i) {
case 1:
val.setStr((String) putDelta[0]);
break;
case 2:
val.setIntVar(((Integer) putDelta[2]).intValue());
break;
}
r.put(key, val);
}
}
use of org.apache.geode.internal.cache.PartitionedRegionLocalMaxMemoryDUnitTest.TestObject1 in project geode by apache.
the class DeltaTestImpl method fromDelta.
/*
* (non-Javadoc)
*
* @see org.apache.geode.Delta#fromDelta(java.io.DataInput)
*/
public void fromDelta(DataInput in) throws IOException {
try {
fromDeltaInvokations++;
boolean tempHasDelta = false;
byte tempDeltaBits = this.deltaBits;
byte[] tempByteArr = this.byteArr;
int tempIntVar = this.intVar;
double tempDoubleVar = this.doubleVar;
String tempStr = this.str;
TestObject1 tempTestObj = this.testObj;
tempDeltaBits = DataSerializer.readByte(in);
if (tempDeltaBits != 0) {
tempHasDelta = true;
if ((tempDeltaBits & INT_MASK) == INT_MASK) {
tempIntVar = DataSerializer.readPrimitiveInt(in);
checkInvalidInt2(tempIntVar);
}
if ((tempDeltaBits & STR_MASK) == STR_MASK) {
tempStr = DataSerializer.readString(in);
// Simulates exception
checkInvalidString(tempStr);
}
if ((tempDeltaBits & DOUBLE_MASK) == DOUBLE_MASK) {
tempDoubleVar = DataSerializer.readDouble(in);
}
if ((tempDeltaBits & BYTE_ARR_MASK) == BYTE_ARR_MASK) {
tempByteArr = DataSerializer.readByteArray(in);
}
if ((tempDeltaBits & TEST_OBJ_MASK) == TEST_OBJ_MASK) {
tempTestObj = (TestObject1) DataSerializer.readObject(in);
}
if ((deltaBits | COMPLETE_MASK) != COMPLETE_MASK) {
throw new IllegalArgumentException("Unknown field code: " + tempDeltaBits);
}
}
if (tempHasDelta) {
// this.hasDelta = true;
// this.deltaBits = tempDeltaBits;
this.intVar = tempIntVar;
this.str = tempStr;
this.doubleVar = tempDoubleVar;
this.byteArr = tempByteArr;
this.testObj = tempTestObj;
}
} catch (IOException e) {
GemFireCacheImpl.getInstance().getLogger().warning("DeltaTestImpl.fromDelta(): " + e);
throw e;
} catch (IllegalArgumentException iae) {
GemFireCacheImpl.getInstance().getLogger().warning("DeltaTestImpl.fromDelta(): " + iae);
throw new InvalidDeltaException(iae);
} catch (ClassNotFoundException cnfe) {
GemFireCacheImpl.getInstance().getLogger().warning("DeltaTestImpl.fromDelta(): " + cnfe);
throw new InvalidDeltaException(cnfe);
}
}
use of org.apache.geode.internal.cache.PartitionedRegionLocalMaxMemoryDUnitTest.TestObject1 in project geode by apache.
the class DeltaPropagationDUnitTest method prepareErroneousDeltasForToDelta.
public static void prepareErroneousDeltasForToDelta() {
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(DeltaTestImpl.ERRONEOUS_INT_FOR_TO_DELTA);
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("str changed");
deltaPut[5].setIntVar(100);
deltaPut[5].setTestObj(new TestObject1("CHANGED", 100));
}
use of org.apache.geode.internal.cache.PartitionedRegionLocalMaxMemoryDUnitTest.TestObject1 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));
}
Aggregations