use of org.neo4j.bolt.runtime.statemachine.StatementProcessor in project neo4j by neo4j.
the class MutableConnectionStateTest method shouldSetAndGetStatementProcessor.
@Test
void shouldSetAndGetStatementProcessor() throws Throwable {
StatementProcessor processor = mock(StatementProcessor.class);
state.setStatementProcessor(processor);
assertThat(state.getStatementProcessor()).isEqualTo(processor);
}
use of org.neo4j.bolt.runtime.statemachine.StatementProcessor in project neo4j by neo4j.
the class ReadyState method processBeginMessage.
private BoltStateMachineState processBeginMessage(BeginMessage message, StateMachineContext context) throws Exception {
StatementProcessor statementProcessor = getStatementProcessor(message, context);
statementProcessor.beginTransaction(message.bookmarks(), message.transactionTimeout(), message.getAccessMode(), message.transactionMetadata());
return txReadyState;
}
use of org.neo4j.bolt.runtime.statemachine.StatementProcessor in project neo4j by neo4j.
the class BoltStateMachineContextImplTest method boltStateMachineContextWithStatementProcessor.
private static BoltStateMachineContextImpl boltStateMachineContextWithStatementProcessor(StatementProcessor txStateMachine, String databaseName) throws BoltProtocolBreachFatality, BoltIOException {
StatementProcessorProvider provider = mock(StatementProcessorProvider.class);
when(provider.getStatementProcessor(databaseName)).thenReturn(txStateMachine);
when(txStateMachine.databaseName()).thenReturn(databaseName);
BoltStateMachineContextImpl context = newContext(mock(BoltStateMachine.class), mock(BoltStateMachineSPI.class));
context.setStatementProcessorProvider(provider);
assertThat(context.connectionState().getStatementProcessor()).isEqualTo(EMPTY);
StatementProcessor processor = context.setCurrentStatementProcessorForDatabase(databaseName);
assertThat(processor).isEqualTo(txStateMachine);
assertThat(context.connectionState().getStatementProcessor()).isEqualTo(txStateMachine);
return context;
}
use of org.neo4j.bolt.runtime.statemachine.StatementProcessor in project neo4j by neo4j.
the class BoltStateMachineContextImplTest method shouldReturnTheSameStatementProcessorIfDatabaseNameAreTheSame.
@Test
void shouldReturnTheSameStatementProcessorIfDatabaseNameAreTheSame() throws Throwable {
// Given a context that has a active tx state machine set.
StatementProcessor txStateMachine = mock(StatementProcessor.class);
BoltStateMachineContextImpl context = boltStateMachineContextWithStatementProcessor(txStateMachine, DB_NAME);
StatementProcessor molly = context.connectionState().getStatementProcessor();
// When & Then
StatementProcessor processor = context.setCurrentStatementProcessorForDatabase(DB_NAME);
assertThat(processor).isEqualTo(molly);
}
use of org.neo4j.bolt.runtime.statemachine.StatementProcessor in project neo4j by neo4j.
the class BoltStateMachineContextImplTest method releaseShouldResetStatementProcessorBackToEmpty.
@Test
void releaseShouldResetStatementProcessorBackToEmpty() 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
context.releaseStatementProcessor();
// Then
assertThat(context.connectionState().getStatementProcessor()).isEqualTo(EMPTY);
}
Aggregations