use of org.neo4j.bolt.v3.BoltStateMachineV3 in project neo4j by neo4j.
the class FailedStateIT method shouldMoveToInterruptedOnInterruptSignal.
@Test
void shouldMoveToInterruptedOnInterruptSignal() throws Throwable {
// Given
BoltStateMachineV3 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.v3.BoltStateMachineV3 in project neo4j by neo4j.
the class FailedStateIT method getBoltStateMachineInFailedState.
private BoltStateMachineV3 getBoltStateMachineInFailedState() throws BoltConnectionFatality, InterruptedException {
BoltStateMachineV3 machine = newStateMachine();
machine.process(newHelloMessage(), nullResponseHandler());
RunMessage runMessage = mock(RunMessage.class);
when(runMessage.statement()).thenThrow(new RuntimeException("error here"));
BoltResponseRecorder recorder = new BoltResponseRecorder();
machine.process(runMessage, recorder);
assertThat(recorder.nextResponse()).satisfies(failedWithStatus(Status.General.UnknownError));
assertThat(machine.state()).isInstanceOf(FailedState.class);
return machine;
}
use of org.neo4j.bolt.v3.BoltStateMachineV3 in project neo4j by neo4j.
the class InterruptedStateIT method shouldStayInInterruptedOnMoreReset.
@Test
void shouldStayInInterruptedOnMoreReset() throws Throwable {
// Given
BoltStateMachineV3 machine = getBoltStateMachineInInterruptedState();
machine.interrupt();
// need two reset to recover
machine.interrupt();
// When & Then
machine.process(ResetMessage.INSTANCE, nullResponseHandler());
assertThat(machine.state()).isInstanceOf(InterruptedState.class);
BoltResponseRecorder recorder = new BoltResponseRecorder();
machine.process(ResetMessage.INSTANCE, recorder);
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 InterruptedStateIT method shouldMoveReadyOnReset_succ.
@Test
void shouldMoveReadyOnReset_succ() throws Throwable {
// Given
BoltStateMachineV3 machine = getBoltStateMachineInInterruptedState();
// When
BoltResponseRecorder recorder = new BoltResponseRecorder();
machine.process(ResetMessage.INSTANCE, 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 InterruptedStateIT method shouldCloseConnectionOnIllegalMessages.
private void shouldCloseConnectionOnIllegalMessages(RequestMessage message) throws InterruptedException, BoltConnectionFatality {
// Given
BoltStateMachineV3 machine = getBoltStateMachineInInterruptedState();
// when
BoltResponseRecorder recorder = new BoltResponseRecorder();
machine.process(message, recorder);
// then
assertThat(recorder.nextResponse()).satisfies(wasIgnored());
assertThat(machine.state()).isInstanceOf(InterruptedState.class);
}
Aggregations