I am trying to work out how to unit test OSGi bundles that are intended to be installed under Fuse ESB. These tests would be included in the Maven build process for the bundles.
I have been trying to use Pax Exam, but a default Pax Exam test doesn't include the large number of bundles that come pre-installed with Fuse ESB. Our bundles make heavy use of Apache Camel/Fuse Mediation Router, amongst other things.
I tried dumping a list of all the pre-installed bundles in Fuse ESB, and adding them to the Options list in Pax Exam. Unfortunately, many of them fail to activate correctly, throwing exceptions instead.
I suspect I may be going about this in completely the wrong way.
Does anybody have experience in unit testing bundles that have large numbers of dependencies? Is Pax Exam the right tool for the job, or should I be looking at other tools?
Yeah, pax-exam definitely is the way to go.
You may wanna check the itests in Karaf and camel-itest-osgi/camel-itest-karaf in Camel code base, there are lots of tests example there.