Search in sources :

Example 1 with CompactSerializationConfig

use of com.hazelcast.config.CompactSerializationConfig in project hazelcast by hazelcast.

the class RecordSerializationWithMemberIntegrationTest method getDriverWithConfig.

@Override
public HazelcastInstance getDriverWithConfig(CompactSerializationConfig compactSerializationConfig) {
    Config config = smallInstanceConfig();
    config.getSerializationConfig().setCompactSerializationConfig(compactSerializationConfig);
    return factory.newHazelcastInstance(config);
}
Also used : Config(com.hazelcast.config.Config) CompactSerializationConfig(com.hazelcast.config.CompactSerializationConfig)

Example 2 with CompactSerializationConfig

use of com.hazelcast.config.CompactSerializationConfig in project hazelcast by hazelcast.

the class RecordSerializationTest method createSerializationService.

@Before
public void createSerializationService() {
    CompactSerializationConfig compactSerializationConfig = new CompactSerializationConfig();
    compactSerializationConfig.setEnabled(true);
    service = new DefaultSerializationServiceBuilder().setSchemaService(schemaService).setConfig(new SerializationConfig().setCompactSerializationConfig(compactSerializationConfig)).build();
}
Also used : DefaultSerializationServiceBuilder(com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder) CompactSerializationConfig(com.hazelcast.config.CompactSerializationConfig) SerializationConfig(com.hazelcast.config.SerializationConfig) CompactSerializationConfig(com.hazelcast.config.CompactSerializationConfig) Before(org.junit.Before)

Example 3 with CompactSerializationConfig

use of com.hazelcast.config.CompactSerializationConfig in project hazelcast by hazelcast.

the class ConfigFactoryTest method should_create_compact_serialization_config.

@Test
public void should_create_compact_serialization_config() {
    Map<String, TriTuple<String, String, String>> registrations = new HashMap<>();
    TriTuple<String, String, String> registration = TriTuple.of("a", "b", "c");
    registrations.put("b", registration);
    CompactSerializationConfig config = ConfigFactory.newCompactSerializationConfig(true, registrations);
    assertThat(config.isEnabled()).isTrue();
    assertThat(CompactSerializationConfigAccessor.getNamedRegistrations(config)).isEqualTo(registrations);
}
Also used : TriTuple(com.hazelcast.internal.util.TriTuple) CompactSerializationConfig(com.hazelcast.config.CompactSerializationConfig) HashMap(java.util.HashMap) Test(org.junit.Test)

Example 4 with CompactSerializationConfig

use of com.hazelcast.config.CompactSerializationConfig in project hazelcast by hazelcast.

the class ConfigFactory method newCompactSerializationConfig.

public static CompactSerializationConfig newCompactSerializationConfig(boolean isEnabled, Map<String, TriTuple<String, String, String>> registrations) {
    CompactSerializationConfig config = new CompactSerializationConfig();
    config.setEnabled(isEnabled);
    for (TriTuple<String, String, String> registration : registrations.values()) {
        String className = registration.element1;
        String typeName = registration.element2;
        String serializerName = registration.element3;
        if (serializerName != null) {
            CompactSerializationConfigAccessor.registerExplicitSerializer(config, className, typeName, serializerName);
        } else {
            CompactSerializationConfigAccessor.registerReflectiveSerializer(config, className);
        }
    }
    return config;
}
Also used : CompactSerializationConfig(com.hazelcast.config.CompactSerializationConfig)

Example 5 with CompactSerializationConfig

use of com.hazelcast.config.CompactSerializationConfig in project hazelcast by hazelcast.

the class ClientConfigXmlGenerator method compactSerialization.

private static void compactSerialization(XmlGenerator gen, SerializationConfig serializationConfig) {
    CompactSerializationConfig compactSerializationConfig = serializationConfig.getCompactSerializationConfig();
    if (!compactSerializationConfig.isEnabled()) {
        return;
    }
    gen.open("compact-serialization", "enabled", compactSerializationConfig.isEnabled());
    Map<String, TriTuple<Class, String, CompactSerializer>> registrations = CompactSerializationConfigAccessor.getRegistrations(compactSerializationConfig);
    Map<String, TriTuple<String, String, String>> namedRegistries = CompactSerializationConfigAccessor.getNamedRegistrations(compactSerializationConfig);
    if (!MapUtil.isNullOrEmpty(registrations) || !MapUtil.isNullOrEmpty(namedRegistries)) {
        gen.open("registered-classes");
        appendRegisteredClasses(gen, registrations);
        appendNamedRegisteredClasses(gen, namedRegistries);
        gen.close();
    }
    gen.close();
}
Also used : TriTuple(com.hazelcast.internal.util.TriTuple) CompactSerializationConfig(com.hazelcast.config.CompactSerializationConfig)

Aggregations

CompactSerializationConfig (com.hazelcast.config.CompactSerializationConfig)30 Test (org.junit.Test)12 SerializationConfig (com.hazelcast.config.SerializationConfig)10 DefaultSerializationServiceBuilder (com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder)10 QuickTest (com.hazelcast.test.annotation.QuickTest)9 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)8 Config (com.hazelcast.config.Config)7 TriTuple (com.hazelcast.internal.util.TriTuple)6 MapConfig (com.hazelcast.config.MapConfig)5 HazelcastInstance (com.hazelcast.core.HazelcastInstance)5 IndexConfig (com.hazelcast.config.IndexConfig)4 Data (com.hazelcast.internal.serialization.Data)4 InternalSerializationService (com.hazelcast.internal.serialization.InternalSerializationService)4 ClientConfig (com.hazelcast.client.config.ClientConfig)3 IMap (com.hazelcast.map.IMap)3 Before (org.junit.Before)3 Node (org.w3c.dom.Node)3 GenericRecordQueryReader (com.hazelcast.internal.serialization.impl.GenericRecordQueryReader)2 SchemaService (com.hazelcast.internal.serialization.impl.compact.SchemaService)2 CompactReader (com.hazelcast.nio.serialization.compact.CompactReader)2