Search in sources :

Example 1 with NestedGroupObject

use of com.hazelcast.internal.serialization.impl.compact.reader.CompactValueReaderTestStructure.NestedGroupObject in project hazelcast by hazelcast.

the class CompactStreamSerializerValueReaderSpecTest method fromObjectArrayToObjectArrayToPrimitiveArrayAnyScenarios.

// ----------------------------------------------------------------------------------------------------------
// from PORTABLE_ARRAY[any] via PORTABLE_ARRAY[any] to further PRIMITIVE_ARRAY[any] access
// ----------------------------------------------------------------------------------------------------------
private static void fromObjectArrayToObjectArrayToPrimitiveArrayAnyScenarios(List<Object[]> result) {
    String method = "fromObjectArrayToObjectArrayToPrimitiveArrayAnyScenarios";
    String p = method + " mixed";
    // =============================================
    // INPUT mixed
    // =============================================
    NestedGroupObject input = nested(new GroupObject[] { new GroupObject(new PrimitiveObject[0]), group(prim(1, NONE), prim(10, FULL), prim(50, NULL)), new GroupObject((PrimitiveObject[]) null), group(prim(20, FULL), prim(70, NULL)) });
    PrimitiveObject p10 = prim(10, FULL);
    PrimitiveObject p20 = prim(20, FULL);
    result.addAll(asList(scenario(input, list(null, p10.bytes, p20.bytes), "objects[any].objects[any].bytes[any]", p), scenario(input, list(null, p10.shorts, p20.shorts), "objects[any].objects[any].shorts[any]", p), scenario(input, list(null, p10.ints, p20.ints), "objects[any].objects[any].ints[any]", p), scenario(input, list(null, p10.longs, p20.longs), "objects[any].objects[any].longs[any]", p), scenario(input, list(null, p10.floats, p20.floats), "objects[any].objects[any].floats[any]", p), scenario(input, list(null, p10.doubles, p20.doubles), "objects[any].objects[any].doubles[any]", p), scenario(input, list(null, p10.booleans, p20.booleans), "objects[any].objects[any].booleans[any]", p), scenario(input, list(null, p10.strings, p20.strings), "objects[any].objects[any].strings[any]", p)));
    // =============================================
    // INPUT empty
    // =============================================
    p = method + " empty";
    NestedGroupObject inputEmpty = nested(new GroupObject[0]);
    result.addAll(asList(scenario(inputEmpty, null, "objects[any].objects[any].bytes[any]", p), scenario(inputEmpty, null, "objects[any].objects[any].shorts[any]", p), scenario(inputEmpty, null, "objects[any].objects[any].ints[any]", p), scenario(inputEmpty, null, "objects[any].objects[any].longs[any]", p), scenario(inputEmpty, null, "objects[any].objects[any].floats[any]", p), scenario(inputEmpty, null, "objects[any].objects[any].doubles[any]", p), scenario(inputEmpty, null, "objects[any].objects[any].booleans[any]", p), scenario(inputEmpty, null, "objects[any].objects[any].strings[any]", p)));
    // =============================================
    // INPUT null
    // =============================================
    p = method + " null";
    NestedGroupObject inputNull = nested((GroupObject[]) null);
    result.addAll(asList(scenario(inputNull, null, "objects[any].objects[any].bytes[any]", p), scenario(inputNull, null, "objects[any].objects[any].shorts[any]", p), scenario(inputNull, null, "objects[any].objects[any].ints[any]", p), scenario(inputNull, null, "objects[any].objects[any].longs[any]", p), scenario(inputNull, null, "objects[any].objects[any].floats[any]", p), scenario(inputNull, null, "objects[any].objects[any].doubles[any]", p), scenario(inputNull, null, "objects[any].objects[any].booleans[any]", p), scenario(inputNull, null, "objects[any].objects[any].strings[any]", p)));
}
Also used : PrimitiveObject(com.hazelcast.internal.serialization.impl.compact.reader.CompactValueReaderTestStructure.PrimitiveObject) GroupObject(com.hazelcast.internal.serialization.impl.compact.reader.CompactValueReaderTestStructure.GroupObject) NestedGroupObject(com.hazelcast.internal.serialization.impl.compact.reader.CompactValueReaderTestStructure.NestedGroupObject) NestedGroupObject(com.hazelcast.internal.serialization.impl.compact.reader.CompactValueReaderTestStructure.NestedGroupObject)

