use of com.hazelcast.config.CompactSerializationConfig in project hazelcast by hazelcast.
the class ExtractionWithExtractorsSpecTest method doWithConfig.
@Override
public void doWithConfig(Config config) {
MapConfig mapConfig = config.getMapConfig("map");
AttributeConfig tattoosCount = new AttributeConfig();
tattoosCount.setName("tattoosCount");
tattoosCount.setExtractorClassName("com.hazelcast.internal.serialization.impl.compact.extractor.ExtractionWithExtractorsSpecTest$LimbTattoosCountExtractor");
mapConfig.addAttributeConfig(tattoosCount);
config.getSerializationConfig().setCompactSerializationConfig(new CompactSerializationConfig().setEnabled(true));
}
use of com.hazelcast.config.CompactSerializationConfig in project hazelcast by hazelcast.
the class ClientCompactTest method setup.
@Override
public void setup() {
member1 = factory.newHazelcastInstance(getConfig());
member2 = factory.newHazelcastInstance(getConfig());
ClientConfig clientConfig = new ClientConfig();
CompactSerializationConfig compactSerializationConfig = new CompactSerializationConfig();
clientConfig.getSerializationConfig().setCompactSerializationConfig(compactSerializationConfig.setEnabled(true));
instance1 = factory.newHazelcastClient(clientConfig);
instance2 = factory.newHazelcastClient(clientConfig);
}
use of com.hazelcast.config.CompactSerializationConfig in project hazelcast by hazelcast.
the class CompactStreamSerializerTest method createSerializationService.
private InternalSerializationService createSerializationService() {
CompactSerializationConfig compactSerializationConfig = new CompactSerializationConfig();
compactSerializationConfig.setEnabled(true);
return new DefaultSerializationServiceBuilder().setSchemaService(schemaService).setConfig(new SerializationConfig().setCompactSerializationConfig(compactSerializationConfig)).build();
}
use of com.hazelcast.config.CompactSerializationConfig in project hazelcast by hazelcast.
the class CompactWithSchemaStreamSerializerTest method createSerializationService.
private InternalSerializationService createSerializationService() {
SchemaService schemaService = CompactTestUtil.createInMemorySchemaService();
CompactSerializationConfig compactSerializationConfig = new CompactSerializationConfig();
compactSerializationConfig.setEnabled(true);
return new DefaultSerializationServiceBuilder().setSchemaService(schemaService).setConfig(new SerializationConfig().setCompactSerializationConfig(compactSerializationConfig)).build();
}
use of com.hazelcast.config.CompactSerializationConfig in project hazelcast by hazelcast.
the class CompactStreamSerializerValueReaderSpecTest method executeTestScenario.
@Test
@SuppressWarnings("unchecked")
public void executeTestScenario() throws Exception {
// handle result
Object resultToMatch = expectedResult;
if (expectedResult instanceof Class) {
// expected exception case
expected.expect(isA((Class) expectedResult));
} else if (expectedResult instanceof List) {
// just convenience -> if result is a list if will be compared to an array, so it has to be converted
resultToMatch = ((List) resultToMatch).toArray();
}
// print test scenario for debug purposes
// it makes debugging easier since all scenarios are generated
printlnScenarioDescription(resultToMatch);
SchemaService schemaService = CompactTestUtil.createInMemorySchemaService();
SerializationConfig serializationConfig = new SerializationConfig();
serializationConfig.setCompactSerializationConfig(new CompactSerializationConfig().setEnabled(true));
InternalSerializationService ss = new DefaultSerializationServiceBuilder().setConfig(serializationConfig).setSchemaService(schemaService).build();
Data data = ss.toData(inputObject);
GenericRecordQueryReader reader = new GenericRecordQueryReader(ss.readAsInternalGenericRecord(data));
Object result = reader.read(pathToRead);
if (result instanceof MultiResult) {
MultiResult multiResult = (MultiResult) result;
if (multiResult.getResults().size() == 1 && multiResult.getResults().get(0) == null && multiResult.isNullEmptyTarget()) {
// explode null in case of a single multi-result target result
result = null;
} else {
// in case of multi result while invoking generic "read" method deal with the multi results
result = ((MultiResult) result).getResults().toArray();
}
}
assertThat(result, equalTo(resultToMatch));
}
Aggregations