Book Image

Mastering Apache Camel

By : Bilgin Ismet Ibryam, Jean Baptiste Onofre, Jean-Baptiste Onofré
5 (1)
Book Image

Mastering Apache Camel

5 (1)
By: Bilgin Ismet Ibryam, Jean Baptiste Onofre, Jean-Baptiste Onofré

Overview of this book

Table of Contents (15 chapters)
Mastering Apache Camel
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Mocking OSGi services


The Camel Blueprint test kit allows you to mock and prototype OSGi services.

For that, the kit uses the PojoSR library.

For instance, we want to test the following route:

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">

      <reference id="service" interface="org.apache.camel.Processor"/>

      <camelContext xmlns="http://camel.apache.org/schema/blueprint">
          <route id="test">
              <from uri="direct:input"/>
              <process ref="service"/>
              <to uri="direct:output"/>
          </route>
      </camelContext>

</blueprint>

If this route is very simple, it uses an OSGi service via the <reference/> element. In the OSGi container, the reference element is looking for the actual service in the OSGi Service Registry.

Instead of using a real blueprint container, the Camel Blueprint test kit allows you to register services...