use of org.neo4j.bolt.v4.BoltStateMachineV4 in project neo4j by neo4j.
the class AutoCommitStateIT method shouldMoveFromAutoCommitToInterruptedOnInterrupt.
@Test
void shouldMoveFromAutoCommitToInterruptedOnInterrupt() throws Throwable {
// Given
BoltStateMachineV4 machine = getBoltStateMachineInAutoCommitState();
// When
BoltResponseRecorder recorder = new BoltResponseRecorder();
machine.process(InterruptSignal.INSTANCE, recorder);
// Then
assertThat(machine.state()).isInstanceOf(InterruptedState.class);
}
use of org.neo4j.bolt.v4.BoltStateMachineV4 in project neo4j by neo4j.
the class AutoCommitStateIT method shouldMoveFromAutoCommitToReadyOnPull_succ.
@Test
void shouldMoveFromAutoCommitToReadyOnPull_succ() throws Throwable {
// Given
BoltStateMachineV4 machine = getBoltStateMachineInAutoCommitState();
// When
BoltResponseRecorder recorder = new BoltResponseRecorder();
machine.process(newPullMessage(100L), recorder);
// Then
RecordedBoltResponse response = recorder.nextResponse();
assertThat(response).satisfies(succeeded());
assertTrue(response.hasMetadata("type"));
assertTrue(response.hasMetadata("t_last"));
assertTrue(response.hasMetadata("bookmark"));
assertTrue(response.hasMetadata("db"));
assertThat(machine.state()).isInstanceOf(ReadyState.class);
}
use of org.neo4j.bolt.v4.BoltStateMachineV4 in project neo4j by neo4j.
the class FailedStateIT method shouldMoveToInterruptedOnInterruptSignal.
@Test
void shouldMoveToInterruptedOnInterruptSignal() throws Throwable {
// Given
BoltStateMachineV4 machine = getBoltStateMachineInFailedState();
// When
BoltResponseRecorder recorder = new BoltResponseRecorder();
machine.process(InterruptSignal.INSTANCE, recorder);
// Then
assertThat(recorder.nextResponse()).satisfies(succeeded());
assertThat(machine.state()).isInstanceOf(InterruptedState.class);
}
use of org.neo4j.bolt.v4.BoltStateMachineV4 in project neo4j by neo4j.
the class FailedStateIT method shouldIgnoreMessages.
@ParameterizedTest
@MethodSource("ignoredMessages")
void shouldIgnoreMessages(RequestMessage message) throws Throwable {
// Given
BoltStateMachineV4 machine = getBoltStateMachineInFailedState();
// When
BoltResponseRecorder recorder = new BoltResponseRecorder();
machine.process(message, recorder);
// Then
assertThat(recorder.nextResponse()).satisfies(wasIgnored());
assertThat(machine.state()).isInstanceOf(FailedState.class);
}
use of org.neo4j.bolt.v4.BoltStateMachineV4 in project neo4j by neo4j.
the class ReadyStateIT method shouldCloseConnectionOnIllegalMessages.
private void shouldCloseConnectionOnIllegalMessages(RequestMessage message) throws InterruptedException, BoltConnectionFatality {
// Given
BoltStateMachineV4 machine = newStateMachine();
machine.process(newHelloMessage(), nullResponseHandler());
// when
BoltResponseRecorder recorder = new BoltResponseRecorder();
verifyKillsConnection(() -> machine.process(message, recorder));
// then
assertThat(recorder.nextResponse()).satisfies(failedWithStatus(Status.Request.Invalid));
assertNull(machine.state());
}
Aggregations