//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldResumeCommandApplicationProcessIfDownloaderIsStopped() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldResumeCommandApplicationProcessIfDownloaderIsStopped() { // given CoreStateDownloader coreStateDownloader = mock(typeof(CoreStateDownloader)); when(coreStateDownloader.DownloadSnapshot(any())).thenReturn(false); //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(null, applicationProcess, coreStateDownloader, log, timeout, () => _dbHealth, new Monitors()); // when Thread thread = new Thread(persistentSnapshotDownloader); thread.Start(); AwaitOneIteration(timeout); persistentSnapshotDownloader.Stop(); thread.Join(); // then verify(applicationProcess, times(1)).pauseApplier(OPERATION_NAME); verify(applicationProcess, times(1)).resumeApplier(OPERATION_NAME); assertTrue(persistentSnapshotDownloader.HasCompleted()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldPauseAndResumeApplicationProcessIfDownloadIsSuccessful() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldPauseAndResumeApplicationProcessIfDownloadIsSuccessful() { // given CoreStateDownloader coreStateDownloader = mock(typeof(CoreStateDownloader)); when(coreStateDownloader.DownloadSnapshot(any())).thenReturn(true); //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)); PersistentSnapshotDownloader persistentSnapshotDownloader = new PersistentSnapshotDownloader(_catchupAddressProvider, applicationProcess, coreStateDownloader, log, new NoTimeout(), () => _dbHealth, new Monitors()); // when persistentSnapshotDownloader.Run(); // then verify(applicationProcess, times(1)).pauseApplier(OPERATION_NAME); verify(applicationProcess, times(1)).resumeApplier(OPERATION_NAME); verify(coreStateDownloader, times(1)).downloadSnapshot(any()); assertTrue(persistentSnapshotDownloader.HasCompleted()); }
//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()); }