use of example.serialization.ExternalizableEmployeeDTO in project hazelcast by hazelcast.
the class CompactStreamSerializerTest method testOverridesJavaSerializationWhenRegisteredAsReflectivelySerializable.
@Test
public void testOverridesJavaSerializationWhenRegisteredAsReflectivelySerializable() {
SerializationConfig serializationConfig = new SerializationConfig();
serializationConfig.getCompactSerializationConfig().setEnabled(true).register(ExternalizableEmployeeDTO.class);
SerializationService serializationService = new DefaultSerializationServiceBuilder().setSchemaService(schemaService).setConfig(serializationConfig).build();
ExternalizableEmployeeDTO employeeDTO = new ExternalizableEmployeeDTO(30, "John Doe");
Data data = serializationService.toData(employeeDTO);
assertFalse(employeeDTO.usedExternalizableSerialization());
Object object = serializationService.toObject(data);
ExternalizableEmployeeDTO actual = (ExternalizableEmployeeDTO) object;
assertFalse(employeeDTO.usedExternalizableSerialization());
assertEquals(employeeDTO, actual);
}
use of example.serialization.ExternalizableEmployeeDTO in project hazelcast by hazelcast.
the class CompactTestUtil method verifyReflectiveSerializerIsUsed.
public static void verifyReflectiveSerializerIsUsed(SerializationConfig serializationConfig) {
SerializationService serializationService = new DefaultSerializationServiceBuilder().setSchemaService(CompactTestUtil.createInMemorySchemaService()).setConfig(serializationConfig).build();
ExternalizableEmployeeDTO object = new ExternalizableEmployeeDTO();
Data data = serializationService.toData(object);
assertFalse(object.usedExternalizableSerialization());
ExternalizableEmployeeDTO deserializedObject = serializationService.toObject(data);
assertFalse(deserializedObject.usedExternalizableSerialization());
}
Aggregations