use of com.hazelcast.internal.serialization.SerializationService in project hazelcast by hazelcast.
the class JetInitDataSerializerHookTest method testSerializerHook.
@Test
public void testSerializerHook() throws Exception {
assertFalse("Type implements java.io.Serializable", instance instanceof Serializable);
SerializationService serializationService = new DefaultSerializationServiceBuilder().build();
Data serialized = serializationService.toData(instance);
Object deserialized = serializationService.toObject(serialized);
assertNotSame("serialization/deserialization didn't take place", instance, deserialized);
// compare all field using reflection
compareFields(instance, deserialized, ignoredFields);
}
use of com.hazelcast.internal.serialization.SerializationService in project hazelcast by hazelcast.
the class OutboxImplTest method mockSerializationService.
private static SerializationService mockSerializationService() {
SerializationService mock = mock(SerializationService.class);
when(mock.toData(any())).thenReturn(mock(Data.class));
return mock;
}
use of com.hazelcast.internal.serialization.SerializationService in project hazelcast by hazelcast.
the class QueryCacheIMapEventHandlingTest method executeMergeOperation.
private void executeMergeOperation(HazelcastInstance member, String mapName, int key, int mergedValue) throws Exception {
Node node = getNode(member);
NodeEngineImpl nodeEngine = node.nodeEngine;
OperationServiceImpl operationService = nodeEngine.getOperationService();
SerializationService serializationService = getSerializationService(member);
Data keyData = serializationService.toData(key);
Data valueData = serializationService.toData(mergedValue);
SplitBrainMergeTypes.MapMergeTypes mergingEntry = createMergingEntry(serializationService, keyData, valueData, Mockito.mock(Record.class), ExpiryMetadata.NULL);
Operation mergeOperation = new MergeOperation(mapName, singletonList(mergingEntry), new PassThroughMergePolicy<>(), false);
int partitionId = nodeEngine.getPartitionService().getPartitionId(key);
Future<Object> future = operationService.invokeOnPartition(SERVICE_NAME, mergeOperation, partitionId);
future.get();
}
use of com.hazelcast.internal.serialization.SerializationService in project hazelcast by hazelcast.
the class WriteBehindQueueTest method createDelayedEntryList.
private List<DelayedEntry> createDelayedEntryList(int numberOfEntriesToCreate) {
List<DelayedEntry> list = new ArrayList<DelayedEntry>(numberOfEntriesToCreate);
SerializationService ss1 = new DefaultSerializationServiceBuilder().build();
long storeTime = Clock.currentTimeMillis();
for (int i = 0; i < numberOfEntriesToCreate; i++) {
final DelayedEntry<Data, Object> e = DelayedEntries.newDeletedEntry(ss1.toData(i), storeTime, i, null);
list.add(e);
}
return list;
}
use of com.hazelcast.internal.serialization.SerializationService in project hazelcast by hazelcast.
the class EntryViewTest method testEntryViewSerialization.
@Test
public void testEntryViewSerialization() {
ReplicatedMapEntryView entryView = createEntryView();
SerializationServiceBuilder serializationServiceBuilder = new DefaultSerializationServiceBuilder();
SerializationService serializationService = serializationServiceBuilder.build();
Data data = serializationService.toData(entryView);
ReplicatedMapEntryView deserialized = serializationService.toObject(data);
verifyFields(deserialized);
}
Aggregations