-
1. Re: Unit testing OSGi bundles within FUSE ESB 4
hzbarcea_hzbarcea Aug 13, 2009 11:39 PM (in response to frederic.conrotte)Frederick,
Thanks for you kind words.
You are obviously right that for a non-trivial application the number of bundles grows pretty fast. How manageable that is is probably a subjective matter, given the alternatives. OSGi goes a long way in managing the dependencies and versions for you.
What we commonly do and encourage is to use maven as a build system and have your bundles managed/generated by maven. This is actually described in the doc you pointed to at: http://fusesource.com/docs/esb/4.1/osgi/index.html
You can then use maven to manage your dependencies using:
$ mvn dependency:list (or)
$ mvn dependency:tree
For deployment, you may want to use an OBR repository to manage your bundles and dependencies: http://www.osgi.org/Repository
I hope this helps.
-
2. Re: Unit testing OSGi bundles within FUSE ESB 4
davsclaus Aug 14, 2009 12:12 AM (in response to frederic.conrotte)Hi
At Apache Camel we use pax-exam to do osgi unit and integration tests.
https://svn.apache.org/repos/asf/camel/trunk/tests/camel-itest-osgi/
That is addition to the approx. 3000+ and still counting regular unit tests we do with Camel using plain junit.
-
3. Re: Unit testing OSGi bundles within FUSE ESB 4
frederic.conrotte Aug 14, 2009 2:56 AM (in response to davsclaus)Hi,
Many thanks for the pointers, I'll as well give pax-exam a try.
Frederic
-
4. Re: Unit testing OSGi bundles within FUSE ESB 4
dgreco Aug 14, 2009 3:59 AM (in response to davsclaus)Pax-exam is really cool and effective, unfortunately pax-exam doesn't work together with the cxf bundle. The only platform it seems working correctly is
knopflerfish.
-
5. Re: Unit testing OSGi bundles within FUSE ESB 4
njiang Aug 14, 2009 8:03 PM (in response to dgreco)Can I know what kind of error that you got when you run the cxf-bundle within pax-exam?
I managed to run the camel-cxf test with pax-exam a month ago and I know there some OSGi integration tests of servicemix which are also using the cxf-bundle.
-
6. Re: Unit testing OSGi bundles within FUSE ESB 4
dgreco Aug 15, 2009 11:31 AM (in response to njiang)Servimix uses the spring testing framework and not pax-exam. Anyway it's very easy to reproduce the problem. Pax-exam uses pax-runner, so you can just try to run a cxf based project using pax-runner and you'll notice that the osgi framework blocks indefinetely trying to resolve the cxf bundle. Trying with knopflerfish works fine.
-
7. Re: Unit testing OSGi bundles within FUSE ESB 4
njiang Aug 16, 2009 3:24 AM (in response to dgreco)I got a timeout issue[1] when publishing the service with CXF bundle[2] in JDK 1.5.
Maybe you can try out the fix
https://issues.apache.org/activemq/browse/SMX4-325
https://svn.apache.org/repos/asf/camel/trunk/examples/camel-example-reportincident/src/test/java/org/apache/camel/example/reportincident/ReportIncidentRoutesOSGiTest.java
-
8. Re: Unit testing OSGi bundles within FUSE ESB 4
jkhan Sep 15, 2009 5:09 PM (in response to njiang)This shows that it will work standalone camel. How do I use the unit testing with my camel osgi services deployed in SMX4?
-
9. Re: Unit testing OSGi bundles within FUSE ESB 4
njiang Sep 16, 2009 2:47 AM (in response to jkhan)Hi jkhan ,
If you take a close look at the tests file , there is an example[1] of unit test by using Pax Exam.
Since Fuse ESB use the Pax runner to start the OSGi Environment, and Pax Exam did the same thing to start the JUnit test in OSGi Environment.
https://svn.apache.org/repos/asf/camel/trunk/examples/camel-example-reportincident/src/test/java/org/apache/camel/example/reportincident/ReportIncidentRoutesOSGiTest.java