You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by psnively <ps...@vmware.com> on 2013/04/25 21:09:42 UTC

Karaf-Pax-Exam Runs Tests Before Bundles Active

This has come up before, but I haven't been able to nail down a definitive
answer.

I'm using Karaf 2.3.1, and have successfully added the tooling and Pax-Exam
2.6.0 dependencies to my project. The Pax-Exam Karaf instance comes up
successfully and deploys several bundles, some from Maven, some from the
filesystem, successfully. However, my first test, which uses the injected
BundleContext to look up a bundle and confirm that its state is ACTIVE,
fails because the bundle is still in STARTING state. When I keep the
distribution folder and run Karaf manually, in a short while the bundle does
become ACTIVE.

So my question is: how do I ensure that my tests don't run until all bundles
are either ACTIVE (bundles) or RESOLVED (fragments)? I've seen references to
waitForFrameworkStartup, which apparently doesn't exist anymore, as well as
scanFeatures (for bundles?) and scanBundle (which doesn't even seem to
actually deploy the bundle at the URL). Any advice would be greatly
appreciated.

Many thanks and best regards,
Paul




--
View this message in context: http://karaf.922171.n3.nabble.com/Karaf-Pax-Exam-Runs-Tests-Before-Bundles-Active-tp4028489.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Karaf-Pax-Exam Runs Tests Before Bundles Active

Posted by Achim Nierbeck <bc...@googlemail.com>.
One possible solution might be to wait for a service provided by your
bundle in the setup method.
It's something I usually also do in the pax-web karaf itests, I added a
link to one of these tests [1]


regards, Achim

[1] -
https://github.com/ops4j/org.ops4j.pax.web/blob/master/pax-web-itest-karaf/src/test/java/org/ops4j/pax/web/itest/karaf/SpringOsgiKarafTest.java#L78

2013/4/25 psnively <ps...@vmware.com>

> This has come up before, but I haven't been able to nail down a definitive
> answer.
>
> I'm using Karaf 2.3.1, and have successfully added the tooling and Pax-Exam
> 2.6.0 dependencies to my project. The Pax-Exam Karaf instance comes up
> successfully and deploys several bundles, some from Maven, some from the
> filesystem, successfully. However, my first test, which uses the injected
> BundleContext to look up a bundle and confirm that its state is ACTIVE,
> fails because the bundle is still in STARTING state. When I keep the
> distribution folder and run Karaf manually, in a short while the bundle
> does
> become ACTIVE.
>
> So my question is: how do I ensure that my tests don't run until all
> bundles
> are either ACTIVE (bundles) or RESOLVED (fragments)? I've seen references
> to
> waitForFrameworkStartup, which apparently doesn't exist anymore, as well as
> scanFeatures (for bundles?) and scanBundle (which doesn't even seem to
> actually deploy the bundle at the URL). Any advice would be greatly
> appreciated.
>
> Many thanks and best regards,
> Paul
>
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/Karaf-Pax-Exam-Runs-Tests-Before-Bundles-Active-tp4028489.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>



-- 

Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home>
Commiter & Project Lead
blog <http://notizblog.nierbeck.de/>