Esempio n. 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void executeQueryStartDefaultTransaction()
        internal virtual void ExecuteQueryStartDefaultTransaction()
        {
            KernelTransaction   kernelTransaction = mock(typeof(KernelTransaction));
            InternalTransaction transaction       = new TopLevelTransaction(kernelTransaction);

            when(_queryService.beginTransaction(KernelTransaction.Type.@implicit, AUTH_DISABLED)).thenReturn(transaction);

            _graphDatabaseFacade.execute("create (n)");
            _graphDatabaseFacade.execute("create (n)", new Dictionary <string, object>());

            long timeout = Config.defaults().get(GraphDatabaseSettings.transaction_timeout).toMillis();

            verify(_spi, times(2)).beginTransaction(KernelTransaction.Type.@implicit, AUTH_DISABLED, timeout);
        }
Esempio n. 2
0
        private void SetUpMocks()
        {
            _queryService = mock(typeof(GraphDatabaseQueryService));
            DependencyResolver resolver = mock(typeof(DependencyResolver));

            _txBridge         = mock(typeof(ThreadToStatementContextBridge));
            _initialStatement = mock(typeof(KernelStatement));

            _statistics = new ConfiguredExecutionStatistics(this);
            QueryRegistryOperations queryRegistryOperations = mock(typeof(QueryRegistryOperations));
            InternalTransaction     internalTransaction     = mock(typeof(InternalTransaction));

            when(internalTransaction.TerminationReason()).thenReturn(null);

            when(_initialStatement.queryRegistration()).thenReturn(queryRegistryOperations);
            when(_queryService.DependencyResolver).thenReturn(resolver);
            when(resolver.ResolveDependency(typeof(ThreadToStatementContextBridge))).thenReturn(_txBridge);
            when(_queryService.beginTransaction(any(), any())).thenReturn(internalTransaction);

            KernelTransaction mockTransaction = mockTransaction(_initialStatement);

            when(_txBridge.get()).thenReturn(_initialStatement);
            when(_txBridge.getKernelTransactionBoundToThisThread(true)).thenReturn(mockTransaction);
        }