Search in sources :

Example 1 with NestedGroupPortable

use of com.hazelcast.internal.serialization.impl.portable.portablereader.DefaultPortableReaderTestStructure.NestedGroupPortable in project hazelcast by hazelcast.

the class DefaultPortableReaderSpecTest method fromPortableToPortableToPrimitiveScenarios.

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

Example 2 with NestedGroupPortable

use of com.hazelcast.internal.serialization.impl.portable.portablereader.DefaultPortableReaderTestStructure.NestedGroupPortable in project hazelcast by hazelcast.

the class DefaultPortableReaderSpecTest method fromPortableArrayToPortableArrayToPrimitiveScenarios.

// ----------------------------------------------------------------------------------------------------------
// from PORTABLE_ARRAY to PORTABLE_ARRAY access + further
// ----------------------------------------------------------------------------------------------------------
private static void fromPortableArrayToPortableArrayToPrimitiveScenarios(List<Object[]> result) {
    String p = "fromPortableArrayToPortableArrayToPrimitiveScenarios";
    // FULLy initialised primitive objects accessed from portable stored in array
    NestedGroupPortable nestedFullGroup = nested(group(prim(1, FULL), prim(10, FULL), prim(100, FULL)));
    result.addAll(asList(scenario(nestedFullGroup, ((GroupPortable) (nestedFullGroup.portables[0])).portables, "portables[0].portables", p), scenario(nestedFullGroup, ((GroupPortable) (nestedFullGroup.portables[0])).portables, "portables[0].portables[any]", p), scenario(nestedFullGroup, prim(1, FULL), "portables[any].portables[0]", p), scenario(nestedFullGroup, ((GroupPortable) (nestedFullGroup.portables[0])).portables, "portables[any].portables[any]", p), scenario(nestedFullGroup, ((GroupPortable) (nestedFullGroup.portables[0])).portables[0], "portables[0].portables[0]", p), scenario(nestedFullGroup, ((GroupPortable) (nestedFullGroup.portables[0])).portables[1], "portables[0].portables[1]", p), scenario(nestedFullGroup, ((GroupPortable) (nestedFullGroup.portables[0])).portables[2], "portables[0].portables[2]", p), scenario(nestedFullGroup, null, "portables[0].portables[12]", p)));
    result.addAll(expandPortableArrayPrimitiveScenario(nestedFullGroup, (GroupPortable) nestedFullGroup.portable, "portables[0].portableArray.primitive_", p));
    NestedGroupPortable anyGroup = nested(new Portable[] { group(prim(1, FULL), prim(10, NONE), prim(50, NULL)), group(prim(2, FULL), prim(20, NONE), prim(80, NULL)) });
    result.addAll(expandPortableArrayPrimitiveScenario(anyGroup, (GroupPortable) anyGroup.portables[0], "portables[0].portableArray.primitive_", p));
    // empty or null portable array de-referenced further
    NestedGroupPortable nestedNullArrayGroup = nested(new GroupPortable((Portable[]) null));
    result.addAll(asList(scenario(nestedNullArrayGroup, null, "portables[0].portables", p), scenario(nestedNullArrayGroup, null, "portables[0].portables[any]", p), scenario(nestedNullArrayGroup, null, "portables[any].portables[0]", p), scenario(nestedNullArrayGroup, null, "portables[any].portables[any]", p), scenario(nestedNullArrayGroup, null, "portables[0].portables[0]", p), scenario(nestedNullArrayGroup, null, "portables[0].portables[1]", p), scenario(nestedNullArrayGroup, null, "portables[0].portables[2]", p)));
    result.addAll(expandPortableArrayPrimitiveScenario(nestedNullArrayGroup, (GroupPortable) nestedNullArrayGroup.portable, "portables[0].portableArray.primitive_", p));
    NestedGroupPortable nestedEmptyArrayGroup = nested(new GroupPortable(new Portable[0]));
    result.addAll(asList(scenario(nestedEmptyArrayGroup, new Portable[0], "portables[0].portables", p), scenario(nestedEmptyArrayGroup, null, "portables[0].portables[any]", p), scenario(nestedEmptyArrayGroup, null, "portables[any].portables[0]", p), scenario(nestedEmptyArrayGroup, null, "portables[any].portables[any]", p), scenario(nestedEmptyArrayGroup, null, "portables[0].portables[0]", p), scenario(nestedEmptyArrayGroup, null, "portables[0].portables[1]", p), scenario(nestedEmptyArrayGroup, null, "portables[0].portables[2]", p)));
    result.addAll(expandPortableArrayPrimitiveScenario(nestedEmptyArrayGroup, (GroupPortable) nestedEmptyArrayGroup.portable, "portables[0].portableArray.primitive_", p));
    NestedGroupPortable nestedEmpty = nested(new GroupPortable[0]);
    result.addAll(asList(scenario(nestedEmpty, null, "portables[0].portables", p), scenario(nestedEmpty, null, "portables[0].portables[any]", p), scenario(nestedEmpty, null, "portables[any].portables[0]", p), scenario(nestedEmpty, null, "portables[any].portables[any]", p), scenario(nestedEmpty, null, "portables[0].portables[0]", p), scenario(nestedEmpty, null, "portables[0].portables[1]", p), scenario(nestedEmpty, null, "portables[0].portables[2]", p)));
    result.addAll(expandPortableArrayPrimitiveScenario(nestedEmpty, (GroupPortable) nestedEmpty.portable, "portables[0].portableArray.primitive_", p));
    NestedGroupPortable nestedNull = nested((GroupPortable[]) null);
    result.addAll(asList(scenario(nestedNull, null, "portables[0].portables", p), scenario(nestedNull, null, "portables[0].portables[any]", p), scenario(nestedNull, null, "portables[any].portables[0]", p), scenario(nestedNull, null, "portables[any].portables[any]", p), scenario(nestedNull, null, "portables[0].portables[0]", p), scenario(nestedNull, null, "portables[0].portables[1]", p), scenario(nestedNull, null, "portables[0].portables[2]", p)));
    result.addAll(expandPortableArrayPrimitiveScenario(nestedNull, (GroupPortable) nestedNull.portable, "portables[0].portableArray.primitive_", p));
}
Also used : NestedGroupPortable(com.hazelcast.internal.serialization.impl.portable.portablereader.DefaultPortableReaderTestStructure.NestedGroupPortable) GroupPortable(com.hazelcast.internal.serialization.impl.portable.portablereader.DefaultPortableReaderTestStructure.GroupPortable) Portable(com.hazelcast.nio.serialization.Portable) PrimitivePortable(com.hazelcast.internal.serialization.impl.portable.portablereader.DefaultPortableReaderTestStructure.PrimitivePortable) NestedGroupPortable(com.hazelcast.internal.serialization.impl.portable.portablereader.DefaultPortableReaderTestStructure.NestedGroupPortable) NestedGroupPortable(com.hazelcast.internal.serialization.impl.portable.portablereader.DefaultPortableReaderTestStructure.NestedGroupPortable) GroupPortable(com.hazelcast.internal.serialization.impl.portable.portablereader.DefaultPortableReaderTestStructure.GroupPortable)

