Search in sources :

Example 1 with ResultHandler

use of org.neo4j.bolt.v3.messaging.ResultHandler in project neo4j by neo4j.

the class ResultHandlerTest method shouldPullTheResult.

@Test
void shouldPullTheResult() throws Throwable {
    BoltResponseMessageRecorder messageWriter = new BoltResponseMessageRecorder();
    ResultHandler handler = new ResultHandler(messageWriter, mock(BoltConnection.class), NullLog.getInstance());
    Value[] record1 = values("a", "b", "c");
    Value[] record2 = values("1", "2", "3");
    BoltResult result = new TestBoltResult(record1, record2);
    handler.onPullRecords(result, STREAM_LIMIT_UNLIMITED);
    handler.onFinish();
    List<ResponseMessage> messages = messageWriter.asList();
    assertThat(messages.size()).isEqualTo(3);
    assertThat(messages.get(0)).isEqualTo(new RecordMessage(record1));
    assertThat(messages.get(1)).isEqualTo(new RecordMessage(record2));
    assertThat(messages.get(2)).isInstanceOf(SuccessMessage.class);
}
Also used : BoltResponseMessageRecorder(org.neo4j.bolt.messaging.BoltResponseMessageRecorder) BoltConnection(org.neo4j.bolt.runtime.BoltConnection) AnyValue(org.neo4j.values.AnyValue) Value(org.neo4j.values.storable.Value) ResponseMessage(org.neo4j.bolt.messaging.ResponseMessage) RecordMessage(org.neo4j.bolt.v3.messaging.response.RecordMessage) BoltResult(org.neo4j.bolt.runtime.BoltResult) Test(org.junit.jupiter.api.Test)

Example 2 with ResultHandler

use of org.neo4j.bolt.v3.messaging.ResultHandler in project neo4j by neo4j.

the class BoltRequestMessageReaderV3 method buildDecoders.

private static List<RequestMessageDecoder> buildDecoders(BoltConnection connection, BoltResponseMessageWriter responseMessageWriter, LogService logService) {
    BoltResponseHandler resultHandler = new ResultHandler(responseMessageWriter, connection, internalLog(logService));
    BoltResponseHandler defaultHandler = newSimpleResponseHandler(responseMessageWriter, connection, logService);
    return Arrays.asList(new HelloMessageDecoder(defaultHandler), new RunMessageDecoder(defaultHandler), new DiscardAllMessageDecoder(resultHandler), new PullAllMessageDecoder(resultHandler), new BeginMessageDecoder(defaultHandler), new CommitMessageDecoder(resultHandler), new RollbackMessageDecoder(resultHandler), new ResetMessageDecoder(connection, defaultHandler), new GoodbyeMessageDecoder(connection, defaultHandler));
}
Also used : DiscardAllMessageDecoder(org.neo4j.bolt.v3.messaging.decoder.DiscardAllMessageDecoder) PullAllMessageDecoder(org.neo4j.bolt.v3.messaging.decoder.PullAllMessageDecoder) RollbackMessageDecoder(org.neo4j.bolt.v3.messaging.decoder.RollbackMessageDecoder) HelloMessageDecoder(org.neo4j.bolt.v3.messaging.decoder.HelloMessageDecoder) GoodbyeMessageDecoder(org.neo4j.bolt.v3.messaging.decoder.GoodbyeMessageDecoder) BoltResponseHandler(org.neo4j.bolt.runtime.BoltResponseHandler) ResetMessageDecoder(org.neo4j.bolt.v3.messaging.decoder.ResetMessageDecoder) CommitMessageDecoder(org.neo4j.bolt.v3.messaging.decoder.CommitMessageDecoder) BeginMessageDecoder(org.neo4j.bolt.v3.messaging.decoder.BeginMessageDecoder) RunMessageDecoder(org.neo4j.bolt.v3.messaging.decoder.RunMessageDecoder)

Example 3 with ResultHandler

use of org.neo4j.bolt.v3.messaging.ResultHandler in project neo4j by neo4j.

the class BoltRequestMessageReaderV41 method buildDecoders.

