Search in sources :

Example 1 with AsyncIndexInfoServiceImpl

use of org.apache.jackrabbit.oak.plugins.index.AsyncIndexInfoServiceImpl in project jackrabbit-oak by apache.

the class LucenePropertyIndexTest method storedIndexDefinitionDiff.

@Test
public void storedIndexDefinitionDiff() throws Exception {
    IndexDefinitionBuilder idxb = new IndexDefinitionBuilder().noAsync();
    idxb.indexRule("nt:base").property("foo").propertyIndex();
    Tree idx = root.getTree("/").getChild("oak:index").addChild("test1");
    idxb.build(idx);
    root.commit();
    AsyncIndexInfoService asyncService = new AsyncIndexInfoServiceImpl(nodeStore);
    LuceneIndexInfoProvider indexInfoProvider = new LuceneIndexInfoProvider(nodeStore, asyncService, temporaryFolder.newFolder());
    IndexInfo info = indexInfoProvider.getInfo("/oak:index/test1");
    assertNotNull(info);
    assertFalse(info.hasIndexDefinitionChangedWithoutReindexing());
    assertNull(info.getIndexDefinitionDiff());
    Tree idxTree = root.getTree("/oak:index/test1");
    idxTree.setProperty("foo", "bar");
    root.commit();
    info = indexInfoProvider.getInfo("/oak:index/test1");
    assertTrue(info.hasIndexDefinitionChangedWithoutReindexing());
    assertNotNull(info.getIndexDefinitionDiff());
}
Also used : AsyncIndexInfoService(org.apache.jackrabbit.oak.plugins.index.AsyncIndexInfoService) IndexDefinitionBuilder(org.apache.jackrabbit.oak.plugins.index.lucene.util.IndexDefinitionBuilder) Tree(org.apache.jackrabbit.oak.api.Tree) IndexInfo(org.apache.jackrabbit.oak.plugins.index.IndexInfo) AsyncIndexInfoServiceImpl(org.apache.jackrabbit.oak.plugins.index.AsyncIndexInfoServiceImpl) Test(org.junit.Test) AbstractQueryTest(org.apache.jackrabbit.oak.query.AbstractQueryTest)

Aggregations

Tree (org.apache.jackrabbit.oak.api.Tree)1 AsyncIndexInfoService (org.apache.jackrabbit.oak.plugins.index.AsyncIndexInfoService)1 AsyncIndexInfoServiceImpl (org.apache.jackrabbit.oak.plugins.index.AsyncIndexInfoServiceImpl)1 IndexInfo (org.apache.jackrabbit.oak.plugins.index.IndexInfo)1 IndexDefinitionBuilder (org.apache.jackrabbit.oak.plugins.index.lucene.util.IndexDefinitionBuilder)1 AbstractQueryTest (org.apache.jackrabbit.oak.query.AbstractQueryTest)1 Test (org.junit.Test)1