Example 3 with NestedGroupPortable

use of com.hazelcast.internal.serialization.impl.portable.portablereader.DefaultPortableReaderTestStructure.NestedGroupPortable in project hazelcast by hazelcast.

the class DefaultPortableReaderSpecTest method fromPortableArrayToPortableArrayToPrimitiveArrayAnyScenarios.

// ----------------------------------------------------------------------------------------------------------
// from PORTABLE_ARRAY[any] via PORTABLE_ARRAY[any] to further PRIMITIVE_ARRAY[any] access
// ----------------------------------------------------------------------------------------------------------
private static void fromPortableArrayToPortableArrayToPrimitiveArrayAnyScenarios(List<Object[]> result) {
    String method = "fromPortableArrayToPortableArrayToPrimitiveArrayAnyScenarios";
    String p = method + " mixed";
    // =============================================
    // INPUT mixed
    // =============================================
    NestedGroupPortable input = nested(new Portable[] { new GroupPortable(new Portable[0]), group(prim(1, NONE), prim(10, FULL), prim(50, NULL)), new GroupPortable((Portable[]) null), group(prim(20, FULL), prim(70, NULL)) });
    PrimitivePortable p10 = prim(10, FULL);
    PrimitivePortable p20 = prim(20, FULL);
    result.addAll(asList(scenario(input, list(null, p10.bytes, p20.bytes), "portables[any].portables[any].bytes[any]", p), scenario(input, list(null, p10.shorts, p20.shorts), "portables[any].portables[any].shorts[any]", p), scenario(input, list(null, p10.ints, p20.ints), "portables[any].portables[any].ints[any]", p), scenario(input, list(null, p10.longs, p20.longs), "portables[any].portables[any].longs[any]", p), scenario(input, list(null, p10.chars, p20.chars), "portables[any].portables[any].chars[any]", p), scenario(input, list(null, p10.floats, p20.floats), "portables[any].portables[any].floats[any]", p), scenario(input, list(null, p10.doubles, p20.doubles), "portables[any].portables[any].doubles[any]", p), scenario(input, list(null, p10.booleans, p20.booleans), "portables[any].portables[any].booleans[any]", p), scenario(input, list(null, p10.strings, p20.strings), "portables[any].portables[any].strings[any]", p)));
    // =============================================
    // INPUT empty
    // =============================================
    p = method + " empty";
    NestedGroupPortable inputEmpty = nested(new Portable[0]);
    result.addAll(asList(scenario(inputEmpty, null, "portables[any].portables[any].bytes[any]", p), scenario(inputEmpty, null, "portables[any].portables[any].shorts[any]", p), scenario(inputEmpty, null, "portables[any].portables[any].ints[any]", p), scenario(inputEmpty, null, "portables[any].portables[any].longs[any]", p), scenario(inputEmpty, null, "portables[any].portables[any].chars[any]", p), scenario(inputEmpty, null, "portables[any].portables[any].floats[any]", p), scenario(inputEmpty, null, "portables[any].portables[any].doubles[any]", p), scenario(inputEmpty, null, "portables[any].portables[any].booleans[any]", p), scenario(inputEmpty, null, "portables[any].portables[any].strings[any]", p)));
    // =============================================
    // INPUT null
    // =============================================
    p = method + " null";
    NestedGroupPortable inputNull = nested((Portable[]) null);
    result.addAll(asList(scenario(inputNull, null, "portables[any].portables[any].bytes[any]", p), scenario(inputNull, null, "portables[any].portables[any].shorts[any]", p), scenario(inputNull, null, "portables[any].portables[any].ints[any]", p), scenario(inputNull, null, "portables[any].portables[any].longs[any]", p), scenario(inputNull, null, "portables[any].portables[any].chars[any]", p), scenario(inputNull, null, "portables[any].portables[any].floats[any]", p), scenario(inputNull, null, "portables[any].portables[any].doubles[any]", p), scenario(inputNull, null, "portables[any].portables[any].booleans[any]", p), scenario(inputNull, null, "portables[any].portables[any].strings[any]", p)));
}
Also used : NestedGroupPortable(com.hazelcast.internal.serialization.impl.portable.portablereader.DefaultPortableReaderTestStructure.NestedGroupPortable) GroupPortable(com.hazelcast.internal.serialization.impl.portable.portablereader.DefaultPortableReaderTestStructure.GroupPortable) Portable(com.hazelcast.nio.serialization.Portable) PrimitivePortable(com.hazelcast.internal.serialization.impl.portable.portablereader.DefaultPortableReaderTestStructure.PrimitivePortable) PrimitivePortable(com.hazelcast.internal.serialization.impl.portable.portablereader.DefaultPortableReaderTestStructure.PrimitivePortable) NestedGroupPortable(com.hazelcast.internal.serialization.impl.portable.portablereader.DefaultPortableReaderTestStructure.NestedGroupPortable) NestedGroupPortable(com.hazelcast.internal.serialization.impl.portable.portablereader.DefaultPortableReaderTestStructure.NestedGroupPortable) GroupPortable(com.hazelcast.internal.serialization.impl.portable.portablereader.DefaultPortableReaderTestStructure.GroupPortable)

