use of org.apache.jackrabbit.oak.spi.commit.CompositeHook in project jackrabbit-oak by apache.
the class PropertyIndexTest method mountWithCommitInWritableMount.
@Test
public void mountWithCommitInWritableMount() throws Exception {
NodeState root = INITIAL_CONTENT;
// Add index definition
NodeBuilder builder = root.builder();
NodeBuilder index = createIndexDefinition(builder.child(INDEX_DEFINITIONS_NAME), "foo", true, false, ImmutableSet.of("foo"), null);
index.setProperty("entryCount", -1);
NodeState before = builder.getNodeState();
// Add some content and process it through the property index hook
builder.child("content").setProperty("foo", "abc");
NodeState after = builder.getNodeState();
MountInfoProvider mip = Mounts.newBuilder().readOnlyMount("foo", "/readOnly").build();
CompositeHook hook = new CompositeHook(new EditorHook(new IndexUpdateProvider(new PropertyIndexEditorProvider().with(mip))), new EditorHook(new ValidatorProvider() {
protected Validator getRootValidator(NodeState before, NodeState after, CommitInfo info) {
return new PrivateStoreValidator("/", mip);
}
}));
NodeState indexed = hook.processCommit(before, after, CommitInfo.EMPTY);
Mount defMount = mip.getDefaultMount();
assertTrue(getNode(indexed, pathInIndex(defMount, "/oak:index/foo", "/content", "abc")).exists());
}
use of org.apache.jackrabbit.oak.spi.commit.CompositeHook in project jackrabbit-oak by apache.
the class PropertyIndexCleaner method merge.
private void merge(NodeBuilder builder) throws CommitFailedException {
// TODO Configure validator
CompositeHook hooks = createCommitHook();
nodeStore.merge(builder, hooks, createCommitInfo());
}
Aggregations