Search in sources :

Example 6 with GroupPortable

use of com.hazelcast.internal.serialization.impl.portable.portablereader.DefaultPortableReaderTestStructure.GroupPortable 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)

Example 7 with GroupPortable

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

the class DefaultPortableReaderSpecTest method fromPortableToPortableArrayToPrimitiveScenarios.

// ----------------------------------------------------------------------------------------------------------
// from PORTABLE via PORTABLE_ARRAY to further access
// ----------------------------------------------------------------------------------------------------------
private static void fromPortableToPortableArrayToPrimitiveScenarios(List<Object[]> result) {
    // FULLy initialised primitive objects accessed from portable stored in array
    String p = "fromPortableToPortableToPrimitiveScenarios";
    NestedGroupPortable nestedFullGroup = nested(group(prim(1, FULL), prim(10, FULL), prim(100, FULL)));
    result.addAll(asList(scenario(nestedFullGroup, ((GroupPortable) (nestedFullGroup.portable)).portables, "portable.portables", p), scenario(nestedFullGroup, ((GroupPortable) (nestedFullGroup.portable)).portables, "portable.portables[any]", p), scenario(nestedFullGroup, ((GroupPortable) (nestedFullGroup.portable)).portables[0], "portable.portables[0]", p), scenario(nestedFullGroup, ((GroupPortable) (nestedFullGroup.portable)).portables[1], "portable.portables[1]", p), scenario(nestedFullGroup, ((GroupPortable) (nestedFullGroup.portable)).portables[2], "portable.portables[2]", p), scenario(nestedFullGroup, null, "portable.portables[12]", p)));
    result.addAll(expandPortableArrayPrimitiveScenario(nestedFullGroup, (GroupPortable) nestedFullGroup.portable, "portable.portableArray.primitive_", p));
    NestedGroupPortable nestedFullEmptyNullGroup = nested(group(prim(1, FULL), prim(10, NONE), prim(100, NULL)));
    result.addAll(expandPortableArrayPrimitiveScenario(nestedFullEmptyNullGroup, (GroupPortable) nestedFullEmptyNullGroup.portable, "portable.portableArray.primitive_", p));
    // empty or null portable array de-referenced further
    NestedGroupPortable nestedNullArrayGroup = nested(new GroupPortable((Portable[]) null));
    result.addAll(asList(scenario(nestedNullArrayGroup, null, "portable.portables", p), scenario(nestedNullArrayGroup, null, "portable.portables[any]", p), scenario(nestedNullArrayGroup, null, "portable.portables[0]", p), scenario(nestedNullArrayGroup, null, "portable.portables[1]", p), scenario(nestedNullArrayGroup, null, "portable.portables[2]", p)));
    result.addAll(expandPortableArrayPrimitiveScenario(nestedNullArrayGroup, (GroupPortable) nestedNullArrayGroup.portable, "portable.portableArray.primitive_", p));
    NestedGroupPortable nestedEmptyArrayGroup = nested(new GroupPortable(new Portable[0]));
    result.addAll(asList(scenario(nestedEmptyArrayGroup, new Portable[0], "portable.portables", p), scenario(nestedEmptyArrayGroup, null, "portable.portables[any]", p), scenario(nestedEmptyArrayGroup, null, "portable.portables[0]", p), scenario(nestedEmptyArrayGroup, null, "portable.portables[1]", p), scenario(nestedEmptyArrayGroup, null, "portable.portables[2]", p)));
    result.addAll(expandPortableArrayPrimitiveScenario(nestedEmptyArrayGroup, (GroupPortable) nestedEmptyArrayGroup.portable, "portable.portableArray.primitive_", p));
    NestedGroupPortable nestedEmpty = nested(new GroupPortable[0]);
    result.addAll(asList(scenario(nestedEmpty, null, "portable.portables", p), scenario(nestedEmpty, null, "portable.portables[any]", p), scenario(nestedEmpty, null, "portable.portables[0]", p), scenario(nestedEmpty, null, "portable.portables[1]", p), scenario(nestedEmpty, null, "portable.portables[2]", p)));
    result.addAll(expandPortableArrayPrimitiveScenario(nestedEmpty, (GroupPortable) nestedEmpty.portable, "portable.portableArray.primitive_", p));
    NestedGroupPortable nestedNull = nested((GroupPortable[]) null);
    result.addAll(asList(scenario(nestedNull, null, "portable.portables", p), scenario(nestedNull, null, "portable.portables[any]", p), scenario(nestedNull, null, "portable.portables[0]", p), scenario(nestedNull, null, "portable.portables[1]", p), scenario(nestedNull, null, "portable.portables[2]", p)));
    result.addAll(expandPortableArrayPrimitiveScenario(nestedNull, (GroupPortable) nestedNull.portable, "portable.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)

Aggregations

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