Neo4jFactoryImpl implements Neo4jFactory { @Override public Neo4jGraphAPI newGraphDatabase(String path, Map<String, String> config) { try { if (path.startsWith("file:")) { path = new URL(path).getPath(); } GraphDatabaseBuilder builder = createGraphDatabaseFactory(config).newEmbeddedDatabaseBuilder(new File(path)); if (config != null) builder = builder.setConfig(config); return new Neo4jGraphAPIImpl(builder.newGraphDatabase()); } catch(MalformedURLException e) { throw new RuntimeException("Error handling path "+path,e); } }  @Override Neo4jGraphAPI newGraphDatabase(String path, Map<String, String> config);  }
@Test public void testCreateHighlyAvailableGraphDatabase() throws Exception { Path file = Files.createTempDirectory("tp-test-db"); String path = file.toAbsolutePath().toString(); Map<String, String> config = new HashMap<>(); config.put("ha.server_id","1"); config.put("ha.initial_hosts","localhost:5001"); Neo4jGraphAPIImpl db = (Neo4jGraphAPIImpl) new Neo4jFactoryImpl().newGraphDatabase(path, config); assertEquals(true, db.getGraphDatabase() instanceof HighlyAvailableGraphDatabase); db.shutdown(); }