use of org.neo4j.commandline.admin.OutsideWorld in project neo4j by neo4j.
the class CheckConsistencyCommandTest method passesOnCheckParameters.
@Test
public void passesOnCheckParameters() 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(), anyObject(), any(CheckConsistencyConfig.class))).toReturn(ConsistencyCheckService.Result.success(null));
checkConsistencyCommand.execute(new String[] { "--database=mydb", "--check-graph=false", "--check-indexes=false", "--check-label-scan-store=false", "--check-property-owners=true" });
verify(consistencyCheckService).runFullConsistencyCheck(anyObject(), anyObject(), anyObject(), anyObject(), anyObject(), anyBoolean(), anyObject(), eq(new CheckConsistencyConfig(false, false, false, true)));
}
use of org.neo4j.commandline.admin.OutsideWorld in project neo4j by neo4j.
the class CheckConsistencyCommandTest method failsWhenInconsistenciesAreFound.
@Test
public void failsWhenInconsistenciesAreFound() 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(true), anyObject(), any(CheckConsistencyConfig.class))).thenReturn(ConsistencyCheckService.Result.failure(new File("/the/report/path")));
try {
checkConsistencyCommand.execute(new String[] { "--database=mydb", "--verbose" });
} catch (CommandFailed e) {
assertThat(e.getMessage(), containsString(new File("/the/report/path").toString()));
}
}
use of org.neo4j.commandline.admin.OutsideWorld in project neo4j by neo4j.
the class CheckConsistencyCommandTest method enablesVerbosity.
@Test
public void enablesVerbosity() 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(true), anyObject(), any(CheckConsistencyConfig.class))).thenReturn(ConsistencyCheckService.Result.success(null));
checkConsistencyCommand.execute(new String[] { "--database=mydb", "--verbose" });
verify(consistencyCheckService).runFullConsistencyCheck(eq(databasePath), any(Config.class), any(ProgressMonitorFactory.class), any(LogProvider.class), any(FileSystemAbstraction.class), eq(true), anyObject(), any(CheckConsistencyConfig.class));
}
use of org.neo4j.commandline.admin.OutsideWorld in project neo4j by neo4j.
the class CheckConsistencyCommandTest method canRunOnBackup.
@Test
public void canRunOnBackup() throws Exception {
ConsistencyCheckService consistencyCheckService = mock(ConsistencyCheckService.class);
Path backupDir = testDir.directory("backup").toPath();
Path homeDir = testDir.directory("home").toPath();
OutsideWorld outsideWorld = mock(OutsideWorld.class);
CheckConsistencyCommand checkConsistencyCommand = new CheckConsistencyCommand(homeDir, testDir.directory("conf").toPath(), outsideWorld, consistencyCheckService);
when(consistencyCheckService.runFullConsistencyCheck(eq(backupDir.toFile()), 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[] { "--backup=" + backupDir });
verify(consistencyCheckService).runFullConsistencyCheck(eq(backupDir.toFile()), 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 backupNeedsToBePath.
@Test
public void backupNeedsToBePath() 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 backupPath = new File(homeDir.toFile(), "dir/does/not/exist");
expect.expect(CommandFailed.class);
expect.expectMessage("Specified backup should be a directory: " + backupPath);
checkConsistencyCommand.execute(new String[] { "--backup=" + backupPath });
}
Aggregations