@Test public void testEmbeddedIsTheDefaultGraphDatabaseService() throws Exception { Properties properties = new Properties(); properties.put(Neo4jProperties.DATABASE_PATH, Neo4jTestHelper.dbLocation()); Neo4jGraphDatabaseServiceFactoryProvider graphService = new Neo4jGraphDatabaseServiceFactoryProvider(); GraphDatabaseService db = graphService.load(properties, new ClassLoaderServiceImpl()).create(); db.shutdown(); assertThat(db, is(EmbeddedGraphDatabase.class)); }
@Test public void testSelectedGraphDatabaseServiceIsLoaded() throws Exception { Properties properties = new Properties(); properties.put(Neo4jProperties.DATABASE_PATH, Neo4jTestHelper.dbLocation()); properties.put( Neo4jProperties.NEO4J_GRAPHDB_FACTORYCLASS, MockGraphServiceFactory.class.getName()); Neo4jGraphDatabaseServiceFactoryProvider graphService = new Neo4jGraphDatabaseServiceFactoryProvider(); GraphDatabaseService db = graphService.load(properties, new ClassLoaderServiceImpl()).create(); db.shutdown(); assertThat(db, is(MockGraphDatabaseService.class)); }
@Test public void testPropertiesArePassed() throws Exception { Properties properties = new Properties(); properties.put(Neo4jProperties.DATABASE_PATH, Neo4jTestHelper.dbLocation()); properties.put( Neo4jProperties.NEO4J_GRAPHDB_FACTORYCLASS, MockGraphServiceFactory.class.getName()); Neo4jGraphDatabaseServiceFactoryProvider graphService = new Neo4jGraphDatabaseServiceFactoryProvider(); MockGraphDatabaseService db = (MockGraphDatabaseService) graphService.load(properties, new ClassLoaderServiceImpl()).create(); db.shutdown(); assertTrue( "GraphDatabaseService factory cannot read the configuration properties", db.isConfigurationReadable()); }