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);
}
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();
}
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);
}
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;
}
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();
}
Aggregations