//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void verifyAsyncActionCausesConcurrentFlushingRush(org.neo4j.function.ThrowingConsumer<CheckPointerImpl,java.io.IOException> asyncAction) throws Exception private void VerifyAsyncActionCausesConcurrentFlushingRush(ThrowingConsumer <CheckPointerImpl, IOException> asyncAction) { AtomicLong limitDisableCounter = new AtomicLong(); AtomicLong observedRushCount = new AtomicLong(); BinaryLatch backgroundCheckPointStartedLatch = new BinaryLatch(); BinaryLatch forceCheckPointStartLatch = new BinaryLatch(); _limiter = new IOLimiterAnonymousInnerClass4(this, limitDisableCounter, forceCheckPointStartLatch); MockTxIdStore(); CheckPointerImpl checkPointer = checkPointer(); doAnswer(invocation => { backgroundCheckPointStartedLatch.Release(); forceCheckPointStartLatch.Await(); long newValue = limitDisableCounter.get(); observedRushCount.set(newValue); return(null); }).when(_storageEngine).flushAndForce(_limiter); Future <object> forceCheckPointer = forkFuture(() => { backgroundCheckPointStartedLatch.Await(); asyncAction.Accept(checkPointer); return(null); }); when(_threshold.isCheckPointingNeeded(anyLong(), eq(_info))).thenReturn(true); checkPointer.CheckPointIfNeeded(_info); forceCheckPointer.get(); assertThat(observedRushCount.get(), @is(1L)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldFlushIfItIsNeeded() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldFlushIfItIsNeeded() { // Given CheckPointerImpl checkPointing = CheckPointer(); when(_threshold.isCheckPointingNeeded(anyLong(), eq(_info))).thenReturn(true, false); MockTxIdStore(); checkPointing.Start(); // When long txId = checkPointing.CheckPointIfNeeded(_info); // Then assertEquals(_transactionId, txId); verify(_storageEngine, times(1)).flushAndForce(_limiter); verify(_health, times(2)).assertHealthy(typeof(IOException)); verify(_appender, times(1)).checkPoint(eq(_logPosition), any(typeof(LogCheckPointEvent))); verify(_threshold, times(1)).initialize(_initialTransactionId); verify(_threshold, times(1)).checkPointHappened(_transactionId); verify(_threshold, times(1)).isCheckPointingNeeded(_transactionId, _info); verify(_logPruning, times(1)).pruneLogs(_logPosition.LogVersion); verify(_tracer, times(1)).beginCheckPoint(); verifyNoMoreInteractions(_storageEngine, _health, _appender, _threshold, _tracer); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void mustUseIoLimiterFromFlushing() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void MustUseIoLimiterFromFlushing() { _limiter = new IOLimiterAnonymousInnerClass(this); when(_threshold.isCheckPointingNeeded(anyLong(), eq(_info))).thenReturn(true, false); MockTxIdStore(); CheckPointerImpl checkPointing = CheckPointer(); checkPointing.Start(); checkPointing.CheckPointIfNeeded(_info); verify(_storageEngine).flushAndForce(_limiter); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotFlushIfItIsNotNeeded() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNotFlushIfItIsNotNeeded() { // Given CheckPointerImpl checkPointing = CheckPointer(); when(_threshold.isCheckPointingNeeded(anyLong(), any(typeof(TriggerInfo)))).thenReturn(false); checkPointing.Start(); // When long txId = checkPointing.CheckPointIfNeeded(_info); // Then assertEquals(-1, txId); verifyZeroInteractions(_storageEngine); verifyZeroInteractions(_tracer); verifyZeroInteractions(_appender); }