There is no general facility for this in OSGi.
For karaf we provide a marker service with the
org.apache.karaf.features.BootFinished interface.
We use it in the karaf itests like this:
/**
* To make sure the tests run only when the boot features are fully
installed
*/
@Inject
BootFinished bootFinished;
The service will be started when all bundles have been started.
Be aware though that some startup logic may still be unfinished. For
example blueprint contexts are started asynchronously after the bundle
is started.
So the better solution is to inject some service your bundle under test
starts. Still BootFinished covers a lot of cases where this is not possible.
Christian
On 21.01.2015 12:39, Milan Tomic wrote:
Hello,
If I define PAX EXAM configuration as:
public static Option[] getConfiguration() {
...
mavenBundle().groupId("
myGroupId").artifactId(" myArtifactId").version("1.0.0" ).start(),
...
}
then execution of JUnit method waits all bundles to be deployed and
started before entering test():
@Test
public void test() {
// my code here
}
but if I have configuration like this:
public static Option[] getConfiguration() {
...
KarafDistributionOption. features(maven().groupId(" myGroupId")
.artifactId("myArtifactId").
version("1.0.0").type("xml"). classifier("features"), "my-feature"),
...
}
so when I have all my bundles inside feature.xml specified then
execution of my JUnit's test() method doesn't wait for all bundles to
be loaded and started.
How can I tell PAX-EXAM/Karaf to wait for all bundles to be loaded and
started?
Thank you in advance,
Milan
--
Christian Schneider
http://www.liquid-reality.de
Open Source Architect
http://www.talend.com