Search in sources :

Example 26 with DeltaTestImpl

use of org.apache.geode.DeltaTestImpl in project geode by apache.

the class ClientToServerDeltaDUnitTest method putWithFromDeltaERR.

/*
   * put delta with some times fromDelta fails to apply client sends back full object
   */
private static void putWithFromDeltaERR(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.setStr((String) putDelta[1]);
                break;
            case 2:
                val = new DeltaTestImpl(0, (String) putDelta[1], new Double(0), new byte[0], new TestObject1("0", 0));
                val.setIntVar(((Integer) putDelta[2]).intValue());
                break;
        }
        r.put(key, val);
    }
}
Also used : DeltaTestImpl(org.apache.geode.DeltaTestImpl) TestObject1(org.apache.geode.internal.cache.PartitionedRegionLocalMaxMemoryDUnitTest.TestObject1) LocalRegion(org.apache.geode.internal.cache.LocalRegion) Region(org.apache.geode.cache.Region)

Example 27 with DeltaTestImpl

use of org.apache.geode.DeltaTestImpl in project geode by apache.

the class DeltaPropagationWithCQDUnitTest method doPuts.

public static void doPuts(Integer num, Boolean useDelta) throws Exception {
    Region<Object, Object> region = cache.getRegion(regionName);
    for (int i = 0; i < num; i++) {
        if (useDelta) {
            DeltaTestImpl delta = new DeltaTestImpl(i, "VALUE_" + i);
            delta.setIntVar(i);
            region.put("KEY_" + i, delta);
        } else {
            region.put("KEY_" + i, i);
        }
    }
}
Also used : DeltaTestImpl(org.apache.geode.DeltaTestImpl)

Example 28 with DeltaTestImpl

use of org.apache.geode.DeltaTestImpl in project geode by apache.

the class ClientToServerDeltaDUnitTest method putDeltaForCQ.

private static void putDeltaForCQ(String key, Integer numOfPuts, Integer[] cqIndices, Boolean[] satisfyQuery) {
    Region region = cache.getRegion(REGION_NAME);
    DeltaTestImpl val = null;
    for (int j = 0; j < numOfPuts; j++) {
        val = new DeltaTestImpl(0, "0", new Double(0), new byte[0], new TestObject1("0", 0));
        for (int i = 0; i < cqIndices.length; i++) {
            switch(i) {
                case 0:
                    val.setStr("CASE_0");
                    // select *
                    break;
                case 1:
                    val.setStr("CASE_1");
                    // select where intVar = 0
                    if (satisfyQuery[i]) {
                        val.setIntVar(0);
                    } else {
                        val.setIntVar(100);
                    }
                    break;
                case 2:
                    val.setStr("CASE_2");
                    // select where intVar > 0
                    if (satisfyQuery[i]) {
                        val.setIntVar(100);
                    } else {
                        val.setIntVar(-100);
                    }
                    break;
                case 3:
                    val.setStr("CASE_3");
                    // select where intVar < 0
                    if (satisfyQuery[i]) {
                        val.setIntVar(-100);
                    } else {
                        val.setIntVar(100);
                    }
                    break;
                default:
                    break;
            }
        }
        region.put(key, val);
    }
}
Also used : DeltaTestImpl(org.apache.geode.DeltaTestImpl) TestObject1(org.apache.geode.internal.cache.PartitionedRegionLocalMaxMemoryDUnitTest.TestObject1) LocalRegion(org.apache.geode.internal.cache.LocalRegion) Region(org.apache.geode.cache.Region)

Example 29 with DeltaTestImpl

use of org.apache.geode.DeltaTestImpl in project geode by apache.

the class ClientToServerDeltaDUnitTest method put.

/*
   * put delta full cycle
   */
private static void put(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.setStr((String) putDelta[0]);
                break;
            case 2:
                val = new DeltaTestImpl(0, (String) putDelta[1], new Double(0), new byte[0], new TestObject1("0", 0));
                val.setIntVar(((Integer) putDelta[2]).intValue());
                break;
        }
        r.put(key, val);
    }
}
Also used : DeltaTestImpl(org.apache.geode.DeltaTestImpl) TestObject1(org.apache.geode.internal.cache.PartitionedRegionLocalMaxMemoryDUnitTest.TestObject1) LocalRegion(org.apache.geode.internal.cache.LocalRegion) Region(org.apache.geode.cache.Region)

Example 30 with DeltaTestImpl

use of org.apache.geode.DeltaTestImpl in project geode by apache.

the class P2PDeltaPropagationDUnitTest method putDelta.

public static void putDelta() throws Exception {
    Region r1 = cache.getRegion(Region.SEPARATOR + REGION_NAME);
    DeltaTestImpl test = new DeltaTestImpl(9999, NEW_STR);
    test.setIntVar(NEW_INT);
    r1.put("KEY", test);
}
Also used : DeltaTestImpl(org.apache.geode.DeltaTestImpl) Region(org.apache.geode.cache.Region)

Aggregations

DeltaTestImpl (org.apache.geode.DeltaTestImpl)38 Region (org.apache.geode.cache.Region)21 Test (org.junit.Test)10 TestObject1 (org.apache.geode.internal.cache.PartitionedRegionLocalMaxMemoryDUnitTest.TestObject1)9 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)9 SerializationTest (org.apache.geode.test.junit.categories.SerializationTest)9 ConflationDUnitTest (org.apache.geode.internal.cache.tier.sockets.ConflationDUnitTest)8 ClientSubscriptionTest (org.apache.geode.test.junit.categories.ClientSubscriptionTest)8 LocalRegion (org.apache.geode.internal.cache.LocalRegion)7 InvalidDeltaException (org.apache.geode.InvalidDeltaException)3 ByteArrayInputStream (java.io.ByteArrayInputStream)1 DataInput (java.io.DataInput)1 DataInputStream (java.io.DataInputStream)1 Properties (java.util.Properties)1 DataSerializable (org.apache.geode.DataSerializable)1 Delta (org.apache.geode.Delta)1 AttributesFactory (org.apache.geode.cache.AttributesFactory)1 EntryEvent (org.apache.geode.cache.EntryEvent)1 PartitionAttributesFactory (org.apache.geode.cache.PartitionAttributesFactory)1 RegionAttributes (org.apache.geode.cache.RegionAttributes)1