use of org.apache.jackrabbit.oak.spi.commit.CommitInfo in project jackrabbit-oak by apache.
the class ExternalIndexObserverTest method ruleNotResultingInDoc.
@Test
public void ruleNotResultingInDoc() throws Exception {
Multimap<String, String> indexedPaths = HashMultimap.create();
indexedPaths.put("/a", "/oak:index/foo");
commitContext.set(LuceneDocumentHolder.NAME, new IndexedPaths(indexedPaths));
CommitInfo ci = newCommitInfo();
//Rule is of type nt:base but does not have any matching property definition
when(tracker.getIndexDefinition("/oak:index/foo")).thenReturn(createNRTIndex("nt:base"));
NodeBuilder nb = INITIAL_CONTENT.builder();
nb.child("a");
observer.contentChanged(nb.getNodeState(), ci);
verifyZeroInteractions(queue);
}
use of org.apache.jackrabbit.oak.spi.commit.CommitInfo in project jackrabbit-oak by apache.
the class LocalIndexObserverTest method docsAddedToQueue.
@Test
public void docsAddedToQueue() throws Exception {
CommitInfo info = newCommitInfo();
CommitContext cc = (CommitContext) info.getInfo().get(CommitContext.NAME);
LuceneDocumentHolder holder = new LuceneDocumentHolder(collectingQueue, 500);
holder.add(false, LuceneDoc.forDelete("foo", "bar"));
cc.set(LuceneDocumentHolder.NAME, holder);
observer.contentChanged(EMPTY_NODE, info);
assertEquals(1, collectingQueue.getQueuedDocs().size());
assertNull(cc.get(LuceneDocumentHolder.NAME));
}
use of org.apache.jackrabbit.oak.spi.commit.CommitInfo in project jackrabbit-oak by apache.
the class ExternalIndexObserverTest method nonApplicableRule.
@Test
public void nonApplicableRule() throws Exception {
Multimap<String, String> indexedPaths = HashMultimap.create();
indexedPaths.put("/a", "/oak:index/foo");
commitContext.set(LuceneDocumentHolder.NAME, new IndexedPaths(indexedPaths));
CommitInfo ci = newCommitInfo();
//Rule is on nt:file but node if of type nt:base
when(tracker.getIndexDefinition("/oak:index/foo")).thenReturn(createNRTIndex("nt:file"));
NodeBuilder nb = INITIAL_CONTENT.builder();
nb.child("a");
observer.contentChanged(nb.getNodeState(), ci);
verifyZeroInteractions(queue);
}
use of org.apache.jackrabbit.oak.spi.commit.CommitInfo in project jackrabbit-oak by apache.
the class LockBasedSchedulerCheckpointTest method createBlockingCommit.
private Commit createBlockingCommit(final Scheduler scheduler, final String property, String value, final Callable<Boolean> callable) {
NodeBuilder a = getRoot(scheduler).builder();
a.setProperty(property, value);
Commit blockingCommit = new Commit(a, new CommitHook() {
@Override
@Nonnull
public NodeState processCommit(NodeState before, NodeState after, CommitInfo info) {
try {
callable.call();
} catch (Exception e) {
fail();
}
return after;
}
}, CommitInfo.EMPTY);
return blockingCommit;
}
use of org.apache.jackrabbit.oak.spi.commit.CommitInfo in project jackrabbit-oak by apache.
the class DocumentNodeStore method newCommitInfo.
private static CommitInfo newCommitInfo(@Nonnull ChangeSet changeSet, JournalPropertyHandler journalPropertyHandler) {
CommitContext commitContext = new SimpleCommitContext();
commitContext.set(COMMIT_CONTEXT_OBSERVATION_CHANGESET, changeSet);
journalPropertyHandler.addTo(commitContext);
Map<String, Object> info = ImmutableMap.<String, Object>of(CommitContext.NAME, commitContext);
return new CommitInfo(CommitInfo.OAK_UNKNOWN, CommitInfo.OAK_UNKNOWN, info, true);
}
Aggregations