use of org.neo4j.bolt.v3.BoltStateMachineV3 in project neo4j by neo4j.
the class ConnectedStateIT method shouldCloseConnectionOnIllegalMessages.
private void shouldCloseConnectionOnIllegalMessages(RequestMessage message) throws InterruptedException {
// Given
BoltStateMachineV3 machine = newStateMachine();
// when
BoltResponseRecorder recorder = new BoltResponseRecorder();
verifyKillsConnection(() -> machine.process(message, recorder));
// then
assertThat(recorder.nextResponse()).satisfies(failedWithStatus(Status.Request.Invalid));
assertNull(machine.state());
}
use of org.neo4j.bolt.v3.BoltStateMachineV3 in project neo4j by neo4j.
the class ReadyStateIT method shouldMoveToInterruptedOnInterrupt.
@Test
void shouldMoveToInterruptedOnInterrupt() throws Throwable {
// Given
BoltStateMachineV3 machine = newStateMachine();
machine.process(newHelloMessage(), nullResponseHandler());
// When
BoltResponseRecorder recorder = new BoltResponseRecorder();
machine.process(InterruptSignal.INSTANCE, recorder);
// Then
assertThat(machine.state()).isInstanceOf(InterruptedState.class);
}
use of org.neo4j.bolt.v3.BoltStateMachineV3 in project neo4j by neo4j.
the class TransactionReadyStateIT method shouldMoveToReadyOnRollback_succ.
@Test
void shouldMoveToReadyOnRollback_succ() throws Throwable {
BoltStateMachineV3 machine = getBoltStateMachineInTxReadyState();
// When
BoltResponseRecorder recorder = new BoltResponseRecorder();
machine.process(ROLLBACK_MESSAGE, recorder);
// Then
assertThat(recorder.nextResponse()).satisfies(succeeded());
assertThat(machine.state()).isInstanceOf(ReadyState.class);
}
use of org.neo4j.bolt.v3.BoltStateMachineV3 in project neo4j by neo4j.
the class TransactionReadyStateIT method getBoltStateMachineInTxReadyState.
private BoltStateMachineV3 getBoltStateMachineInTxReadyState() throws BoltConnectionFatality {
BoltStateMachineV3 machine = newStateMachine();
machine.process(newHelloMessage(), nullResponseHandler());
machine.process(new BeginMessage(), nullResponseHandler());
return machine;
}
use of org.neo4j.bolt.v3.BoltStateMachineV3 in project neo4j by neo4j.
the class TransactionReadyStateIT method shouldMoveToReadyOnCommit_succ.
@Test
void shouldMoveToReadyOnCommit_succ() throws Throwable {
BoltStateMachineV3 machine = getBoltStateMachineInTxReadyState();
// When
BoltResponseRecorder recorder = new BoltResponseRecorder();
machine.process(COMMIT_MESSAGE, recorder);
// Then
RecordedBoltResponse response = recorder.nextResponse();
assertThat(response).satisfies(succeeded());
assertTrue(response.hasMetadata("bookmark"));
assertThat(machine.state()).isInstanceOf(ReadyState.class);
}
Aggregations