use of com.hazelcast.nio.serialization.StreamSerializer in project hazelcast by hazelcast.
the class IssuesTest method testIssue1067GlobalSerializer.
@Test
public void testIssue1067GlobalSerializer() {
TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);
final Config config = getConfig();
GlobalSerializerConfig globalSerializerConfig = new GlobalSerializerConfig();
globalSerializerConfig.setOverrideJavaSerialization(false);
config.getSerializationConfig().setGlobalSerializerConfig(globalSerializerConfig.setImplementation(new StreamSerializer() {
public void write(ObjectDataOutput out, Object object) throws IOException {
}
public Object read(ObjectDataInput in) throws IOException {
return new DummyValue();
}
public int getTypeId() {
return 123;
}
public void destroy() {
}
}));
HazelcastInstance hz = factory.newHazelcastInstance(config);
IMap<Object, Object> map = hz.getMap("test");
for (int i = 0; i < 10; i++) {
map.put(i, new DummyValue());
}
assertEquals(10, map.size());
HazelcastInstance hz2 = factory.newHazelcastInstance(config);
IMap<Object, Object> map2 = hz2.getMap("test");
assertEquals(10, map2.size());
assertEquals(10, map.size());
for (int i = 0; i < 10; i++) {
Object o = map2.get(i);
assertNotNull(o);
assertTrue(o instanceof DummyValue);
}
}
Aggregations