in src/main/java/org/apache/sling/testing/clients/indexing/IndexingClient.java [240:262]
public void waitForAsyncIndexing(final long timeout, final long delay)
throws TimeoutException, InterruptedException, ClientException {
install(); // will install only if needed
final String uniqueValue = randomUUID().toString(); // to be added in all the content nodes
final List<String> lanes = getLaneNames(); // dynamically detect which lanes to wait for
Polling p = new Polling(() -> searchContent(lanes, uniqueValue));
try {
createContent(lanes, uniqueValue);
p.poll(timeout, delay);
} finally {
long total = totalWaited.addAndGet(p.getWaited()); // count waited in all the cases (timeout)
LOG.info("Waited for async index {} ms (overall: {} ms)", p.getWaited(), total);
try {
deleteContent(uniqueValue);
} catch (ClientException e) {
LOG.warn("Failed to delete temporary content", e);
}
}
}