use of org.neo4j.kernel.api.index.SchemaIndexProvider in project neo4j by neo4j.
the class TestLuceneSchemaBatchInsertIT method shouldLoadAndUseLuceneProvider.
@Test
public void shouldLoadAndUseLuceneProvider() throws Exception {
// GIVEN
File storeDir = testDirectory.graphDbDir();
BatchInserter inserter = BatchInserters.inserter(storeDir, fileSystemRule.get());
inserter.createDeferredSchemaIndex(LABEL).on("name").create();
// WHEN
inserter.createNode(map("name", "Mattias"), LABEL);
inserter.shutdown();
// THEN
GraphDatabaseFactory graphDatabaseFactory = new TestGraphDatabaseFactory();
GraphDatabaseAPI db = (GraphDatabaseAPI) graphDatabaseFactory.newEmbeddedDatabase(storeDir);
DependencyResolver dependencyResolver = db.getDependencyResolver();
SchemaIndexProvider schemaIndexProvider = dependencyResolver.resolveDependency(SchemaIndexProvider.class, HighestSelectionStrategy.getInstance());
// assert the indexProvider is a Lucene one
try (Transaction ignore = db.beginTx()) {
IndexDefinition indexDefinition = Iterables.single(db.schema().getIndexes(LABEL));
assertThat(db.schema().getIndexState(indexDefinition), is(Schema.IndexState.ONLINE));
assertThat(schemaIndexProvider, instanceOf(LuceneSchemaIndexProvider.class));
}
// CLEANUP
db.shutdown();
}
Aggregations