use of org.neo4j.commandline.admin.NullOutsideWorld in project neo4j by neo4j.
the class DatabaseImporterTest method requiresFromArgument.
@Test
public void requiresFromArgument() throws Exception {
String[] arguments = { "--mode=database", "--database=bar" };
try {
new DatabaseImporter(Args.parse(arguments), Config.defaults(), new NullOutsideWorld());
fail("Should have thrown an exception.");
} catch (IncorrectUsage e) {
assertThat(e.getMessage(), containsString("from"));
}
}
use of org.neo4j.commandline.admin.NullOutsideWorld in project neo4j by neo4j.
the class DatabaseImporterTest method copiesDatabaseFromOldLocationToNewLocation.
@Test
public void copiesDatabaseFromOldLocationToNewLocation() throws Exception {
File home = testDir.directory("home");
File from = provideStoreDirectory();
File destination = new File(new File(new File(home, "data"), "databases"), "bar");
String[] arguments = { "--mode=database", "--database=bar", "--from=" + from.getAbsolutePath() };
DatabaseImporter importer = new DatabaseImporter(Args.parse(arguments), getConfigWith(home, "bar"), new NullOutsideWorld());
assertThat(destination, not(isExistingDatabase()));
importer.doImport();
assertThat(destination, isExistingDatabase());
}
use of org.neo4j.commandline.admin.NullOutsideWorld in project neo4j by neo4j.
the class ImportCommandTest method failIfInvalidModeSpecified.
@Test
public void failIfInvalidModeSpecified() throws Exception {
try (NullOutsideWorld outsideWorld = new NullOutsideWorld()) {
ImportCommand importCommand = new ImportCommand(testDir.directory("home").toPath(), testDir.directory("conf").toPath(), outsideWorld);
String[] arguments = { "--mode=foo", "--database=bar", "--from=baz" };
try {
importCommand.execute(arguments);
fail("Should have thrown an exception.");
} catch (IncorrectUsage e) {
assertThat(e.getMessage(), containsString("foo"));
}
}
}
use of org.neo4j.commandline.admin.NullOutsideWorld in project neo4j by neo4j.
the class DatabaseImporterTest method removesOldMessagesLog.
@Test
public void removesOldMessagesLog() throws Exception {
File home = testDir.directory("home");
File from = provideStoreDirectory();
File oldMessagesLog = new File(from, "messages.log");
assertTrue(oldMessagesLog.createNewFile());
File destination = new File(new File(new File(home, "data"), "databases"), "bar");
String[] arguments = { "--mode=database", "--database=bar", "--from=" + from.getAbsolutePath() };
DatabaseImporter importer = new DatabaseImporter(Args.parse(arguments), getConfigWith(home, "bar"), new NullOutsideWorld());
File messagesLog = new File(destination, "messages.log");
importer.doImport();
assertFalse(messagesLog.exists());
}
use of org.neo4j.commandline.admin.NullOutsideWorld in project neo4j by neo4j.
the class DatabaseImporterTest method failIfSourceIsNotAStore.
@Test
public void failIfSourceIsNotAStore() throws Exception {
File from = testDir.directory("empty");
String[] arguments = { "--mode=database", "--database=bar", "--from=" + from.getAbsolutePath() };
try {
new DatabaseImporter(Args.parse(arguments), Config.defaults(), new NullOutsideWorld());
fail("Should have thrown an exception.");
} catch (IncorrectUsage e) {
assertThat(e.getMessage(), containsString("does not contain a database"));
}
}
Aggregations