Example #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldRunPersistentDownloader() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldRunPersistentDownloader()
        {
            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));
            CoreStateDownloaderService coreStateDownloaderService = new CoreStateDownloaderService(_centralJobScheduler, coreStateDownloader, applicationProcess, LogProvider(log), new NoTimeout(), () => _dbHealth, new Monitors());

            coreStateDownloaderService.ScheduleDownload(_catchupAddressProvider);
            WaitForApplierToResume(applicationProcess);

            verify(applicationProcess, times(1)).pauseApplier(OPERATION_NAME);
            verify(applicationProcess, times(1)).resumeApplier(OPERATION_NAME);
            verify(coreStateDownloader, times(1)).downloadSnapshot(any());
        }
Example #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldOnlyScheduleOnePersistentDownloaderTaskAtTheTime() throws InterruptedException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldOnlyScheduleOnePersistentDownloaderTaskAtTheTime()
        {
            AtomicInteger        schedules            = new AtomicInteger();
            CountingJobScheduler countingJobScheduler = new CountingJobScheduler(schedules, _centralJobScheduler);
            Semaphore            blockDownloader      = new Semaphore(0);
            CoreStateDownloader  coreStateDownloader  = new BlockingCoreStateDownloader(blockDownloader);
//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));
            CoreStateDownloaderService coreStateDownloaderService = new CoreStateDownloaderService(countingJobScheduler, coreStateDownloader, applicationProcess, LogProvider(log), new NoTimeout(), () => _dbHealth, new Monitors());

            coreStateDownloaderService.ScheduleDownload(_catchupAddressProvider);
            Thread.Sleep(50);
            coreStateDownloaderService.ScheduleDownload(_catchupAddressProvider);
            coreStateDownloaderService.ScheduleDownload(_catchupAddressProvider);
            coreStateDownloaderService.ScheduleDownload(_catchupAddressProvider);

            assertEquals(1, schedules.get());
            blockDownloader.release();
        }