示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void reportQueryWaitingTimeToTransactionStatisticWhenFinishQueryExecution()
        public virtual void ReportQueryWaitingTimeToTransactionStatisticWhenFinishQueryExecution()
        {
            KernelTransactionImplementation transaction = mock(typeof(KernelTransactionImplementation));
            TxStateHolder txStateHolder  = mock(typeof(TxStateHolder));
            StorageReader storeStatement = mock(typeof(StorageReader));

            KernelTransactionImplementation.Statistics statistics = new KernelTransactionImplementation.Statistics(transaction, new AtomicReference <CpuClock>(CpuClock.NOT_AVAILABLE), new AtomicReference <HeapAllocation>(HeapAllocation.NOT_AVAILABLE));
            when(transaction.GetStatistics()).thenReturn(statistics);
            when(transaction.ExecutingQueries()).thenReturn(ExecutingQueryList.EMPTY);

            KernelStatement statement = new KernelStatement(transaction, txStateHolder, storeStatement, LockTracer.NONE, mock(typeof(StatementOperationParts)), new ClockContext(), EmptyVersionContextSupplier.EMPTY);

            statement.Acquire();

            ExecutingQuery query  = QueryWithWaitingTime;
            ExecutingQuery query2 = QueryWithWaitingTime;
            ExecutingQuery query3 = QueryWithWaitingTime;

            statement.StopQueryExecution(query);
            statement.StopQueryExecution(query2);
            statement.StopQueryExecution(query3);

            assertEquals(3, statistics.GetWaitingTimeNanos(1));
        }
示例#2
0
 public override void UnregisterExecutingQuery(KernelStatement statement, ExecutingQuery executingQuery)
 {
     statement.StopQueryExecution(executingQuery);
 }