use of org.apache.jackrabbit.oak.plugins.index.CompositeIndexEditorProvider in project jackrabbit-oak by apache.
the class CrossMountReferenceValidatorTest method initializeHook.
@Before
public void initializeHook() {
MountInfoProvider mip = Mounts.newBuilder().mount("foo", "/a").build();
hook = new EditorHook(new CompositeEditorProvider(new IndexUpdateProvider(new CompositeIndexEditorProvider(new PropertyIndexEditorProvider().with(mip), new ReferenceEditorProvider().with(mip))), new CrossMountReferenceValidatorProvider().with(mip).withFailOnDetection(true)));
}
use of org.apache.jackrabbit.oak.plugins.index.CompositeIndexEditorProvider in project jackrabbit-oak by apache.
the class LuceneIndexEditorTest method copyOnWriteAndLocks.
@Test
public void copyOnWriteAndLocks() throws Exception {
assumeNotWindows();
ExecutorService executorService = Executors.newFixedThreadPool(2);
IndexCopier copier = new IndexCopier(executorService, temporaryFolder.getRoot());
FailOnDemandEditorProvider failingProvider = new FailOnDemandEditorProvider();
EditorHook hook = new EditorHook(new IndexUpdateProvider(new CompositeIndexEditorProvider(failingProvider, new LuceneIndexEditorProvider(copier))));
NodeBuilder index = builder.child(INDEX_DEFINITIONS_NAME);
NodeBuilder nb = newLuceneIndexDefinitionV2(index, "lucene", of(TYPENAME_STRING));
IndexUtils.createIndexDefinition(index, "failingIndex", false, false, of("foo"), null);
//1. Get initial set indexed. So that next cycle is normal indexing
NodeState indexed = hook.processCommit(EMPTY_NODE, builder.getNodeState(), CommitInfo.EMPTY);
builder = indexed.builder();
NodeState before = indexed;
builder.child("test").setProperty("a", "fox is jumping");
NodeState after = builder.getNodeState();
//2. Ensure that Lucene gets triggered but close is not called
failingProvider.setShouldFail(true);
try {
hook.processCommit(before, after, CommitInfo.EMPTY);
fail();
} catch (CommitFailedException ignore) {
}
//3. Disable the troubling editor
failingProvider.setShouldFail(false);
//4. Now commit should process fine
hook.processCommit(before, after, CommitInfo.EMPTY);
executorService.shutdown();
}
Aggregations