use of com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder in project hazelcast by hazelcast.
the class WanReplicationConfigTest method testSerialization.
@Test
public void testSerialization() {
Map<String, Comparable> properties = new HashMap<String, Comparable>();
properties.put("key", "value");
WanConsumerConfig wanConsumerConfig = new WanConsumerConfig();
wanConsumerConfig.setProperties(properties);
wanConsumerConfig.setClassName("className");
wanConsumerConfig.setImplementation("implementation");
WanPublisherConfig wanPublisherConfig1 = new WanPublisherConfig();
WanPublisherConfig wanPublisherConfig2 = new WanPublisherConfig();
List<WanPublisherConfig> publisherConfigs = new LinkedList<WanPublisherConfig>();
publisherConfigs.add(wanPublisherConfig1);
config.setName("name");
config.setWanConsumerConfig(wanConsumerConfig);
config.setWanPublisherConfigs(publisherConfigs);
config.addWanPublisherConfig(wanPublisherConfig2);
SerializationService serializationService = new DefaultSerializationServiceBuilder().build();
Data serialized = serializationService.toData(config);
WanReplicationConfig deserialized = serializationService.toObject(serialized);
assertWanReplicationConfig(config, deserialized);
}
use of com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder in project hazelcast by hazelcast.
the class PartitionRuntimeStateTest method serializeAndDeserialize.
private PartitionRuntimeState serializeAndDeserialize(PartitionRuntimeState state) {
InternalSerializationService serializationService = new DefaultSerializationServiceBuilder().build();
try {
Data data = serializationService.toData(state);
state = serializationService.toObject(data);
} finally {
serializationService.dispose();
}
return state;
}
use of com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder in project hazelcast by hazelcast.
the class TcpIpConnection_AbstractTest method setup.
@Before
public void setup() throws Exception {
addressA = new Address("127.0.0.1", 5701);
addressB = new Address("127.0.0.1", 5702);
addressC = new Address("127.0.0.1", 5703);
loggingService = new LoggingServiceImpl("somegroup", "log4j2", BuildInfoProvider.BUILD_INFO);
logger = loggingService.getLogger(TcpIpConnection_AbstractTest.class);
metricsRegistryA = newMetricsRegistry();
connManagerA = newConnectionManager(addressA.getPort(), metricsRegistryA);
ioServiceA = (MockIOService) connManagerA.getIoService();
metricsRegistryB = newMetricsRegistry();
connManagerB = newConnectionManager(addressB.getPort(), metricsRegistryB);
ioServiceB = (MockIOService) connManagerB.getIoService();
metricsRegistryC = newMetricsRegistry();
connManagerC = newConnectionManager(addressC.getPort(), metricsRegistryC);
ioServiceC = (MockIOService) connManagerB.getIoService();
serializationService = (InternalSerializationService) new DefaultSerializationServiceBuilder().addDataSerializableFactory(TestDataFactory.FACTORY_ID, new TestDataFactory()).build();
}
use of com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder in project hazelcast by hazelcast.
the class EntryViewTest method testEntryViewSerialization.
@Test
public void testEntryViewSerialization() throws Exception {
ReplicatedMapEntryView entryView = createEntryView();
SerializationServiceBuilder serializationServiceBuilder = new DefaultSerializationServiceBuilder();
SerializationService serializationService = serializationServiceBuilder.build();
Data data = serializationService.toData(entryView);
ReplicatedMapEntryView deserialized = serializationService.toObject(data);
verifyFields(deserialized);
}
use of com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder 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);
}
Aggregations