use of org.neo4j.bolt.v3.BoltStateMachineV3 in project neo4j by neo4j.
the class StreamingStateIT method shouldMoveFromStreamingToReadyOnDiscardAll_succ.
@Test
void shouldMoveFromStreamingToReadyOnDiscardAll_succ() throws Throwable {
// Given
BoltStateMachineV3 machine = getBoltStateMachineInStreamingState();
// When
BoltResponseRecorder recorder = new BoltResponseRecorder();
machine.process(DiscardAllMessage.INSTANCE, recorder);
// Then
RecordedBoltResponse response = recorder.nextResponse();
assertThat(response).satisfies(succeeded());
assertTrue(response.hasMetadata("bookmark"));
assertThat(machine.state()).isInstanceOf(ReadyState.class);
}
use of org.neo4j.bolt.v3.BoltStateMachineV3 in project neo4j by neo4j.
the class StreamingStateIT method shouldMoveFromStreamingToInterruptedOnInterrupt.
@Test
void shouldMoveFromStreamingToInterruptedOnInterrupt() throws Throwable {
// Given
BoltStateMachineV3 machine = getBoltStateMachineInStreamingState();
// 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 StreamingStateIT method shouldMoveFromStreamingToReadyOnPullAll_succ.
@Test
void shouldMoveFromStreamingToReadyOnPullAll_succ() throws Throwable {
// Given
BoltStateMachineV3 machine = getBoltStateMachineInStreamingState();
// When
BoltResponseRecorder recorder = new BoltResponseRecorder();
machine.process(PullAllMessage.INSTANCE, recorder);
// Then
RecordedBoltResponse response = recorder.nextResponse();
assertThat(response).satisfies(succeeded());
assertTrue(response.hasMetadata("type"));
assertTrue(response.hasMetadata("t_last"));
assertTrue(response.hasMetadata("bookmark"));
assertThat(machine.state()).isInstanceOf(ReadyState.class);
}
use of org.neo4j.bolt.v3.BoltStateMachineV3 in project neo4j by neo4j.
the class TransactionStreamingStateIT method shouldMoveFromTxStreamingStateToFailedStateOnPullAllOrDiscardAll_fail.
@ParameterizedTest
@MethodSource("pullAllDiscardAllMessages")
void shouldMoveFromTxStreamingStateToFailedStateOnPullAllOrDiscardAll_fail(RequestMessage message) throws Throwable {
// Given
BoltStateMachineV3 machine = getBoltStateMachineInTxStreamingState();
// When
BoltResponseHandler handler = mock(BoltResponseHandler.class);
doThrow(new RuntimeException("Fail")).when(handler).onPullRecords(any(), anyLong());
doThrow(new RuntimeException("Fail")).when(handler).onDiscardRecords(any(), anyLong());
machine.process(message, handler);
// Then
assertThat(machine.state()).isInstanceOf(FailedState.class);
}
use of org.neo4j.bolt.v3.BoltStateMachineV3 in project neo4j by neo4j.
the class TransactionStreamingStateIT method shouldMoveFromTxStreamingToInterruptedOnInterrupt.
@Test
void shouldMoveFromTxStreamingToInterruptedOnInterrupt() throws Throwable {
// Given
BoltStateMachineV3 machine = getBoltStateMachineInTxStreamingState();
// When
BoltResponseRecorder recorder = new BoltResponseRecorder();
machine.process(InterruptSignal.INSTANCE, recorder);
// Then
assertThat(machine.state()).isInstanceOf(InterruptedState.class);
}
Aggregations