Search in sources :

Example 6 with PrimitivePortable

use of com.hazelcast.nio.serialization.impl.DefaultPortableReaderTestStructure.PrimitivePortable 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);
    Class failure = IllegalArgumentException.class;
    result.addAll(asList(scenario(input, failure, ByteArray, "portables[any].portables[any].bytes[any]", p), scenario(input, failure, ShortArray, "portables[any].portables[any].shorts[any]", p), scenario(input, failure, IntArray, "portables[any].portables[any].ints[any]", p), scenario(input, failure, LongArray, "portables[any].portables[any].longs[any]", p), scenario(input, failure, CharArray, "portables[any].portables[any].chars[any]", p), scenario(input, failure, FloatArray, "portables[any].portables[any].floats[any]", p), scenario(input, failure, DoubleArray, "portables[any].portables[any].doubles[any]", p), scenario(input, failure, BooleanArray, "portables[any].portables[any].booleans[any]", p)));
    List expectedUtfArray = list(null, null, p10.strings, null, null, p20.strings, null);
    result.add(scenario(input, expectedUtfArray, UTFArray, "portables[any].portables[any].strings[any]", p));
    result.addAll(asList(scenario(input, list(null, null, p10.bytes, null, null, p20.bytes, null), Generic, "portables[any].portables[any].bytes[any]", p), scenario(input, list(null, null, p10.shorts, null, null, p20.shorts, null), Generic, "portables[any].portables[any].shorts[any]", p), scenario(input, list(null, null, p10.ints, null, null, p20.ints, null), Generic, "portables[any].portables[any].ints[any]", p), scenario(input, list(null, null, p10.longs, null, null, p20.longs, null), Generic, "portables[any].portables[any].longs[any]", p), scenario(input, list(null, null, p10.chars, null, null, p20.chars, null), Generic, "portables[any].portables[any].chars[any]", p), scenario(input, list(null, null, p10.floats, null, null, p20.floats, null), Generic, "portables[any].portables[any].floats[any]", p), scenario(input, list(null, null, p10.doubles, null, null, p20.doubles, null), Generic, "portables[any].portables[any].doubles[any]", p), scenario(input, list(null, null, p10.booleans, null, null, p20.booleans, null), Generic, "portables[any].portables[any].booleans[any]", p), scenario(input, list(null, null, p10.strings, null, null, p20.strings, null), Generic, "portables[any].portables[any].strings[any]", p)));
    // =============================================
    // INPUT empty
    // =============================================
    p = method + " empty";
    NestedGroupPortable inputEmpty = nested(new Portable[0]);
    result.addAll(asList(scenario(inputEmpty, null, ByteArray, "portables[any].portables[any].bytes[any]", p), scenario(inputEmpty, null, ShortArray, "portables[any].portables[any].shorts[any]", p), scenario(inputEmpty, null, IntArray, "portables[any].portables[any].ints[any]", p), scenario(inputEmpty, null, LongArray, "portables[any].portables[any].longs[any]", p), scenario(inputEmpty, null, CharArray, "portables[any].portables[any].chars[any]", p), scenario(inputEmpty, null, FloatArray, "portables[any].portables[any].floats[any]", p), scenario(inputEmpty, null, DoubleArray, "portables[any].portables[any].doubles[any]", p), scenario(inputEmpty, null, BooleanArray, "portables[any].portables[any].booleans[any]", p), scenario(inputEmpty, null, UTFArray, "portables[any].portables[any].strings[any]", p)));
    result.addAll(asList(scenario(inputEmpty, null, Generic, "portables[any].portables[any].bytes[any]", p), scenario(inputEmpty, null, Generic, "portables[any].portables[any].shorts[any]", p), scenario(inputEmpty, null, Generic, "portables[any].portables[any].ints[any]", p), scenario(inputEmpty, null, Generic, "portables[any].portables[any].longs[any]", p), scenario(inputEmpty, null, Generic, "portables[any].portables[any].chars[any]", p), scenario(inputEmpty, null, Generic, "portables[any].portables[any].floats[any]", p), scenario(inputEmpty, null, Generic, "portables[any].portables[any].doubles[any]", p), scenario(inputEmpty, null, Generic, "portables[any].portables[any].booleans[any]", p), scenario(inputEmpty, null, Generic, "portables[any].portables[any].strings[any]", p)));
    // =============================================
    // INPUT null
    // =============================================
    p = method + " null";
    NestedGroupPortable inputNull = nested((Portable[]) null);
    result.addAll(asList(scenario(inputNull, null, ByteArray, "portables[any].portables[any].bytes[any]", p), scenario(inputNull, null, ShortArray, "portables[any].portables[any].shorts[any]", p), scenario(inputNull, null, IntArray, "portables[any].portables[any].ints[any]", p), scenario(inputNull, null, LongArray, "portables[any].portables[any].longs[any]", p), scenario(inputNull, null, CharArray, "portables[any].portables[any].chars[any]", p), scenario(inputNull, null, FloatArray, "portables[any].portables[any].floats[any]", p), scenario(inputNull, null, DoubleArray, "portables[any].portables[any].doubles[any]", p), scenario(inputNull, null, BooleanArray, "portables[any].portables[any].booleans[any]", p), scenario(inputNull, null, UTFArray, "portables[any].portables[any].strings[any]", p)));
    result.addAll(asList(scenario(inputNull, null, Generic, "portables[any].portables[any].bytes[any]", p), scenario(inputNull, null, Generic, "portables[any].portables[any].shorts[any]", p), scenario(inputNull, null, Generic, "portables[any].portables[any].ints[any]", p), scenario(inputNull, null, Generic, "portables[any].portables[any].longs[any]", p), scenario(inputNull, null, Generic, "portables[any].portables[any].chars[any]", p), scenario(inputNull, null, Generic, "portables[any].portables[any].floats[any]", p), scenario(inputNull, null, Generic, "portables[any].portables[any].doubles[any]", p), scenario(inputNull, null, Generic, "portables[any].portables[any].booleans[any]", p), scenario(inputNull, null, Generic, "portables[any].portables[any].strings[any]", p)));
}
Also used : GroupPortable(com.hazelcast.nio.serialization.impl.DefaultPortableReaderTestStructure.GroupPortable) Portable(com.hazelcast.nio.serialization.impl.DefaultPortableReaderTestStructure.Method.Portable) Portable(com.hazelcast.nio.serialization.Portable) PrimitivePortable(com.hazelcast.nio.serialization.impl.DefaultPortableReaderTestStructure.PrimitivePortable) NestedGroupPortable(com.hazelcast.nio.serialization.impl.DefaultPortableReaderTestStructure.NestedGroupPortable) PrimitivePortable(com.hazelcast.nio.serialization.impl.DefaultPortableReaderTestStructure.PrimitivePortable) NestedGroupPortable(com.hazelcast.nio.serialization.impl.DefaultPortableReaderTestStructure.NestedGroupPortable) Arrays.asList(java.util.Arrays.asList) List(java.util.List) ArrayList(java.util.ArrayList) GroupPortable(com.hazelcast.nio.serialization.impl.DefaultPortableReaderTestStructure.GroupPortable) NestedGroupPortable(com.hazelcast.nio.serialization.impl.DefaultPortableReaderTestStructure.NestedGroupPortable)

Aggregations

PrimitivePortable (com.hazelcast.nio.serialization.impl.DefaultPortableReaderTestStructure.PrimitivePortable)6 GroupPortable (com.hazelcast.nio.serialization.impl.DefaultPortableReaderTestStructure.GroupPortable)4 NestedGroupPortable (com.hazelcast.nio.serialization.impl.DefaultPortableReaderTestStructure.NestedGroupPortable)4 ArrayList (java.util.ArrayList)4 Arrays.asList (java.util.Arrays.asList)3 List (java.util.List)3 Portable (com.hazelcast.nio.serialization.Portable)2 Method (com.hazelcast.nio.serialization.impl.DefaultPortableReaderTestStructure.Method)2 Portable (com.hazelcast.nio.serialization.impl.DefaultPortableReaderTestStructure.Method.Portable)2 Config (com.hazelcast.config.Config)1 HazelcastInstanceProxy (com.hazelcast.instance.HazelcastInstanceProxy)1 SerializationServiceV1 (com.hazelcast.internal.serialization.impl.SerializationServiceV1)1 TestPortableFactory (com.hazelcast.nio.serialization.impl.DefaultPortableReaderTestStructure.TestPortableFactory)1