use of org.neo4j.bolt.v3.messaging.request.RunMessage in project neo4j by neo4j.
the class TransactionReadyStateIT method shouldMoveToStreamingOnRun_succ.
@Test
void shouldMoveToStreamingOnRun_succ() throws Throwable {
// Given
BoltStateMachineV3 machine = getBoltStateMachineInTxReadyState();
// When
BoltResponseRecorder recorder = new BoltResponseRecorder();
machine.process(new RunMessage("CREATE (n {k:'k'}) RETURN n.k", EMPTY_PARAMS), recorder);
// Then
RecordedBoltResponse response = recorder.nextResponse();
assertTrue(response.hasMetadata("fields"));
assertTrue(response.hasMetadata("t_first"));
assertThat(machine.state()).isInstanceOf(TransactionStreamingState.class);
}
use of org.neo4j.bolt.v3.messaging.request.RunMessage in project neo4j by neo4j.
the class MessageDecoderTest method testUnpackableStructParametersWithKnownType.
private void testUnpackableStructParametersWithKnownType(Neo4jPack packerForSerialization, AnyValue parameterValue, String expectedMessage) throws Exception {
String statement = "RETURN $x";
MapValue parameters = VirtualValues.map(new String[] { "x" }, new AnyValue[] { parameterValue });
BoltStateMachine stateMachine = mock(BoltStateMachine.class);
SynchronousBoltConnection connection = new SynchronousBoltConnection(stateMachine);
channel = new EmbeddedChannel(newDecoder(connection));
channel.writeInbound(Unpooled.wrappedBuffer(serialize(packerForSerialization, new RunMessage(statement, parameters))));
channel.finishAndReleaseAll();
verify(stateMachine).handleExternalFailure(eq(Neo4jError.from(Status.Statement.TypeError, expectedMessage)), any());
}
use of org.neo4j.bolt.v3.messaging.request.RunMessage in project neo4j by neo4j.
the class BoltRequestMessageV3Test method shouldHandleCommonMessages.
@Test
void shouldHandleCommonMessages() throws Throwable {
assertSerializes(new HelloMessage(map("user_agent", "MyClient/1.0", "scheme", "basic")));
assertSerializes(new RunMessage("CREATE (n) RETURN åäö"));
assertSerializes(DiscardAllMessage.INSTANCE);
assertSerializes(PullAllMessage.INSTANCE);
assertSerializes(new BeginMessage());
assertSerializes(COMMIT_MESSAGE);
assertSerializes(ROLLBACK_MESSAGE);
assertSerializes(ResetMessage.INSTANCE);
assertSerializes(GOODBYE_MESSAGE);
}
use of org.neo4j.bolt.v3.messaging.request.RunMessage in project neo4j by neo4j.
the class BoltRequestMessageV3Test method shouldHandleParameterizedStatements.
@Test
void shouldHandleParameterizedStatements() throws Throwable {
// Given
MapValue parameters = ValueUtils.asMapValue(map("n", 12L));
// When
RunMessage msg = serializeAndDeserialize(new RunMessage("asd", parameters));
// Then
MapValue params = msg.params();
assertThat(params).isEqualTo(parameters);
}
use of org.neo4j.bolt.v3.messaging.request.RunMessage in project neo4j by neo4j.
the class RunMessageDecoderTest method shouldDecodeBeginMessage.
@Test
void shouldDecodeBeginMessage() throws Exception {
RunMessage originalMessage = new RunMessage("A new V3 run messsage");
assertOriginalMessageEqualsToDecoded(originalMessage, decoder);
}
Aggregations