use of org.neo4j.io.layout.DatabaseLayout in project neo4j by neo4j.
the class CheckConsistencyCommandIT method warnsOnUseOfDeprecatedOptions.
@Test
void warnsOnUseOfDeprecatedOptions() throws Exception {
ConsistencyCheckService consistencyCheckService = mock(ConsistencyCheckService.class);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream out = new PrintStream(baos);
CheckConsistencyCommand checkConsistencyCommand = new CheckConsistencyCommand(new ExecutionContext(homeDir, confPath, out, System.err, new DefaultFileSystemAbstraction()), consistencyCheckService);
DatabaseLayout databaseLayout = neo4jLayout.databaseLayout("mydb");
when(consistencyCheckService.runFullConsistencyCheck(eq(databaseLayout), any(Config.class), any(ProgressMonitorFactory.class), any(LogProvider.class), any(FileSystemAbstraction.class), eq(false), any(), any(ConsistencyFlags.class))).thenReturn(ConsistencyCheckService.Result.success(null, null));
CommandLine.populateCommand(checkConsistencyCommand, "--database=mydb", "--check-label-scan-store=true", "--check-relationship-type-scan-store=true", "--check-property-owners=true");
checkConsistencyCommand.execute();
// See that warnings were printed and that command was still run.
String log = baos.toString();
assertThat(log).contains("Option '--check-label-scan-store' has been deprecated and its value will be ignored");
assertThat(log).contains("Option '--check-relationship-type-scan-store' has been deprecated and its value will be ignored");
assertThat(log).contains("Option '--check-property-owners' has been deprecated and its value will be ignored");
verify(consistencyCheckService).runFullConsistencyCheck(eq(databaseLayout), any(Config.class), any(ProgressMonitorFactory.class), any(LogProvider.class), any(FileSystemAbstraction.class), eq(false), any(), any(ConsistencyFlags.class));
}
use of org.neo4j.io.layout.DatabaseLayout 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.io.layout.DatabaseLayout in project neo4j by neo4j.
the class DumpCommandIT method shouldRespectTheDatabaseLock.
@Test
void shouldRespectTheDatabaseLock() throws Exception {
Path databaseDirectory = homeDir.resolve("data/databases/foo");
DatabaseLayout databaseLayout = DatabaseLayout.ofFlat(databaseDirectory);
try (FileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction();
Locker locker = new DatabaseLocker(fileSystem, databaseLayout)) {
locker.checkLock();
CommandFailedException commandFailed = assertThrows(CommandFailedException.class, () -> execute("foo"));
assertEquals("The database is in use. Stop database 'foo' and try again.", commandFailed.getMessage());
}
}
use of org.neo4j.io.layout.DatabaseLayout in project neo4j by neo4j.
the class DumpCommandIT method shouldReportAHelpfulErrorIfWeDontHaveWritePermissionsForLock.
@Test
@DisabledOnOs(OS.WINDOWS)
@DisabledForRoot
void shouldReportAHelpfulErrorIfWeDontHaveWritePermissionsForLock() throws Exception {
DatabaseLayout databaseLayout = DatabaseLayout.ofFlat(databaseDirectory);
try (FileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction()) {
Path file = databaseLayout.databaseLockFile();
try (Closeable ignored = withPermissions(file, emptySet())) {
CommandFailedException commandFailed = assertThrows(CommandFailedException.class, () -> execute("foo"));
assertEquals("You do not have permission to dump the database.", commandFailed.getMessage());
}
}
}
use of org.neo4j.io.layout.DatabaseLayout in project neo4j by neo4j.
the class AllNodesInStoreExistInLabelIndexTest method copyLabelIndexFile.
private Path copyLabelIndexFile() throws IOException {
DatabaseLayout databaseLayout = db.databaseLayout();
Path labelIndexFileCopy = databaseLayout.file("label_index_copy");
database.stop();
fs.copyFile(databaseLayout.labelScanStore(), labelIndexFileCopy);
database.start();
return labelIndexFileCopy;
}
Aggregations