Search in sources :

Example 1 with EnterpriseNeoServer

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;
}
Also used : EnterpriseServerBuilder(org.neo4j.server.enterprise.helpers.EnterpriseServerBuilder) EnterpriseNeoServer(org.neo4j.server.enterprise.EnterpriseNeoServer)

Example 2 with EnterpriseNeoServer

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());
}
Also used : EnterpriseNeoServer(org.neo4j.server.enterprise.EnterpriseNeoServer) NeoServer(org.neo4j.server.NeoServer) Config(org.neo4j.kernel.configuration.Config) EnterpriseNeoServer(org.neo4j.server.enterprise.EnterpriseNeoServer) Test(org.junit.Test)

Aggregations

EnterpriseNeoServer (org.neo4j.server.enterprise.EnterpriseNeoServer)2 Test (org.junit.Test)1 Config (org.neo4j.kernel.configuration.Config)1 NeoServer (org.neo4j.server.NeoServer)1 EnterpriseServerBuilder (org.neo4j.server.enterprise.helpers.EnterpriseServerBuilder)1