use of com.hazelcast.internal.serialization.impl.SerializationServiceV1 in project hazelcast by hazelcast.
the class DefaultPortableReaderSpecTest method reader.
//
// Hazelcast init Utilities
//
public PortableReader reader(Portable portable) throws IOException {
Config config = new Config();
config.getSerializationConfig().addPortableFactory(TestPortableFactory.ID, new TestPortableFactory());
HazelcastInstanceProxy hz = (HazelcastInstanceProxy) createHazelcastInstance(config);
IMap<String, Object> map = hz.getMap("stealingMap");
// avoid the case where there's no class definition
if (portable instanceof PrimitivePortable) {
map.put(P_NON_EMPTY.toString(), P_NON_EMPTY);
}
if (portable instanceof GroupPortable) {
map.put(G_NON_EMPTY.toString(), G_NON_EMPTY);
}
if (portable instanceof NestedGroupPortable) {
map.put(N_NON_EMPTY.toString(), N_NON_EMPTY);
}
map.put(portable.toString(), portable);
EntryStealingProcessor processor = new EntryStealingProcessor(portable.toString());
map.executeOnEntries(processor);
SerializationServiceV1 ss = (SerializationServiceV1) hz.getSerializationService();
return ss.createPortableReader(processor.stolenEntryData);
}
use of com.hazelcast.internal.serialization.impl.SerializationServiceV1 in project hazelcast by hazelcast.
the class MemberVersionTest method testSerialization.
@Test
public void testSerialization() {
MemberVersion given = MemberVersion.of(3, 9, 1);
SerializationServiceV1 ss = new DefaultSerializationServiceBuilder().setVersion(SerializationServiceV1.VERSION_1).build();
MemberVersion deserialized = ss.toObject(ss.toData(given));
assertEquals(deserialized, given);
}
use of com.hazelcast.internal.serialization.impl.SerializationServiceV1 in project hazelcast by hazelcast.
the class DefaultPortableReaderQuickTest method reader.
//
// Utilities
//
public PortableReader reader(Portable portable) throws IOException {
Config config = new Config();
config.getSerializationConfig().addPortableFactory(TestPortableFactory.ID, new TestPortableFactory());
HazelcastInstanceProxy hz = (HazelcastInstanceProxy) createHazelcastInstance(config);
IMap<String, Object> map = hz.getMap("stealingMap");
if (portable instanceof CarPortable) {
// makes sure that proper class definitions are registered
map.put(NON_EMPTY_PORSCHE.toString(), NON_EMPTY_PORSCHE);
}
map.put(portable.toString(), portable);
EntryStealingProcessor processor = new EntryStealingProcessor(portable.toString());
map.executeOnEntries(processor);
SerializationServiceV1 ss = (SerializationServiceV1) hz.getSerializationService();
return ss.createPortableReader(processor.stolenEntryData);
}
use of com.hazelcast.internal.serialization.impl.SerializationServiceV1 in project hazelcast by hazelcast.
the class ClusterVersionTest method testSerialization.
@Test
public void testSerialization() {
Version given = Version.of(3, 9);
SerializationServiceV1 ss = new DefaultSerializationServiceBuilder().setVersion(SerializationServiceV1.VERSION_1).build();
Version deserialized = ss.toObject(ss.toData(given));
assertEquals(deserialized, given);
}
Aggregations