//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void markForTerminationReturnsFalseWhenNotSuccessful() public virtual void MarkForTerminationReturnsFalseWhenNotSuccessful() { KernelTransactionImplementation tx = mock(typeof(KernelTransactionImplementation)); when(tx.ReuseCount).thenReturn(42); when(tx.MarkForTermination(anyLong(), any())).thenReturn(false); KernelTransactionImplementationHandle handle = new KernelTransactionImplementationHandle(tx, _clock); assertFalse(handle.MarkForTermination(Org.Neo4j.Kernel.Api.Exceptions.Status_Transaction.Terminated)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void transactionStatisticForReusedTransactionIsNotAvailable() public virtual void TransactionStatisticForReusedTransactionIsNotAvailable() { KernelTransactionImplementation tx = mock(typeof(KernelTransactionImplementation)); when(tx.Open).thenReturn(true); when(tx.ReuseCount).thenReturn(2).thenReturn(3); KernelTransactionImplementationHandle handle = new KernelTransactionImplementationHandle(tx, _clock); assertSame(TransactionExecutionStatistic.NotAvailable, handle.TransactionStatistic()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void isOpenForUnchangedKernelTransactionImplementation() public virtual void isOpenForUnchangedKernelTransactionImplementation() { int reuseCount = 42; KernelTransactionImplementation tx = mock(typeof(KernelTransactionImplementation)); when(tx.Open).thenReturn(true); when(tx.ReuseCount).thenReturn(reuseCount); KernelTransactionImplementationHandle handle = new KernelTransactionImplementationHandle(tx, _clock); assertTrue(handle.Open); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void returnsCorrectLastTransactionTimestampWhenStartedForClosedTx() public virtual void ReturnsCorrectLastTransactionTimestampWhenStartedForClosedTx() { long lastCommittedTxTimestamp = 4242; KernelTransactionImplementation tx = mock(typeof(KernelTransactionImplementation)); when(tx.LastTransactionTimestampWhenStarted()).thenReturn(lastCommittedTxTimestamp); when(tx.Open).thenReturn(false); KernelTransactionImplementationHandle handle = new KernelTransactionImplementationHandle(tx, _clock); assertEquals(lastCommittedTxTimestamp, handle.LastTransactionTimestampWhenStarted()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void isOpenForReusedKernelTransactionImplementation() public virtual void isOpenForReusedKernelTransactionImplementation() { int initialReuseCount = 42; int nextReuseCount = 4242; KernelTransactionImplementation tx = mock(typeof(KernelTransactionImplementation)); when(tx.Open).thenReturn(true); when(tx.ReuseCount).thenReturn(initialReuseCount).thenReturn(nextReuseCount); KernelTransactionImplementationHandle handle = new KernelTransactionImplementationHandle(tx, _clock); assertFalse(handle.Open); }
public override bool Equals(object o) { if (this == o) { return(true); } if (o == null || this.GetType() != o.GetType()) { return(false); } KernelTransactionImplementationHandle that = ( KernelTransactionImplementationHandle )o; return(_txReuseCount == that._txReuseCount && _tx.Equals(that._tx)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void markForTerminationCallsKernelTransactionImplementation() public virtual void MarkForTerminationCallsKernelTransactionImplementation() { int reuseCount = 42; Org.Neo4j.Kernel.Api.Exceptions.Status_Transaction terminationReason = Org.Neo4j.Kernel.Api.Exceptions.Status_Transaction.Terminated; KernelTransactionImplementation tx = mock(typeof(KernelTransactionImplementation)); when(tx.ReuseCount).thenReturn(reuseCount); KernelTransactionImplementationHandle handle = new KernelTransactionImplementationHandle(tx, _clock); handle.MarkForTermination(terminationReason); verify(tx).markForTermination(reuseCount, terminationReason); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void skipTransactionWithoutTimeout() internal virtual void SkipTransactionWithoutTimeout() { HashSet <KernelTransactionHandle> transactions = new HashSet <KernelTransactionHandle>(); KernelTransactionImplementation tx1 = PrepareTxMock(7, 3, 0); KernelTransactionImplementation tx2 = PrepareTxMock(8, 4, 0); KernelTransactionImplementationHandle handle1 = new KernelTransactionImplementationHandle(tx1, _fakeClock); KernelTransactionImplementationHandle handle2 = new KernelTransactionImplementationHandle(tx2, _fakeClock); transactions.Add(handle1); transactions.Add(handle2); when(_kernelTransactions.activeTransactions()).thenReturn(transactions); KernelTransactionMonitor transactionMonitor = BuildTransactionMonitor(); _fakeClock.forward(300, TimeUnit.MILLISECONDS); transactionMonitor.Run(); verify(tx1, never()).markForTermination(Org.Neo4j.Kernel.Api.Exceptions.Status_Transaction.TransactionTimedOut); verify(tx2, never()).markForTermination(Org.Neo4j.Kernel.Api.Exceptions.Status_Transaction.TransactionTimedOut); _logProvider.rawMessageMatcher().assertNotContains("timeout"); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void terminateExpiredTransactions() internal virtual void TerminateExpiredTransactions() { HashSet <KernelTransactionHandle> transactions = new HashSet <KernelTransactionHandle>(); KernelTransactionImplementation tx1 = PrepareTxMock(3, 1, 3); KernelTransactionImplementation tx2 = PrepareTxMock(4, 1, 8); KernelTransactionImplementationHandle handle1 = new KernelTransactionImplementationHandle(tx1, _fakeClock); KernelTransactionImplementationHandle handle2 = new KernelTransactionImplementationHandle(tx2, _fakeClock); transactions.Add(handle1); transactions.Add(handle2); when(_kernelTransactions.activeTransactions()).thenReturn(transactions); KernelTransactionMonitor transactionMonitor = BuildTransactionMonitor(); _fakeClock.forward(3, TimeUnit.MILLISECONDS); transactionMonitor.Run(); verify(tx1, never()).markForTermination(Org.Neo4j.Kernel.Api.Exceptions.Status_Transaction.TransactionTimedOut); verify(tx2, never()).markForTermination(Org.Neo4j.Kernel.Api.Exceptions.Status_Transaction.TransactionTimedOut); _logProvider.rawMessageMatcher().assertNotContains("timeout"); _fakeClock.forward(2, TimeUnit.MILLISECONDS); transactionMonitor.Run(); verify(tx1).markForTermination(EXPECTED_REUSE_COUNT, Org.Neo4j.Kernel.Api.Exceptions.Status_Transaction.TransactionTimedOut); verify(tx2, never()).markForTermination(Org.Neo4j.Kernel.Api.Exceptions.Status_Transaction.TransactionTimedOut); _logProvider.rawMessageMatcher().assertContains("timeout"); _logProvider.clear(); _fakeClock.forward(10, TimeUnit.MILLISECONDS); transactionMonitor.Run(); verify(tx2).markForTermination(EXPECTED_REUSE_COUNT, Org.Neo4j.Kernel.Api.Exceptions.Status_Transaction.TransactionTimedOut); _logProvider.rawMessageMatcher().assertContains("timeout"); }