Search in sources :

Example 31 with Data

use of com.hazelcast.nio.serialization.Data in project hazelcast by hazelcast.

the class ClusterDataSerializationTest method testSerializationOf_clusterStateChange_fromVersion.

@Test
public void testSerializationOf_clusterStateChange_fromVersion() {
    Data serialized = SERIALIZATION_SERVICE.toData(VERSION_CLUSTER_STATE_CHANGE);
    ClusterStateChange deserialized = SERIALIZATION_SERVICE.toObject(serialized);
    assertEquals(VERSION_CLUSTER_STATE_CHANGE, deserialized);
}
Also used : Data(com.hazelcast.nio.serialization.Data) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 32 with Data

use of com.hazelcast.nio.serialization.Data in project hazelcast by hazelcast.

the class SerializationServiceV1Test method testExtractOperationCallId_withIdentifiedOperation.

@Test
public void testExtractOperationCallId_withIdentifiedOperation() throws Exception {
    IdentifiedIoUtilTestOperation operation = new IdentifiedIoUtilTestOperation(1);
    OperationAccessor.setCallId(operation, 4223);
    Data data = serializationService.toData(operation);
    long callId = serializationService.initDataSerializableInputAndSkipTheHeader(data).readLong();
    assertEquals(4223, callId);
}
Also used : Data(com.hazelcast.nio.serialization.Data) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 33 with Data

use of com.hazelcast.nio.serialization.Data in project hazelcast by hazelcast.

the class BufferPoolTest method takeInputBuffer_whenPooledInstance.

// ======================= in ==========================================
@Test
public void takeInputBuffer_whenPooledInstance() {
    Data data = new HeapData(new byte[] {});
    BufferObjectDataInput found1 = bufferPool.takeInputBuffer(data);
    bufferPool.returnInputBuffer(found1);
    BufferObjectDataInput found2 = bufferPool.takeInputBuffer(data);
    assertSame(found1, found2);
}
Also used : Data(com.hazelcast.nio.serialization.Data) HeapData(com.hazelcast.internal.serialization.impl.HeapData) HeapData(com.hazelcast.internal.serialization.impl.HeapData) BufferObjectDataInput(com.hazelcast.nio.BufferObjectDataInput) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 34 with Data

use of com.hazelcast.nio.serialization.Data in project hazelcast by hazelcast.

the class SerializationServiceV1Test method test_callid_on_correct_stream_position.

@Test
public void test_callid_on_correct_stream_position() throws Exception {
    CancellationOperation operation = new CancellationOperation(UuidUtil.newUnsecureUuidString(), true);
    operation.setCallerUuid(UuidUtil.newUnsecureUuidString());
    OperationAccessor.setCallId(operation, 12345);
    Data data = serializationService.toData(operation);
    long callId = serializationService.initDataSerializableInputAndSkipTheHeader(data).readLong();
    assertEquals(12345, callId);
}
Also used : CancellationOperation(com.hazelcast.executor.impl.operations.CancellationOperation) Data(com.hazelcast.nio.serialization.Data) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 35 with Data

use of com.hazelcast.nio.serialization.Data in project hazelcast by hazelcast.

the class SerializationServiceV1Test method testExtractOperationCallId.

@Test
public void testExtractOperationCallId() throws Exception {
    IoUtilTestOperation operation = new IoUtilTestOperation(1);
    OperationAccessor.setCallId(operation, 2342);
    Data data = serializationService.toData(operation);
    long callId = serializationService.initDataSerializableInputAndSkipTheHeader(data).readLong();
    assertEquals(2342, callId);
}
Also used : Data(com.hazelcast.nio.serialization.Data) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

Data (com.hazelcast.nio.serialization.Data)773 ClientMessage (com.hazelcast.client.impl.protocol.ClientMessage)140 Test (org.junit.Test)121 QuickTest (com.hazelcast.test.annotation.QuickTest)118 ParallelTest (com.hazelcast.test.annotation.ParallelTest)108 ArrayList (java.util.ArrayList)81 Map (java.util.Map)64 SerializationService (com.hazelcast.spi.serialization.SerializationService)54 HashMap (java.util.HashMap)54 NodeEngine (com.hazelcast.spi.NodeEngine)50 HashSet (java.util.HashSet)39 Address (com.hazelcast.nio.Address)28 AbstractMap (java.util.AbstractMap)28 Record (com.hazelcast.map.impl.record.Record)27 HazelcastInstance (com.hazelcast.core.HazelcastInstance)26 HeapData (com.hazelcast.internal.serialization.impl.HeapData)26 List (java.util.List)20 Future (java.util.concurrent.Future)20 CacheEventData (com.hazelcast.cache.impl.CacheEventData)19 Operation (com.hazelcast.spi.Operation)18