You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Blueprint Testing

Testing is a crucial part of any development or integration work. Camel supports the definition of Blueprint routes, but given Blueprint is an OSGi specific technology, writing unit tests is quite difficult. This library leverages PojoSR which provides a service registry without using a fully compliant OSGi container. This allows defining real unit tests (as opposed to integration tests using Pax Exam.

Here is an example using XML Config.

Error formatting macro: snippet: java.lang.NullPointerException

Also notice the use of getBlueprintDescriptor to specify the location of the OSGi Blueprint XML file.

Error formatting macro: snippet: java.lang.NullPointerException

If you have multiple OSGi Blueprint XML files, then you can specify them separated by comma in the getBlueprintDescriptor method.

In order to define blueprint tests, you need to add the following dependency in your pom:

<dependency>
  <groupId>org.apache.camel</groupId>
  <artifactId>camel-test-blueprint</artifactId>
  <version>2.10-SNAPSHOT</version>
  <scope>test</scope>
</dependency>
  • No labels