private static List<RequestMessageDecoder> buildDecoders(BoltConnection connection, BoltResponseMessageWriter responseMessageWriter, BookmarksParser bookmarksParser, LogService logService) {
    BoltResponseHandler resultHandler = new ResultHandler(responseMessageWriter, connection, internalLog(logService));
    BoltResponseHandler defaultHandler = newSimpleResponseHandler(responseMessageWriter, connection, logService);
    return Arrays.asList(// NEW
    new HelloMessageDecoder(defaultHandler), new RunMessageDecoder(defaultHandler, bookmarksParser), new DiscardMessageDecoder(resultHandler), new PullMessageDecoder(resultHandler), new BeginMessageDecoder(defaultHandler, bookmarksParser), new CommitMessageDecoder(resultHandler), new RollbackMessageDecoder(resultHandler), new ResetMessageDecoder(connection, defaultHandler), new GoodbyeMessageDecoder(connection, defaultHandler));
}
Also used : DiscardMessageDecoder(org.neo4j.bolt.v4.messaging.DiscardMessageDecoder) RollbackMessageDecoder(org.neo4j.bolt.v3.messaging.decoder.RollbackMessageDecoder) HelloMessageDecoder(org.neo4j.bolt.v41.messaging.decoder.HelloMessageDecoder) GoodbyeMessageDecoder(org.neo4j.bolt.v3.messaging.decoder.GoodbyeMessageDecoder) BoltResponseHandler(org.neo4j.bolt.runtime.BoltResponseHandler) ResetMessageDecoder(org.neo4j.bolt.v3.messaging.decoder.ResetMessageDecoder) ResultHandler(org.neo4j.bolt.v3.messaging.ResultHandler) CommitMessageDecoder(org.neo4j.bolt.v3.messaging.decoder.CommitMessageDecoder) PullMessageDecoder(org.neo4j.bolt.v4.messaging.PullMessageDecoder) BeginMessageDecoder(org.neo4j.bolt.v4.messaging.BeginMessageDecoder) RunMessageDecoder(org.neo4j.bolt.v4.messaging.RunMessageDecoder)

Example 4 with ResultHandler

use of org.neo4j.bolt.v3.messaging.ResultHandler in project neo4j by neo4j.

the class BoltRequestMessageReaderV43 method buildDecoders.

private static List<RequestMessageDecoder> buildDecoders(BoltConnection connection, BoltResponseMessageWriter responseMessageWriter, BookmarksParser bookmarksParser, LogService logService) {
    BoltResponseHandler resultHandler = new ResultHandler(responseMessageWriter, connection, internalLog(logService));
    BoltResponseHandler defaultHandler = newSimpleResponseHandler(responseMessageWriter, connection, logService);
    return Arrays.asList(new HelloMessageDecoder(defaultHandler), new RunMessageDecoder(defaultHandler, bookmarksParser), new DiscardMessageDecoder(resultHandler), new PullMessageDecoder(resultHandler), new BeginMessageDecoder(defaultHandler, bookmarksParser), new CommitMessageDecoder(resultHandler), new RollbackMessageDecoder(resultHandler), new ResetMessageDecoder(connection, defaultHandler), new GoodbyeMessageDecoder(connection, defaultHandler), // New in 4.3
    new RouteMessageDecoder(defaultHandler, bookmarksParser));
}
Also used : DiscardMessageDecoder(org.neo4j.bolt.v4.messaging.DiscardMessageDecoder) RollbackMessageDecoder(org.neo4j.bolt.v3.messaging.decoder.RollbackMessageDecoder) HelloMessageDecoder(org.neo4j.bolt.v41.messaging.decoder.HelloMessageDecoder) GoodbyeMessageDecoder(org.neo4j.bolt.v3.messaging.decoder.GoodbyeMessageDecoder) BoltResponseHandler(org.neo4j.bolt.runtime.BoltResponseHandler) ResetMessageDecoder(org.neo4j.bolt.v3.messaging.decoder.ResetMessageDecoder) RouteMessageDecoder(org.neo4j.bolt.v43.messaging.decoder.RouteMessageDecoder) ResultHandler(org.neo4j.bolt.v3.messaging.ResultHandler) CommitMessageDecoder(org.neo4j.bolt.v3.messaging.decoder.CommitMessageDecoder) PullMessageDecoder(org.neo4j.bolt.v4.messaging.PullMessageDecoder) BeginMessageDecoder(org.neo4j.bolt.v4.messaging.BeginMessageDecoder) RunMessageDecoder(org.neo4j.bolt.v4.messaging.RunMessageDecoder)

