use of com.hazelcast.spi.serialization.SerializationService in project hazelcast by hazelcast.
the class NearCachePreloaderConfigTest method testSerialization.
@Test
public void testSerialization() {
config.setEnabled(true);
config.setDirectory("myParentDirectory");
config.setStoreInitialDelaySeconds(23);
config.setStoreIntervalSeconds(42);
SerializationService serializationService = new DefaultSerializationServiceBuilder().build();
Data serialized = serializationService.toData(config);
NearCachePreloaderConfig deserialized = serializationService.toObject(serialized);
assertEquals(config.isEnabled(), deserialized.isEnabled());
assertEquals(config.getDirectory(), deserialized.getDirectory());
assertEquals(config.getStoreInitialDelaySeconds(), deserialized.getStoreInitialDelaySeconds());
assertEquals(config.getStoreIntervalSeconds(), deserialized.getStoreIntervalSeconds());
assertEquals(config.toString(), deserialized.toString());
}
use of com.hazelcast.spi.serialization.SerializationService in project hazelcast by hazelcast.
the class RingbufferStoreConfigTest method setStoreImplementation.
@Test
public void setStoreImplementation() {
SerializationService serializationService = new DefaultSerializationServiceBuilder().build();
RingbufferStore<Data> store = RingbufferStoreWrapper.create("name", config, OBJECT, serializationService, null);
config.setStoreImplementation(store);
assertEquals(store, config.getStoreImplementation());
}
use of com.hazelcast.spi.serialization.SerializationService in project hazelcast by hazelcast.
the class ClientMapProxy method submitToKeyInternal.
public void submitToKeyInternal(Data keyData, EntryProcessor entryProcessor, final ExecutionCallback callback) {
ClientMessage request = MapSubmitToKeyCodec.encodeRequest(name, toData(entryProcessor), keyData, getThreadId());
try {
ClientInvocationFuture future = invokeOnKeyOwner(request, keyData);
SerializationService serializationService = getContext().getSerializationService();
ClientDelegatingFuture clientDelegatingFuture = new ClientDelegatingFuture(future, serializationService, SUBMIT_TO_KEY_RESPONSE_DECODER);
clientDelegatingFuture.andThen(callback);
} catch (Exception e) {
throw rethrow(e);
}
}
use of com.hazelcast.spi.serialization.SerializationService in project hazelcast by hazelcast.
the class ClientMapReduceProxy method toObjectMap.
private Map toObjectMap(ClientMessage res) {
SerializationService serializationService = getContext().getSerializationService();
Collection<Map.Entry<Data, Data>> entries = MapReduceForCustomCodec.decodeResponse(res).response;
HashMap hashMap = new HashMap();
for (Map.Entry<Data, Data> entry : entries) {
Object key = serializationService.toObject(entry.getKey());
Object value = serializationService.toObject(entry.getValue());
hashMap.put(key, value);
}
return hashMap;
}
use of com.hazelcast.spi.serialization.SerializationService in project hazelcast by hazelcast.
the class ClientListProxy method listIterator.
@Override
public ListIterator<E> listIterator(int index) {
ClientMessage request = ListListIteratorCodec.encodeRequest(name, index);
ClientMessage response = invokeOnPartition(request);
ListListIteratorCodec.ResponseParameters resultParameters = ListListIteratorCodec.decodeResponse(response);
List<Data> resultCollection = resultParameters.response;
SerializationService serializationService = getContext().getSerializationService();
return new UnmodifiableLazyList<E>(resultCollection, serializationService).listIterator();
}
Aggregations