Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setup() throws java.io.IOException, org.neo4j.causalclustering.catchup.storecopy.StoreIdDownloadFailedException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void Setup()
        {
            when(AddressResolver.resolveCorrectCCAddress(any(), any())).thenReturn(ResolvedFromAddress);
            when(StoreFiles.readStoreId(any())).thenReturn(ExpectedStoreId);
            when(BackupDelegator.fetchStoreId(any())).thenReturn(ExpectedStoreId);
            Subject = new CausalClusteringBackupStrategy(BackupDelegator, AddressResolver, NullLogProvider.Instance, StoreFiles);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Construct a wrapper of supported backup strategies
        /// </summary>
        /// <param name="onlineBackupContext"> the input of the backup tool, such as CLI arguments, config etc. </param>
        /// <param name="backupProtocolService"> the underlying backup implementation for HA and single node instances </param>
        /// <param name="backupDelegator"> the backup implementation used for CC backups </param>
        /// <param name="pageCache"> the page cache used moving files </param>
        /// <returns> strategy coordinator that handles the which backup strategies are tried and establishes if a backup was successful or not </returns>
        internal virtual BackupStrategyCoordinator BackupStrategyCoordinator(OnlineBackupContext onlineBackupContext, BackupProtocolService backupProtocolService, BackupDelegator backupDelegator, PageCache pageCache)
        {
            FileSystemAbstraction  fs                     = _outsideWorld.fileSystem();
            BackupCopyService      copyService            = new BackupCopyService(fs, new FileMoveProvider(fs));
            ProgressMonitorFactory progressMonitorFactory = ProgressMonitorFactory.textual(_outsideWorld.errorStream());
            BackupRecoveryService  recoveryService        = new BackupRecoveryService();
            long   timeout = onlineBackupContext.RequiredArguments.Timeout;
            Config config  = onlineBackupContext.Config;

            StoreFiles     storeFiles = new StoreFiles(fs, pageCache);
            BackupStrategy ccStrategy = new CausalClusteringBackupStrategy(backupDelegator, _addressResolver, _logProvider, storeFiles);
            BackupStrategy haStrategy = new HaBackupStrategy(backupProtocolService, _addressResolver, _logProvider, timeout);

            BackupStrategyWrapper         ccStrategyWrapper       = Wrap(ccStrategy, copyService, pageCache, config, recoveryService);
            BackupStrategyWrapper         haStrategyWrapper       = Wrap(haStrategy, copyService, pageCache, config, recoveryService);
            StrategyResolverService       strategyResolverService = new StrategyResolverService(haStrategyWrapper, ccStrategyWrapper);
            IList <BackupStrategyWrapper> strategies = strategyResolverService.GetStrategies(onlineBackupContext.RequiredArguments.SelectedBackupProtocol);

            return(new BackupStrategyCoordinator(_consistencyCheckService, _outsideWorld, _logProvider, progressMonitorFactory, strategies));
        }