Search in sources :

Example 1 with Person

use of com.hazelcast.nio.serialization.SerializationConcurrencyTest.Person in project hazelcast by hazelcast.

the class SerializationTest method testArrayListSerialization.

@Test
public void testArrayListSerialization() {
    SerializationService ss = new DefaultSerializationServiceBuilder().build();
    ArrayList<Person> arrayList = new ArrayList<Person>();
    arrayList.add(new Person(35, 180, 100, "Orhan", null));
    arrayList.add(new Person(12, 120, 60, "Osman", null));
    Data data = ss.toData(arrayList);
    ArrayList deserialized = ss.toObject(data);
    assertTrue("Objects are not identical!", arrayList.equals(deserialized));
}
Also used : DefaultSerializationServiceBuilder(com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder) ArrayList(java.util.ArrayList) SerializationService(com.hazelcast.spi.serialization.SerializationService) HeapData(com.hazelcast.internal.serialization.impl.HeapData) Person(com.hazelcast.nio.serialization.SerializationConcurrencyTest.Person) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 2 with Person

use of com.hazelcast.nio.serialization.SerializationConcurrencyTest.Person in project hazelcast by hazelcast.

the class SerializationTest method testLinkedListSerialization.

@Test
public void testLinkedListSerialization() {
    SerializationService ss = new DefaultSerializationServiceBuilder().build();
    LinkedList<Person> linkedList = new LinkedList<Person>();
    linkedList.add(new Person(35, 180, 100, "Orhan", null));
    linkedList.add(new Person(12, 120, 60, "Osman", null));
    Data data = ss.toData(linkedList);
    LinkedList deserialized = ss.toObject(data);
    assertTrue("Objects are not identical!", linkedList.equals(deserialized));
}
Also used : DefaultSerializationServiceBuilder(com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder) SerializationService(com.hazelcast.spi.serialization.SerializationService) HeapData(com.hazelcast.internal.serialization.impl.HeapData) Person(com.hazelcast.nio.serialization.SerializationConcurrencyTest.Person) LinkedList(java.util.LinkedList) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

DefaultSerializationServiceBuilder (com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder)2 HeapData (com.hazelcast.internal.serialization.impl.HeapData)2 Person (com.hazelcast.nio.serialization.SerializationConcurrencyTest.Person)2 SerializationService (com.hazelcast.spi.serialization.SerializationService)2 QuickTest (com.hazelcast.test.annotation.QuickTest)2 Test (org.junit.Test)2 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1