Example 2 with NestedGroupObject

use of com.hazelcast.internal.serialization.impl.compact.reader.CompactValueReaderTestStructure.NestedGroupObject in project hazelcast by hazelcast.

the class CompactStreamSerializerValueReaderSpecTest method fromObjectArrayToObjectArrayToPrimitiveScenarios.

// ----------------------------------------------------------------------------------------------------------
// from PORTABLE_ARRAY to PORTABLE_ARRAY access + further
// ----------------------------------------------------------------------------------------------------------
private static void fromObjectArrayToObjectArrayToPrimitiveScenarios(List<Object[]> result) {
    String p = "fromObjectArrayToObjectArrayToPrimitiveScenarios";
    // FULLy initialised primitive objects accessed from object stored in array
    NestedGroupObject nestedFullGroup = nested(group(prim(1, FULL), prim(10, FULL), prim(100, FULL)));
    result.addAll(asList(scenario(nestedFullGroup, ((GroupObject) (nestedFullGroup.objects[0])).objects, "objects[0].objects", p), scenario(nestedFullGroup, ((GroupObject) (nestedFullGroup.objects[0])).objects, "objects[0].objects[any]", p), scenario(nestedFullGroup, prim(1, FULL), "objects[any].objects[0]", p), scenario(nestedFullGroup, ((GroupObject) (nestedFullGroup.objects[0])).objects, "objects[any].objects[any]", p), scenario(nestedFullGroup, ((GroupObject) (nestedFullGroup.objects[0])).objects[0], "objects[0].objects[0]", p), scenario(nestedFullGroup, ((GroupObject) (nestedFullGroup.objects[0])).objects[1], "objects[0].objects[1]", p), scenario(nestedFullGroup, ((GroupObject) (nestedFullGroup.objects[0])).objects[2], "objects[0].objects[2]", p), scenario(nestedFullGroup, null, "objects[0].objects[12]", p)));
    result.addAll(expandObjectArrayPrimitiveScenario(nestedFullGroup, (GroupObject) nestedFullGroup.object, "objects[0].objectArray.primitive_", p));
    NestedGroupObject anyGroup = nested(new GroupObject[] { group(NULL), group(NONE), group(prim(1, FULL), prim(10, NONE), prim(50, NULL)), group(prim(2, FULL), prim(20, NONE), prim(80, NULL)) });
    result.addAll(expandObjectArrayPrimitiveScenario(anyGroup, (GroupObject) anyGroup.objects[0], "objects[0].objectArray.primitive_", p));
    // empty or null object array de-referenced further
    NestedGroupObject nestedNullArrayGroup = nested(new GroupObject((PrimitiveObject[]) null));
    result.addAll(asList(scenario(nestedNullArrayGroup, null, "objects[0].objects", p), scenario(nestedNullArrayGroup, null, "objects[0].objects[any]", p), scenario(nestedNullArrayGroup, null, "objects[any].objects[0]", p), scenario(nestedNullArrayGroup, null, "objects[any].objects[any]", p), scenario(nestedNullArrayGroup, null, "objects[0].objects[0]", p), scenario(nestedNullArrayGroup, null, "objects[0].objects[1]", p), scenario(nestedNullArrayGroup, null, "objects[0].objects[2]", p)));
    result.addAll(expandObjectArrayPrimitiveScenario(nestedNullArrayGroup, (GroupObject) nestedNullArrayGroup.object, "objects[0].objectArray.primitive_", p));
    NestedGroupObject nestedEmptyArrayGroup = nested(new GroupObject(new PrimitiveObject[0]));
    result.addAll(asList(scenario(nestedEmptyArrayGroup, new PrimitiveObject[0], "objects[0].objects", p), scenario(nestedEmptyArrayGroup, null, "objects[0].objects[any]", p), scenario(nestedEmptyArrayGroup, null, "objects[any].objects[0]", p), scenario(nestedEmptyArrayGroup, null, "objects[any].objects[any]", p), scenario(nestedEmptyArrayGroup, null, "objects[0].objects[0]", p), scenario(nestedEmptyArrayGroup, null, "objects[0].objects[1]", p), scenario(nestedEmptyArrayGroup, null, "objects[0].objects[2]", p)));
    result.addAll(expandObjectArrayPrimitiveScenario(nestedEmptyArrayGroup, (GroupObject) nestedEmptyArrayGroup.object, "objects[0].objectArray.primitive_", p));
    NestedGroupObject nestedEmpty = nested(new GroupObject[0]);
    result.addAll(asList(scenario(nestedEmpty, null, "objects[0].objects", p), scenario(nestedEmpty, null, "objects[0].objects[any]", p), scenario(nestedEmpty, null, "objects[any].objects[0]", p), scenario(nestedEmpty, null, "objects[any].objects[any]", p), scenario(nestedEmpty, null, "objects[0].objects[0]", p), scenario(nestedEmpty, null, "objects[0].objects[1]", p), scenario(nestedEmpty, null, "objects[0].objects[2]", p)));
    result.addAll(expandObjectArrayPrimitiveScenario(nestedEmpty, (GroupObject) nestedEmpty.object, "objects[0].objectArray.primitive_", p));
    NestedGroupObject nestedNull = nested((GroupObject[]) null);
    result.addAll(asList(scenario(nestedNull, null, "objects[0].objects", p), scenario(nestedNull, null, "objects[0].objects[any]", p), scenario(nestedNull, null, "objects[any].objects[0]", p), scenario(nestedNull, null, "objects[any].objects[any]", p), scenario(nestedNull, null, "objects[0].objects[0]", p), scenario(nestedNull, null, "objects[0].objects[1]", p), scenario(nestedNull, null, "objects[0].objects[2]", p)));
    result.addAll(expandObjectArrayPrimitiveScenario(nestedNull, (GroupObject) nestedNull.object, "objects[0].objectArray.primitive_", p));
}
Also used : PrimitiveObject(com.hazelcast.internal.serialization.impl.compact.reader.CompactValueReaderTestStructure.PrimitiveObject) GroupObject(com.hazelcast.internal.serialization.impl.compact.reader.CompactValueReaderTestStructure.GroupObject) NestedGroupObject(com.hazelcast.internal.serialization.impl.compact.reader.CompactValueReaderTestStructure.NestedGroupObject) NestedGroupObject(com.hazelcast.internal.serialization.impl.compact.reader.CompactValueReaderTestStructure.NestedGroupObject)

