Пример #1
0
 public override TransactionObligationFulfiller ObligationFulfiller()
 {
     try
     {
         return(GlobalResolver.resolveDependency(typeof(TransactionObligationFulfiller)));
     }
     catch (UnsatisfiedDependencyException)
     {
         return(toTxId =>
         {
             throw new System.NotSupportedException("Should not be called");
         });
     }
 }
Пример #2
0
 public virtual UpdatePullingTransactionObligationFulfiller CreateObligationFulfiller(UpdatePuller updatePuller)
 {
     return(new UpdatePullingTransactionObligationFulfiller(updatePuller, _memberStateMachine, _serverId, () =>
     {
         GraphDatabaseFacade databaseFacade = this._dependencyResolver.resolveDependency(typeof(DatabaseManager)).getDatabaseFacade(_activeDatabaseName).get();
         DependencyResolver databaseResolver = databaseFacade.DependencyResolver;
         return databaseResolver.resolveDependency(typeof(TransactionIdStore));
     }));
 }
Пример #3
0
        private void SetUpMocks()
        {
            _database             = mock(typeof(Database));
            _databaseFacade       = mock(typeof(GraphDatabaseFacade));
            _resolver             = mock(typeof(DependencyResolver));
            _executionEngine      = mock(typeof(ExecutionEngine));
            _statementBridge      = mock(typeof(ThreadToStatementContextBridge));
            _databaseQueryService = mock(typeof(GraphDatabaseQueryService));
            _kernelTransaction    = mock(typeof(KernelTransaction));
            _statement            = mock(typeof(Statement));
            _request = mock(typeof(HttpServletRequest));

            InternalTransaction transaction = new TopLevelTransaction(_kernelTransaction);

            LoginContext loginContext = AUTH_DISABLED;

            KernelTransaction.Type  type = KernelTransaction.Type.@implicit;
            QueryRegistryOperations registryOperations = mock(typeof(QueryRegistryOperations));

            when(_statement.queryRegistration()).thenReturn(registryOperations);
            when(_statementBridge.get()).thenReturn(_statement);
            when(_kernelTransaction.securityContext()).thenReturn(loginContext.Authorize(s => - 1, GraphDatabaseSettings.DEFAULT_DATABASE_NAME));
            when(_kernelTransaction.transactionType()).thenReturn(type);
            when(_database.Graph).thenReturn(_databaseFacade);
            when(_databaseFacade.DependencyResolver).thenReturn(_resolver);
            when(_resolver.resolveDependency(typeof(QueryExecutionEngine))).thenReturn(_executionEngine);
            when(_resolver.resolveDependency(typeof(ThreadToStatementContextBridge))).thenReturn(_statementBridge);
            when(_resolver.resolveDependency(typeof(GraphDatabaseQueryService))).thenReturn(_databaseQueryService);
            when(_databaseQueryService.beginTransaction(type, loginContext)).thenReturn(transaction);
            when(_databaseQueryService.beginTransaction(type, loginContext, CUSTOM_TRANSACTION_TIMEOUT, TimeUnit.MILLISECONDS)).thenReturn(transaction);
            when(_databaseQueryService.DependencyResolver).thenReturn(_resolver);
            when(_request.Scheme).thenReturn("http");
            when(_request.RemoteAddr).thenReturn("127.0.0.1");
            when(_request.RemotePort).thenReturn(5678);
            when(_request.ServerName).thenReturn("127.0.0.1");
            when(_request.ServerPort).thenReturn(7474);
            when(_request.RequestURI).thenReturn("/");
        }
Пример #4
0
 public GraphDatabaseCypherService(GraphDatabaseService graph)
 {
     this._graph          = ( GraphDatabaseFacade )graph;
     this._dbmsOperations = DependencyResolver.resolveDependency(typeof(DbmsOperations));
 }
Пример #5
0
 private IndexProcedures IndexProcedures()
 {
     return(new IndexProcedures(Tx, Resolver.resolveDependency(typeof(IndexingService))));
 }