Search in sources :

Example 6 with BoltProtocolV1

use of org.neo4j.bolt.v1.transport.BoltProtocolV1 in project neo4j by neo4j.

the class BoltProtocolV1Test method messageProcessingErrorIsLogged.

@Test
public void messageProcessingErrorIsLogged() throws IOException {
    RuntimeException error = new RuntimeException("Unexpected error!");
    ByteBuf data = newThrowingByteBuf(error);
    AssertableLogProvider assertableLogProvider = new AssertableLogProvider();
    SimpleLogService logService = new SimpleLogService(NullLogProvider.getInstance(), assertableLogProvider);
    BoltProtocolV1 protocol = new BoltProtocolV1(mock(BoltWorker.class), newChannelMock(), logService);
    protocol.handle(mock(ChannelHandlerContext.class), data);
    assertableLogProvider.assertExactly(inLog(BoltProtocolV1.class).error(equalTo("Failed to handle incoming Bolt message. Connection will be closed."), equalTo(error)));
}
Also used : SimpleLogService(org.neo4j.kernel.impl.logging.SimpleLogService) SynchronousBoltWorker(org.neo4j.bolt.v1.runtime.SynchronousBoltWorker) BoltWorker(org.neo4j.bolt.v1.runtime.BoltWorker) ChannelHandlerContext(io.netty.channel.ChannelHandlerContext) ByteBuf(io.netty.buffer.ByteBuf) AssertableLogProvider(org.neo4j.logging.AssertableLogProvider) Test(org.junit.Test)

Aggregations

SynchronousBoltWorker (org.neo4j.bolt.v1.runtime.SynchronousBoltWorker)5 ByteBuf (io.netty.buffer.ByteBuf)4 Channel (io.netty.channel.Channel)3 ChannelHandlerContext (io.netty.channel.ChannelHandlerContext)3 Test (org.junit.Test)3 BoltStateMachine (org.neo4j.bolt.v1.runtime.BoltStateMachine)3 BoltProtocolV1 (org.neo4j.bolt.v1.transport.BoltProtocolV1)3 HashMap (java.util.HashMap)2 BiFunction (java.util.function.BiFunction)2 BoltWorker (org.neo4j.bolt.v1.runtime.BoltWorker)2 ByteBufAllocator (io.netty.buffer.ByteBufAllocator)1 ProtocolChooser (org.neo4j.bolt.transport.ProtocolChooser)1 RecordingByteChannel (org.neo4j.bolt.v1.messaging.RecordingByteChannel)1 BoltConnectionDescriptor (org.neo4j.bolt.v1.runtime.BoltConnectionDescriptor)1 BoltResponseHandler (org.neo4j.bolt.v1.runtime.BoltResponseHandler)1 SimpleLogService (org.neo4j.kernel.impl.logging.SimpleLogService)1 AssertableLogProvider (org.neo4j.logging.AssertableLogProvider)1