Search in sources :

Example 1 with MorphingBasePortable

use of com.hazelcast.nio.serialization.MorphingBasePortable in project hazelcast by hazelcast.

the class MorphingPortableReaderTest method before.

@Before
public void before() throws Exception {
    service1 = (SerializationServiceV1) new DefaultSerializationServiceBuilder().addPortableFactory(TestSerializationConstants.PORTABLE_FACTORY_ID, new PortableFactory() {

        public Portable create(int classId) {
            return new MorphingBasePortable();
        }
    }).build();
    service2 = (SerializationServiceV1) new DefaultSerializationServiceBuilder().addPortableFactory(TestSerializationConstants.PORTABLE_FACTORY_ID, new PortableFactory() {

        public Portable create(int classId) {
            return new MorphingPortable();
        }
    }).build();
    Data data = service1.toData(new MorphingBasePortable((byte) 1, true, (char) 2, (short) 3, 4, 5, 1f, 2d, "test"));
    BufferObjectDataInput in = service2.createObjectDataInput(data);
    PortableSerializer portableSerializer = service2.getPortableSerializer();
    reader = portableSerializer.createMorphingReader(in);
}
Also used : MorphingBasePortable(com.hazelcast.nio.serialization.MorphingBasePortable) MorphingPortable(com.hazelcast.nio.serialization.MorphingPortable) Data(com.hazelcast.nio.serialization.Data) PortableFactory(com.hazelcast.nio.serialization.PortableFactory) BufferObjectDataInput(com.hazelcast.nio.BufferObjectDataInput) Before(org.junit.Before)

Aggregations

BufferObjectDataInput (com.hazelcast.nio.BufferObjectDataInput)1 Data (com.hazelcast.nio.serialization.Data)1 MorphingBasePortable (com.hazelcast.nio.serialization.MorphingBasePortable)1 MorphingPortable (com.hazelcast.nio.serialization.MorphingPortable)1 PortableFactory (com.hazelcast.nio.serialization.PortableFactory)1 Before (org.junit.Before)1