use of org.neo4j.bolt.messaging.ResponseMessage 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);
}
use of org.neo4j.bolt.messaging.ResponseMessage in project neo4j by neo4j.
the class ResultHandlerTest method shouldDiscardTheResult.
@Test
void shouldDiscardTheResult() 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.onDiscardRecords(result, STREAM_LIMIT_UNLIMITED);
handler.onFinish();
List<ResponseMessage> messages = messageWriter.asList();
assertThat(messages.size()).isEqualTo(1);
assertThat(messages.get(0)).isInstanceOf(SuccessMessage.class);
}
use of org.neo4j.bolt.messaging.ResponseMessage in project neo4j by neo4j.
the class MessageConditions method serialize.
public static byte[] serialize(Neo4jPack neo4jPack, ResponseMessage... messages) throws IOException {
RecordingByteChannel rawData = new RecordingByteChannel();
BufferedChannelOutput output = new BufferedChannelOutput(rawData);
BoltResponseMessageWriter writer = new BoltResponseMessageWriterV3(neo4jPack::newPacker, output, NullLogService.getInstance());
for (ResponseMessage message : messages) {
writer.write(message);
}
writer.flush();
return rawData.getBytes();
}
Aggregations