Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldDownloadCompleteStoreWhenEmpty() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldDownloadCompleteStoreWhenEmpty()
        {
            // given
            StoreId remoteStoreId = new StoreId(5, 6, 7, 8);

            when(_remoteStore.getStoreId(_remoteAddress)).thenReturn(remoteStoreId);
            when(_localDatabase.Empty).thenReturn(true);

            // when
            _downloader.downloadSnapshot(_catchupAddressProvider);

            // then
            verify(_remoteStore, never()).tryCatchingUp(any(), any(), any(), anyBoolean(), anyBoolean());
            verify(_storeCopyProcess).replaceWithStoreFrom(_catchupAddressProvider, remoteStoreId);
        }
Ejemplo n.º 2
0
        public override void Run()
        {
            if (!MoveToRunningState())
            {
                return;
            }

            try
            {
                _monitor.startedDownloadingSnapshot();
                _applicationProcess.pauseApplier(OPERATION_NAME);
                while (_keepRunning && !_downloader.downloadSnapshot(_addressProvider))
                {
                    Thread.Sleep(_timeout.Millis);
                    _timeout.increment();
                }
            }
            catch (InterruptedException)
            {
                Thread.CurrentThread.Interrupt();
                _log.warn("Persistent snapshot downloader was interrupted");
            }
            catch (DatabaseShutdownException e)
            {
                _log.warn("Store copy aborted due to shut down", e);
            }
            catch (Exception e)
            {
                _log.error("Unrecoverable error during store copy", e);
                _dbHealth.get().panic(e);
            }
            finally
            {
                _applicationProcess.resumeApplier(OPERATION_NAME);
                _monitor.downloadSnapshotComplete();
                _state = State.Completed;
            }
        }