Example 5 with ResultHandler

use of org.neo4j.bolt.v3.messaging.ResultHandler in project neo4j by neo4j.

the class BoltRequestMessageReaderV4 method buildDecoders.

private static List<RequestMessageDecoder> buildDecoders(BoltConnection connection, BoltResponseMessageWriter responseMessageWriter, BookmarksParser bookmarksParser, LogService logService) {
    BoltResponseHandler resultHandler = new ResultHandler(responseMessageWriter, connection, internalLog(logService));
    BoltResponseHandler defaultHandler = newSimpleResponseHandler(responseMessageWriter, connection, logService);
    return Arrays.asList(new HelloMessageDecoder(defaultHandler), // New
    new RunMessageDecoder(defaultHandler, bookmarksParser), // New
    new DiscardMessageDecoder(resultHandler), // New
    new PullMessageDecoder(resultHandler), // New
    new BeginMessageDecoder(defaultHandler, bookmarksParser), new CommitMessageDecoder(resultHandler), new RollbackMessageDecoder(resultHandler), new ResetMessageDecoder(connection, defaultHandler), new GoodbyeMessageDecoder(connection, defaultHandler));
}
Also used : RollbackMessageDecoder(org.neo4j.bolt.v3.messaging.decoder.RollbackMessageDecoder) HelloMessageDecoder(org.neo4j.bolt.v3.messaging.decoder.HelloMessageDecoder) GoodbyeMessageDecoder(org.neo4j.bolt.v3.messaging.decoder.GoodbyeMessageDecoder) BoltResponseHandler(org.neo4j.bolt.runtime.BoltResponseHandler) ResetMessageDecoder(org.neo4j.bolt.v3.messaging.decoder.ResetMessageDecoder) ResultHandler(org.neo4j.bolt.v3.messaging.ResultHandler) CommitMessageDecoder(org.neo4j.bolt.v3.messaging.decoder.CommitMessageDecoder)

Aggregations

BoltResponseHandler (org.neo4j.bolt.runtime.BoltResponseHandler)4 CommitMessageDecoder (org.neo4j.bolt.v3.messaging.decoder.CommitMessageDecoder)4 GoodbyeMessageDecoder (org.neo4j.bolt.v3.messaging.decoder.GoodbyeMessageDecoder)4 ResetMessageDecoder (org.neo4j.bolt.v3.messaging.decoder.ResetMessageDecoder)4 RollbackMessageDecoder (org.neo4j.bolt.v3.messaging.decoder.RollbackMessageDecoder)4 ResultHandler (org.neo4j.bolt.v3.messaging.ResultHandler)3 HelloMessageDecoder (org.neo4j.bolt.v3.messaging.decoder.HelloMessageDecoder)2 BeginMessageDecoder (org.neo4j.bolt.v4.messaging.BeginMessageDecoder)2 DiscardMessageDecoder (org.neo4j.bolt.v4.messaging.DiscardMessageDecoder)2 PullMessageDecoder (org.neo4j.bolt.v4.messaging.PullMessageDecoder)2 RunMessageDecoder (org.neo4j.bolt.v4.messaging.RunMessageDecoder)2 HelloMessageDecoder (org.neo4j.bolt.v41.messaging.decoder.HelloMessageDecoder)2 Test (org.junit.jupiter.api.Test)1 BoltResponseMessageRecorder (org.neo4j.bolt.messaging.BoltResponseMessageRecorder)1 ResponseMessage (org.neo4j.bolt.messaging.ResponseMessage)1 BoltConnection (org.neo4j.bolt.runtime.BoltConnection)1 BoltResult (org.neo4j.bolt.runtime.BoltResult)1 BeginMessageDecoder (org.neo4j.bolt.v3.messaging.decoder.BeginMessageDecoder)1 DiscardAllMessageDecoder (org.neo4j.bolt.v3.messaging.decoder.DiscardAllMessageDecoder)1 PullAllMessageDecoder (org.neo4j.bolt.v3.messaging.decoder.PullAllMessageDecoder)1