use of com.hazelcast.spi.serialization.SerializationService in project hazelcast by hazelcast.
the class EntryOperation method innerBeforeRun.
@Override
public void innerBeforeRun() throws Exception {
super.innerBeforeRun();
final SerializationService serializationService = getNodeEngine().getSerializationService();
final ManagedContext managedContext = serializationService.getManagedContext();
managedContext.initialize(entryProcessor);
}
use of com.hazelcast.spi.serialization.SerializationService in project hazelcast by hazelcast.
the class BinaryCompatibilityTest method readAndVerifyBinaries.
@Test
public void readAndVerifyBinaries() throws IOException {
String key = createObjectKey();
SerializationService serializationService = createSerializationService();
Object readObject = serializationService.toObject(dataMap.get(key));
boolean equals = equals(object, readObject);
if (!equals) {
System.out.println(object.getClass().getSimpleName() + " : " + object + " != " + readObject);
}
assertTrue(equals);
}
use of com.hazelcast.spi.serialization.SerializationService in project hazelcast by hazelcast.
the class PortableTest method testWriteObjectWithPortable.
@Test
public void testWriteObjectWithPortable() {
SerializationService serializationService = createSerializationService(1);
NamedPortable namedPortable = new NamedPortable("name", 2);
ObjectCarryingPortable objectCarryingPortable1 = new ObjectCarryingPortable(namedPortable);
Data data = serializationService.toData(objectCarryingPortable1);
ObjectCarryingPortable objectCarryingPortable2 = serializationService.toObject(data);
assertEquals(objectCarryingPortable1, objectCarryingPortable2);
}
use of com.hazelcast.spi.serialization.SerializationService in project hazelcast by hazelcast.
the class PortableTest method testBasics.
private void testBasics(ByteOrder order, boolean allowUnsafe) {
final SerializationService serializationService = createSerializationService(1, order, allowUnsafe);
final SerializationService serializationService2 = createSerializationService(2, order, allowUnsafe);
Data data;
NamedPortable[] nn = new NamedPortable[5];
for (int i = 0; i < nn.length; i++) {
nn[i] = new NamedPortable("named-portable-" + i, i);
}
NamedPortable np = nn[0];
data = serializationService.toData(np);
assertEquals(np, serializationService.toObject(data));
assertEquals(np, serializationService2.toObject(data));
InnerPortable inner = new InnerPortable(new byte[] { 0, 1, 2 }, new char[] { 'c', 'h', 'a', 'r' }, new short[] { 3, 4, 5 }, new int[] { 9, 8, 7, 6 }, new long[] { 0, 1, 5, 7, 9, 11 }, new float[] { 0.6543f, -3.56f, 45.67f }, new double[] { 456.456, 789.789, 321.321 }, nn);
data = serializationService.toData(inner);
assertEquals(inner, serializationService.toObject(data));
assertEquals(inner, serializationService2.toObject(data));
MainPortable main = new MainPortable((byte) 113, true, 'x', (short) -500, 56789, -50992225L, 900.5678f, -897543.3678909d, "this is main portable object created for testing!", inner);
data = serializationService.toData(main);
assertEquals(main, serializationService.toObject(data));
assertEquals(main, serializationService2.toObject(data));
}
use of com.hazelcast.spi.serialization.SerializationService in project hazelcast by hazelcast.
the class PortableTest method test_issue2172_WritePortableArray.
//https://github.com/hazelcast/hazelcast/issues/2172
@Test
public void test_issue2172_WritePortableArray() {
final SerializationService ss = new DefaultSerializationServiceBuilder().setInitialOutputBufferSize(16).build();
final TestObject2[] testObject2s = new TestObject2[100];
for (int i = 0; i < testObject2s.length; i++) {
testObject2s[i] = new TestObject2();
}
final TestObject1 testObject1 = new TestObject1(testObject2s);
ss.toData(testObject1);
}
Aggregations