use of org.neo4j.io.layout.Neo4jLayout in project neo4j by neo4j.
the class Neo4jLayoutSupportExtensionTest method shouldUseDefaultConfig.
@Test
void shouldUseDefaultConfig() {
Config defaultConfig = Config.defaults(neo4j_home, testDirectory.homePath());
Neo4jLayout defaultNeo4jLayout = Neo4jLayout.of(defaultConfig);
DatabaseLayout defaultDatabaseLayout = defaultNeo4jLayout.databaseLayout(defaultConfig.get(default_database));
assertEquals(defaultNeo4jLayout.homeDirectory(), neo4jLayout.homeDirectory());
assertEquals(defaultNeo4jLayout.databasesDirectory(), neo4jLayout.databasesDirectory());
assertEquals(defaultNeo4jLayout.transactionLogsRootDirectory(), neo4jLayout.transactionLogsRootDirectory());
assertEquals(defaultDatabaseLayout.databaseDirectory(), databaseLayout.databaseDirectory());
assertEquals(defaultDatabaseLayout.getTransactionLogsDirectory(), databaseLayout.getTransactionLogsDirectory());
}
use of org.neo4j.io.layout.Neo4jLayout in project neo4j by neo4j.
the class BaseBootstrapperIT method shouldHaveSameLayoutAsEmbedded.
@Test
public void shouldHaveSameLayoutAsEmbedded() throws Exception {
Path serverDir = testDirectory.directory("server-dir");
NeoBootstrapper.start(bootstrapper, withConnectorsOnRandomPortsConfig("--home-dir", serverDir.toAbsolutePath().toString()));
assertEventually("Server was not started", bootstrapper::isRunning, Conditions.TRUE, 1, TimeUnit.MINUTES);
var databaseAPI = (GraphDatabaseAPI) bootstrapper.getDatabaseManagementService().database(DEFAULT_DATABASE_NAME);
var serverLayout = databaseAPI.databaseLayout().getNeo4jLayout();
bootstrapper.stop();
Path embeddedDir = testDirectory.directory("embedded-dir");
DatabaseManagementService dbms = newEmbeddedDbms(embeddedDir);
Neo4jLayout embeddedLayout = ((GraphDatabaseAPI) dbms.database(DEFAULT_DATABASE_NAME)).databaseLayout().getNeo4jLayout();
dbms.shutdown();
assertEquals(serverDir.relativize(serverLayout.homeDirectory()), embeddedDir.relativize(embeddedLayout.homeDirectory()));
assertEquals(serverDir.relativize(serverLayout.databasesDirectory()), embeddedDir.relativize(embeddedLayout.databasesDirectory()));
assertEquals(serverDir.relativize(serverLayout.transactionLogsRootDirectory()), embeddedDir.relativize(embeddedLayout.transactionLogsRootDirectory()));
}
use of org.neo4j.io.layout.Neo4jLayout in project neo4j by neo4j.
the class DatabaseLayoutWatcher method watchDirectories.
private void watchDirectories() {
Neo4jLayout layout = databaseLayout.getNeo4jLayout();
watch(databaseLayout.databaseDirectory());
watch(databaseLayout.getTransactionLogsDirectory());
watch(layout.databasesDirectory());
watch(layout.transactionLogsRootDirectory());
watch(layout.homeDirectory());
startWatching();
}
use of org.neo4j.io.layout.Neo4jLayout in project neo4j by neo4j.
the class PushToCloudCommandTest method createDbAndDump.
private void createDbAndDump() {
Config config = Config.newBuilder().set(GraphDatabaseSettings.neo4j_home, homeDir.toAbsolutePath()).set(default_database, DBNAME).build();
DatabaseLayout databaseLayout = DatabaseLayout.of(config);
Neo4jLayout neo4jLayout = databaseLayout.getNeo4jLayout();
DatabaseManagementService managementService = new TestDatabaseManagementServiceBuilder(neo4jLayout.homeDirectory()).setConfig(config).build();
managementService.database(databaseLayout.getDatabaseName());
managementService.shutdown();
dump = directory.file("some-archive.dump");
new RealDumpCreator(ctx).dumpDatabase(DBNAME, dump);
}
use of org.neo4j.io.layout.Neo4jLayout in project neo4j by neo4j.
the class Neo4jLayoutSupportExtension method prepare.
private void prepare(ExtensionContext context) {
TestInstances testInstances = context.getRequiredTestInstances();
TestDirectory testDir = getTestDirectory(context);
Config config = Config.defaults(neo4j_home, testDir.homePath());
Neo4jLayout neo4jLayout = Neo4jLayout.of(config);
DatabaseLayout databaseLayout = neo4jLayout.databaseLayout(config.get(default_database));
createDirectories(testDir.getFileSystem(), neo4jLayout, databaseLayout);
for (Object testInstance : testInstances.getAllInstances()) {
injectInstance(testInstance, neo4jLayout, Neo4jLayout.class);
injectInstance(testInstance, databaseLayout, DatabaseLayout.class);
}
}
Aggregations