use of org.neo4j.bolt.v4.messaging.BeginMessage in project neo4j by neo4j.
the class BoltRequestMessageReaderV41Test method shouldDecodeBoltV3RunAndBeginMessageAsBoltV41Message.
@Test
void shouldDecodeBoltV3RunAndBeginMessageAsBoltV41Message() throws Exception {
org.neo4j.bolt.v3.messaging.request.RunMessage runMessageV3 = new org.neo4j.bolt.v3.messaging.request.RunMessage("RETURN 1", EMPTY_MAP);
org.neo4j.bolt.v3.messaging.request.BeginMessage beginMessageV3 = new org.neo4j.bolt.v3.messaging.request.BeginMessage();
RunMessage runMessageV4 = new RunMessage("RETURN 1", EMPTY_MAP);
BeginMessage beginMessageV4 = new BeginMessage();
verifyBoltV3MessageIsReadAsBoltV4Message(runMessageV3, runMessageV4);
verifyBoltV3MessageIsReadAsBoltV4Message(beginMessageV3, beginMessageV4);
}
use of org.neo4j.bolt.v4.messaging.BeginMessage in project neo4j by neo4j.
the class BoltRequestMessageReaderV43Test method shouldDecodeBoltV3RunAndBeginMessageAsBoltv43Message.
@Test
void shouldDecodeBoltV3RunAndBeginMessageAsBoltv43Message() throws Exception {
org.neo4j.bolt.v3.messaging.request.RunMessage runMessageV3 = new org.neo4j.bolt.v3.messaging.request.RunMessage("RETURN 1", EMPTY_MAP);
org.neo4j.bolt.v3.messaging.request.BeginMessage beginMessageV3 = new org.neo4j.bolt.v3.messaging.request.BeginMessage();
RunMessage runMessageV4 = new RunMessage("RETURN 1", EMPTY_MAP);
BeginMessage beginMessageV4 = new BeginMessage();
verifyBoltV3MessageIsReadAsBoltV4Message(runMessageV3, runMessageV4);
verifyBoltV3MessageIsReadAsBoltV4Message(beginMessageV3, beginMessageV4);
}
use of org.neo4j.bolt.v4.messaging.BeginMessage in project neo4j by neo4j.
the class BoltV43TransportIT method shouldReturnUpdatedBookmarkAfterExplicitTransaction.
@ParameterizedTest(name = "{0}")
@MethodSource("argumentsProvider")
public void shouldReturnUpdatedBookmarkAfterExplicitTransaction(Class<? extends TransportConnection> connectionClass) throws Exception {
init(connectionClass);
assumeFalse(FabricDatabaseManager.fabricByDefault(Config.defaults()));
negotiateBoltV43();
// bookmark is expected to advance once the auto-commit transaction is committed
var lastClosedTransactionId = getLastClosedTransactionId();
var expectedBookmark = new BookmarkWithDatabaseId(lastClosedTransactionId + 1, getDatabaseId()).toString();
connection.send(util.chunk(new BeginMessage()));
assertThat(connection).satisfies(util.eventuallyReceives(msgSuccess()));
connection.send(util.chunk(new RunMessage("CREATE ()"), new PullMessage(asMapValue(map("n", -1L)))));
assertThat(connection).satisfies(util.eventuallyReceives(msgSuccess(), msgSuccess(message -> assertThat(message).doesNotContainEntry("bookmark", expectedBookmark))));
connection.send(util.chunk(CommitMessage.COMMIT_MESSAGE));
assertThat(connection).satisfies(util.eventuallyReceives(msgSuccess(message -> assertThat(message).containsEntry("bookmark", expectedBookmark))));
}
use of org.neo4j.bolt.v4.messaging.BeginMessage in project neo4j by neo4j.
the class InTransactionStateIT method getBoltStateMachineInTxState.
private BoltStateMachineV4 getBoltStateMachineInTxState(String query) throws BoltConnectionFatality {
BoltStateMachineV4 machine = newStateMachine();
machine.process(newHelloMessage(), nullResponseHandler());
machine.process(new BeginMessage(), nullResponseHandler());
assertThat(machine.state()).isInstanceOf(InTransactionState.class);
machine.process(new RunMessage(query, EMPTY_PARAMS), nullResponseHandler());
// tx streaming state
assertThat(machine.state()).isInstanceOf(InTransactionState.class);
return machine;
}
use of org.neo4j.bolt.v4.messaging.BeginMessage in project neo4j by neo4j.
the class InTransactionStateIT method shouldThrowExceptionOnIllegalMessagesInTxStreamingState.
private void shouldThrowExceptionOnIllegalMessagesInTxStreamingState(RequestMessage message) throws Throwable {
// Given
BoltStateMachineV4 machine = newStateMachine();
machine.process(newHelloMessage(), nullResponseHandler());
machine.process(new BeginMessage(), nullResponseHandler());
machine.process(new RunMessage("CREATE (n {k:'k'}) RETURN n.k", EMPTY_PARAMS), nullResponseHandler());
assertThat(machine.state()).isInstanceOf(InTransactionState.class);
// when
BoltResponseRecorder recorder = new BoltResponseRecorder();
verifyKillsConnection(() -> machine.process(message, recorder));
// then
assertThat(recorder.nextResponse()).satisfies(failedWithStatus(Status.Request.Invalid));
assertNull(machine.state());
}
Aggregations