//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotStartIfCurrentlyRunning() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNotStartIfCurrentlyRunning() { // given CoreStateDownloader coreStateDownloader = mock(typeof(CoreStateDownloader)); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.causalclustering.core.state.CommandApplicationProcess applicationProcess = mock(org.neo4j.causalclustering.core.state.CommandApplicationProcess.class); CommandApplicationProcess applicationProcess = mock(typeof(CommandApplicationProcess)); when(coreStateDownloader.DownloadSnapshot(any())).thenReturn(false); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.logging.Log log = mock(org.neo4j.logging.Log.class); Log log = mock(typeof(Log)); NoTimeout timeout = new NoTimeout(); PersistentSnapshotDownloader persistentSnapshotDownloader = new PersistentSnapshotDownloader(_catchupAddressProvider, applicationProcess, coreStateDownloader, log, timeout, () => _dbHealth, new Monitors()); Thread thread = new Thread(persistentSnapshotDownloader); // when thread.Start(); AwaitOneIteration(timeout); persistentSnapshotDownloader.Run(); persistentSnapshotDownloader.Stop(); thread.Join(); // then verify(applicationProcess, times(1)).pauseApplier(OPERATION_NAME); verify(applicationProcess, times(1)).resumeApplier(OPERATION_NAME); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldEventuallySucceed() public virtual void ShouldEventuallySucceed() { // given CoreStateDownloader coreStateDownloader = new EventuallySuccessfulDownloader(this, 3); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.causalclustering.core.state.CommandApplicationProcess applicationProcess = mock(org.neo4j.causalclustering.core.state.CommandApplicationProcess.class); CommandApplicationProcess applicationProcess = mock(typeof(CommandApplicationProcess)); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.logging.Log log = mock(org.neo4j.logging.Log.class); Log log = mock(typeof(Log)); NoTimeout timeout = new NoTimeout(); PersistentSnapshotDownloader persistentSnapshotDownloader = new PersistentSnapshotDownloader(_catchupAddressProvider, applicationProcess, coreStateDownloader, log, timeout, () => _dbHealth, new Monitors()); // when persistentSnapshotDownloader.Run(); // then verify(applicationProcess, times(1)).pauseApplier(OPERATION_NAME); verify(applicationProcess, times(1)).resumeApplier(OPERATION_NAME); assertEquals(3, timeout.CurrentCount()); assertTrue(persistentSnapshotDownloader.HasCompleted()); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void awaitOneIteration(NoTimeout timeout) throws java.util.concurrent.TimeoutException private void AwaitOneIteration(NoTimeout timeout) { Predicates.await(() => timeout.CurrentCount() > 0, 2, TimeUnit.SECONDS); }