use of com.hazelcast.internal.serialization.SerializationService in project hazelcast by hazelcast.
the class PortableClassVersionTest method testDifferentClassVersions.
@Test
public void testDifferentClassVersions() {
SerializationService serializationService = new DefaultSerializationServiceBuilder().addPortableFactory(FACTORY_ID, new PortableFactory() {
public Portable create(int classId) {
return new NamedPortable();
}
}).build();
SerializationService serializationService2 = new DefaultSerializationServiceBuilder().addPortableFactory(FACTORY_ID, new PortableFactory() {
public Portable create(int classId) {
return new NamedPortableV2();
}
}).build();
testDifferentClassVersions(serializationService, serializationService2);
}
use of com.hazelcast.internal.serialization.SerializationService in project hazelcast by hazelcast.
the class PortableClassVersionTest method testDifferentClassAndServiceVersions.
@Test
public void testDifferentClassAndServiceVersions() {
SerializationService serializationService = new DefaultSerializationServiceBuilder().setPortableVersion(1).addPortableFactory(FACTORY_ID, new PortableFactory() {
public Portable create(int classId) {
return new NamedPortable();
}
}).build();
SerializationService serializationService2 = new DefaultSerializationServiceBuilder().setPortableVersion(2).addPortableFactory(FACTORY_ID, new PortableFactory() {
public Portable create(int classId) {
return new NamedPortableV2();
}
}).build();
testDifferentClassVersions(serializationService, serializationService2);
}
use of com.hazelcast.internal.serialization.SerializationService in project hazelcast by hazelcast.
the class ExplicitClassDefinitionRegistrationTest method test_classesWithSameClassIdInDifferentFactories.
@Test
public void test_classesWithSameClassIdInDifferentFactories() {
SerializationService ss = new DefaultSerializationServiceBuilder().addPortableFactory(MyPortableFactory1.ID, new MyPortableFactory1()).addPortableFactory(MyPortableFactory2.ID, new MyPortableFactory2()).addClassDefinition(new ClassDefinitionBuilder(MyPortableFactory1.ID, MyPortable1.ID).addStringField("stringField").build()).addClassDefinition(new ClassDefinitionBuilder(MyPortableFactory2.ID, MyPortable2.ID).addIntField("intField").build()).build();
MyPortable1 object = new MyPortable1("test");
Data data = ss.toData(object);
assertEquals(object, ss.toObject(data));
MyPortable2 object2 = new MyPortable2(1);
Data data2 = ss.toData(object2);
assertEquals(object2, ss.toObject(data2));
}
use of com.hazelcast.internal.serialization.SerializationService in project hazelcast by hazelcast.
the class CollectionUtilTest method testObjectToDataCollection_size.
@Test
public void testObjectToDataCollection_size() {
SerializationService serializationService = new DefaultSerializationServiceBuilder().build();
Collection<Object> list = new ArrayList<Object>();
list.add(1);
list.add("foo");
Collection<Data> dataCollection = objectToDataCollection(list, serializationService);
assertEquals(list.size(), dataCollection.size());
}
use of com.hazelcast.internal.serialization.SerializationService in project hazelcast by hazelcast.
the class ClientMapProxy method keySetWithPagingPredicate.
@SuppressWarnings("unchecked")
private Set keySetWithPagingPredicate(Predicate predicate) {
PagingPredicateImpl pagingPredicate = unwrapPagingPredicate(predicate);
pagingPredicate.setIterationType(IterationType.KEY);
PagingPredicateHolder pagingPredicateHolder = PagingPredicateHolder.of(predicate, getSerializationService());
ClientMessage request = MapKeySetWithPagingPredicateCodec.encodeRequest(name, pagingPredicateHolder);
ClientMessage response = invokeWithPredicate(request, predicate);
MapKeySetWithPagingPredicateCodec.ResponseParameters resultParameters = MapKeySetWithPagingPredicateCodec.decodeResponse(response);
SerializationService serializationService = getSerializationService();
pagingPredicate.setAnchorList(resultParameters.anchorDataList.asAnchorList(serializationService));
return new UnmodifiableLazySet(resultParameters.response, serializationService);
}
Aggregations