Search in sources :

Example 61 with Packet

use of com.hazelcast.internal.nio.Packet in project hazelcast by hazelcast.

the class PacketDispatcherTest method whenUrgentOperationResponsePacket.

@Test
public void whenUrgentOperationResponsePacket() {
    Packet packet = new Packet().setPacketType(Packet.Type.OPERATION).raiseFlags(FLAG_OP_RESPONSE | FLAG_URGENT);
    dispatcher.accept(packet);
    verify(responseHandler).accept(packet);
    verifyZeroInteractions(operationExecutor, eventService, invocationMonitor, jetService);
}
Also used : Packet(com.hazelcast.internal.nio.Packet) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 62 with Packet

use of com.hazelcast.internal.nio.Packet in project hazelcast by hazelcast.

the class PacketDispatcherTest method whenJetPacket.

@Test
public void whenJetPacket() {
    Packet packet = new Packet().setPacketType(Packet.Type.JET);
    dispatcher.accept(packet);
    verify(jetService).accept(packet);
    verifyZeroInteractions(responseHandler, operationExecutor, eventService, invocationMonitor);
}
Also used : Packet(com.hazelcast.internal.nio.Packet) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 63 with Packet

use of com.hazelcast.internal.nio.Packet in project hazelcast by hazelcast.

the class PacketDispatcherTest method whenProblemHandlingPacket_thenSwallowed.

// when one of the handlers throws an exception, the exception is logged but not rethrown
@Test
public void whenProblemHandlingPacket_thenSwallowed() {
    Packet packet = new Packet().setPacketType(Packet.Type.OPERATION);
    Mockito.doThrow(new ExpectedRuntimeException()).when(operationExecutor).accept(packet);
    dispatcher.accept(packet);
}
Also used : Packet(com.hazelcast.internal.nio.Packet) ExpectedRuntimeException(com.hazelcast.test.ExpectedRuntimeException) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 64 with Packet

use of com.hazelcast.internal.nio.Packet in project hazelcast by hazelcast.

the class PacketDispatcherTest method whenUrgentOperationPacket.

@Test
public void whenUrgentOperationPacket() {
    Packet packet = new Packet().setPacketType(Packet.Type.OPERATION).raiseFlags(FLAG_URGENT);
    dispatcher.accept(packet);
    verify(operationExecutor).accept(packet);
    verifyZeroInteractions(responseHandler, eventService, invocationMonitor, jetService);
}
Also used : Packet(com.hazelcast.internal.nio.Packet) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 65 with Packet

use of com.hazelcast.internal.nio.Packet in project hazelcast by hazelcast.

the class HazelcastTestSupport method toPacket.

// ###########################################
// ########## implementation getter ##########
// ###########################################
public static Packet toPacket(HazelcastInstance local, HazelcastInstance remote, Operation operation) {
    InternalSerializationService serializationService = Accessors.getSerializationService(local);
    ServerConnectionManager connectionManager = Accessors.getConnectionManager(local);
    return new Packet(serializationService.toBytes(operation), operation.getPartitionId()).setPacketType(Packet.Type.OPERATION).setConn(connectionManager.get(Accessors.getAddress(remote)));
}
Also used : Packet(com.hazelcast.internal.nio.Packet) ServerConnectionManager(com.hazelcast.internal.server.ServerConnectionManager) InternalSerializationService(com.hazelcast.internal.serialization.InternalSerializationService)

Aggregations

Packet (com.hazelcast.internal.nio.Packet)65 Test (org.junit.Test)46 QuickTest (com.hazelcast.test.annotation.QuickTest)41 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)19 Operation (com.hazelcast.spi.impl.operationservice.Operation)11 ByteBuffer (java.nio.ByteBuffer)10 NormalResponse (com.hazelcast.spi.impl.operationservice.impl.responses.NormalResponse)9 AssertTask (com.hazelcast.test.AssertTask)6 PacketIOHelper (com.hazelcast.internal.nio.PacketIOHelper)5 SerializationConcurrencyTest (com.hazelcast.internal.serialization.impl.SerializationConcurrencyTest)3 OperationRunner (com.hazelcast.spi.impl.operationexecutor.OperationRunner)3 IOException (java.io.IOException)3 Address (com.hazelcast.cluster.Address)2 MemberHandshake (com.hazelcast.internal.cluster.impl.MemberHandshake)2 HandlerStatus (com.hazelcast.internal.networking.HandlerStatus)2 InternalSerializationService (com.hazelcast.internal.serialization.InternalSerializationService)2 HeapData (com.hazelcast.internal.serialization.impl.HeapData)2 ServerConnection (com.hazelcast.internal.server.ServerConnection)2 ServerConnectionManager (com.hazelcast.internal.server.ServerConnectionManager)2 OperationRunnerFactory (com.hazelcast.spi.impl.operationexecutor.OperationRunnerFactory)2