Example 3 with NestedGroupObject

use of com.hazelcast.internal.serialization.impl.compact.reader.CompactValueReaderTestStructure.NestedGroupObject in project hazelcast by hazelcast.

the class CompactStreamSerializerValueReaderSpecTest method fromObjectToObjectToPrimitiveScenarios.

// ----------------------------------------------------------------------------------------------------------
// from PORTABLE via PORTABLE to further access
// ----------------------------------------------------------------------------------------------------------
private static void fromObjectToObjectToPrimitiveScenarios(List<Object[]> result) {
    String p = "fromObjectToObjectToPrimitiveScenarios";
    // FULLy initialised primitive objects accessed from object stored in array
    NestedGroupObject nestedFullGroup = nested(group(prim(1, FULL), prim(10, FULL), prim(100, FULL)));
    result.addAll(asList(scenario(nestedFullGroup, (nestedFullGroup.object), "object", p), scenario(nestedFullGroup, ((GroupObject) (nestedFullGroup.object)).object, "object.object", p)));
    result.addAll(expandPrimitiveScenario(nestedFullGroup, ((GroupObject) nestedFullGroup.object).object, "object.object.primitive_", p));
    result.addAll(expandPrimitiveArrayScenario(nestedFullGroup, (PrimitiveObject) ((GroupObject) nestedFullGroup.object).object, "object.object.primitiveArray", p));
    NestedGroupObject nestedFullEmptyNullGroup = nested(group(prim(1, FULL), prim(10, NONE), prim(100, NULL)));
    result.addAll(expandPrimitiveScenario(nestedFullEmptyNullGroup, ((GroupObject) nestedFullEmptyNullGroup.object).object, "object.object.primitive_", p));
    result.addAll(expandPrimitiveArrayScenario(nestedFullEmptyNullGroup, (PrimitiveObject) ((GroupObject) nestedFullEmptyNullGroup.object).object, "object.object.primitiveArray", p));
    // empty or null object array de-referenced further
    NestedGroupObject nestedNullArrayGroup = nested(new GroupObject((PrimitiveObject[]) null));
    result.addAll(asList(scenario(nestedNullArrayGroup, (nestedNullArrayGroup.object), "object", p), scenario(nestedNullArrayGroup, null, "object.object", p)));
    result.addAll(expandPrimitiveScenario(nestedNullArrayGroup, null, "object.object.primitive_", p));
    result.addAll(expandPrimitiveArrayScenario(nestedNullArrayGroup, null, "object.object.primitiveArray", p));
    NestedGroupObject nestedNull = nested(new GroupObject[0]);
    result.addAll(asList(scenario(nestedNull, null, "object", p), scenario(nestedNull, null, "object.object", p)));
    result.addAll(expandPrimitiveScenario(nestedNull, null, "object.object.primitive_", p));
    result.addAll(expandPrimitiveArrayScenario(nestedNull, null, "object.object.primitiveArray", p));
}
Also used : PrimitiveObject(com.hazelcast.internal.serialization.impl.compact.reader.CompactValueReaderTestStructure.PrimitiveObject) GroupObject(com.hazelcast.internal.serialization.impl.compact.reader.CompactValueReaderTestStructure.GroupObject) NestedGroupObject(com.hazelcast.internal.serialization.impl.compact.reader.CompactValueReaderTestStructure.NestedGroupObject) NestedGroupObject(com.hazelcast.internal.serialization.impl.compact.reader.CompactValueReaderTestStructure.NestedGroupObject)

