Search in sources :

Example 26 with HeapData

use of com.hazelcast.internal.serialization.impl.HeapData in project hazelcast by hazelcast.

the class EntryEventDataCacheTest method eventDataExcludingValues_whenDataIncludingValuesAreCached.

@Test
public void eventDataExcludingValues_whenDataIncludingValuesAreCached() throws Exception {
    // when: no EntryEventData values have been created
    EntryEventData eed = instance.getOrCreateEventData("test", ADDRESS, new HeapData(), new Object(), new Object(), new Object(), EntryEventType.ADDED.getType(), true);
    // then: the cache is empty & eventDataIncludingValues returns null or empty collection
    assertTrue(instance.eventDataExcludingValues() == null || instance.eventDataExcludingValues().isEmpty());
}
Also used : Matchers.anyObject(org.mockito.Matchers.anyObject) HeapData(com.hazelcast.internal.serialization.impl.HeapData) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 27 with HeapData

use of com.hazelcast.internal.serialization.impl.HeapData in project hazelcast by hazelcast.

the class EntryEventDataCacheTest method isEmpty_whenEntryEventDataHaveBeenCreated.

@Test
public void isEmpty_whenEntryEventDataHaveBeenCreated() throws Exception {
    // when: EntryEventData have been getOrCreate'd
    instance.getOrCreateEventData("test", ADDRESS, new HeapData(), new Object(), new Object(), new Object(), EntryEventType.ADDED.getType(), false);
    // then: the cache is not empty
    assertFalse(instance.isEmpty());
}
Also used : Matchers.anyObject(org.mockito.Matchers.anyObject) HeapData(com.hazelcast.internal.serialization.impl.HeapData) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 28 with HeapData

use of com.hazelcast.internal.serialization.impl.HeapData in project hazelcast by hazelcast.

the class OutboundResponseHandlerTest method testToBackupAckPacket.

private void testToBackupAckPacket(int callId, boolean urgent) {
    Packet packet = handler.toBackupAckPacket(callId, urgent);
    HeapData expected = serializationService.toData(new BackupAckResponse(callId, urgent));
    assertEquals(expected, new HeapData(packet.toByteArray()));
}
Also used : Packet(com.hazelcast.internal.nio.Packet) BackupAckResponse(com.hazelcast.spi.impl.operationservice.impl.responses.BackupAckResponse) HeapData(com.hazelcast.internal.serialization.impl.HeapData)

Aggregations

HeapData (com.hazelcast.internal.serialization.impl.HeapData)28 QuickTest (com.hazelcast.test.annotation.QuickTest)18 Test (org.junit.Test)18 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)13 Matchers.anyObject (org.mockito.Matchers.anyObject)7 Data (com.hazelcast.internal.serialization.Data)6 BufferObjectDataInput (com.hazelcast.internal.nio.BufferObjectDataInput)4 ClientMessage (com.hazelcast.client.impl.protocol.ClientMessage)2 HandlerStatus (com.hazelcast.internal.networking.HandlerStatus)2 Packet (com.hazelcast.internal.nio.Packet)2 SerializationService (com.hazelcast.spi.serialization.SerializationService)2 ByteBuffer (java.nio.ByteBuffer)2 AtomicReference (java.util.concurrent.atomic.AtomicReference)2 Before (org.junit.Before)2 MapPutCodec (com.hazelcast.client.impl.protocol.codec.MapPutCodec)1 PartitioningStrategy (com.hazelcast.core.PartitioningStrategy)1 DefaultSerializationServiceBuilder (com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder)1 MapUtil.createHashMap (com.hazelcast.internal.util.MapUtil.createHashMap)1 CustomByteArrayOutputStream (com.hazelcast.jet.impl.util.AsyncSnapshotWriterImpl.CustomByteArrayOutputStream)1 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)1