Search in sources :

Example 41 with DefaultSerializationServiceBuilder

use of com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder in project hazelcast by hazelcast.

the class WanConsumerConfigTest method testSerialization.

@Test
public void testSerialization() {
    Map<String, Comparable> properties = new HashMap<String, Comparable>();
    properties.put("key", "value");
    config.setProperties(properties);
    config.setClassName("className");
    config.setImplementation("implementation");
    SerializationService serializationService = new DefaultSerializationServiceBuilder().build();
    Data serialized = serializationService.toData(config);
    WanConsumerConfig deserialized = serializationService.toObject(serialized);
    assertWanConsumerConfig(config, deserialized);
}
Also used : DefaultSerializationServiceBuilder(com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder) HashMap(java.util.HashMap) SerializationService(com.hazelcast.spi.serialization.SerializationService) Data(com.hazelcast.nio.serialization.Data) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 42 with DefaultSerializationServiceBuilder

use of com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder in project hazelcast by hazelcast.

the class WanReplicationConfigTest method testSerialization_withEmpyConfigs.

@Test
public void testSerialization_withEmpyConfigs() {
    config.setName("name");
    SerializationService serializationService = new DefaultSerializationServiceBuilder().build();
    Data serialized = serializationService.toData(config);
    WanReplicationConfig deserialized = serializationService.toObject(serialized);
    assertWanReplicationConfig(config, deserialized);
}
Also used : DefaultSerializationServiceBuilder(com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder) SerializationService(com.hazelcast.spi.serialization.SerializationService) Data(com.hazelcast.nio.serialization.Data) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 43 with DefaultSerializationServiceBuilder

use of com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder in project hazelcast by hazelcast.

the class WanReplicationRefTest method testSerialization.

@Test
public void testSerialization() {
    ref.setName("myWanReplicationRef");
    ref.setMergePolicy("myMergePolicy");
    ref.setRepublishingEnabled(true);
    ref.addFilter("myFilter");
    SerializationService serializationService = new DefaultSerializationServiceBuilder().build();
    Data serialized = serializationService.toData(ref);
    WanReplicationRef deserialized = serializationService.toObject(serialized);
    assertEquals(ref.getName(), deserialized.getName());
    assertEquals(ref.getMergePolicy(), deserialized.getMergePolicy());
    assertEquals(ref.isRepublishingEnabled(), deserialized.isRepublishingEnabled());
    assertEquals(ref.getFilters(), deserialized.getFilters());
    assertEquals(ref.toString(), deserialized.toString());
}
Also used : DefaultSerializationServiceBuilder(com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder) SerializationService(com.hazelcast.spi.serialization.SerializationService) Data(com.hazelcast.nio.serialization.Data) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 44 with DefaultSerializationServiceBuilder

use of com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder in project hazelcast by hazelcast.

the class NearCacheConfigTest method testSerialization.

@Test
public void testSerialization() {
    config.setInvalidateOnChange(true);
    config.setCacheLocalEntries(true);
    config.setName("foobar");
    config.setInMemoryFormat(InMemoryFormat.NATIVE);
    config.setTimeToLiveSeconds(23);
    config.setMaxIdleSeconds(42);
    config.setLocalUpdatePolicy(NearCacheConfig.LocalUpdatePolicy.CACHE_ON_UPDATE);
    SerializationService serializationService = new DefaultSerializationServiceBuilder().build();
    Data serialized = serializationService.toData(config);
    NearCacheConfig deserialized = serializationService.toObject(serialized);
    assertEquals(config.isInvalidateOnChange(), deserialized.isInvalidateOnChange());
    assertEquals(config.isCacheLocalEntries(), deserialized.isCacheLocalEntries());
    assertEquals(config.getName(), deserialized.getName());
    assertEquals(config.getInMemoryFormat(), deserialized.getInMemoryFormat());
    assertEquals(config.getTimeToLiveSeconds(), deserialized.getTimeToLiveSeconds());
    assertEquals(config.getMaxIdleSeconds(), deserialized.getMaxIdleSeconds());
    assertEquals(config.getLocalUpdatePolicy(), deserialized.getLocalUpdatePolicy());
    assertEquals(config.getEvictionPolicy(), deserialized.getEvictionPolicy());
    assertEquals(config.getMaxSize(), deserialized.getMaxSize());
    assertEquals(config.toString(), deserialized.toString());
}
Also used : DefaultSerializationServiceBuilder(com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder) SerializationService(com.hazelcast.spi.serialization.SerializationService) Data(com.hazelcast.nio.serialization.Data) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 45 with DefaultSerializationServiceBuilder

use of com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder in project hazelcast by hazelcast.

the class NearCachePreloaderConfigTest method testSerialization.

@Test
public void testSerialization() {
    config.setEnabled(true);
    config.setDirectory("myParentDirectory");
    config.setStoreInitialDelaySeconds(23);
    config.setStoreIntervalSeconds(42);
    SerializationService serializationService = new DefaultSerializationServiceBuilder().build();
    Data serialized = serializationService.toData(config);
    NearCachePreloaderConfig deserialized = serializationService.toObject(serialized);
    assertEquals(config.isEnabled(), deserialized.isEnabled());
    assertEquals(config.getDirectory(), deserialized.getDirectory());
    assertEquals(config.getStoreInitialDelaySeconds(), deserialized.getStoreInitialDelaySeconds());
    assertEquals(config.getStoreIntervalSeconds(), deserialized.getStoreIntervalSeconds());
    assertEquals(config.toString(), deserialized.toString());
}
Also used : DefaultSerializationServiceBuilder(com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder) SerializationService(com.hazelcast.spi.serialization.SerializationService) Data(com.hazelcast.nio.serialization.Data) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

DefaultSerializationServiceBuilder (com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder)70 Test (org.junit.Test)56 QuickTest (com.hazelcast.test.annotation.QuickTest)55 SerializationService (com.hazelcast.spi.serialization.SerializationService)46 InternalSerializationService (com.hazelcast.internal.serialization.InternalSerializationService)22 ParallelTest (com.hazelcast.test.annotation.ParallelTest)18 HeapData (com.hazelcast.internal.serialization.impl.HeapData)16 Data (com.hazelcast.nio.serialization.Data)15 SerializationConfig (com.hazelcast.config.SerializationConfig)11 SerializationServiceBuilder (com.hazelcast.internal.serialization.SerializationServiceBuilder)6 ArrayList (java.util.ArrayList)6 SerializerConfig (com.hazelcast.config.SerializerConfig)5 Before (org.junit.Before)5 PartitioningStrategy (com.hazelcast.core.PartitioningStrategy)4 Config (com.hazelcast.config.Config)3 GlobalSerializerConfig (com.hazelcast.config.GlobalSerializerConfig)3 ObjectDataInput (com.hazelcast.nio.ObjectDataInput)3 ObjectDataOutput (com.hazelcast.nio.ObjectDataOutput)3 HashMap (java.util.HashMap)3 HazelcastThreadGroup (com.hazelcast.instance.HazelcastThreadGroup)2