use of com.hazelcast.config.SerializationConfig in project hazelcast by hazelcast.
the class SerializerHookLoaderTest method testLoad_implException.
@Test(expected = HazelcastSerializationException.class)
public void testLoad_implException() {
SerializerConfig serializerConfig = new SerializerConfig();
serializerConfig.setClassName("NOT FOUND CLASS");
serializerConfig.setTypeClassName("com.hazelcast.internal.serialization.impl.SampleIdentifiedDataSerializable");
SerializationConfig serializationConfig = getConfig().getSerializationConfig();
serializationConfig.addSerializerConfig(serializerConfig);
new SerializerHookLoader(serializationConfig, classLoader);
}
use of com.hazelcast.config.SerializationConfig in project hazelcast by hazelcast.
the class BinaryCompatibilityFileGenerator method createSerializationService.
@SuppressWarnings("checkstyle:avoidnestedblocks")
private static SerializationService createSerializationService(ByteOrder byteOrder) {
SerializationConfig config = new SerializationConfig();
{
SerializerConfig serializerConfig = new SerializerConfig();
serializerConfig.setImplementation(new CustomByteArraySerializer()).setTypeClass(CustomByteArraySerializable.class);
config.addSerializerConfig(serializerConfig);
}
{
SerializerConfig serializerConfig = new SerializerConfig();
serializerConfig.setImplementation(new CustomStreamSerializer()).setTypeClass(CustomStreamSerializable.class);
config.addSerializerConfig(serializerConfig);
}
config.setByteOrder(byteOrder);
ClassDefinition classDefinition = new ClassDefinitionBuilder(ReferenceObjects.PORTABLE_FACTORY_ID, ReferenceObjects.INNER_PORTABLE_CLASS_ID).addIntField("i").addFloatField("f").build();
return new DefaultSerializationServiceBuilder().setConfig(config).setVersion(VERSION).addPortableFactory(ReferenceObjects.PORTABLE_FACTORY_ID, new APortableFactory()).addDataSerializableFactory(ReferenceObjects.IDENTIFIED_DATA_SERIALIZABLE_FACTORY_ID, new ADataSerializableFactory()).addClassDefinition(classDefinition).build();
}
use of com.hazelcast.config.SerializationConfig in project hazelcast by hazelcast.
the class ReplicatedMapAntiEntropyTest method testMapConvergesToSameValueWhenMissingReplicationUpdate.
@Test
public void testMapConvergesToSameValueWhenMissingReplicationUpdate() {
String mapName = randomMapName();
System.setProperty("hazelcast.serialization.custom.override", "true");
SerializerConfig serializerConfig = new SerializerConfig().setTypeClassName(PutOperation.class.getName()).setImplementation(new PutOperationWithNoReplicationSerializer());
SerializationConfig serializationConfig = new SerializationConfig().addSerializerConfig(serializerConfig);
Config config = new Config().setSerializationConfig(serializationConfig);
TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory();
HazelcastInstance instance1 = factory.newHazelcastInstance(config);
HazelcastInstance instance2 = factory.newHazelcastInstance(config);
HazelcastInstance instance3 = factory.newHazelcastInstance(config);
final ReplicatedMap<Object, Object> map1 = instance1.getReplicatedMap(mapName);
final ReplicatedMap<Object, Object> map2 = instance2.getReplicatedMap(mapName);
final ReplicatedMap<Object, Object> map3 = instance3.getReplicatedMap(mapName);
final String key = generateKeyOwnedBy(instance2);
final String value = randomString();
map1.put(key, value);
assertEquals(value, map1.get(key));
assertTrueEventually(new AssertTask() {
@Override
public void run() throws Exception {
assertEquals(value, map2.get(key));
assertEquals(value, map3.get(key));
}
});
}
Aggregations