//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void failureDuringMoveCausesAbsoluteFailure() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void FailureDuringMoveCausesAbsoluteFailure() { // given moves fail doThrow(typeof(IOException)).when(_backupCopyService).moveBackupLocation(any(), any()); // and fallback to full _requiredArguments = _requiredArguments(true); _onlineBackupContext = new OnlineBackupContext(_requiredArguments, _config, ConsistencyFlags()); // and backup exists when(_backupCopyService.backupExists(any())).thenReturn(true); // and incremental fails when(_backupStrategyImplementation.performIncrementalBackup(any(), any(), any())).thenReturn(new Fallible <>(BackupStageOutcome.Failure, null)); // and full passes when(_backupStrategyImplementation.performFullBackup(any(), any(), any())).thenReturn(new Fallible <>(BackupStageOutcome.Success, null)); // when Fallible <BackupStrategyOutcome> state = _subject.doBackup(_onlineBackupContext); // then result was catastrophic and contained reason assertEquals(BackupStrategyOutcome.AbsoluteFailure, state.State); assertEquals(typeof(IOException), state.Cause.get().GetType()); // and full backup was definitely performed verify(_backupStrategyImplementation).performFullBackup(any(), any(), any()); }
/// <summary> /// Iterate over all the provided strategies trying to perform a successful backup. /// Will also do consistency checks if specified in <seealso cref="OnlineBackupContext"/> /// </summary> /// <param name="onlineBackupContext"> filesystem, command arguments and configuration </param> /// <exception cref="CommandFailed"> when backup failed or there were issues with consistency checks </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public void performBackup(OnlineBackupContext onlineBackupContext) throws org.neo4j.commandline.admin.CommandFailed public virtual void PerformBackup(OnlineBackupContext onlineBackupContext) { // Convenience OnlineBackupRequiredArguments requiredArgs = onlineBackupContext.RequiredArguments; Path destination = onlineBackupContext.ResolvedLocationFromName; ConsistencyFlags consistencyFlags = onlineBackupContext.ConsistencyFlags; Fallible <BackupStrategyOutcome> throwableWithState = null; IList <Exception> causesOfFailure = new List <Exception>(); foreach (BackupStrategyWrapper backupStrategy in _strategies) { throwableWithState = backupStrategy.DoBackup(onlineBackupContext); if (throwableWithState.State == BackupStrategyOutcome.Success) { break; } if (throwableWithState.State == BackupStrategyOutcome.CorrectStrategyFailed) { throw CommandFailedWithCause(throwableWithState).get(); } throwableWithState.Cause.ifPresent(causesOfFailure.add); } if (throwableWithState == null || !BackupStrategyOutcome.Success.Equals(throwableWithState.State)) { CommandFailed commandFailed = new CommandFailed("Failed to run a backup using the available strategies."); causesOfFailure.ForEach(commandFailed.addSuppressed); throw commandFailed; } if (requiredArgs.DoConsistencyCheck) { PerformConsistencyCheck(onlineBackupContext.Config, requiredArgs, consistencyFlags, DatabaseLayout.of(destination.toFile())); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldParseATimeoutWithUnits() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldParseATimeoutWithUnits() { OnlineBackupContextFactory handler = new OnlineBackupContextFactory(_homeDir, _configDir); OnlineBackupContext context = handler.CreateContext(RequiredAnd("--timeout=10h")); OnlineBackupRequiredArguments requiredArguments = context.RequiredArguments; assertEquals(HOURS.toMillis(10), requiredArguments.Timeout); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldInterpretAUnitlessTimeoutAsSeconds() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldInterpretAUnitlessTimeoutAsSeconds() { OnlineBackupContextFactory handler = new OnlineBackupContextFactory(_homeDir, _configDir); OnlineBackupContext context = handler.CreateContext("--timeout=10", "--backup-dir=/", "--name=mybackup"); OnlineBackupRequiredArguments requiredArguments = context.RequiredArguments; assertEquals(SECONDS.toMillis(10), requiredArguments.Timeout); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldDefaultTimeoutToTwentyMinutes() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldDefaultTimeoutToTwentyMinutes() { OnlineBackupContextFactory handler = new OnlineBackupContextFactory(_homeDir, _configDir); OnlineBackupContext context = handler.CreateContext("--backup-dir=/", "--name=mybackup"); OnlineBackupRequiredArguments requiredArguments = context.RequiredArguments; assertEquals(MINUTES.toMillis(20), requiredArguments.Timeout); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void unspecifiedHostnameIsEmptyOptional() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void UnspecifiedHostnameIsEmptyOptional() { OnlineBackupContextFactory handler = new OnlineBackupContextFactory(_homeDir, _configDir); OnlineBackupContext context = handler.CreateContext(RequiredAnd("--from=:1234")); OnlineBackupRequiredArguments requiredArguments = context.RequiredArguments; assertFalse(requiredArguments.Address.Hostname.Present); assertEquals(1234, requiredArguments.Address.Port.Value.intValue()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void acceptBothIfSpecified() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void AcceptBothIfSpecified() { OnlineBackupContextFactory handler = new OnlineBackupContextFactory(_homeDir, _configDir); OnlineBackupContext context = handler.CreateContext(RequiredAnd("--from=foo.bar.server:1234")); OnlineBackupRequiredArguments requiredArguments = context.RequiredArguments; assertEquals("foo.bar.server", requiredArguments.Address.Hostname.get()); assertEquals(1234, requiredArguments.Address.Port.Value.intValue()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void acceptHostWithTrailingPort() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void AcceptHostWithTrailingPort() { OnlineBackupContextFactory handler = new OnlineBackupContextFactory(_homeDir, _configDir); OnlineBackupContext context = handler.CreateContext(RequiredAnd("--from=foo.bar.server:")); OnlineBackupRequiredArguments requiredArguments = context.RequiredArguments; assertEquals("foo.bar.server", requiredArguments.Address.Hostname.get()); assertFalse(requiredArguments.Address.Port.HasValue); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void unspecifiedPortIsEmptyOptional() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void UnspecifiedPortIsEmptyOptional() { OnlineBackupContextFactory handler = new OnlineBackupContextFactory(_homeDir, _configDir); OnlineBackupContext context = handler.CreateContext(RequiredAnd("--from=abc")); OnlineBackupRequiredArguments requiredArguments = context.RequiredArguments; assertEquals("abc", requiredArguments.Address.Hostname.get()); assertFalse(requiredArguments.Address.Port.HasValue); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public OnlineBackupContext createContext(String... args) throws org.neo4j.commandline.admin.IncorrectUsage, org.neo4j.commandline.admin.CommandFailed public virtual OnlineBackupContext CreateContext(params string[] args) { try { Arguments arguments = arguments(); arguments.Parse(args); OptionalHostnamePort address = Converters.toOptionalHostnamePortFromRawAddress(arguments.Get(ARG_NAME_BACKUP_SOURCE)); Path folder = this.GetBackupDirectory(arguments); string name = arguments.Get(ARG_NAME_BACKUP_NAME); bool fallbackToFull = arguments.GetBoolean(ARG_NAME_FALLBACK_FULL); bool doConsistencyCheck = arguments.GetBoolean(ARG_NAME_CHECK_CONSISTENCY); long timeout = ( long? )arguments.Get(ARG_NAME_TIMEOUT, TimeUtil.parseTimeMillis).Value; SelectedBackupProtocol selectedBackupProtocol = SelectedBackupProtocol.fromUserInput(arguments.Get(ARG_NAME_PROTO_OVERRIDE)); string pagecacheMemory = arguments.Get(ARG_NAME_PAGECACHE); Optional <Path> additionalConfig = arguments.GetOptionalPath(ARG_NAME_ADDITIONAL_CONFIG_DIR); Path reportDir = ( Path )arguments.GetOptionalPath(ARG_NAME_REPORT_DIRECTORY).orElseThrow(() => { return(new System.ArgumentException(ARG_NAME_REPORT_DIRECTORY + " must be a path")); }); OnlineBackupRequiredArguments requiredArguments = new OnlineBackupRequiredArguments(address, folder, name, selectedBackupProtocol, fallbackToFull, doConsistencyCheck, timeout, reportDir); Path configFile = _configDir.resolve(Config.DEFAULT_CONFIG_FILE_NAME); Config.Builder builder = Config.fromFile(configFile); Path logPath = requiredArguments.ResolvedLocationFromName; Config config = builder.WithHome(this._homeDir).withSetting(GraphDatabaseSettings.logical_logs_location, logPath.ToString()).withConnectorsDisabled().withNoThrowOnFileLoadFailure().build(); additionalConfig.map(this.loadAdditionalConfigFile).ifPresent(config.augment); // We only replace the page cache memory setting. // Any other custom page swapper, etc. settings are preserved and used. config.Augment(GraphDatabaseSettings.pagecache_memory, pagecacheMemory); // Disable prometheus to avoid binding exceptions config.Augment("metrics.prometheus.enabled", Settings.FALSE); // Build consistency-checker configuration. // Note: We can remove the loading from config file in 4.0. System.Func <string, Setting <bool>, bool> oneOf = (a, s) => arguments.Has(a) ? arguments.GetBoolean(a) : config.Get(s); ConsistencyFlags consistencyFlags = new ConsistencyFlags(config); return(new OnlineBackupContext(requiredArguments, config, consistencyFlags)); } catch (System.ArgumentException e) { throw new IncorrectUsage(e.Message); } catch (UncheckedIOException e) { throw new CommandFailed(e.Message, e); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void performingFullBackupInvokesRecovery() public virtual void PerformingFullBackupInvokesRecovery() { // given full backup flag is set _requiredArguments = _requiredArguments(true); _onlineBackupContext = new OnlineBackupContext(_requiredArguments, _config, ConsistencyFlags()); // when _subject.doBackup(_onlineBackupContext); // then verify(_backupRecoveryService).recoverWithDatabase(any(), any(), any()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void fullBackupIsPerformedWhenNoOtherBackupExists() public virtual void FullBackupIsPerformedWhenNoOtherBackupExists() { // given _requiredArguments = _requiredArguments(true); _onlineBackupContext = new OnlineBackupContext(_requiredArguments, _config, ConsistencyFlags()); // and when(_backupCopyService.backupExists(any())).thenReturn(false); // when _subject.doBackup(_onlineBackupContext); // then verify(_backupStrategyImplementation).performFullBackup(any(), any(), any()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setup() public virtual void Setup() { _backupDirectory = TestDirectory.directory("backupDirectory").toPath(); _reportDirectory = TestDirectory.directory("reportDirectory/").toPath(); BackupSupportingClasses backupSupportingClasses = new BackupSupportingClasses(mock(typeof(BackupDelegator)), mock(typeof(BackupProtocolService)), mock(typeof(PageCache)), Collections.emptyList()); when(_backupSupportingClassesFactory.createSupportingClasses(any())).thenReturn(backupSupportingClasses); _requiredArguments = new OnlineBackupRequiredArguments(_address, _backupDirectory, _backupName, SelectedBackupProtocol.Any, _fallbackToFull, _doConsistencyCheck, _timeout, _reportDirectory); OnlineBackupContext onlineBackupContext = new OnlineBackupContext(_requiredArguments, _config, _consistencyFlags); when(_backupStrategyCoordinatorFactory.backupStrategyCoordinator(any(), any(), any(), any())).thenReturn(_backupStrategyCoordinator); _subject = NewOnlineBackupCommand(_outsideWorld, onlineBackupContext, _backupSupportingClassesFactory, _backupStrategyCoordinatorFactory); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void fallbackDoesNotHappenIfNotSpecified() public virtual void FallbackDoesNotHappenIfNotSpecified() { // given when(_backupCopyService.backupExists(any())).thenReturn(true); when(_backupStrategyImplementation.performIncrementalBackup(any(), any(), any())).thenReturn(new Fallible <>(BackupStageOutcome.Failure, null)); // and _requiredArguments = _requiredArguments(false); _onlineBackupContext = new OnlineBackupContext(_requiredArguments, _config, ConsistencyFlags()); // when _subject.doBackup(_onlineBackupContext); // then verify(_backupStrategyImplementation, never()).performFullBackup(any(), any(), any()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void performingIncrementalBackupInvokesRecovery() public virtual void PerformingIncrementalBackupInvokesRecovery() { // given backup exists when(_backupCopyService.backupExists(any())).thenReturn(true); _requiredArguments = _requiredArguments(true); _onlineBackupContext = new OnlineBackupContext(_requiredArguments, _config, ConsistencyFlags()); // and incremental backups are successful when(_backupStrategyImplementation.performIncrementalBackup(any(), any(), any())).thenReturn(_success); // when _subject.doBackup(_onlineBackupContext); // then verify(_backupRecoveryService).recoverWithDatabase(any(), any(), any()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void fullBackupIsNotPerformedWhenAnIncrementalBackupIsSuccessful() public virtual void FullBackupIsNotPerformedWhenAnIncrementalBackupIsSuccessful() { // given when(_backupCopyService.backupExists(any())).thenReturn(true); when(_backupStrategyImplementation.performIncrementalBackup(any(), any(), any())).thenReturn(_success); // and _requiredArguments = _requiredArguments(true); _onlineBackupContext = new OnlineBackupContext(_requiredArguments, _config, ConsistencyFlags()); // when _subject.doBackup(_onlineBackupContext); // then verify(_backupStrategyImplementation, never()).performFullBackup(_desiredBackupLayout, _config, _userProvidedAddress); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void failedIncrementalFallsBackToFullWhenOptionSet() public virtual void FailedIncrementalFallsBackToFullWhenOptionSet() { // given conditions for incremental exist when(_backupCopyService.backupExists(any())).thenReturn(true); _requiredArguments = _requiredArguments(true); _onlineBackupContext = new OnlineBackupContext(_requiredArguments, _config, ConsistencyFlags()); // and incremental fails when(_backupStrategyImplementation.performIncrementalBackup(any(), any(), any())).thenReturn(new Fallible <>(BackupStageOutcome.Failure, null)); // when _subject.doBackup(_onlineBackupContext); // then verify(_backupStrategyImplementation).performFullBackup(any(), any(), any()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void fullBackupIsIgnoredIfNoOtherBackupAndNotFallback() public virtual void FullBackupIsIgnoredIfNoOtherBackupAndNotFallback() { // given there is an existing backup when(_backupCopyService.backupExists(any())).thenReturn(false); // and we don't want to fallback to full backups _requiredArguments = _requiredArguments(false); _onlineBackupContext = new OnlineBackupContext(_requiredArguments, _config, ConsistencyFlags()); // and incremental backup fails because it's a different store when(_backupStrategyImplementation.performIncrementalBackup(any(), any(), any())).thenReturn(_failure); // when _subject.doBackup(_onlineBackupContext); // then full backup wasnt performed verify(_backupStrategyImplementation, never()).performFullBackup(any(), any(), any()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void logsAreNotClearedWhenIncrementalNotSuccessful() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void LogsAreNotClearedWhenIncrementalNotSuccessful() { // given backup exists when(_backupCopyService.backupExists(any())).thenReturn(true); // and incremental is not successful IncrementalBackupIsSuccessful(false); // and _requiredArguments = _requiredArguments(false); _onlineBackupContext = new OnlineBackupContext(_requiredArguments, _config, ConsistencyFlags()); // when backups are performed _subject.doBackup(_onlineBackupContext); // then do not verify(_backupCopyService, never()).clearIdFiles(any()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void logsAreClearedAfterIncrementalBackup() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void LogsAreClearedAfterIncrementalBackup() { // given backup exists when(_backupCopyService.backupExists(any())).thenReturn(true); // and IncrementalBackupIsSuccessful(true); // and _requiredArguments = _requiredArguments(false); _onlineBackupContext = new OnlineBackupContext(_requiredArguments, _config, ConsistencyFlags()); // when _subject.doBackup(_onlineBackupContext); // then verify(_backupCopyService).clearIdFiles(any()); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void performConsistencyCheck(org.neo4j.kernel.configuration.Config config, OnlineBackupRequiredArguments requiredArgs, org.neo4j.consistency.checking.full.ConsistencyFlags consistencyFlags, org.neo4j.io.layout.DatabaseLayout layout) throws org.neo4j.commandline.admin.CommandFailed private void PerformConsistencyCheck(Config config, OnlineBackupRequiredArguments requiredArgs, ConsistencyFlags consistencyFlags, DatabaseLayout layout) { try { bool verbose = false; File reportDir = requiredArgs.ReportDir.toFile(); ConsistencyCheckService.Result ccResult = _consistencyCheckService.runFullConsistencyCheck(layout, config, _progressMonitorFactory, _logProvider, _outsideWorld.fileSystem(), verbose, reportDir, consistencyFlags); if (!ccResult.Successful) { throw new CommandFailed(format("Inconsistencies found. See '%s' for details.", ccResult.ReportFile()), STATUS_CC_INCONSISTENT); } } catch (Exception e) { if (e is CommandFailed) { throw ( CommandFailed )e; } throw new CommandFailed("Failed to do consistency check on backup: " + e.Message, e, STATUS_CC_ERROR); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void failedBackupsDontMoveExisting() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void FailedBackupsDontMoveExisting() { // given a backup already exists when(_backupCopyService.backupExists(any())).thenReturn(true); // and fallback to full is true _requiredArguments = _requiredArguments(true); _onlineBackupContext = new OnlineBackupContext(_requiredArguments, _config, ConsistencyFlags()); // and an incremental backup fails when(_backupStrategyImplementation.performIncrementalBackup(any(), any(), any())).thenReturn(new Fallible <>(BackupStageOutcome.Failure, null)); // and full backup fails when(_backupStrategyImplementation.performFullBackup(any(), any(), any())).thenReturn(new Fallible <>(BackupStageOutcome.Failure, null)); // when backup is performed _subject.doBackup(_onlineBackupContext); // then existing backup hasn't moved verify(_backupStrategyImplementation).performFullBackup(any(), any(), any()); verify(_backupCopyService, never()).moveBackupLocation(any(), any()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void successfulFullBackupsMoveExistingBackup() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void SuccessfulFullBackupsMoveExistingBackup() { // given backup exists _desiredBackupLayout = TestDirectory.databaseLayout("some-preexisting-backup"); when(_backupCopyService.backupExists(_desiredBackupLayout)).thenReturn(true); // and fallback to full flag has been set _requiredArguments = _requiredArguments(true); _onlineBackupContext = new OnlineBackupContext(_requiredArguments, _config, ConsistencyFlags()); // and a new location for the existing backup is found Path newLocationForExistingBackup = TestDirectory.directory("new-backup-location").toPath(); when(_backupCopyService.findNewBackupLocationForBrokenExisting(_desiredBackupLayout.databaseDirectory().toPath())).thenReturn(newLocationForExistingBackup); // and there is a generated location for where to store a new full backup so the original is not destroyed Path temporaryFullBackupLocation = TestDirectory.directory("temporary-full-backup").toPath(); when(_backupCopyService.findAnAvailableLocationForNewFullBackup(_desiredBackupLayout.databaseDirectory().toPath())).thenReturn(temporaryFullBackupLocation); // and incremental fails when(_backupStrategyImplementation.performIncrementalBackup(any(), any(), any())).thenReturn(new Fallible <>(BackupStageOutcome.Failure, null)); // and full passes when(_backupStrategyImplementation.performFullBackup(any(), any(), any())).thenReturn(new Fallible <>(BackupStageOutcome.Success, null)); // when Fallible <BackupStrategyOutcome> state = _subject.doBackup(_onlineBackupContext); // then original existing backup is moved to err directory verify(_backupCopyService).moveBackupLocation(eq(_desiredBackupLayout.databaseDirectory().toPath()), eq(newLocationForExistingBackup)); // and new successful backup is renamed to original expected name verify(_backupCopyService).moveBackupLocation(eq(temporaryFullBackupLocation), eq(_desiredBackupLayout.databaseDirectory().toPath())); // and backup was successful assertEquals(BackupStrategyOutcome.Success, state.State); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void protocolOverrideWarnsUser() throws org.neo4j.commandline.admin.CommandFailed, org.neo4j.commandline.admin.IncorrectUsage //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ProtocolOverrideWarnsUser() { // with IList <object[]> cases = new IList <object[]> { new object[] { SelectedBackupProtocol.Catchup, string.Format("The selected protocol `catchup` means that it is only compatible with causal clustering instances%n") }, new object[] { SelectedBackupProtocol.Common, string.Format("The selected protocol `common` means that it is only compatible with HA and single instances%n") } }; foreach (object[] thisCase in cases) { // given _requiredArguments = new OnlineBackupRequiredArguments(_address, _backupDirectory, _backupName, ( SelectedBackupProtocol )thisCase[0], _fallbackToFull, _doConsistencyCheck, _timeout, _reportDirectory); OnlineBackupContext onlineBackupContext = new OnlineBackupContext(_requiredArguments, _config, _consistencyFlags); _subject = NewOnlineBackupCommand(_outsideWorld, onlineBackupContext, _backupSupportingClassesFactory, _backupStrategyCoordinatorFactory); // when Execute(); // then assertThat(_baosOut.ToString(), containsString((string)thisCase[1])); _baosOut.reset(); } }
internal OnlineBackupContext(OnlineBackupRequiredArguments requiredArguments, Config config, ConsistencyFlags consistencyFlags) { this._requiredArguments = requiredArguments; this._config = config; this._consistencyFlags = consistencyFlags; }
private void FallbackToFullPasses() { _requiredArguments = _requiredArguments(true); when(_backupStrategyImplementation.performIncrementalBackup(any(), any(), any())).thenReturn(_failure); when(_backupStrategyImplementation.performFullBackup(any(), any(), any())).thenReturn(_success); }
private void BothBackupsFail() { _requiredArguments = _requiredArguments(true); when(_backupStrategyImplementation.performIncrementalBackup(any(), any(), any())).thenReturn(_failure); when(_backupStrategyImplementation.performFullBackup(any(), any(), any())).thenReturn(_failure); }