use of org.neo4j.commandline.admin.OutsideWorld in project neo4j by neo4j.
the class CheckConsistencyCommandTest method shouldWriteReportFileToCurrentDirectoryByDefault.
@Test
public void shouldWriteReportFileToCurrentDirectoryByDefault() throws IOException, ConsistencyCheckIncompleteException, CommandFailed, IncorrectUsage {
ConsistencyCheckService consistencyCheckService = mock(ConsistencyCheckService.class);
Path homeDir = testDir.directory("home").toPath();
OutsideWorld outsideWorld = mock(OutsideWorld.class);
CheckConsistencyCommand checkConsistencyCommand = new CheckConsistencyCommand(homeDir, testDir.directory("conf").toPath(), outsideWorld, consistencyCheckService);
stub(consistencyCheckService.runFullConsistencyCheck(anyObject(), anyObject(), anyObject(), anyObject(), anyObject(), anyBoolean(), anyObject(), any(CheckConsistencyConfig.class))).toReturn(ConsistencyCheckService.Result.success(null));
checkConsistencyCommand.execute(new String[] { "--database=mydb" });
verify(consistencyCheckService).runFullConsistencyCheck(anyObject(), anyObject(), anyObject(), anyObject(), anyObject(), anyBoolean(), eq(new File(".").getCanonicalFile()), any(CheckConsistencyConfig.class));
}
use of org.neo4j.commandline.admin.OutsideWorld in project neo4j by neo4j.
the class CheckConsistencyCommandTest method databaseAndBackupAreMutuallyExclusive.
@Test
public void databaseAndBackupAreMutuallyExclusive() throws Exception {
ConsistencyCheckService consistencyCheckService = mock(ConsistencyCheckService.class);
Path homeDir = testDir.directory("home").toPath();
OutsideWorld outsideWorld = mock(OutsideWorld.class);
CheckConsistencyCommand checkConsistencyCommand = new CheckConsistencyCommand(homeDir, testDir.directory("conf").toPath(), outsideWorld, consistencyCheckService);
stub(consistencyCheckService.runFullConsistencyCheck(anyObject(), anyObject(), anyObject(), anyObject(), anyObject(), anyBoolean(), any(CheckConsistencyConfig.class))).toReturn(ConsistencyCheckService.Result.success(null));
expect.expect(IncorrectUsage.class);
expect.expectMessage("Only one of '--database' and '--backup' can be specified.");
checkConsistencyCommand.execute(new String[] { "--database=foo", "--backup=bar" });
}
use of org.neo4j.commandline.admin.OutsideWorld in project neo4j by neo4j.
the class CheckConsistencyCommandTest method shouldCanonicalizeReportDirectory.
@Test
public void shouldCanonicalizeReportDirectory() throws IOException, ConsistencyCheckIncompleteException, CommandFailed, IncorrectUsage {
ConsistencyCheckService consistencyCheckService = mock(ConsistencyCheckService.class);
Path homeDir = testDir.directory("home").toPath();
OutsideWorld outsideWorld = mock(OutsideWorld.class);
CheckConsistencyCommand checkConsistencyCommand = new CheckConsistencyCommand(homeDir, testDir.directory("conf").toPath(), outsideWorld, consistencyCheckService);
stub(consistencyCheckService.runFullConsistencyCheck(anyObject(), anyObject(), anyObject(), anyObject(), anyObject(), anyBoolean(), anyObject(), any(CheckConsistencyConfig.class))).toReturn(ConsistencyCheckService.Result.success(null));
checkConsistencyCommand.execute(new String[] { "--database=mydb", "--report-dir=" + Paths.get("..", "bar") });
verify(consistencyCheckService).runFullConsistencyCheck(anyObject(), anyObject(), anyObject(), anyObject(), anyObject(), anyBoolean(), eq(new File("../bar").getCanonicalFile()), any(CheckConsistencyConfig.class));
}
use of org.neo4j.commandline.admin.OutsideWorld in project neo4j by neo4j.
the class CheckConsistencyCommandTest method runsConsistencyChecker.
@Test
public void runsConsistencyChecker() throws Exception {
ConsistencyCheckService consistencyCheckService = mock(ConsistencyCheckService.class);
Path homeDir = testDir.directory("home").toPath();
OutsideWorld outsideWorld = mock(OutsideWorld.class);
CheckConsistencyCommand checkConsistencyCommand = new CheckConsistencyCommand(homeDir, testDir.directory("conf").toPath(), outsideWorld, consistencyCheckService);
File databasePath = new File(homeDir.toFile(), "data/databases/mydb");
when(consistencyCheckService.runFullConsistencyCheck(eq(databasePath), any(Config.class), any(ProgressMonitorFactory.class), any(LogProvider.class), any(FileSystemAbstraction.class), eq(false), anyObject(), any(CheckConsistencyConfig.class))).thenReturn(ConsistencyCheckService.Result.success(null));
checkConsistencyCommand.execute(new String[] { "--database=mydb" });
verify(consistencyCheckService).runFullConsistencyCheck(eq(databasePath), any(Config.class), any(ProgressMonitorFactory.class), any(LogProvider.class), any(FileSystemAbstraction.class), eq(false), anyObject(), any(CheckConsistencyConfig.class));
}
use of org.neo4j.commandline.admin.OutsideWorld in project neo4j by neo4j.
the class CheckConsistencyCommandTest method shouldWriteReportFileToSpecifiedDirectory.
@Test
public void shouldWriteReportFileToSpecifiedDirectory() throws IOException, ConsistencyCheckIncompleteException, CommandFailed, IncorrectUsage {
ConsistencyCheckService consistencyCheckService = mock(ConsistencyCheckService.class);
Path homeDir = testDir.directory("home").toPath();
OutsideWorld outsideWorld = mock(OutsideWorld.class);
CheckConsistencyCommand checkConsistencyCommand = new CheckConsistencyCommand(homeDir, testDir.directory("conf").toPath(), outsideWorld, consistencyCheckService);
stub(consistencyCheckService.runFullConsistencyCheck(anyObject(), anyObject(), anyObject(), anyObject(), anyObject(), anyBoolean(), anyObject(), any(CheckConsistencyConfig.class))).toReturn(ConsistencyCheckService.Result.success(null));
checkConsistencyCommand.execute(new String[] { "--database=mydb", "--report-dir=some-dir-or-other" });
verify(consistencyCheckService).runFullConsistencyCheck(anyObject(), anyObject(), anyObject(), anyObject(), anyObject(), anyBoolean(), eq(new File("some-dir-or-other").getCanonicalFile()), any(CheckConsistencyConfig.class));
}
Aggregations