• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Modular Java: Pax tools

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Craig,

I assume your latest book is covering this experience in details, but could you please make a briefing here on how do you use Pax tools while working with OSGi, and which are your favorite ones?

Thanks,
Cristina
 
author
Posts: 422
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Cristina Gutiu wrote:I assume your latest book is covering this experience in details, but could you please make a briefing here on how do you use Pax tools while working with OSGi, and which are your favorite ones?



I became familiar with the Pax tools via Pax Runner. I was looking for a way to launch an OSGi container with a given set of bundles pre-installed and started. Trying to do that with Equinox or Felix by themselves proved to be cumbersome and the technique varied between the different framework implementations. Pax Runner unifies all of the OSGi framework implementations so that you can start them up with a set of bundles all the same way. It was exactly what I was looking for.

Once hooked on Pax Runner, I came into contact with Pax Construct. Hands down, this is my favorite Pax tool. Basically, Pax Construct brings a script/template-driven development model (ala, Rails or Grails) for OSGi. It takes a lot of the work out of developing the boilerplate pieces of OSGi bundles and leaves it to me to implement the most interesting stuff.

Then, there are other Pax goodies such as Pax Exam that lets me create a JUnit 4 test that loads up OSGi with a selection of bundles and perform assertions against that installation and the services exposed by those bundles.

I could catalog the entire Pax toolchest here, but those three are my favorites, by far.
 
Ranch Hand
Posts: 56
Scala Mac OS X Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Craig Walls wrote:
Then, there are other Pax goodies such as Pax Exam that lets me create a JUnit 4 test that loads up OSGi with a selection of bundles and perform assertions against that installation and the services exposed by those bundles.



Could you give us a little more in-depth about Unit testing in the OSGi container?
Like, can I do "integration testing" with Pax Exam? I mean can I test features that depend on the services of bundles other than the one I'm testing?

Thank you,
Ivano.
 
Craig Walls
author
Posts: 422
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ivano Pagano wrote:Could you give us a little more in-depth about Unit testing in the OSGi container?
Like, can I do "integration testing" with Pax Exam? I mean can I test features that depend on the services of bundles other than the one I'm testing?



Actually, that's precisely what Pax Exam is for. Here's roughly how it works:

You write a JUnit test that uses a special exam test runner. When that runner starts up, the first thing it does is start an OSGi runtime (of your choosing...it uses Pax Runner under the covers and so it can start any version of any OSGi runtime you want it to start). Then it installs a selection of bundles you specify in the test. At this point, you have a ready-to-test OSGi runtime, so the last thing it does is make an on-the-fly bundle that contains your JUnit test and installs that on-the-fly bundle into the OSGi runtime. From within the OSGi runtime, your test has access to the BundleContext and can do pretty much anything it wants. This includes consuming services published by other bundles and making assertions on what those services do.

FWIW, Spring-DM also has very similar testing support that follows an almost identical pattern. The only downside of Spring-DM's testing support is that currently it's based on JUnit 3. I much prefer Pax Exam's JUnit 4 style.
 
Ivano Pagano
Ranch Hand
Posts: 56
Scala Mac OS X Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Got it, sound just perfect!
Thanks so much, Craig

Ivano
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic