in src/main/java/org/apache/sling/testing/clients/osgi/OsgiConsoleClient.java [242:271]
public void waitServiceRegistered(final String type, final String bundleSymbolicName , final long timeout, final long delay) throws TimeoutException, InterruptedException {
Polling p = new Polling() {
@Override
public Boolean call() throws Exception {
Collection<ServiceInfo> infos = getServiceInfos(type);
if (infos != null) {
if (bundleSymbolicName != null) {
for (ServiceInfo info : infos) {
if (bundleSymbolicName.equals(info.getBundleSymbolicName())) {
return true;
}
}
LOG.debug("Could not find service info for service type {} provided by bundle {}", type, bundleSymbolicName);
return false;
} else {
return !infos.isEmpty();
}
} else {
LOG.debug("Could not find any service info for service type {}", type);
}
return false;
}
@Override
protected String message() {
return "Service with type " + type + " was not registered in %1$d ms";
}
};
p.poll(timeout, delay);
}