Example 4 with NestedGroupObject

use of com.hazelcast.internal.serialization.impl.compact.reader.CompactValueReaderTestStructure.NestedGroupObject in project hazelcast by hazelcast.

the class CompactStreamSerializerValueReaderSpecTest method fromObjectArrayToObjectArrayAnyScenarios.

// ----------------------------------------------------------------------------------------------------------
// from PORTABLE_ARRAY to PORTABLE_ARRAY access + further
// ----------------------------------------------------------------------------------------------------------
private static void fromObjectArrayToObjectArrayAnyScenarios(List<Object[]> result) {
    String p = "fromObjectArrayToObjectArrayAnyScenarios";
    NestedGroupObject anyGroup = nested(new GroupObject[] { group(prim(1, FULL), prim(10, NONE), prim(50, NULL)), group(prim(2, FULL), prim(20, NONE), prim(80, NULL)) });
    result.addAll(asList(scenario(anyGroup, ((GroupObject) (anyGroup.objects[0])).objects, "objects[0].objects[any]", p), scenario(anyGroup, new PrimitiveObject[] { prim(1, FULL), prim(2, FULL) }, "objects[any].objects[0]", p), scenario(anyGroup, new PrimitiveObject[] { prim(10, FULL), prim(20, FULL) }, "objects[any].objects[1]", p), scenario(anyGroup, new PrimitiveObject[] { prim(50, FULL), prim(80, FULL) }, "objects[any].objects[2]", p), scenario(anyGroup, new PrimitiveObject[] { prim(1, FULL), prim(10, FULL), prim(50, FULL), prim(2, FULL), prim(20, FULL), prim(80, FULL) }, "objects[any].objects[any]", p)));
    NestedGroupObject nestedEmptyArrayGroup = nested(new GroupObject[] { new GroupObject(new PrimitiveObject[0]), group(prim(1, FULL), prim(10, NONE), prim(50, NULL)) });
    result.addAll(asList(scenario(nestedEmptyArrayGroup, null, "objects[0].objects[any]", p), scenario(nestedEmptyArrayGroup, new PrimitiveObject[] { null, prim(1, FULL) }, "objects[any].objects[0]", p), scenario(nestedEmptyArrayGroup, new PrimitiveObject[] { null, prim(10, FULL) }, "objects[any].objects[1]", p), scenario(nestedEmptyArrayGroup, new PrimitiveObject[] { null, prim(50, FULL) }, "objects[any].objects[2]", p), scenario(nestedEmptyArrayGroup, new PrimitiveObject[] { null, prim(1, FULL), prim(10, FULL), prim(50, FULL) }, "objects[any].objects[any]", p)));
    NestedGroupObject nestedNullArrayGroup = nested(new GroupObject[] { new GroupObject((PrimitiveObject[]) null), group(prim(1, FULL), prim(10, NONE), prim(50, NULL)) });
    result.addAll(asList(scenario(nestedNullArrayGroup, null, "objects[0].objects[any]", p), scenario(nestedNullArrayGroup, new PrimitiveObject[] { null, prim(1, FULL) }, "objects[any].objects[0]", p), scenario(nestedNullArrayGroup, new PrimitiveObject[] { null, prim(10, FULL) }, "objects[any].objects[1]", p), scenario(nestedNullArrayGroup, new PrimitiveObject[] { null, prim(50, FULL) }, "objects[any].objects[2]", p), scenario(nestedNullArrayGroup, new PrimitiveObject[] { null, prim(1, FULL), prim(10, FULL), prim(50, FULL) }, "objects[any].objects[any]", p)));
}
Also used : PrimitiveObject(com.hazelcast.internal.serialization.impl.compact.reader.CompactValueReaderTestStructure.PrimitiveObject) GroupObject(com.hazelcast.internal.serialization.impl.compact.reader.CompactValueReaderTestStructure.GroupObject) NestedGroupObject(com.hazelcast.internal.serialization.impl.compact.reader.CompactValueReaderTestStructure.NestedGroupObject) NestedGroupObject(com.hazelcast.internal.serialization.impl.compact.reader.CompactValueReaderTestStructure.NestedGroupObject)

