@Override public GraphDatabaseBuilder loadPropertiesFromFile( String fileName ) throws IllegalArgumentException { actual.loadPropertiesFromFile( fileName ); return this; }
@Override public GraphDatabaseBuilder loadPropertiesFromFile( String fileName ) throws IllegalArgumentException { actual.loadPropertiesFromFile( fileName ); return this; }
@Before public void setUp() throws Exception { assumeTravis(); // Impermanent Database creation with additional configuration db = new TestGraphDatabaseFactory() .newImpermanentDatabaseBuilder() .loadPropertiesFromFile("src/test/resources/geoSpatial.conf") .newGraphDatabase(); registerProcedure(db, Geocode.class); }
import org.neo4j.graphdb.factory.HighlyAvailableGraphDatabaseFactory import org.neo4j.graphdb.factory.GraphDatabaseBuilder .... GraphDatabaseBuilder builder = new HighlyAvailableGraphDatabaseFactory() .newHighlyAvailableDatabaseBuilder("<path>"); GraphDatabaseService db = builder.loadPropertiesFromFile("neo4j.properties") .newGraphDatabase();
private static GraphDatabaseAPI instantiateGraphDb( GraphDatabaseFactory factory, File path, boolean readOnly, String configFileOrNull ) { GraphDatabaseBuilder builder = factory. newEmbeddedDatabaseBuilder( path ). setConfig( GraphDatabaseSettings.disconnected, Boolean.toString( true ) ). setConfig( GraphDatabaseSettings.read_only, Boolean.toString( readOnly ) ); if ( configFileOrNull != null ) { builder.loadPropertiesFromFile( configFileOrNull ); } return (GraphDatabaseAPI) builder.newGraphDatabase(); }
/** * Instantiate a database. By default this will be {@link org.neo4j.test.ImpermanentGraphDatabase}. * * @return new database. */ @Override protected GraphDatabaseService createDatabase() { GraphDatabaseBuilder builder = createGraphDatabaseBuilder(); if (configFile() != null) { try { builder = builder.loadPropertiesFromFile(new ClassPathResource(configFile()).getFile().getAbsolutePath()); } catch (IOException e) { throw new RuntimeException(e); } } else { populateConfig(builder); } GraphDatabaseService database = builder.newGraphDatabase(); registerShutdownHook(database); return database; }
graphDB = factory.newEmbeddedDatabaseBuilder(new File(dbName)).loadPropertiesFromFile(propsFileName).newGraphDatabase();
@Test public void loadFromFile() { String pathToConfig = "src/test/resources/"; // START SNIPPET: startDbWithConfig GraphDatabaseService graphDb = new GraphDatabaseFactory() .newEmbeddedDatabaseBuilder( testDirectory.graphDbDir() ) .loadPropertiesFromFile( pathToConfig + "neo4j.conf" ) .newGraphDatabase(); // END SNIPPET: startDbWithConfig assertNotNull( graphDb ); graphDb.shutdown(); }