Exemple #1
0
//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);
        }
Exemple #2
0
 public CoreStateDownloaderService(JobScheduler jobScheduler, CoreStateDownloader downloader, CommandApplicationProcess applicationProcess, LogProvider logProvider, Org.Neo4j.causalclustering.helper.TimeoutStrategy_Timeout downloaderPauseStrategy, System.Func <DatabaseHealth> dbHealth, Monitors monitors)
 {
     this._jobScheduler       = jobScheduler;
     this._downloader         = downloader;
     this._applicationProcess = applicationProcess;
     this._log = logProvider.getLog(this.GetType());
     this._downloaderPauseStrategy = downloaderPauseStrategy;
     this._dbHealth = dbHealth;
     this._monitors = monitors;
 }
Exemple #3
0
 internal PersistentSnapshotDownloader(CatchupAddressProvider addressProvider, CommandApplicationProcess applicationProcess, CoreStateDownloader downloader, Log log, Org.Neo4j.causalclustering.helper.TimeoutStrategy_Timeout pauseStrategy, System.Func <DatabaseHealth> dbHealth, Monitors monitors)
 {
     this._applicationProcess = applicationProcess;
     this._addressProvider    = addressProvider;
     this._downloader         = downloader;
     this._log         = log;
     this._timeout     = pauseStrategy;
     this._dbHealth    = dbHealth;
     this._monitor     = monitors.NewMonitor(typeof(Monitor));
     this._state       = State.Initiated;
     this._keepRunning = true;
 }
Exemple #4
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());
        }
Exemple #5
0
//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());
        }
Exemple #6
0
 public CatchUpResponseAdaptorAnonymousInnerClass(CoreStateDownloader outerInstance)
 {
     this.outerInstance = outerInstance;
 }
Exemple #7
0
 private void InitializeInstanceFields()
 {
     _catchupAddressProvider = CatchupAddressProvider.fromSingleAddress(_remoteAddress);
     _downloader             = new CoreStateDownloader(_localDatabase, _startStopLife, _remoteStore, _catchUpClient, _logProvider, _storeCopyProcess, _coreStateMachines, _snapshotService, _commitStateHelper);
 }