Exemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void exitWithFailureIfConfigSpecifiedButConfigFileDoesNotExist()
        public virtual void ExitWithFailureIfConfigSpecifiedButConfigFileDoesNotExist()
        {
            // given
            File configFile = _testDirectory.file("nonexistent_file");

            string[] args = new string[] { "-host", "localhost", "-to", "my_backup", "-config", configFile.Path };
            BackupProtocolService service    = mock(typeof(BackupProtocolService));
            PrintStream           systemOut  = mock(typeof(PrintStream));
            BackupTool            backupTool = new BackupTool(service, systemOut);

            try
            {
                // when
                backupTool.Run(args);
                fail("should exit abnormally");
            }
            catch (BackupTool.ToolFailureException e)
            {
                // then
                assertThat(e.Message, containsString("Could not read configuration file"));
                assertThat(e.InnerException, instanceOf(typeof(ConfigLoadIOException)));
            }

            verifyZeroInteractions(service);
        }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldInvokeBackupServiceWhenArgsAreValid() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldInvokeBackupServiceWhenArgsAreValid()
        {
            // Given
            string[] args = ArgsAsString.Split(" ", true);

            BackupProtocolService backupProtocolService = mock(typeof(BackupProtocolService));
            PrintStream           printStream           = mock(typeof(PrintStream));
            BackupTool            backupTool            = new BackupTool(backupProtocolService, printStream);

            // When
            backupTool.Run(args);

            // Then
            verify(backupProtocolService).doIncrementalBackupOrFallbackToFull(eq(HOST), eq(PORT), eq(DatabaseLayout.of(_path.toFile())), ExpectedVerifyStoreValue ? eq(ConsistencyCheck.FULL) : eq(ConsistencyCheck.NONE), any(typeof(Config)), eq(BackupClient.BIG_READ_TIMEOUT), eq(false));
        }
Exemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void exitWithFailureIfNoDestinationSpecified()
        public virtual void ExitWithFailureIfNoDestinationSpecified()
        {
            // given
            string[] args = new string[] { "-host", "localhost" };
            BackupProtocolService service    = mock(typeof(BackupProtocolService));
            PrintStream           systemOut  = mock(typeof(PrintStream));
            BackupTool            backupTool = new BackupTool(service, systemOut);

            try
            {
                // when
                backupTool.Run(args);
                fail("should exit abnormally");
            }
            catch (BackupTool.ToolFailureException e)
            {
                // then
                assertEquals("Specify target location with -to <target-directory>", e.Message);
            }

            verifyZeroInteractions(service);
        }
Exemplo n.º 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void exitWithFailureIfInvalidSourceSpecified()
        public virtual void ExitWithFailureIfInvalidSourceSpecified()
        {
            // given
            string[] args = new string[] { "-host", "foo:localhost", "-port", "123", "-to", "my_backup" };
            BackupProtocolService service    = mock(typeof(BackupProtocolService));
            PrintStream           systemOut  = mock(typeof(PrintStream));
            BackupTool            backupTool = new BackupTool(service, systemOut);

            try
            {
                // when
                backupTool.Run(args);
                fail("should exit abnormally");
            }
            catch (BackupTool.ToolFailureException e)
            {
                // then
                assertEquals(BackupTool.WrongFromAddressSyntax, e.Message);
            }

            verifyZeroInteractions(service);
        }