Example 5 with NestedGroupObject

use of com.hazelcast.internal.serialization.impl.compact.reader.CompactValueReaderTestStructure.NestedGroupObject in project hazelcast by hazelcast.

the class CompactStreamSerializerValueReaderSpecTest method fromObjectToObjectArrayToPrimitiveScenarios.

// ----------------------------------------------------------------------------------------------------------
// from PORTABLE via PORTABLE_ARRAY to further access
// ----------------------------------------------------------------------------------------------------------
private static void fromObjectToObjectArrayToPrimitiveScenarios(List<Object[]> result) {
    // FULLy initialised primitive objects accessed from object stored in array
    String p = "fromObjectToObjectToPrimitiveScenarios";
    NestedGroupObject nestedFullGroup = nested(group(prim(1, FULL), prim(10, FULL), prim(100, FULL)));
    result.addAll(asList(scenario(nestedFullGroup, ((GroupObject) (nestedFullGroup.object)).objects, "object.objects", p), scenario(nestedFullGroup, ((GroupObject) (nestedFullGroup.object)).objects, "object.objects[any]", p), scenario(nestedFullGroup, ((GroupObject) (nestedFullGroup.object)).objects[0], "object.objects[0]", p), scenario(nestedFullGroup, ((GroupObject) (nestedFullGroup.object)).objects[1], "object.objects[1]", p), scenario(nestedFullGroup, ((GroupObject) (nestedFullGroup.object)).objects[2], "object.objects[2]", p), scenario(nestedFullGroup, null, "object.objects[12]", p)));
    result.addAll(expandObjectArrayPrimitiveScenario(nestedFullGroup, (GroupObject) nestedFullGroup.object, "object.objectArray.primitive_", p));
    NestedGroupObject nestedFullEmptyNullGroup = nested(group(prim(1, FULL), prim(10, NONE), prim(100, NULL)));
    result.addAll(expandObjectArrayPrimitiveScenario(nestedFullEmptyNullGroup, (GroupObject) nestedFullEmptyNullGroup.object, "object.objectArray.primitive_", p));
    // empty or null object array de-referenced further
    NestedGroupObject nestedNullArrayGroup = nested(new GroupObject((PrimitiveObject[]) null));
    result.addAll(asList(scenario(nestedNullArrayGroup, null, "object.objects", p), scenario(nestedNullArrayGroup, null, "object.objects[any]", p), scenario(nestedNullArrayGroup, null, "object.objects[0]", p), scenario(nestedNullArrayGroup, null, "object.objects[1]", p), scenario(nestedNullArrayGroup, null, "object.objects[2]", p)));
    result.addAll(expandObjectArrayPrimitiveScenario(nestedNullArrayGroup, (GroupObject) nestedNullArrayGroup.object, "object.objectArray.primitive_", p));
    NestedGroupObject nestedEmptyArrayGroup = nested(new GroupObject(new PrimitiveObject[0]));
    result.addAll(asList(scenario(nestedEmptyArrayGroup, new PrimitiveObject[0], "object.objects", p), scenario(nestedEmptyArrayGroup, null, "object.objects[any]", p), scenario(nestedEmptyArrayGroup, null, "object.objects[0]", p), scenario(nestedEmptyArrayGroup, null, "object.objects[1]", p), scenario(nestedEmptyArrayGroup, null, "object.objects[2]", p)));
    result.addAll(expandObjectArrayPrimitiveScenario(nestedEmptyArrayGroup, (GroupObject) nestedEmptyArrayGroup.object, "object.objectArray.primitive_", p));
    NestedGroupObject nestedEmpty = nested(new GroupObject[0]);
    result.addAll(asList(scenario(nestedEmpty, null, "object.objects", p), scenario(nestedEmpty, null, "object.objects[any]", p), scenario(nestedEmpty, null, "object.objects[0]", p), scenario(nestedEmpty, null, "object.objects[1]", p), scenario(nestedEmpty, null, "object.objects[2]", p)));
    result.addAll(expandObjectArrayPrimitiveScenario(nestedEmpty, (GroupObject) nestedEmpty.object, "object.objectArray.primitive_", p));
    NestedGroupObject nestedNull = nested((GroupObject[]) null);
    result.addAll(asList(scenario(nestedNull, null, "object.objects", p), scenario(nestedNull, null, "object.objects[any]", p), scenario(nestedNull, null, "object.objects[0]", p), scenario(nestedNull, null, "object.objects[1]", p), scenario(nestedNull, null, "object.objects[2]", p)));
    result.addAll(expandObjectArrayPrimitiveScenario(nestedNull, (GroupObject) nestedNull.object, "object.objectArray.primitive_", p));
}
Also used : PrimitiveObject(com.hazelcast.internal.serialization.impl.compact.reader.CompactValueReaderTestStructure.PrimitiveObject) GroupObject(com.hazelcast.internal.serialization.impl.compact.reader.CompactValueReaderTestStructure.GroupObject) NestedGroupObject(com.hazelcast.internal.serialization.impl.compact.reader.CompactValueReaderTestStructure.NestedGroupObject) NestedGroupObject(com.hazelcast.internal.serialization.impl.compact.reader.CompactValueReaderTestStructure.NestedGroupObject)

Aggregations

GroupObject (com.hazelcast.internal.serialization.impl.compact.reader.CompactValueReaderTestStructure.GroupObject)6 NestedGroupObject (com.hazelcast.internal.serialization.impl.compact.reader.CompactValueReaderTestStructure.NestedGroupObject)6 PrimitiveObject (com.hazelcast.internal.serialization.impl.compact.reader.CompactValueReaderTestStructure.PrimitiveObject)6