use of org.neo4j.kernel.api.KernelTransaction in project neo4j by neo4j.
the class TransitionalTxManagementKernelTransaction method commit.
public void commit() {
try {
KernelTransaction kernelTransactionBoundToThisThread = bridge.getKernelTransactionBoundToThisThread(true);
kernelTransactionBoundToThisThread.success();
kernelTransactionBoundToThisThread.close();
} catch (TransactionFailureException e) {
throw new RuntimeException(e);
} finally {
bridge.unbindTransactionFromCurrentThread();
}
}
use of org.neo4j.kernel.api.KernelTransaction in project neo4j by neo4j.
the class CypherExecutorTest method setUpMocks.
private void setUpMocks() {
database = mock(Database.class);
databaseFacade = mock(GraphDatabaseFacade.class);
resolver = mock(DependencyResolver.class);
executionEngine = mock(ExecutionEngine.class);
statementBridge = mock(ThreadToStatementContextBridge.class);
databaseQueryService = mock(GraphDatabaseQueryService.class);
kernelTransaction = mock(KernelTransaction.class);
statement = mock(Statement.class);
request = mock(HttpServletRequest.class);
InternalTransaction transaction = new TopLevelTransaction(kernelTransaction, () -> statement);
SecurityContext securityContext = AUTH_DISABLED;
KernelTransaction.Type type = KernelTransaction.Type.implicit;
QueryRegistryOperations registryOperations = mock(QueryRegistryOperations.class);
when(statement.queryRegistration()).thenReturn(registryOperations);
when(statementBridge.get()).thenReturn(statement);
when(kernelTransaction.securityContext()).thenReturn(securityContext);
when(kernelTransaction.transactionType()).thenReturn(type);
when(database.getGraph()).thenReturn(databaseFacade);
when(databaseFacade.getDependencyResolver()).thenReturn(resolver);
when(resolver.resolveDependency(QueryExecutionEngine.class)).thenReturn(executionEngine);
when(resolver.resolveDependency(ThreadToStatementContextBridge.class)).thenReturn(statementBridge);
when(resolver.resolveDependency(GraphDatabaseQueryService.class)).thenReturn(databaseQueryService);
when(databaseQueryService.beginTransaction(type, securityContext)).thenReturn(transaction);
when(databaseQueryService.beginTransaction(type, securityContext, CUSTOM_TRANSACTION_TIMEOUT, TimeUnit.MILLISECONDS)).thenReturn(transaction);
when(databaseQueryService.getDependencyResolver()).thenReturn(resolver);
when(request.getScheme()).thenReturn("http");
when(request.getRemoteAddr()).thenReturn("127.0.0.1");
when(request.getRemotePort()).thenReturn(5678);
when(request.getServerName()).thenReturn("127.0.0.1");
when(request.getServerPort()).thenReturn(7474);
when(request.getRequestURI()).thenReturn("/");
}
Aggregations