Example 4 with NestedGroupPortable

use of com.hazelcast.internal.serialization.impl.portable.portablereader.DefaultPortableReaderTestStructure.NestedGroupPortable in project hazelcast by hazelcast.

the class DefaultPortableReaderSpecTest method fromPortableArrayAnyToPortableArrayAnyToPrimitiveScenarios.

// ----------------------------------------------------------------------------------------------------------
// from PORTABLE_ARRAY[any] via PORTABLE_ARRAY[any] to further PRIMITIVE access
// ----------------------------------------------------------------------------------------------------------
private static void fromPortableArrayAnyToPortableArrayAnyToPrimitiveScenarios(List<Object[]> result) {
    String p = "fromPortableArrayAnyToPortableArrayAnyToPrimitiveScenarios";
    // =============================================
    // INPUT mixed
    // =============================================
    PrimitivePortable p1 = prim(1, NONE);
    PrimitivePortable p10 = prim(10, FULL);
    PrimitivePortable p20 = prim(20, FULL);
    NestedGroupPortable input = nested(new Portable[] { new GroupPortable(new Portable[0]), group(p1, p10), new GroupPortable((Portable[]) null), group(new PrimitivePortable[] { p20 }) });
    result.addAll(asList(scenario(input, list(null, p1.byte_, p10.byte_, p20.byte_), "portables[any].portables[any].byte_", p), scenario(input, list(null, p1.short_, p10.short_, p20.short_), "portables[any].portables[any].short_", p), scenario(input, list(null, p1.int_, p10.int_, p20.int_), "portables[any].portables[any].int_", p), scenario(input, list(null, p1.long_, p10.long_, p20.long_), "portables[any].portables[any].long_", p), scenario(input, list(null, p1.char_, p10.char_, p20.char_), "portables[any].portables[any].char_", p), scenario(input, list(null, p1.float_, p10.float_, p20.float_), "portables[any].portables[any].float_", p), scenario(input, list(null, p1.double_, p10.double_, p20.double_), "portables[any].portables[any].double_", p), scenario(input, list(null, p1.boolean_, p10.boolean_, p20.boolean_), "portables[any].portables[any].boolean_", p), scenario(input, list(null, p1.string_, p10.string_, p20.string_), "portables[any].portables[any].string_", p)));
    // =============================================
    // INPUT empty
    // =============================================
    NestedGroupPortable inputEmpty = nested(new Portable[0]);
    result.addAll(asList(scenario(inputEmpty, null, "portables[any].portables[any].byte_", p), scenario(inputEmpty, null, "portables[any].portables[any].short_", p), scenario(inputEmpty, null, "portables[any].portables[any].int_", p), scenario(inputEmpty, null, "portables[any].portables[any].long_", p), scenario(inputEmpty, null, "portables[any].portables[any].char_", p), scenario(inputEmpty, null, "portables[any].portables[any].float_", p), scenario(inputEmpty, null, "portables[any].portables[any].double_", p), scenario(inputEmpty, null, "portables[any].portables[any].boolean_", p), scenario(inputEmpty, null, "portables[any].portables[any].string_", p)));
    // =============================================
    // INPUT null
    // =============================================
    NestedGroupPortable inputNull = nested((Portable[]) null);
    result.addAll(asList(scenario(inputNull, null, "portables[any].portables[any].byte_", p), scenario(inputNull, null, "portables[any].portables[any].short_", p), scenario(inputNull, null, "portables[any].portables[any].int_", p), scenario(inputNull, null, "portables[any].portables[any].long_", p), scenario(inputNull, null, "portables[any].portables[any].char_", p), scenario(inputNull, null, "portables[any].portables[any].float_", p), scenario(inputNull, null, "portables[any].portables[any].double_", p), scenario(inputNull, null, "portables[any].portables[any].boolean_", p), scenario(inputNull, null, "portables[any].portables[any].string_", p)));
}
Also used : NestedGroupPortable(com.hazelcast.internal.serialization.impl.portable.portablereader.DefaultPortableReaderTestStructure.NestedGroupPortable) GroupPortable(com.hazelcast.internal.serialization.impl.portable.portablereader.DefaultPortableReaderTestStructure.GroupPortable) Portable(com.hazelcast.nio.serialization.Portable) PrimitivePortable(com.hazelcast.internal.serialization.impl.portable.portablereader.DefaultPortableReaderTestStructure.PrimitivePortable) PrimitivePortable(com.hazelcast.internal.serialization.impl.portable.portablereader.DefaultPortableReaderTestStructure.PrimitivePortable) NestedGroupPortable(com.hazelcast.internal.serialization.impl.portable.portablereader.DefaultPortableReaderTestStructure.NestedGroupPortable) NestedGroupPortable(com.hazelcast.internal.serialization.impl.portable.portablereader.DefaultPortableReaderTestStructure.NestedGroupPortable) GroupPortable(com.hazelcast.internal.serialization.impl.portable.portablereader.DefaultPortableReaderTestStructure.GroupPortable)

