Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldConvertListsAndMapsWhenPassingFromScalaToJava() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldConvertListsAndMapsWhenPassingFromScalaToJava()
        {
            GraphDatabaseQueryService graph    = new GraphDatabaseCypherService(this.Database.GraphDatabaseAPI);
            DependencyResolver        resolver = graph.DependencyResolver;
            Monitors monitors = resolver.ResolveDependency(typeof(Monitors));

            NullLogProvider nullLogProvider = NullLogProvider.Instance;

            Config config = resolver.ResolveDependency(typeof(Config));
            CypherConfiguration cypherConfig = CypherConfiguration.fromConfig(config);

            CommunityCompilerFactory compilerFactory = new CommunityCompilerFactory(graph, monitors, nullLogProvider, cypherConfig.toCypherPlannerConfiguration(config), cypherConfig.toCypherRuntimeConfiguration());
            ExecutionEngine          executionEngine = new ExecutionEngine(graph, nullLogProvider, compilerFactory);

            Result result;

            using (InternalTransaction tx = graph.BeginTransaction(KernelTransaction.Type.@implicit, LoginContext.AUTH_DISABLED))
            {
                string query            = "RETURN { key : 'Value' , collectionKey: [{ inner: 'Map1' }, { inner: 'Map2' }]}";
                TransactionalContext tc = CreateTransactionContext(graph, tx, query);
                result = executionEngine.ExecuteQuery(query, _noParams, tc);

                VerifyResult(result);

                result.Close();
                tx.Success();
            }
        }
Ejemplo n.º 2
0
        protected internal override QueryExecutionEngine CreateEngine(Dependencies deps, GraphDatabaseAPI graphAPI)
        {
            GraphDatabaseCypherService queryService = new GraphDatabaseCypherService(graphAPI);

            deps.SatisfyDependency(queryService);

            DependencyResolver         resolver        = graphAPI.DependencyResolver;
            LogService                 logService      = resolver.ResolveDependency(typeof(LogService));
            Monitors                   monitors        = resolver.ResolveDependency(typeof(Monitors));
            Config                     config          = resolver.ResolveDependency(typeof(Config));
            CypherConfiguration        cypherConfig    = CypherConfiguration.fromConfig(config);
            CypherPlannerConfiguration plannerConfig   = cypherConfig.toCypherPlannerConfiguration(config);
            CypherRuntimeConfiguration runtimeConfig   = cypherConfig.toCypherRuntimeConfiguration();
            LogProvider                logProvider     = logService.InternalLogProvider;
            CommunityCompilerFactory   compilerFactory = new CommunityCompilerFactory(queryService, monitors, logProvider, plannerConfig, runtimeConfig);

            deps.SatisfyDependencies(compilerFactory);
            return(CreateEngine(queryService, config, logProvider, compilerFactory));
        }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUp() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void SetUp()
        {
            GraphDatabaseQueryService cypherService = new GraphDatabaseCypherService(this.Database.GraphDatabaseAPI);

            _compilerFactory      = mock(typeof(CompilerFactory));
            _transactionalContext = mock(typeof(TransactionalContext));
            KernelStatement kernelStatement = mock(typeof(KernelStatement));

            _executor       = mock(typeof(SnapshotExecutionEngine.ParametrizedQueryExecutor));
            _versionContext = mock(typeof(VersionContext));

            _executionEngine = CreateExecutionEngine(cypherService);
            when(kernelStatement.VersionContext).thenReturn(_versionContext);
            when(_transactionalContext.statement()).thenReturn(kernelStatement);
            Result          result     = mock(typeof(Result));
            QueryStatistics statistics = mock(typeof(QueryStatistics));

            when(result.QueryStatistics).thenReturn(statistics);
            when(_executor.execute(any(), anyMap(), any())).thenReturn(result);
        }
Ejemplo n.º 4
0
 private ExecutionEngine StandardEngine(GraphDatabaseCypherService queryService, LogProvider logProvider, CommunityCompilerFactory compilerFactory)
 {
     return(new ExecutionEngine(queryService, logProvider, compilerFactory));
 }
Ejemplo n.º 5
0
 private SnapshotExecutionEngine SnapshotEngine(GraphDatabaseCypherService queryService, Config config, LogProvider logProvider, CommunityCompilerFactory compilerFactory)
 {
     return(new SnapshotExecutionEngine(queryService, config, logProvider, compilerFactory));
 }
Ejemplo n.º 6
0
 private QueryExecutionEngine CreateEngine(GraphDatabaseCypherService queryService, Config config, LogProvider logProvider, CommunityCompilerFactory compilerFactory)
 {
     return(config.Get(GraphDatabaseSettings.snapshot_query) ? SnapshotEngine(queryService, config, logProvider, compilerFactory) : StandardEngine(queryService, logProvider, compilerFactory));
 }