use of com.hazelcast.config.CompactSerializationConfig in project hazelcast by hazelcast.
the class ConfigFactoryTest method should_create_compact_serialization_config_with_reflective_serializer.
@Test
public void should_create_compact_serialization_config_with_reflective_serializer() {
Map<String, TriTuple<String, String, String>> registrations = new HashMap<>();
TriTuple<String, String, String> registration = TriTuple.of("a", "a", null);
registrations.put("a", 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 TestFullApplicationContext method testCompactSerializationConfig.
@Test
public void testCompactSerializationConfig() {
CompactSerializationConfig compactSerializationConfig = config.getSerializationConfig().getCompactSerializationConfig();
assertTrue(compactSerializationConfig.isEnabled());
Map<String, TriTuple<String, String, String>> namedRegistrations = CompactSerializationConfigAccessor.getNamedRegistrations(compactSerializationConfig);
assertEquals(2, namedRegistrations.size());
String reflectivelySerializableClassName = DummyReflectiveSerializable.class.getName();
TriTuple<String, String, String> reflectiveClassRegistration = TriTuple.of(reflectivelySerializableClassName, reflectivelySerializableClassName, null);
TriTuple<String, String, String> actualReflectiveRegistration = namedRegistrations.get(reflectivelySerializableClassName);
assertEquals(reflectiveClassRegistration, actualReflectiveRegistration);
String compactSerializableClassName = DummyCompactSerializable.class.getName();
String compactSerializerClassName = DummyCompactSerializer.class.getName();
String typeName = "dummy";
TriTuple<String, String, String> explicitClassRegistration = TriTuple.of(compactSerializableClassName, typeName, compactSerializerClassName);
TriTuple<String, String, String> actualExplicitRegistration = namedRegistrations.get(typeName);
assertEquals(explicitClassRegistration, actualExplicitRegistration);
}
use of com.hazelcast.config.CompactSerializationConfig in project hazelcast by hazelcast.
the class TestClientApplicationContext method tesCompactSerializationConfig.
@Test
public void tesCompactSerializationConfig() {
CompactSerializationConfig compactSerializationConfig = clientWithCompactSerialization.getClientConfig().getSerializationConfig().getCompactSerializationConfig();
assertTrue(compactSerializationConfig.isEnabled());
Map<String, TriTuple<String, String, String>> namedRegistrations = CompactSerializationConfigAccessor.getNamedRegistrations(compactSerializationConfig);
assertEquals(2, namedRegistrations.size());
String reflectivelySerializableClassName = DummyReflectiveSerializable.class.getName();
TriTuple<String, String, String> reflectiveClassRegistration = TriTuple.of(reflectivelySerializableClassName, reflectivelySerializableClassName, null);
TriTuple<String, String, String> actualReflectiveRegistration = namedRegistrations.get(reflectivelySerializableClassName);
assertEquals(reflectiveClassRegistration, actualReflectiveRegistration);
String compactSerializableClassName = DummyCompactSerializable.class.getName();
String compactSerializerClassName = DummyCompactSerializer.class.getName();
String typeName = "dummy";
TriTuple<String, String, String> explicitClassRegistration = TriTuple.of(compactSerializableClassName, typeName, compactSerializerClassName);
TriTuple<String, String, String> actualExplicitRegistration = namedRegistrations.get(typeName);
assertEquals(explicitClassRegistration, actualExplicitRegistration);
}
use of com.hazelcast.config.CompactSerializationConfig in project hazelcast by hazelcast.
the class RecordSerializationIntegrationTest method shouldSerializeAndDeserializeRecordWhenRegisteredExplicitly.
@Test
public void shouldSerializeAndDeserializeRecordWhenRegisteredExplicitly() {
CompactSerializationConfig compactSerializationConfig = new CompactSerializationConfig();
compactSerializationConfig.setEnabled(true).register(AllTypesRecord.class);
HazelcastInstance instance = getDriverWithConfig(compactSerializationConfig);
AllTypesRecord allTypesRecord = AllTypesRecord.create();
IMap<Integer, AllTypesRecord> map = instance.getMap(randomMapName());
map.put(1, allTypesRecord);
AllTypesRecord loaded = map.get(1);
assertThat(loaded).isEqualTo(allTypesRecord);
}
use of com.hazelcast.config.CompactSerializationConfig in project hazelcast by hazelcast.
the class QueryTest method tesObjectInMemoryFormatSupported_withoutClassConfig.
@Test
public void tesObjectInMemoryFormatSupported_withoutClassConfig() {
Config config = new Config();
MapConfig mapConfig = new MapConfig();
mapConfig.setName("map");
mapConfig.setInMemoryFormat(InMemoryFormat.OBJECT);
config.addMapConfig(mapConfig);
config.getSerializationConfig().setCompactSerializationConfig(new CompactSerializationConfig().setEnabled(true));
HazelcastInstance instance = createHazelcastInstance(config);
IMap map = instance.getMap("map");
map.put(1, BOND);
map.values(sql("name == Bond"));
}
Aggregations