use of com.hazelcast.internal.serialization.impl.portable.MainPortable in project hazelcast by hazelcast.
the class AbstractGenericRecordIntegrationTest method testPutWithoutFactory_readAsGenericRecord.
@Test
public void testPutWithoutFactory_readAsGenericRecord() {
MainPortable expectedPortable = createMainPortable();
GenericRecord expected = createGenericRecord(expectedPortable);
assertEquals(expectedPortable.c, expected.getChar("c"));
assertEquals(expectedPortable.f, expected.getFloat32("f"), 0.1);
HazelcastInstance[] instances = createCluster();
IMap<Object, Object> clusterMap = instances[0].getMap("test");
clusterMap.put(1, expected);
HazelcastInstance instance = createAccessorInstance(new SerializationConfig());
IMap<Object, Object> map = instance.getMap("test");
GenericRecord actual = (GenericRecord) map.get(1);
assertEquals(expected, actual);
}
use of com.hazelcast.internal.serialization.impl.portable.MainPortable in project hazelcast by hazelcast.
the class AbstractGenericRecordIntegrationTest method createMainPortable.
@Nonnull
private MainPortable createMainPortable() {
NamedPortable[] nn = new NamedPortable[2];
nn[0] = new NamedPortable("name", 123);
nn[1] = new NamedPortable("name", 123);
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, new BigDecimal[] { new BigDecimal("12345"), new BigDecimal("123456") }, new LocalTime[] { LocalTime.now(), LocalTime.now() }, new LocalDate[] { LocalDate.now(), LocalDate.now() }, new LocalDateTime[] { LocalDateTime.now() }, new OffsetDateTime[] { OffsetDateTime.now() });
return new MainPortable((byte) 113, true, 'x', (short) -500, 56789, -50992225L, 900.5678f, -897543.3678909d, "this is main portable object created for testing!", inner, new BigDecimal("12312313"), LocalTime.now(), LocalDate.now(), LocalDateTime.now(), OffsetDateTime.now());
}
use of com.hazelcast.internal.serialization.impl.portable.MainPortable in project hazelcast by hazelcast.
the class AbstractGenericRecordIntegrationTest method testPutWithoutFactory_readAsPortable.
@Test
public void testPutWithoutFactory_readAsPortable() {
MainPortable expectedPortable = createMainPortable();
GenericRecord expected = createGenericRecord(expectedPortable);
assertEquals(expectedPortable.c, expected.getChar("c"));
assertEquals(expectedPortable.f, expected.getFloat32("f"), 0.1);
HazelcastInstance[] instances = createCluster();
IMap<Object, Object> clusterMap = instances[0].getMap("test");
clusterMap.put(1, expected);
HazelcastInstance instance = createAccessorInstance(serializationConfig);
IMap<Object, Object> map = instance.getMap("test");
MainPortable actual = (MainPortable) map.get(1);
assertEquals(expectedPortable, actual);
}
use of com.hazelcast.internal.serialization.impl.portable.MainPortable in project hazelcast by hazelcast.
the class AbstractGenericRecordIntegrationTest method testToStringIsValidJson.
@Test
public void testToStringIsValidJson() {
MainPortable expectedPortable = createMainPortable();
GenericRecord expected = createGenericRecord(expectedPortable);
Json.parse(expected.toString());
}
Aggregations