use of org.neo4j.bolt.runtime.statemachine.StatementProcessor in project neo4j by neo4j.
the class BoltStateMachineContextImplTest method shouldAllowToSetNewStatementProcessor.
@Test
void shouldAllowToSetNewStatementProcessor() throws Throwable {
// Given
StatementProcessor txStateMachine = mock(StatementProcessor.class);
// Then we can set tx state machine on a context.
boltStateMachineContextWithStatementProcessor(txStateMachine, DB_NAME);
}
use of org.neo4j.bolt.runtime.statemachine.StatementProcessor in project neo4j by neo4j.
the class BoltStateMachineContextImplTest method shouldErrorToSetNewStatementProcessorWhilePreviousIsNotReleased.
@Test
void shouldErrorToSetNewStatementProcessorWhilePreviousIsNotReleased() throws Throwable {
// Given a context that has a active tx state machine set.
StatementProcessor txStateMachine = mock(StatementProcessor.class);
BoltStateMachineContextImpl context = boltStateMachineContextWithStatementProcessor(txStateMachine, DB_NAME);
// When & Then
BoltProtocolBreachFatality error = assertThrows(BoltProtocolBreachFatality.class, () -> context.setCurrentStatementProcessorForDatabase("Bossi"));
assertThat(error.getMessage()).contains("Changing database without closing the previous is forbidden.");
assertThat(context.connectionState().getStatementProcessor()).isEqualTo(txStateMachine);
}
Aggregations