use of org.ops4j.pax.url.mvn.MavenResolver in project karaf by apache.
the class MavenTest method awaitMavenResolver.
/**
* Invoke config admin task and await reregistration of {@link MavenResolver} service
*/
private void awaitMavenResolver(Runnable task) throws Exception {
final CountDownLatch latch = new CountDownLatch(2);
ServiceListener listener = event -> {
if (event.getType() == ServiceEvent.UNREGISTERING || event.getType() == ServiceEvent.REGISTERED) {
latch.countDown();
}
};
bundleContext.addServiceListener(listener, "(objectClass=org.ops4j.pax.url.mvn.MavenResolver)");
try {
task.run();
assertTrue(latch.await(5, TimeUnit.SECONDS));
} finally {
bundleContext.removeServiceListener(listener);
}
}
Aggregations