Example 5 with NestedGroupPortable

use of com.hazelcast.internal.serialization.impl.portable.portablereader.DefaultPortableReaderTestStructure.NestedGroupPortable in project hazelcast by hazelcast.

the class DefaultPortableReaderSpecTest method fromPortableArrayToPortableArrayAnyScenarios.

// ----------------------------------------------------------------------------------------------------------
// from PORTABLE_ARRAY to PORTABLE_ARRAY access + further
// ----------------------------------------------------------------------------------------------------------
private static void fromPortableArrayToPortableArrayAnyScenarios(List<Object[]> result) {
    String p = "fromPortableArrayToPortableArrayAnyScenarios";
    NestedGroupPortable anyGroup = nested(new Portable[] { 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, ((GroupPortable) (anyGroup.portables[0])).portables, "portables[0].portables[any]", p), scenario(anyGroup, new Portable[] { prim(1, FULL), prim(2, FULL) }, "portables[any].portables[0]", p), scenario(anyGroup, new Portable[] { prim(10, FULL), prim(20, FULL) }, "portables[any].portables[1]", p), scenario(anyGroup, new Portable[] { prim(50, FULL), prim(80, FULL) }, "portables[any].portables[2]", p), scenario(anyGroup, new Portable[] { prim(1, FULL), prim(10, FULL), prim(50, FULL), prim(2, FULL), prim(20, FULL), prim(80, FULL) }, "portables[any].portables[any]", p)));
    NestedGroupPortable nestedEmptyArrayGroup = nested(new Portable[] { new GroupPortable(new Portable[0]), group(prim(1, FULL), prim(10, NONE), prim(50, NULL)) });
    result.addAll(asList(scenario(nestedEmptyArrayGroup, null, "portables[0].portables[any]", p), scenario(nestedEmptyArrayGroup, new Portable[] { null, prim(1, FULL) }, "portables[any].portables[0]", p), scenario(nestedEmptyArrayGroup, new Portable[] { null, prim(10, FULL) }, "portables[any].portables[1]", p), scenario(nestedEmptyArrayGroup, new Portable[] { null, prim(50, FULL) }, "portables[any].portables[2]", p), scenario(nestedEmptyArrayGroup, new Portable[] { null, prim(1, FULL), prim(10, FULL), prim(50, FULL) }, "portables[any].portables[any]", p)));
    NestedGroupPortable nestedNullArrayGroup = nested(new Portable[] { new GroupPortable((Portable[]) null), group(prim(1, FULL), prim(10, NONE), prim(50, NULL)) });
    result.addAll(asList(scenario(nestedNullArrayGroup, null, "portables[0].portables[any]", p), scenario(nestedNullArrayGroup, new Portable[] { null, prim(1, FULL) }, "portables[any].portables[0]", p), scenario(nestedNullArrayGroup, new Portable[] { null, prim(10, FULL) }, "portables[any].portables[1]", p), scenario(nestedNullArrayGroup, new Portable[] { null, prim(50, FULL) }, "portables[any].portables[2]", p), scenario(nestedNullArrayGroup, new Portable[] { null, prim(1, FULL), prim(10, FULL), prim(50, FULL) }, "portables[any].portables[any]", p)));
}
Also used : NestedGroupPortable(com.hazelcast.internal.serialization.impl.portable.portablereader.DefaultPortableReaderTestStructure.NestedGroupPortable) GroupPortable(com.hazelcast.internal.serialization.impl.portable.portablereader.DefaultPortableReaderTestStructure.GroupPortable) Portable(com.hazelcast.nio.serialization.Portable) PrimitivePortable(com.hazelcast.internal.serialization.impl.portable.portablereader.DefaultPortableReaderTestStructure.PrimitivePortable) NestedGroupPortable(com.hazelcast.internal.serialization.impl.portable.portablereader.DefaultPortableReaderTestStructure.NestedGroupPortable) NestedGroupPortable(com.hazelcast.internal.serialization.impl.portable.portablereader.DefaultPortableReaderTestStructure.NestedGroupPortable) GroupPortable(com.hazelcast.internal.serialization.impl.portable.portablereader.DefaultPortableReaderTestStructure.GroupPortable)

Aggregations

GroupPortable (com.hazelcast.internal.serialization.impl.portable.portablereader.DefaultPortableReaderTestStructure.GroupPortable)6 NestedGroupPortable (com.hazelcast.internal.serialization.impl.portable.portablereader.DefaultPortableReaderTestStructure.NestedGroupPortable)6 PrimitivePortable (com.hazelcast.internal.serialization.impl.portable.portablereader.DefaultPortableReaderTestStructure.PrimitivePortable)6 Portable (com.hazelcast.nio.serialization.Portable)5