Example #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void backupNeedsToBePath()
        internal virtual void BackupNeedsToBePath()
        {
            ConsistencyCheckService consistencyCheckService = mock(typeof(ConsistencyCheckService));

            Path homeDir = _testDir.directory("home").toPath();
            CheckConsistencyCommand checkConsistencyCommand = new CheckConsistencyCommand(homeDir, _testDir.directory("conf").toPath(), consistencyCheckService);

            File backupPath = new File(homeDir.toFile(), "dir/does/not/exist");

            CommandFailed commandFailed = assertThrows(typeof(CommandFailed), () => checkConsistencyCommand.execute(new string[] { "--backup=" + backupPath }));

            assertEquals("Specified backup should be a directory: " + backupPath, commandFailed.Message);
        }
Example #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void databaseAndBackupAreMutuallyExclusive() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void DatabaseAndBackupAreMutuallyExclusive()
        {
            ConsistencyCheckService consistencyCheckService = mock(typeof(ConsistencyCheckService));

            Path homeDir = _testDir.directory("home").toPath();
            CheckConsistencyCommand checkConsistencyCommand = new CheckConsistencyCommand(homeDir, _testDir.directory("conf").toPath(), consistencyCheckService);

            when(consistencyCheckService.runFullConsistencyCheck(any(), any(), any(), any(), any(), anyBoolean(), any(typeof(ConsistencyFlags)))).thenReturn(ConsistencyCheckService.Result.success(null));

            IncorrectUsage incorrectUsage = assertThrows(typeof(IncorrectUsage), () => checkConsistencyCommand.execute(new string[] { "--database=foo", "--backup=bar" }));

            assertEquals("Only one of '--database' and '--backup' can be specified.", incorrectUsage.Message);
        }
Example #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void passesOnCheckParameters() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void PassesOnCheckParameters()
        {
            ConsistencyCheckService consistencyCheckService = mock(typeof(ConsistencyCheckService));

            Path homeDir = _testDir.directory("home").toPath();
            CheckConsistencyCommand checkConsistencyCommand = new CheckConsistencyCommand(homeDir, _testDir.directory("conf").toPath(), consistencyCheckService);

            when(consistencyCheckService.runFullConsistencyCheck(any(), any(), any(), any(), any(), anyBoolean(), any(), any(typeof(ConsistencyFlags)))).thenReturn(ConsistencyCheckService.Result.success(null));

            checkConsistencyCommand.Execute(new string[] { "--database=mydb", "--check-graph=false", "--check-indexes=false", "--check-index-structure=false", "--check-label-scan-store=false", "--check-property-owners=true" });

            verify(consistencyCheckService).runFullConsistencyCheck(any(), any(), any(), any(), any(), anyBoolean(), any(), eq(new ConsistencyFlags(false, false, false, false, true)));
        }
Example #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldCanonicalizeReportDirectory() throws java.io.IOException, org.neo4j.consistency.checking.full.ConsistencyCheckIncompleteException, org.neo4j.commandline.admin.CommandFailed, org.neo4j.commandline.admin.IncorrectUsage
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void ShouldCanonicalizeReportDirectory()
        {
            ConsistencyCheckService consistencyCheckService = mock(typeof(ConsistencyCheckService));

            Path homeDir = _testDir.directory("home").toPath();
            CheckConsistencyCommand checkConsistencyCommand = new CheckConsistencyCommand(homeDir, _testDir.directory("conf").toPath(), consistencyCheckService);

            when(consistencyCheckService.runFullConsistencyCheck(any(), any(), any(), any(), any(), anyBoolean(), any(), any(typeof(ConsistencyFlags)))).thenReturn(ConsistencyCheckService.Result.success(null));

            checkConsistencyCommand.Execute(new string[] { "--database=mydb", "--report-dir=" + Paths.get("..", "bar") });

            verify(consistencyCheckService).runFullConsistencyCheck(any(), any(), any(), any(), any(), anyBoolean(), eq((new File("../bar")).CanonicalFile), any(typeof(ConsistencyFlags)));
        }
