use of org.neo4j.kernel.impl.query.QueryExecutionEngine in project neo4j by neo4j.
the class TransactionHandleTest method shouldCommitTransactionAndTellRegistryToForgetItsHandle.
@Test
public void shouldCommitTransactionAndTellRegistryToForgetItsHandle() throws Exception {
// given
TransitionalPeriodTransactionMessContainer kernel = mockKernel();
TransitionalTxManagementKernelTransaction transactionContext = kernel.newTransaction(explicit, AUTH_DISABLED, -1);
TransactionRegistry registry = mock(TransactionRegistry.class);
QueryExecutionEngine engine = mock(QueryExecutionEngine.class);
TransactionalContext transactionalContext = prepareKernelWithQuerySession(kernel);
Result result = mock(Result.class);
when(engine.executeQuery("query", map(), transactionalContext)).thenReturn(result);
when(registry.begin(any(TransactionHandle.class))).thenReturn(1337L);
GraphDatabaseQueryService queryService = mock(GraphDatabaseQueryService.class);
TransactionHandle handle = new TransactionHandle(kernel, engine, queryService, registry, uriScheme, false, AUTH_DISABLED, anyLong(), NullLogProvider.getInstance());
ExecutionResultSerializer output = mock(ExecutionResultSerializer.class);
// when
Statement statement = new Statement("query", map(), false, (ResultDataContent[]) null);
handle.commit(statements(statement), output, mock(HttpServletRequest.class));
// then
InOrder transactionOrder = inOrder(transactionContext, registry);
transactionOrder.verify(transactionContext).commit();
transactionOrder.verify(registry).forget(1337L);
InOrder outputOrder = inOrder(output);
outputOrder.verify(output).statementResult(result, false, (ResultDataContent[]) null);
outputOrder.verify(output).notifications(anyCollectionOf(Notification.class));
outputOrder.verify(output).errors(argThat(hasNoErrors()));
outputOrder.verify(output).finish();
verifyNoMoreInteractions(output);
}
Aggregations