Search in sources :

Example 1 with ErrorMessage

use of io.pravega.shared.protocol.netty.WireCommands.ErrorMessage in project pravega by pravega.

the class RawClientTest method testRecvErrorMessage.

@Test
public void testRecvErrorMessage() {
    PravegaNodeUri endpoint = new PravegaNodeUri("localhost", -1);
    @Cleanup MockConnectionFactoryImpl connectionFactory = new MockConnectionFactoryImpl();
    @Cleanup MockController controller = new MockController(endpoint.getEndpoint(), endpoint.getPort(), connectionFactory, true);
    ClientConnection connection = Mockito.mock(ClientConnection.class);
    connectionFactory.provideConnection(endpoint, connection);
    Segment segment = new Segment("scope", "testHello", 0);
    @Cleanup RawClient rawClient = new RawClient(controller, connectionFactory, segment);
    ReplyProcessor processor = connectionFactory.getProcessor(endpoint);
    WireCommands.ErrorMessage reply = new ErrorMessage(requestId, segment.getScopedName(), "error.", ErrorMessage.ErrorCode.ILLEGAL_ARGUMENT_EXCEPTION);
    processor.process(reply);
    Mockito.verify(connection).close();
}
Also used : ErrorMessage(io.pravega.shared.protocol.netty.WireCommands.ErrorMessage) PravegaNodeUri(io.pravega.shared.protocol.netty.PravegaNodeUri) MockConnectionFactoryImpl(io.pravega.client.stream.mock.MockConnectionFactoryImpl) MockController(io.pravega.client.stream.mock.MockController) WireCommands(io.pravega.shared.protocol.netty.WireCommands) ErrorMessage(io.pravega.shared.protocol.netty.WireCommands.ErrorMessage) Cleanup(lombok.Cleanup) Segment(io.pravega.client.segment.impl.Segment) ReplyProcessor(io.pravega.shared.protocol.netty.ReplyProcessor) Test(org.junit.Test)

Aggregations

Segment (io.pravega.client.segment.impl.Segment)1 MockConnectionFactoryImpl (io.pravega.client.stream.mock.MockConnectionFactoryImpl)1 MockController (io.pravega.client.stream.mock.MockController)1 PravegaNodeUri (io.pravega.shared.protocol.netty.PravegaNodeUri)1 ReplyProcessor (io.pravega.shared.protocol.netty.ReplyProcessor)1 WireCommands (io.pravega.shared.protocol.netty.WireCommands)1 ErrorMessage (io.pravega.shared.protocol.netty.WireCommands.ErrorMessage)1 Cleanup (lombok.Cleanup)1 Test (org.junit.Test)1