Exemplo n.º 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private java.util.List<LockOperationRecord> traceQueryLocks(String query, LockOperationListener... listeners) throws org.neo4j.kernel.impl.query.QueryExecutionKernelException
        private IList <LockOperationRecord> TraceQueryLocks(string query, params LockOperationListener[] listeners)
        {
            GraphDatabaseQueryService graph           = DatabaseRule.resolveDependency(typeof(GraphDatabaseQueryService));
            QueryExecutionEngine      executionEngine = DatabaseRule.resolveDependency(typeof(QueryExecutionEngine));

            using (InternalTransaction tx = graph.BeginTransaction(KernelTransaction.Type.@implicit, LoginContext.AUTH_DISABLED))
            {
                TransactionalContextWrapper context = new TransactionalContextWrapper(CreateTransactionContext(graph, tx, query), listeners);
                executionEngine.ExecuteQuery(query, VirtualValues.emptyMap(), context);
                return(new List <LockOperationRecord>(context.RecordingLocks.LockOperationRecords));
            }
        }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldProduceSensibleMapRepresentationInWaitingOnQueryState()
        public virtual void ShouldProduceSensibleMapRepresentationInWaitingOnQueryState()
        {
            // given
            WaitingOnQuery status = new WaitingOnQuery(new ExecutingQuery(12, null, null, "", VirtualValues.emptyMap(), null, () => 0, PageCursorTracer.NULL, Thread.CurrentThread.Id, Thread.CurrentThread.Name, _clock, FakeCpuClock.NOT_AVAILABLE, HeapAllocation.NOT_AVAILABLE), _clock.nanos());

            _clock.forward(1025, TimeUnit.MILLISECONDS);

            // when
            IDictionary <string, object> statusMap = status.ToMap(_clock.nanos());

            // then
            assertEquals("waiting", status.Name());
            IDictionary <string, object> expected = new Dictionary <string, object>();

            expected["waitTimeMillis"] = 1025L;
            expected["queryId"]        = "query-12";
            assertEquals(expected, statusMap);
        }