use of org.neo4j.server.enterprise.EnterpriseNeoServer in project neo4j by neo4j.
the class EnterpriseServerHelper method createServer.
private static EnterpriseNeoServer createServer(File databaseDir, boolean persistent) throws IOException {
EnterpriseServerBuilder builder = EnterpriseServerBuilder.server().usingDataDir(databaseDir.getAbsolutePath());
if (persistent) {
builder = (EnterpriseServerBuilder) builder.persistent();
}
builder.withDefaultDatabaseTuning();
EnterpriseNeoServer server = builder.build();
server.start();
return server;
}
use of org.neo4j.server.enterprise.EnterpriseNeoServer in project neo4j by neo4j.
the class ServerManagementTest method shouldBeAbleToRestartServer.
@Test
public void shouldBeAbleToRestartServer() throws Exception {
// Given
String dataDirectory1 = baseDir.directory("data1").getAbsolutePath();
String dataDirectory2 = baseDir.directory("data2").getAbsolutePath();
Config config = ConfigLoader.loadConfig(Optional.of(baseDir.directory()), EnterpriseServerBuilder.server().withDefaultDatabaseTuning().usingDataDir(dataDirectory1).createConfigFiles(), pair(GraphDatabaseSettings.logs_directory.name(), baseDir.directory("logs").getPath()));
// When
NeoServer server = cleanup.add(new EnterpriseNeoServer(config, graphDbDependencies(), NullLogProvider.getInstance()));
server.start();
assertNotNull(server.getDatabase().getGraph());
assertEquals(config.get(DatabaseManagementSystemSettings.database_path).getAbsolutePath(), server.getDatabase().getLocation());
// Change the database location
config.augment(stringMap(DatabaseManagementSystemSettings.data_directory.name(), dataDirectory2));
ServerManagement bean = new ServerManagement(server);
bean.restartServer();
// Then
assertNotNull(server.getDatabase().getGraph());
assertEquals(config.get(DatabaseManagementSystemSettings.database_path).getAbsolutePath(), server.getDatabase().getLocation());
}
Aggregations