コード例 #1
0
        private TransactionalContext CreateTransactionContext(GraphDatabaseQueryService graph, InternalTransaction tx, string query)
        {
            PropertyContainerLocker     locker         = new PropertyContainerLocker();
            TransactionalContextFactory contextFactory = Neo4jTransactionalContextFactory.create(graph, locker);

            return(contextFactory.NewContext(ClientConnectionInfo.EMBEDDED_CONNECTION, tx, query, EMPTY_MAP));
        }
コード例 #2
0
        public override void Start()
        {
            DependencyResolver resolver = _database.Graph.DependencyResolver;

            this._executionEngine = ( ExecutionEngine )resolver.ResolveDependency(typeof(QueryExecutionEngine));
            this._service         = resolver.ResolveDependency(typeof(GraphDatabaseQueryService));
            this._contextFactory  = Neo4jTransactionalContextFactory.create(this._service, _locker);
        }
コード例 #3
0
 public TransactionFacade(TransitionalPeriodTransactionMessContainer kernel, QueryExecutionEngine engine, GraphDatabaseQueryService queryService, TransactionRegistry registry, LogProvider logProvider)
 {
     this._kernel       = kernel;
     this._engine       = engine;
     this._queryService = queryService;
     this._registry     = registry;
     this._logProvider  = logProvider;
 }
コード例 #4
0
ファイル: ExecutionEngine.cs プロジェクト: Neo4Net/Neo4Net
        /// <summary>
        /// Creates an execution engine around the give graph database </summary>
        /// <param name="queryService"> The database to wrap </param>
        /// <param name="logProvider"> A <seealso cref="LogProvider"/> for cypher-statements </param>
        public ExecutionEngine(GraphDatabaseQueryService queryService, LogProvider logProvider, CompilerFactory compilerFactory)
        {
            DependencyResolver  resolver            = queryService.DependencyResolver;
            Monitors            monitors            = resolver.ResolveDependency(typeof(Monitors));
            CacheTracer         cacheTracer         = new MonitoringCacheTracer(monitors.NewMonitor(typeof(StringCacheMonitor)));
            Config              config              = resolver.ResolveDependency(typeof(Config));
            CypherConfiguration cypherConfiguration = CypherConfiguration.fromConfig(config);
            CompilationTracer   tracer              = new TimingCompilationTracer(monitors.NewMonitor(typeof(TimingCompilationTracer.EventListener)));

            _inner = new [email protected](queryService, monitors, tracer, cacheTracer, cypherConfiguration, compilerFactory, logProvider, Clock.systemUTC());
        }
コード例 #5
0
        private static DatabaseManager NewDbMock()
        {
            GraphDatabaseFacade db = mock(typeof(GraphDatabaseFacade));
            DependencyResolver  dependencyResolver = mock(typeof(DependencyResolver));

            when(Db.DependencyResolver).thenReturn(dependencyResolver);
            GraphDatabaseQueryService queryService = mock(typeof(GraphDatabaseQueryService));

            when(queryService.DependencyResolver).thenReturn(dependencyResolver);
            when(dependencyResolver.ResolveDependency(typeof(GraphDatabaseQueryService))).thenReturn(queryService);
            DatabaseManager databaseManager = mock(typeof(DatabaseManager));

            when(databaseManager.GetDatabaseFacade(CUSTOM_DB_NAME)).thenReturn(db);
            return(databaseManager);
        }
コード例 #6
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("/");
        }
コード例 #7
0
 internal SnapshotExecutionEngine(GraphDatabaseQueryService queryService, Config config, LogProvider logProvider, CompilerFactory compilerFactory) : base(queryService, logProvider, compilerFactory)
 {
     this._maxQueryExecutionAttempts = config.Get(GraphDatabaseSettings.snapshot_query_retries);
 }
コード例 #8
0
 private TestSnapshotExecutionEngine CreateExecutionEngine(GraphDatabaseQueryService cypherService)
 {
     return(new TestSnapshotExecutionEngine(this, cypherService, _config, NullLogProvider.Instance, _compilerFactory));
 }
コード例 #9
0
 internal TestSnapshotExecutionEngine(SnapshotExecutionEngineTest outerInstance, GraphDatabaseQueryService queryService, Config config, LogProvider logProvider, CompilerFactory compatibilityFactory) : base(queryService, config, logProvider, compatibilityFactory)
 {
     this._outerInstance = outerInstance;
 }