//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 reportDirMustBeAPath() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ReportDirMustBeAPath() { Expected.expect(typeof(IncorrectUsage)); Expected.expectMessage("cc-report-dir must be a path"); OnlineBackupContextFactory handler = new OnlineBackupContextFactory(_homeDir, _configDir); handler.CreateContext(RequiredAnd("--check-consistency", "--cc-report-dir")); }
//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 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 shouldTreatNameArgumentAsMandatory() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldTreatNameArgumentAsMandatory() { Expected.expect(typeof(IncorrectUsage)); Expected.expectMessage("Missing argument 'name'"); OnlineBackupContextFactory handler = new OnlineBackupContextFactory(_homeDir, _configDir); handler.CreateContext("--backup-dir=/"); }
//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 TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void errorHandledForNonExistingAdditionalConfigFile() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ErrorHandledForNonExistingAdditionalConfigFile() { // given Path additionalConf = _homeDir.resolve("neo4j.conf"); // and Expected.expect(typeof(CommandFailed)); Expected.expectCause(hasCause(any(typeof(IOException)))); // expect OnlineBackupContextFactory handler = new OnlineBackupContextFactory(_homeDir, _configDir); handler.CreateContext(RequiredAnd("--additional-config=" + additionalConf)); }
private static OnlineBackupCommand NewOnlineBackupCommand(OutsideWorld outsideWorld, OnlineBackupContext onlineBackupContext, BackupSupportingClassesFactory backupSupportingClassesFactory, BackupStrategyCoordinatorFactory backupStrategyCoordinatorFactory) { OnlineBackupContextFactory contextBuilder = mock(typeof(OnlineBackupContextFactory)); try { when(contextBuilder.CreateContext(any())).thenReturn(onlineBackupContext); } catch (Exception e) when(e is IncorrectUsage || e is CommandFailed) { throw new Exception("Shouldn't happen", e); } return(new OnlineBackupCommand(outsideWorld, contextBuilder, backupSupportingClassesFactory, backupStrategyCoordinatorFactory)); }