use of org.apache.jackrabbit.oak.spi.commit.Observer in project jackrabbit-oak by apache.
the class CheckpointTest method noContentChangeForCheckpoints.
@Test
public void noContentChangeForCheckpoints() throws Exception {
final AtomicInteger invocationCount = new AtomicInteger();
((Observable) store).addObserver(new Observer() {
@Override
public void contentChanged(@Nonnull NodeState root, @Nonnull CommitInfo info) {
invocationCount.incrementAndGet();
}
});
invocationCount.set(0);
String cp = store.checkpoint(Long.MAX_VALUE);
assertEquals(0, invocationCount.get());
store.release(cp);
assertEquals(0, invocationCount.get());
}
use of org.apache.jackrabbit.oak.spi.commit.Observer in project jackrabbit-oak by apache.
the class HybridIndexClusterIT method customize.
@Override
protected Jcr customize(Jcr jcr) {
IndexCopier copier;
try {
copier = new IndexCopier(executorService, temporaryFolder.getRoot());
} catch (IOException e) {
throw new RuntimeException(e);
}
MountInfoProvider mip = defaultMountInfoProvider();
NRTIndexFactory nrtIndexFactory = new NRTIndexFactory(copier, clock, TimeUnit.MILLISECONDS.toSeconds(refreshDelta), StatisticsProvider.NOOP);
LuceneIndexReaderFactory indexReaderFactory = new DefaultIndexReaderFactory(mip, copier);
IndexTracker tracker = new IndexTracker(indexReaderFactory, nrtIndexFactory);
LuceneIndexProvider provider = new LuceneIndexProvider(tracker);
DocumentQueue queue = new DocumentQueue(100, tracker, sameThreadExecutor());
LuceneIndexEditorProvider editorProvider = new LuceneIndexEditorProvider(copier, tracker, null, null, mip);
editorProvider.setIndexingQueue(queue);
LocalIndexObserver localIndexObserver = new LocalIndexObserver(queue, StatisticsProvider.NOOP);
ExternalIndexObserver externalIndexObserver = new ExternalIndexObserver(queue, tracker, StatisticsProvider.NOOP);
QueryEngineSettings qs = new QueryEngineSettings();
qs.setFailTraversal(true);
jcr.with((QueryIndexProvider) provider).with((Observer) provider).with(localIndexObserver).with(externalIndexObserver).with(editorProvider).with(qs).withAsyncIndexing("async", TimeUnit.DAYS.toSeconds(1));
return jcr;
}
use of org.apache.jackrabbit.oak.spi.commit.Observer in project jackrabbit-oak by apache.
the class JsonIndexCommand method openSession.
public static Session openSession(NodeStore nodeStore) throws RepositoryException {
if (nodeStore == null) {
return null;
}
StatisticsProvider statisticsProvider = StatisticsProvider.NOOP;
Oak oak = new Oak(nodeStore).with(ManagementFactory.getPlatformMBeanServer());
oak.getWhiteboard().register(StatisticsProvider.class, statisticsProvider, Collections.emptyMap());
LuceneIndexProvider provider = createLuceneIndexProvider();
oak.with((QueryIndexProvider) provider).with((Observer) provider).with(createLuceneIndexEditorProvider());
Jcr jcr = new Jcr(oak);
Repository repository = jcr.createRepository();
return repository.login(new SimpleCredentials("admin", "admin".toCharArray()));
}
use of org.apache.jackrabbit.oak.spi.commit.Observer in project jackrabbit-oak by apache.
the class LuceneIndexDescendantSuggestionTest method before.
@Before
public void before() throws Exception {
LuceneIndexProvider provider = new LuceneIndexProvider();
Jcr jcr = new Jcr().with(((QueryIndexProvider) provider)).with((Observer) provider).with(new LuceneIndexEditorProvider());
repository = jcr.createRepository();
session = (JackrabbitSession) repository.login(new SimpleCredentials("admin", "admin".toCharArray()));
root = session.getRootNode();
createContent();
session.save();
}
use of org.apache.jackrabbit.oak.spi.commit.Observer in project jackrabbit-oak by apache.
the class LuceneIndexDescendantSpellcheckTest method before.
@Before
public void before() throws Exception {
LuceneIndexProvider provider = new LuceneIndexProvider();
Jcr jcr = new Jcr().with(((QueryIndexProvider) provider)).with((Observer) provider).with(new LuceneIndexEditorProvider());
repository = jcr.createRepository();
session = (JackrabbitSession) repository.login(new SimpleCredentials("admin", "admin".toCharArray()));
root = session.getRootNode();
createContent();
session.save();
}
Aggregations