Search in sources :

Example 1 with TestPortableFactory

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

the class DefaultPortableReaderSpecTest method reader.

// 
// Hazelcast init Utilities
// 
public GenericRecordQueryReader reader(Portable portable) throws IOException {
    SerializationConfig serializationConfig = new SerializationConfig();
    serializationConfig.addPortableFactory(TestPortableFactory.ID, new TestPortableFactory());
    InternalSerializationService ss = new DefaultSerializationServiceBuilder().setConfig(serializationConfig).build();
    // put fully initialised object to a map
    // avoid the case where there's no class definition
    ss.toData(P_NON_EMPTY);
    ss.toData(G_NON_EMPTY);
    ss.toData(N_NON_EMPTY);
    Data data = ss.toData(portable);
    return new GenericRecordQueryReader(ss.readAsInternalGenericRecord(data));
}
Also used : DefaultSerializationServiceBuilder(com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder) TestPortableFactory(com.hazelcast.internal.serialization.impl.portable.portablereader.DefaultPortableReaderTestStructure.TestPortableFactory) SerializationConfig(com.hazelcast.config.SerializationConfig) GenericRecordQueryReader(com.hazelcast.internal.serialization.impl.GenericRecordQueryReader) Data(com.hazelcast.internal.serialization.Data) InternalSerializationService(com.hazelcast.internal.serialization.InternalSerializationService)

Aggregations

SerializationConfig (com.hazelcast.config.SerializationConfig)1 Data (com.hazelcast.internal.serialization.Data)1 InternalSerializationService (com.hazelcast.internal.serialization.InternalSerializationService)1 DefaultSerializationServiceBuilder (com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder)1 GenericRecordQueryReader (com.hazelcast.internal.serialization.impl.GenericRecordQueryReader)1 TestPortableFactory (com.hazelcast.internal.serialization.impl.portable.portablereader.DefaultPortableReaderTestStructure.TestPortableFactory)1