Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Unit Testing OSGi Blueprint with Apache Camel Made Easier

DZone's Guide to

Unit Testing OSGi Blueprint with Apache Camel Made Easier

· Integration Zone
Free Resource

Discover how developers can easily discover existing APIs and back-end data sources and create new APIs and microservices based on the popular open-source Node.js Express and LoopBack® frameworks.  Brought to you in partnership with IBM.

Apache Camel 2.10 has a new camel-test-blueprint component, added by Guillaume Node, to make unit testing Camel with OSGi blueprint much easier.

I have since polished the camel-test-blueprint to make it easier to use, and I've also fix a few glitches etc. So what's the story then? Well, camel-test-blueprint works exactly as the regular camel-test you may be familiar with already.

So all you have to do is extend the CamelTestSupport class and override the getBlueprintDescriptor method, and then return the path for your OSGi blueprint XML file. Then the rest is the usual story, to add test methods.

The Camel documentation has been updated, and you can find details here.

This is a great step forward for Camel end users who are on the OSGi blueprint wagon; it's becoming easier to develop and unit test along the way. All you have to do is to right click from your editor and run the unit tests as shown in the screenshot below.

JUnit testing Camel with OSGi Blueprint

The Camel Maven archetype camel-archetype-blueprint has been updated and includes the test kit out of the box with a sample code. I used this archetype to generate a new project, then I imported the project into Fuse IDE / Eclipse, and I opened the unit test source code file, and right clicked -> run as -> JUnit test. This is all standard functionality in Eclipse.

The camel-test-blueprint component is part of Apache Camel 2.10 release and the Fuse Mediation Router 2.9 release (our distribution of Apache Camel).

Learn about the comprehensive capabilities to create, run, manage, secure and monetize APIs and microservices with API Connect.  Brought to you in partnership with IBM.

Topics:

Published at DZone with permission of Claus Ibsen, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}