use of org.neo4j.consistency.CheckConsistencyCommand in project neo4j by neo4j.
the class CheckConsistencyCommandIT method shouldCanonicalizeReportDirectory.
@Test
void shouldCanonicalizeReportDirectory() throws IOException, ConsistencyCheckIncompleteException, CommandFailedException {
ConsistencyCheckService consistencyCheckService = mock(ConsistencyCheckService.class);
CheckConsistencyCommand checkConsistencyCommand = new CheckConsistencyCommand(new ExecutionContext(homeDir, confPath), consistencyCheckService);
when(consistencyCheckService.runFullConsistencyCheck(any(), any(), any(), any(), any(), anyBoolean(), any(), any(ConsistencyFlags.class))).thenReturn(ConsistencyCheckService.Result.success(null, null));
CommandLine.populateCommand(checkConsistencyCommand, "--database=mydb", "--report-dir=" + Paths.get("..", "bar"));
checkConsistencyCommand.execute();
verify(consistencyCheckService).runFullConsistencyCheck(any(), any(), any(), any(), any(), anyBoolean(), eq(Path.of("../bar")), any(ConsistencyFlags.class));
}
use of org.neo4j.consistency.CheckConsistencyCommand in project neo4j by neo4j.
the class CheckConsistencyCommandIT method enablesVerbosity.
@Test
void enablesVerbosity() throws Exception {
ConsistencyCheckService consistencyCheckService = mock(ConsistencyCheckService.class);
CheckConsistencyCommand checkConsistencyCommand = new CheckConsistencyCommand(new ExecutionContext(homeDir, confPath), consistencyCheckService);
DatabaseLayout databaseLayout = neo4jLayout.databaseLayout("mydb");
when(consistencyCheckService.runFullConsistencyCheck(eq(databaseLayout), any(Config.class), any(ProgressMonitorFactory.class), any(LogProvider.class), any(FileSystemAbstraction.class), eq(true), any(), any(ConsistencyFlags.class))).thenReturn(ConsistencyCheckService.Result.success(null, null));
CommandLine.populateCommand(checkConsistencyCommand, "--database=mydb", "--verbose");
checkConsistencyCommand.execute();
verify(consistencyCheckService).runFullConsistencyCheck(eq(databaseLayout), any(Config.class), any(ProgressMonitorFactory.class), any(LogProvider.class), any(FileSystemAbstraction.class), eq(true), any(), any(ConsistencyFlags.class));
}
use of org.neo4j.consistency.CheckConsistencyCommand in project neo4j by neo4j.
the class CheckConsistencyCommandIT method databaseAndBackupAreMutuallyExclusive.
@Test
void databaseAndBackupAreMutuallyExclusive() throws Exception {
ConsistencyCheckService consistencyCheckService = mock(ConsistencyCheckService.class);
CheckConsistencyCommand checkConsistencyCommand = new CheckConsistencyCommand(new ExecutionContext(homeDir, confPath), consistencyCheckService);
when(consistencyCheckService.runFullConsistencyCheck(any(), any(), any(), any(), any(), anyBoolean(), any(ConsistencyFlags.class))).thenReturn(ConsistencyCheckService.Result.success(null, null));
MutuallyExclusiveArgsException incorrectUsage = assertThrows(MutuallyExclusiveArgsException.class, () -> {
CommandLine.populateCommand(checkConsistencyCommand, "--database=foo", "--backup=bar");
checkConsistencyCommand.execute();
});
assertThat(incorrectUsage.getMessage()).contains("--database=<database>, --backup=<path> are mutually exclusive (specify only one)");
}
use of org.neo4j.consistency.CheckConsistencyCommand in project neo4j by neo4j.
the class CheckConsistencyCommandIT method backupNeedsToBePath.
@Test
void backupNeedsToBePath() {
ConsistencyCheckService consistencyCheckService = mock(ConsistencyCheckService.class);
CheckConsistencyCommand checkConsistencyCommand = new CheckConsistencyCommand(new ExecutionContext(homeDir, confPath), consistencyCheckService);
Path backupPath = homeDir.resolve("dir/does/not/exist");
CommandFailedException commandFailed = assertThrows(CommandFailedException.class, () -> {
CommandLine.populateCommand(checkConsistencyCommand, "--backup=" + backupPath);
checkConsistencyCommand.execute();
});
assertThat(commandFailed.getMessage()).contains("Report directory path doesn't exist or not a directory");
}
use of org.neo4j.consistency.CheckConsistencyCommand in project neo4j by neo4j.
the class CheckConsistencyCommandIT method passesOnCheckParameters.
@Test
void passesOnCheckParameters() throws Exception {
ConsistencyCheckService consistencyCheckService = mock(ConsistencyCheckService.class);
CheckConsistencyCommand checkConsistencyCommand = new CheckConsistencyCommand(new ExecutionContext(homeDir, confPath), consistencyCheckService);
when(consistencyCheckService.runFullConsistencyCheck(any(), any(), any(), any(), any(), anyBoolean(), any(), any(ConsistencyFlags.class))).thenReturn(ConsistencyCheckService.Result.success(null, null));
CommandLine.populateCommand(checkConsistencyCommand, "--database=mydb", "--check-graph=false", "--check-indexes=false", "--check-index-structure=true");
checkConsistencyCommand.execute();
verify(consistencyCheckService).runFullConsistencyCheck(any(), any(), any(), any(), any(), anyBoolean(), any(), eq(new ConsistencyFlags(false, false, true)));
}
Aggregations