use of org.neo4j.bolt.v3.BoltStateMachineV3 in project neo4j by neo4j.
the class FailedStateIT method shouldIgnoreMessages.
@ParameterizedTest
@MethodSource("ignoredMessages")
void shouldIgnoreMessages(RequestMessage message) throws Throwable {
// Given
BoltStateMachineV3 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.v3.BoltStateMachineV3 in project neo4j by neo4j.
the class FailedStateIT method shouldCloseConnectionOnIllegalMessages.
private void shouldCloseConnectionOnIllegalMessages(RequestMessage message) throws InterruptedException, BoltConnectionFatality {
// Given
BoltStateMachineV3 machine = getBoltStateMachineInFailedState();
// 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 InterruptedStateIT method shouldStayInInterruptedOnInterruptedSignal.
@Test
void shouldStayInInterruptedOnInterruptedSignal() throws Throwable {
// Given
BoltStateMachineV3 machine = getBoltStateMachineInInterruptedState();
// 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 InterruptedStateIT method getBoltStateMachineInInterruptedState.
private BoltStateMachineV3 getBoltStateMachineInInterruptedState() throws BoltConnectionFatality {
BoltStateMachineV3 machine = newStateMachine();
machine.process(newHelloMessage(), nullResponseHandler());
machine.process(InterruptSignal.INSTANCE, nullResponseHandler());
assertThat(machine.state()).isInstanceOf(InterruptedState.class);
return machine;
}
use of org.neo4j.bolt.v3.BoltStateMachineV3 in project neo4j by neo4j.
the class StreamingStateIT method shouldThrowExceptionOnIllegalMessagesInStreamingState.
private void shouldThrowExceptionOnIllegalMessagesInStreamingState(RequestMessage message) throws Throwable {
// Given
BoltStateMachineV3 machine = newStateMachine();
machine.process(newHelloMessage(), nullResponseHandler());
machine.process(new RunMessage("CREATE (n {k:'k'}) RETURN n.k", EMPTY_PARAMS), nullResponseHandler());
assertThat(machine.state()).isInstanceOf(StreamingState.class);
// when
BoltResponseRecorder recorder = new BoltResponseRecorder();
verifyKillsConnection(() -> machine.process(message, recorder));
// then
assertThat(recorder.nextResponse()).satisfies(failedWithStatus(Status.Request.Invalid));
assertNull(machine.state());
}
Aggregations