Example #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void canRunOnBackup() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void CanRunOnBackup()
        {
            ConsistencyCheckService consistencyCheckService = mock(typeof(ConsistencyCheckService));

            DatabaseLayout          backupLayout            = _testDir.databaseLayout("backup");
            Path                    homeDir                 = _testDir.directory("home").toPath();
            CheckConsistencyCommand checkConsistencyCommand = new CheckConsistencyCommand(homeDir, _testDir.directory("conf").toPath(), consistencyCheckService);

            when(consistencyCheckService.runFullConsistencyCheck(eq(backupLayout), any(typeof(Config)), any(typeof(ProgressMonitorFactory)), any(typeof(LogProvider)), any(typeof(FileSystemAbstraction)), eq(false), any(), any(typeof(ConsistencyFlags)))).thenReturn(ConsistencyCheckService.Result.success(null));

            checkConsistencyCommand.Execute(new string[] { "--backup=" + backupLayout.DatabaseDirectory() });

            verify(consistencyCheckService).runFullConsistencyCheck(eq(backupLayout), any(typeof(Config)), any(typeof(ProgressMonitorFactory)), any(typeof(LogProvider)), any(typeof(FileSystemAbstraction)), eq(false), any(), any(typeof(ConsistencyFlags)));
        }
Example #6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void failsWhenInconsistenciesAreFound() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void FailsWhenInconsistenciesAreFound()
        {
            ConsistencyCheckService consistencyCheckService = mock(typeof(ConsistencyCheckService));

            Path homeDir         = _testDir.directory("home").toPath();
            File databasesFolder = GetDatabasesFolder(homeDir);
            CheckConsistencyCommand checkConsistencyCommand = new CheckConsistencyCommand(homeDir, _testDir.directory("conf").toPath(), consistencyCheckService);
            DatabaseLayout          databaseLayout          = DatabaseLayout.of(databasesFolder, "mydb");

            when(consistencyCheckService.runFullConsistencyCheck(eq(databaseLayout), any(typeof(Config)), any(typeof(ProgressMonitorFactory)), any(typeof(LogProvider)), any(typeof(FileSystemAbstraction)), eq(true), any(), any(typeof(ConsistencyFlags)))).thenReturn(ConsistencyCheckService.Result.failure(new File("/the/report/path")));

            CommandFailed commandFailed = assertThrows(typeof(CommandFailed), () => checkConsistencyCommand.execute(new string[] { "--database=mydb", "--verbose" }));

            assertThat(commandFailed.Message, containsString((new File("/the/report/path")).ToString()));
        }
Example #7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void enablesVerbosity() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void EnablesVerbosity()
        {
            ConsistencyCheckService consistencyCheckService = mock(typeof(ConsistencyCheckService));

            Path homeDir         = _testDir.directory("home").toPath();
            File databasesFolder = GetDatabasesFolder(homeDir);
            CheckConsistencyCommand checkConsistencyCommand = new CheckConsistencyCommand(homeDir, _testDir.directory("conf").toPath(), consistencyCheckService);

            DatabaseLayout databaseLayout = DatabaseLayout.of(databasesFolder, "mydb");

            when(consistencyCheckService.runFullConsistencyCheck(eq(databaseLayout), any(typeof(Config)), any(typeof(ProgressMonitorFactory)), any(typeof(LogProvider)), any(typeof(FileSystemAbstraction)), eq(true), any(), any(typeof(ConsistencyFlags)))).thenReturn(ConsistencyCheckService.Result.success(null));

            checkConsistencyCommand.Execute(new string[] { "--database=mydb", "--verbose" });

            verify(consistencyCheckService).runFullConsistencyCheck(eq(databaseLayout), any(typeof(Config)), any(typeof(ProgressMonitorFactory)), any(typeof(LogProvider)), any(typeof(FileSystemAbstraction)), eq(true), any(), any(typeof(ConsistencyFlags)));
        }