Search in sources :

Example 21 with RunMessage

use of org.neo4j.bolt.v4.messaging.RunMessage in project neo4j by neo4j.

the class AutoCommitStateIT method getBoltStateMachineInAutoCommitState.

private BoltStateMachineV4 getBoltStateMachineInAutoCommitState(String query) throws BoltConnectionFatality {
    BoltStateMachineV4 machine = newStateMachine();
    machine.process(newHelloMessage(), nullResponseHandler());
    machine.process(new RunMessage(query, EMPTY_PARAMS), nullResponseHandler());
    assertThat(machine.state()).isInstanceOf(AutoCommitState.class);
    return machine;
}
Also used : BoltStateMachineV4(org.neo4j.bolt.v4.BoltStateMachineV4) RunMessage(org.neo4j.bolt.v4.messaging.RunMessage)

Example 22 with RunMessage

use of org.neo4j.bolt.v4.messaging.RunMessage in project neo4j by neo4j.

the class ReadyStateIT method shouldMoveToAutoCommitOnRun_succ.

@Test
void shouldMoveToAutoCommitOnRun_succ() throws Throwable {
    // Given
    BoltStateMachineV4 machine = newStateMachine();
    machine.process(newHelloMessage(), nullResponseHandler());
    // When
    BoltResponseRecorder recorder = new BoltResponseRecorder();
    machine.process(new RunMessage("CREATE (n {k:'k'}) RETURN n.k", EMPTY_PARAMS), recorder);
    // Then
    RecordedBoltResponse response = recorder.nextResponse();
    assertThat(response).satisfies(succeeded());
    assertTrue(response.hasMetadata("fields"));
    assertTrue(response.hasMetadata("t_first"));
    assertThat(machine.state()).isInstanceOf(AutoCommitState.class);
}
Also used : BoltStateMachineV4(org.neo4j.bolt.v4.BoltStateMachineV4) BoltResponseRecorder(org.neo4j.bolt.testing.BoltResponseRecorder) RecordedBoltResponse(org.neo4j.bolt.testing.RecordedBoltResponse) RunMessage(org.neo4j.bolt.v4.messaging.RunMessage) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

RunMessage (org.neo4j.bolt.v4.messaging.RunMessage)22 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)15 MethodSource (org.junit.jupiter.params.provider.MethodSource)9 BoltStateMachineV4 (org.neo4j.bolt.v4.BoltStateMachineV4)9 PullMessage (org.neo4j.bolt.v4.messaging.PullMessage)9 BeginMessage (org.neo4j.bolt.v4.messaging.BeginMessage)8 BookmarkWithDatabaseId (org.neo4j.bolt.v4.runtime.bookmarking.BookmarkWithDatabaseId)8 BoltResponseRecorder (org.neo4j.bolt.testing.BoltResponseRecorder)7 Test (org.junit.jupiter.api.Test)6 RecordedBoltResponse (org.neo4j.bolt.testing.RecordedBoltResponse)2 ByteBuf (io.netty.buffer.ByteBuf)1 EmbeddedChannel (io.netty.channel.embedded.EmbeddedChannel)1 IOException (java.io.IOException)1 BoltChannel (org.neo4j.bolt.BoltChannel)1 BoltProtocol (org.neo4j.bolt.BoltProtocol)1 RequestMessage (org.neo4j.bolt.messaging.RequestMessage)1 BoltResponseHandler (org.neo4j.bolt.runtime.BoltResponseHandler)1 SynchronousBoltConnection (org.neo4j.bolt.runtime.SynchronousBoltConnection)1 BoltStateMachine (org.neo4j.bolt.runtime.statemachine.BoltStateMachine)1 BoltTestUtil.newTestBoltChannel (org.neo4j.bolt.testing.BoltTestUtil.newTestBoltChannel)1