Modified: websites/production/camel/content/book-cookbook.html
==============================================================================
--- websites/production/camel/content/book-cookbook.html (original)
+++ websites/production/camel/content/book-cookbook.html Thu Nov 29 08:26:57 
2018
@@ -95,13 +95,13 @@
 
 <h1 id="Bookcookbook-CookBook">CookBook</h1>
 This document describes various recipes for working with Camel
-<ul><li><a shape="rect" href="bean-integration.html">Bean Integration</a> 
describes how to work with beans and Camel in a loosely coupled way so that 
your beans do not have to depend on any Camel APIs
+<ul class="conf-macro output-block" data-hasbody="false" 
data-macro-name="include"><li><a shape="rect" href="bean-integration.html">Bean 
Integration</a> describes how to work with beans and Camel in a loosely coupled 
way so that your beans do not have to depend on any Camel APIs
        <ul><li><a shape="rect" 
href="annotation-based-expression-language.html">Annotation Based Expression 
Language</a> binds expressions to method parameters</li><li><a shape="rect" 
href="bean-binding.html">Bean Binding</a> defines which methods are invoked and 
how the Message is converted into the parameters of the method when it is 
invoked</li><li><a shape="rect" href="bean-injection.html">Bean Injection</a> 
for injecting Camel related resources into your POJOs</li><li><a shape="rect" 
href="parameter-binding-annotations.html">Parameter Binding Annotations</a> for 
extracting various headers, properties or payloads from a Message</li><li><a 
shape="rect" href="pojo-consuming.html">POJO Consuming</a> for consuming and 
possibly routing messages from Camel</li><li><a shape="rect" 
href="pojo-producing.html">POJO Producing</a> for producing camel messages from 
your POJOs</li><li><a shape="rect" 
href="recipientlist-annotation.html">RecipientList Annotation</a> for creating 
a Recipient List fro
 m a POJO method</li><li><a shape="rect" 
href="using-exchange-pattern-annotations.html">Using Exchange Pattern 
Annotations</a> describes how pattern annotations can be used to change the 
behaviour of method invocations</li></ul>
        </li><li><a shape="rect" href="hiding-middleware.html">Hiding 
Middleware</a> describes how to avoid your business logic being coupled to any 
particular middleware APIs allowing you to easily switch from in JVM <a 
shape="rect" href="seda.html">SEDA</a> to <a shape="rect" 
href="jms.html">JMS</a>, <a shape="rect" href="activemq.html">ActiveMQ</a>, <a 
shape="rect" href="hibernate.html">Hibernate</a>, <a shape="rect" 
href="jpa.html">JPA</a>, <a shape="rect" href="jdbc.html">JDBC</a>, <a 
shape="rect" href="ibatis.html">iBatis</a> or <a shape="rect" 
href="javaspace.html">JavaSpace</a> etc.</li><li><a shape="rect" 
href="visualisation.html">Visualisation</a> describes how to visualise your <a 
shape="rect" href="enterprise-integration-patterns.html">Enterprise Integration 
Patterns</a> to help you understand your routing rules</li><li><a shape="rect" 
href="bam.html">Business Activity Monitoring (BAM)</a> for monitoring business 
processes across systems</li><li><a shape="rect" href="etl.html">
 Extract Transform Load (ETL)</a> to load data into systems or 
databases</li><li><a shape="rect" href="testing.html">Testing</a> for testing 
distributed and asynchronous systems using a messaging approach
        <ul><li><a shape="rect" href="camel-test.html">Camel Test</a> for 
creating test cases using a single Java class for all your configuration and 
routing</li><li><a shape="rect" href="spring-testing.html">Spring Testing</a> 
uses Spring Test together with either XML or Java Config to dependency inject 
your test classes</li><li><a shape="rect" href="guice.html">Guice</a> uses 
Guice to dependency inject your test classes</li></ul>
        </li><li><a shape="rect" href="templating.html">Templating</a> is a 
great way to create service stubs to be able to test your system without some 
back end system.</li><li><a shape="rect" href="database.html">Database</a> for 
working with databases</li><li><a shape="rect" 
href="parallel-processing-and-ordering.html">Parallel Processing and 
Ordering</a> on how using parallel processing and <a shape="rect" 
href="seda.html">SEDA</a> or <a shape="rect" href="jms.html">JMS</a> based load 
balancing can be achieved.</li><li><a shape="rect" 
href="asynchronous-processing.html">Asynchronous Processing</a> in Camel 
Routes.</li><li><a shape="rect" 
href="implementing-virtual-topics-on-other-jms-providers.html">Implementing 
Virtual Topics on other JMS providers</a> shows how to get the effect of 
Virtual Topics and avoid issues with JMS durable topics</li><li><a shape="rect" 
href="camel-transport-for-cxf.html">Camel Transport for CXF</a> describes how 
to put the Camel context into the CXF transpor
 t layer.</li><li><a shape="rect" 
href="fine-grained-control-over-a-channel.html">Fine Grained Control Over a 
Channel</a> describes how to deliver a sequence of messages over a single 
channel and then stopping any more messages being sent over that channel. 
Typically used for sending data over a socket and then closing the 
socket.</li><li><a shape="rect" 
href="eventnotifier-to-log-details-about-all-sent-exchanges.html">EventNotifier 
to log details about all sent Exchanges</a> shows how to let Camels 
<code>EventNotifier</code> log all sent to endpoint events and how long time it 
took.</li><li><a shape="rect" href="loading-routes-from-xml-files.html">Loading 
routes from XML files</a> into an existing <a shape="rect" 
href="camelcontext.html">CamelContext</a>.</li><li>Using <a shape="rect" 
href="mdc-logging.html">MDC logging</a> with Camel</li><li><a shape="rect" 
href="running-camel-standalone-and-have-it-keep-running.html">Running Camel 
standalone and have it keep running</a> shows how 
 to keep Camel running when you run it standalone.</li><li><a shape="rect" 
href="hazelcast-idempotent-repository-tutorial.html">Hazelcast Idempotent 
Repository Tutorial</a> shows how to avoid to consume duplicated messages in a 
clustered environment.</li><li><a shape="rect" 
href="how-to-use-camel-as-a-http-proxy-between-a-client-and-server.html">How to 
use Camel as a HTTP proxy between a client and server</a> shows how to use 
Camel as a HTTP adapter/proxy between a client and HTTP service.</li></ul>
 
-<h2 id="Bookcookbook-BeanIntegration">Bean Integration</h2>
+<div class="conf-macro output-block" data-hasbody="false" 
data-macro-name="include"><h2 id="Bookcookbook-BeanIntegration">Bean 
Integration</h2>
 
 <p>Camel supports the integration of beans and POJOs in a number of ways</p>
 
@@ -128,8 +128,8 @@ This document describes various recipes
 <p>We support a <a shape="rect" href="spring-remoting.html">Spring 
Remoting</a> provider which uses Camel as the underlying transport mechanism. 
The nice thing about this approach is we can use any of the Camel transport <a 
shape="rect" href="components.html">Components</a> to communicate between 
beans. It also means we can use <a shape="rect" 
href="content-based-router.html">Content Based Router</a> and the other <a 
shape="rect" href="enterprise-integration-patterns.html">Enterprise Integration 
Patterns</a> in between the beans; in particular we can use <a shape="rect" 
href="message-translator.html">Message Translator</a> to be able to convert 
what the on-the-wire messages look like in addition to adding various headers 
and so forth. </p>
 
 <div class="confluence-information-macro 
confluence-information-macro-information conf-macro output-block" 
data-hasbody="true" data-macro-name="info"><p class="title">Bean 
binding</p><span class="aui-icon aui-icon-small aui-iconfont-info 
confluence-information-macro-icon"> </span><div 
class="confluence-information-macro-body">
-<p>Whenever Camel invokes a bean method via one of the above methods (<a 
shape="rect" href="bean.html">Bean</a> component, <a shape="rect" 
href="spring-remoting.html">Spring Remoting</a> or <a shape="rect" 
href="pojo-consuming.html">POJO Consuming</a>) then the <strong><a shape="rect" 
href="bean-binding.html">Bean Binding</a></strong> mechanism is used to figure 
out what method to use (if it is not explicit) and how to bind the <a 
shape="rect" href="message.html">Message</a> to the parameters possibly using 
the <a shape="rect" href="parameter-binding-annotations.html">Parameter Binding 
Annotations</a> or using a <a shape="rect" href="bean-binding.html">method name 
option</a>.</p></div></div>
-<h3 id="Bookcookbook-AnnotationBasedExpressionLanguage">Annotation Based 
Expression Language</h3>
+<p>Whenever Camel invokes a bean method via one of the above methods (<a 
shape="rect" href="bean.html">Bean</a> component, <a shape="rect" 
href="spring-remoting.html">Spring Remoting</a> or <a shape="rect" 
href="pojo-consuming.html">POJO Consuming</a>) then the <strong><a shape="rect" 
href="bean-binding.html">Bean Binding</a></strong> mechanism is used to figure 
out what method to use (if it is not explicit) and how to bind the <a 
shape="rect" href="message.html">Message</a> to the parameters possibly using 
the <a shape="rect" href="parameter-binding-annotations.html">Parameter Binding 
Annotations</a> or using a <a shape="rect" href="bean-binding.html">method name 
option</a>.</p></div></div></div>
+<div class="conf-macro output-block" data-hasbody="false" 
data-macro-name="include"><h3 
id="Bookcookbook-AnnotationBasedExpressionLanguage">Annotation Based Expression 
Language</h3>
 
 <p>You can also use any of the <a shape="rect" 
href="languages.html">Languages</a> supported in Camel to bind expressions to 
method parameters when using <a shape="rect" href="bean-integration.html">Bean 
Integration</a>. For example you can use any of these annotations:</p>
 
@@ -218,8 +218,8 @@ public class MySimpleIdGenerator {
 </pre>
 </div></div>
 
-<p>Groovy supports GStrings that is like a template where we can insert $ 
placeholders that will be evaluated by Groovy.</p>
-<h2 id="Bookcookbook-BeanBinding">Bean Binding</h2><p>Bean Binding in Camel 
defines both which methods are invoked and also how the <a shape="rect" 
href="message.html">Message</a> is converted into the parameters of the method 
when it is invoked.</p><h3 id="Bookcookbook-Choosingthemethodtoinvoke">Choosing 
the method to invoke</h3><p>The binding of a Camel <a shape="rect" 
href="message.html">Message</a> to a bean method call can occur in different 
ways, in the following order of importance:</p><ul><li>if the message contains 
the header <strong>CamelBeanMethodName</strong> then that method is invoked, 
converting the body to the type of the method's argument.<ul><li>From 
<strong>Camel 2.8</strong> onwards you can qualify parameter types to select 
exactly which method to use among overloads with the same name (see below for 
more details).</li><li>From <strong>Camel 2.9</strong> onwards you can specify 
parameter values directly in the method option (see below for more 
details).</li></ul>
 </li><li>you can explicitly specify the method name in the <a shape="rect" 
href="dsl.html">DSL</a> or when using <a shape="rect" 
href="pojo-consuming.html">POJO Consuming</a> or <a shape="rect" 
href="pojo-producing.html">POJO Producing</a></li><li>if the bean has a method 
marked with the <code>@Handler</code> annotation, then that method is 
selected</li><li>if the bean can be converted to a <a shape="rect" 
href="processor.html">Processor</a> using the <a shape="rect" 
href="type-converter.html">Type Converter</a> mechanism, then this is used to 
process the message. The <a shape="rect" href="activemq.html">ActiveMQ</a> 
component uses this mechanism to allow any JMS MessageListener to be invoked 
directly by Camel without having to write any integration glue code. You can 
use the same mechanism to integrate Camel into any other messaging/remoting 
frameworks.</li><li>if the body of the message can be converted to a <a 
shape="rect" class="external-link" href="http://camel.apache.org/maven
 
/current/camel-core/apidocs/org/apache/camel/component/bean/BeanInvocation.html">BeanInvocation</a>
 (the default payload used by the <a shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/component/bean/ProxyHelper.html";>ProxyHelper</a>)
 component - then that is used to invoke the method and pass its 
arguments</li><li>otherwise the type of the body is used to find a matching 
method; an error is thrown if a single method cannot be chosen 
unambiguously.</li><li>you can also use Exchange as the parameter itself, but 
then the return type must be void.</li><li>if the bean class is private (or 
package-private), interface methods will be preferred (from <strong>Camel 
2.9</strong> onwards) since Camel can't invoke class methods on such 
beans</li></ul><p>In cases where Camel cannot choose a method to invoke, an 
<code>AmbiguousMethodCallException</code> is thrown.</p><p>By default the 
return value is set on the outbound message bo
 dy.&#160;</p><h3 id="Bookcookbook-Asynchronousprocessing">Asynchronous 
processing</h3><p>From&#160;<strong>Camel 2.18</strong>&#160;onwards you can 
return a CompletionStage implementation (e.g. a CompletableFuture) to implement 
asynchronous processing.</p><p>Please be sure to properly complete the 
CompletionStage with the result or exception, including any timeout handling. 
Exchange processing would wait for completion and would not impose any timeouts 
automatically. It's extremely useful to monitor&#160;<a shape="rect" 
class="external-link" 
href="https://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/spi/InflightRepository.html";>Inflight
 repository</a> for any hanging messages.</p><p>Note that completing with 
"null" won't set outbody message body to null, but would keep message intact. 
This is useful to support methods that don't modify exchange and return 
CompletableFuture&lt;Void&gt;. To set body to null, just add Exchange method 
parameter and directly modify 
 exchange messages.</p><p>Examples:</p><p>Simple asynchronous processor, 
modifying message body.</p><div class="code panel pdl conf-macro output-block" 
data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+<p>Groovy supports GStrings that is like a template where we can insert $ 
placeholders that will be evaluated by Groovy.</p></div>
+<div class="conf-macro output-block" data-hasbody="false" 
data-macro-name="include"><h2 id="Bookcookbook-BeanBinding">Bean 
Binding</h2><p>Bean Binding in Camel defines both which methods are invoked and 
also how the <a shape="rect" href="message.html">Message</a> is converted into 
the parameters of the method when it is invoked.</p><h3 
id="Bookcookbook-Choosingthemethodtoinvoke">Choosing the method to 
invoke</h3><p>The binding of a Camel <a shape="rect" 
href="message.html">Message</a> to a bean method call can occur in different 
ways, in the following order of importance:</p><ul><li>if the message contains 
the header <strong>CamelBeanMethodName</strong> then that method is invoked, 
converting the body to the type of the method's argument.<ul><li>From 
<strong>Camel 2.8</strong> onwards you can qualify parameter types to select 
exactly which method to use among overloads with the same name (see below for 
more details).</li><li>From <strong>Camel 2.9</strong> onwards you can specify 
pa
 rameter values directly in the method option (see below for more 
details).</li></ul></li><li>you can explicitly specify the method name in the 
<a shape="rect" href="dsl.html">DSL</a> or when using <a shape="rect" 
href="pojo-consuming.html">POJO Consuming</a> or <a shape="rect" 
href="pojo-producing.html">POJO Producing</a></li><li>if the bean has a method 
marked with the <code>@Handler</code> annotation, then that method is 
selected</li><li>if the bean can be converted to a <a shape="rect" 
href="processor.html">Processor</a> using the <a shape="rect" 
href="type-converter.html">Type Converter</a> mechanism, then this is used to 
process the message. The <a shape="rect" href="activemq.html">ActiveMQ</a> 
component uses this mechanism to allow any JMS MessageListener to be invoked 
directly by Camel without having to write any integration glue code. You can 
use the same mechanism to integrate Camel into any other messaging/remoting 
frameworks.</li><li>if the body of the message can be conv
 erted to a <a shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/component/bean/BeanInvocation.html";>BeanInvocation</a>
 (the default payload used by the <a shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/component/bean/ProxyHelper.html";>ProxyHelper</a>)
 component - then that is used to invoke the method and pass its 
arguments</li><li>otherwise the type of the body is used to find a matching 
method; an error is thrown if a single method cannot be chosen 
unambiguously.</li><li>you can also use Exchange as the parameter itself, but 
then the return type must be void.</li><li>if the bean class is private (or 
package-private), interface methods will be preferred (from <strong>Camel 
2.9</strong> onwards) since Camel can't invoke class methods on such 
beans</li></ul><p>In cases where Camel cannot choose a method to invoke, an 
<code>AmbiguousMethodCallException</
 code> is thrown.</p><p>By default the return value is set on the outbound 
message body.&#160;</p><h3 
id="Bookcookbook-Asynchronousprocessing">Asynchronous 
processing</h3><p>From&#160;<strong>Camel 2.18</strong>&#160;onwards you can 
return a CompletionStage implementation (e.g. a CompletableFuture) to implement 
asynchronous processing.</p><p>Please be sure to properly complete the 
CompletionStage with the result or exception, including any timeout handling. 
Exchange processing would wait for completion and would not impose any timeouts 
automatically. It's extremely useful to monitor&#160;<a shape="rect" 
class="external-link" 
href="https://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/spi/InflightRepository.html";>Inflight
 repository</a> for any hanging messages.</p><p>Note that completing with 
"null" won't set outbody message body to null, but would keep message intact. 
This is useful to support methods that don't modify exchange and return 
CompletableFuture&lt;Vo
 id&gt;. To set body to null, just add Exchange method parameter and directly 
modify exchange messages.</p><p>Examples:</p><p>Simple asynchronous processor, 
modifying message body.</p><div class="code panel pdl conf-macro output-block" 
data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
 <pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; 
gutter: false; theme: Default" data-theme="Default">public 
CompletableFuture&lt;String&gt; doSomethingAsync(String body)</pre>
 </div></div><p><br clear="none">Composite processor that do not modify 
exchange</p><div class="code panel pdl conf-macro output-block" 
data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
 <pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; 
gutter: false; theme: Default" data-theme="Default">&#160;public 
CompletableFuture&lt;Void&gt; doSomethingAsync(String body) {
@@ -293,8 +293,8 @@ public class MySimpleIdGenerator {
 <pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; 
gutter: false; theme: Default" data-theme="Default">.bean(OrderService.class, 
"doSomething(com.foo.MyOrder)")</pre>
 </div></div><p><br clear="none">Camel currently only supports either 
specifying parameter binding or type per parameter in the method name option. 
You <strong>cannot</strong> specify both at the same time, such as</p><div 
class="code panel pdl conf-macro output-block" data-hasbody="true" 
data-macro-name="code" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
 <pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; 
gutter: false; theme: Default" 
data-theme="Default">&#160;doSomething(com.foo.MyOrder ${body}, boolean 
${header.high})</pre>
-</div></div><p>This may change in the future.</p>
-<h3 id="Bookcookbook-BeanInjection">Bean Injection</h3>
+</div></div><p>This may change in the future.</p></div>
+<div class="conf-macro output-block" data-hasbody="false" 
data-macro-name="include"><h3 id="Bookcookbook-BeanInjection">Bean 
Injection</h3>
 
 <p>We support the injection of various resources using @EndpointInject or 
@BeanInject. This can be used to inject</p>
 
@@ -334,8 +334,8 @@ public class MyRouteBuilder extends Rout
    @BeanInject
    MyFooBean foo;
 </pre>
-</div></div>
-<h3 id="Bookcookbook-ParameterBindingAnnotations">Parameter Binding 
Annotations</h3>
+</div></div></div>
+<div class="conf-macro output-block" data-hasbody="false" 
data-macro-name="include"><h3 
id="Bookcookbook-ParameterBindingAnnotations">Parameter Binding Annotations</h3>
 
 <div class="confluence-information-macro 
confluence-information-macro-information conf-macro output-block" 
data-hasbody="true" data-macro-name="info"><p class="title">camel-core</p><span 
class="aui-icon aui-icon-small aui-iconfont-info 
confluence-information-macro-icon"> </span><div 
class="confluence-information-macro-body">
 <p>The annotations below are all part of <strong>camel-core</strong> and thus 
does not require <strong>camel-spring</strong> or <a shape="rect" 
href="spring.html">Spring</a>. These annotations can be used with the <a 
shape="rect" href="bean.html">Bean</a> component or when invoking beans in the 
<a shape="rect" href="dsl.html">DSL</a></p></div></div>
@@ -415,7 +415,7 @@ from("activemq:someQueue").
 </pre>
 </div></div>
 
-<h3 id="Bookcookbook-AnnotationBasedExpressionLanguage.1">Annotation Based 
Expression Language</h3>
+<div class="conf-macro output-block" data-hasbody="false" 
data-macro-name="include"><h3 
id="Bookcookbook-AnnotationBasedExpressionLanguage.1">Annotation Based 
Expression Language</h3>
 
 <p>You can also use any of the <a shape="rect" 
href="languages.html">Languages</a> supported in Camel to bind expressions to 
method parameters when using <a shape="rect" href="bean-integration.html">Bean 
Integration</a>. For example you can use any of these annotations:</p>
 
@@ -504,8 +504,8 @@ public class MySimpleIdGenerator {
 </pre>
 </div></div>
 
-<p>Groovy supports GStrings that is like a template where we can insert $ 
placeholders that will be evaluated by Groovy.</p>
-<h4 id="Bookcookbook-@Consume">@Consume</h4>
+<p>Groovy supports GStrings that is like a template where we can insert $ 
placeholders that will be evaluated by Groovy.</p></div></div>
+<div class="conf-macro output-block" data-hasbody="false" 
data-macro-name="include"><h4 id="Bookcookbook-@Consume">@Consume</h4>
 
 <p>To consume a message you use the <a shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Consume.html";>@Consume</a>
 annotation to mark a particular method of a bean as being a consumer method. 
The uri of the annotation defines the Camel <a shape="rect" 
href="endpoint.html">Endpoint</a> to consume from. </p>
 
@@ -658,8 +658,8 @@ Camel uses this algorithm to find the ge
 
 <p>Using the @Consume annotations are simpler when you are creating a simple 
route with a single well defined input URI. </p>
 
-<p>However if you require more complex routes or the same bean method needs to 
be invoked from many places then please use the routing <a shape="rect" 
href="dsl.html">DSL</a> as shown above.</p>
-There are two different ways to send messages to any Camel <a shape="rect" 
href="endpoint.html">Endpoint</a> from a POJO<h4 
id="Bookcookbook-@EndpointInject"><code>@EndpointInject</code></h4><p>To allow 
sending of messages from POJOs you can use the <a shape="rect" 
class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/EndpointInject.html";>@EndpointInject</a>
 annotation. This will inject a <a shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/ProducerTemplate.html";>ProducerTemplate</a>
 so that the bean can participate in message exchanges.</p><p>Example: send a 
message to the <strong><code>foo.bar</code></strong> ActiveMQ queue:</p><div 
class="code panel pdl conf-macro output-block" data-hasbody="true" 
data-macro-name="code" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
+<p>However if you require more complex routes or the same bean method needs to 
be invoked from many places then please use the routing <a shape="rect" 
href="dsl.html">DSL</a> as shown above.</p></div>
+<div class="conf-macro output-block" data-hasbody="false" 
data-macro-name="include">There are two different ways to send messages to any 
Camel <a shape="rect" href="endpoint.html">Endpoint</a> from a POJO<h4 
id="Bookcookbook-@EndpointInject"><code>@EndpointInject</code></h4><p>To allow 
sending of messages from POJOs you can use the <a shape="rect" 
class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/EndpointInject.html";>@EndpointInject</a>
 annotation. This will inject a <a shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/ProducerTemplate.html";>ProducerTemplate</a>
 so that the bean can participate in message exchanges.</p><p>Example: send a 
message to the <strong><code>foo.bar</code></strong> ActiveMQ queue:</p><div 
class="code panel pdl conf-macro output-block" data-hasbody="true" 
data-macro-name="code" style="border-width: 1px;"><div class="codeContent 
panelContent pdl
 ">
 <pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; 
gutter: false; theme: Default" data-theme="Default">public class Foo {
   @EndpointInject(uri="activemq:foo.bar")
   ProducerTemplate producer;
@@ -686,8 +686,8 @@ public class MyBean {
     }
 }
 </pre>
-</div></div><p>Here Camel will automatically inject a smart client side proxy 
at the&#160;<strong><code>@Produce</code></strong> annotation - an instance of 
the&#160;<strong><code>MyListener</code></strong> instance. When we invoke 
methods on this interface the method call is turned into an object and using 
the Camel <a shape="rect" href="spring-remoting.html">Spring Remoting</a> 
mechanism it is sent to the endpoint - in this case the <a shape="rect" 
href="activemq.html">ActiveMQ</a> endpoint to queue 
<strong><code>foo</code></strong>; then the caller blocks for a 
response.</p><p>If you want to make asynchronous message sends then use <a 
shape="rect" href="using-exchange-pattern-annotations.html">an @InOnly 
annotation on the injection point</a>.</p>
-<h2 id="Bookcookbook-@RecipientListAnnotation">@RecipientList Annotation</h2>
+</div></div><p>Here Camel will automatically inject a smart client side proxy 
at the&#160;<strong><code>@Produce</code></strong> annotation - an instance of 
the&#160;<strong><code>MyListener</code></strong> instance. When we invoke 
methods on this interface the method call is turned into an object and using 
the Camel <a shape="rect" href="spring-remoting.html">Spring Remoting</a> 
mechanism it is sent to the endpoint - in this case the <a shape="rect" 
href="activemq.html">ActiveMQ</a> endpoint to queue 
<strong><code>foo</code></strong>; then the caller blocks for a 
response.</p><p>If you want to make asynchronous message sends then use <a 
shape="rect" href="using-exchange-pattern-annotations.html">an @InOnly 
annotation on the injection point</a>.</p></div>
+<div class="conf-macro output-block" data-hasbody="false" 
data-macro-name="include"><h2 
id="Bookcookbook-@RecipientListAnnotation">@RecipientList Annotation</h2>
 
 <p>We support the use of @RecipientList on a bean method to easily create a 
dynamic <a shape="rect" href="recipient-list.html">Recipient List</a> using a 
Java method.</p>
 
@@ -788,8 +788,8 @@ public class MyRouteBuilder extends Rout
 
 
 <p>Notice how we are injecting some headers or expressions and using them to 
determine the recipients using <a shape="rect" 
href="recipient-list.html">Recipient List</a> EIP.<br clear="none">
-See the <a shape="rect" href="bean-integration.html">Bean Integration</a> for 
more details.</p>
-<h2 id="Bookcookbook-UsingExchangePatternAnnotations">Using Exchange Pattern 
Annotations</h2>
+See the <a shape="rect" href="bean-integration.html">Bean Integration</a> for 
more details.</p></div>
+<div class="conf-macro output-block" data-hasbody="false" 
data-macro-name="include"><h2 
id="Bookcookbook-UsingExchangePatternAnnotations">Using Exchange Pattern 
Annotations</h2>
 
 <p>When working with <a shape="rect" href="pojo-producing.html">POJO 
Producing</a> or <a shape="rect" href="spring-remoting.html">Spring 
Remoting</a> you invoke methods which typically by default are InOut for <a 
shape="rect" href="request-reply.html">Request Reply</a>. That is there is an 
In message and an Out for the result. Typically invoking this operation will be 
synchronous, the caller will block until the server returns a result.</p>
 
@@ -895,8 +895,8 @@ public interface Foo {
   String someInOutMethod(String input); 
 }
 </pre>
-</div></div>
-When writing software these days, its important to try and decouple as much 
middleware code from your business logic as possible. 
+</div></div></div>
+<div class="conf-macro output-block" data-hasbody="false" 
data-macro-name="include">When writing software these days, its important to 
try and decouple as much middleware code from your business logic as possible. 
 
 <p>This provides a number of benefits...</p>
 <ul><li>you can choose the right middleware solution for your deployment and 
switch at any time</li><li>you don't have to spend a large amount of time 
learning the specifics of any particular technology, whether its <a 
shape="rect" href="jms.html">JMS</a> or <a shape="rect" 
href="javaspace.html">JavaSpace</a> or <a shape="rect" 
href="hibernate.html">Hibernate</a> or <a shape="rect" href="jpa.html">JPA</a> 
or <a shape="rect" href="ibatis.html">iBatis</a> whatever</li></ul>
@@ -912,9 +912,9 @@ When writing software these days, its im
 
 <p>The best approach when using remoting is to use <a shape="rect" 
href="spring-remoting.html">Spring Remoting</a> which can then use any 
messaging or remoting technology under the covers. When using Camel's 
implementation you can then use any of the Camel <a shape="rect" 
href="components.html">Components</a> along with any of the <a shape="rect" 
href="enterprise-integration-patterns.html">Enterprise Integration 
Patterns</a>.</p>
 
-<p>Another approach is to bind Java beans to Camel endpoints via the <a 
shape="rect" href="bean-integration.html">Bean Integration</a>. For example 
using <a shape="rect" href="pojo-consuming.html">POJO Consuming</a> and <a 
shape="rect" href="pojo-producing.html">POJO Producing</a> you can avoid using 
any Camel APIs to decouple your code both from middleware APIs <em>and</em> 
Camel APIs! <img class="emoticon emoticon-smile" 
src="https://cwiki.apache.org/confluence/s/en_GB/7701/d7b403a44466e5e8970db7530201039d865e79e1/_/images/icons/emoticons/smile.svg";
 data-emoticon-name="smile" alt="(smile)"></p>
-<h2 id="Bookcookbook-Visualisation">Visualisation</h2><div 
class="confluence-information-macro confluence-information-macro-warning 
conf-macro output-block" data-hasbody="true" data-macro-name="warning"><span 
class="aui-icon aui-icon-small aui-iconfont-error 
confluence-information-macro-icon"> </span><div 
class="confluence-information-macro-body"><p>This functionality is deprecated 
and to be removed in future Camel 
releases.</p></div></div><p>&#160;</p><p>Camel supports the visualisation of 
your <a shape="rect" href="enterprise-integration-patterns.html">Enterprise 
Integration Patterns</a> using the <a shape="rect" class="external-link" 
href="http://graphviz.org"; rel="nofollow">GraphViz</a> DOT files which can 
either be rendered directly via a suitable GraphViz tool or turned into HTML, 
PNG or SVG files via the <a shape="rect" href="camel-maven-plugin.html">Camel 
Maven Plugin</a>.</p><p>Here is a <a shape="rect" class="external-link" 
href="http://activemq.apache.org/camel/maven/came
 l-spring/cameldoc/index.html">typical example</a> of the kind of thing we can 
generate</p><p><span class="confluence-embedded-file-wrapper"><img 
class="confluence-embedded-image" 
src="book-cookbook.data/org.apache.camel.example.docs.ContentBasedRouteRoute.png"
 
data-image-src="/confluence/download/attachments/64021/org.apache.camel.example.docs.ContentBasedRouteRoute.png?version=1&amp;modificationDate=1229506014000&amp;api=v2"
 data-unresolved-comment-count="0" data-linked-resource-id="9437" 
data-linked-resource-version="1" data-linked-resource-type="attachment" 
data-linked-resource-default-alias="org.apache.camel.example.docs.ContentBasedRouteRoute.png"
 data-base-url="https://cwiki.apache.org/confluence"; 
data-linked-resource-content-type="image/png" 
data-linked-resource-container-id="64021" 
data-linked-resource-container-version="18"></span></p><p>If you click on <a 
shape="rect" class="external-link" 
href="http://activemq.apache.org/camel/maven/examples/camel-example-docs/cameldoc/ma
 in/routes.html">the actual generated html</a>you will see that you can 
navigate from an EIP node to its pattern page, along with getting hover-over 
tool tips ec.</p><h3 id="Bookcookbook-Howtogenerate">How to generate</h3><p>See 
<a shape="rect" href="camel-dot-maven-goal.html">Camel Dot Maven Goal</a> or 
the other maven goals <a shape="rect" href="camel-maven-plugin.html">Camel 
Maven Plugin</a></p><h3 id="Bookcookbook-ForOSXusers">For OS X users</h3><p>If 
you are using OS X then you can open the DOT file using <a shape="rect" 
class="external-link" href="http://www.pixelglow.com/graphviz/"; 
rel="nofollow">graphviz</a> which will then automatically re-render if it 
changes, so you end up with a real time graphical representation of the topic 
and queue hierarchies!</p><p>Also if you want to edit the layout a little 
before adding it to a wiki to distribute to your team, open the DOT file with 
<a shape="rect" class="external-link" 
href="http://www.omnigroup.com/applications/omnigraffle/"; re
 l="nofollow">OmniGraffle</a> then just edit away <img class="emoticon 
emoticon-smile" 
src="https://cwiki.apache.org/confluence/s/en_GB/7701/d7b403a44466e5e8970db7530201039d865e79e1/_/images/icons/emoticons/smile.svg";
 data-emoticon-name="smile" alt="(smile)"></p>
-<h2 id="Bookcookbook-BusinessActivityMonitoring">Business Activity Monitoring 
</h2>
+<p>Another approach is to bind Java beans to Camel endpoints via the <a 
shape="rect" href="bean-integration.html">Bean Integration</a>. For example 
using <a shape="rect" href="pojo-consuming.html">POJO Consuming</a> and <a 
shape="rect" href="pojo-producing.html">POJO Producing</a> you can avoid using 
any Camel APIs to decouple your code both from middleware APIs <em>and</em> 
Camel APIs! <img class="emoticon emoticon-smile" 
src="https://cwiki.apache.org/confluence/s/en_GB/7701/d7b403a44466e5e8970db7530201039d865e79e1/_/images/icons/emoticons/smile.svg";
 data-emoticon-name="smile" alt="(smile)"></p></div>
+<div class="conf-macro output-block" data-hasbody="false" 
data-macro-name="include"><h2 
id="Bookcookbook-Visualisation">Visualisation</h2><div 
class="confluence-information-macro confluence-information-macro-warning 
conf-macro output-block" data-hasbody="true" data-macro-name="warning"><span 
class="aui-icon aui-icon-small aui-iconfont-error 
confluence-information-macro-icon"> </span><div 
class="confluence-information-macro-body"><p>This functionality is deprecated 
and to be removed in future Camel 
releases.</p></div></div><p>&#160;</p><p>Camel supports the visualisation of 
your <a shape="rect" href="enterprise-integration-patterns.html">Enterprise 
Integration Patterns</a> using the <a shape="rect" class="external-link" 
href="http://graphviz.org"; rel="nofollow">GraphViz</a> DOT files which can 
either be rendered directly via a suitable GraphViz tool or turned into HTML, 
PNG or SVG files via the <a shape="rect" href="camel-maven-plugin.html">Camel 
Maven Plugin</a>.</p><p>Here is a <a 
 shape="rect" class="external-link" 
href="http://activemq.apache.org/camel/maven/camel-spring/cameldoc/index.html";>typical
 example</a> of the kind of thing we can generate</p><p><span 
class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image" 
src="book-cookbook.data/org.apache.camel.example.docs.ContentBasedRouteRoute.png"
 
data-image-src="/confluence/download/attachments/64021/org.apache.camel.example.docs.ContentBasedRouteRoute.png?version=1&amp;modificationDate=1229506014000&amp;api=v2"
 data-unresolved-comment-count="0" data-linked-resource-id="9437" 
data-linked-resource-version="1" data-linked-resource-type="attachment" 
data-linked-resource-default-alias="org.apache.camel.example.docs.ContentBasedRouteRoute.png"
 data-base-url="https://cwiki.apache.org/confluence"; 
data-linked-resource-content-type="image/png" 
data-linked-resource-container-id="64021" 
data-linked-resource-container-version="18"></span></p><p>If you click on <a 
shape="rect" class="external-link" 
 
href="http://activemq.apache.org/camel/maven/examples/camel-example-docs/cameldoc/main/routes.html";>the
 actual generated html</a>you will see that you can navigate from an EIP node 
to its pattern page, along with getting hover-over tool tips ec.</p><h3 
id="Bookcookbook-Howtogenerate">How to generate</h3><p>See <a shape="rect" 
href="camel-dot-maven-goal.html">Camel Dot Maven Goal</a> or the other maven 
goals <a shape="rect" href="camel-maven-plugin.html">Camel Maven 
Plugin</a></p><h3 id="Bookcookbook-ForOSXusers">For OS X users</h3><p>If you 
are using OS X then you can open the DOT file using <a shape="rect" 
class="external-link" href="http://www.pixelglow.com/graphviz/"; 
rel="nofollow">graphviz</a> which will then automatically re-render if it 
changes, so you end up with a real time graphical representation of the topic 
and queue hierarchies!</p><p>Also if you want to edit the layout a little 
before adding it to a wiki to distribute to your team, open the DOT file with 
<a shape="rect
 " class="external-link" 
href="http://www.omnigroup.com/applications/omnigraffle/"; 
rel="nofollow">OmniGraffle</a> then just edit away <img class="emoticon 
emoticon-smile" 
src="https://cwiki.apache.org/confluence/s/en_GB/7701/d7b403a44466e5e8970db7530201039d865e79e1/_/images/icons/emoticons/smile.svg";
 data-emoticon-name="smile" alt="(smile)"></p></div>
+<div class="conf-macro output-block" data-hasbody="false" 
data-macro-name="include"><h2 
id="Bookcookbook-BusinessActivityMonitoring">Business Activity Monitoring </h2>
 
 <p>The <strong>Camel BAM</strong> module provides a Business Activity 
Monitoring (BAM) framework for testing business processes across multiple 
message exchanges on different <a shape="rect" 
href="endpoint.html">Endpoint</a> instances.</p>
 
@@ -940,15 +940,15 @@ When writing software these days, its im
 
 <h3 id="Bookcookbook-UseCases">Use Cases</h3>
 
-<p>In the world of finance, a common requirement is tracking trades. Often a 
trader will submit a Front Office Trade which then flows through the Middle 
Office and Back Office through various systems to settle the trade so that 
money is exchanged. You may wish to test that the front and back office trades 
match up within a certain time period; if they don't match or a back office 
trade does not arrive within a required amount of time, you might signal an 
alarm.</p>
-<h2 id="Bookcookbook-ExtractTransformLoad(ETL)">Extract Transform Load 
(ETL)</h2>
+<p>In the world of finance, a common requirement is tracking trades. Often a 
trader will submit a Front Office Trade which then flows through the Middle 
Office and Back Office through various systems to settle the trade so that 
money is exchanged. You may wish to test that the front and back office trades 
match up within a certain time period; if they don't match or a back office 
trade does not arrive within a required amount of time, you might signal an 
alarm.</p></div>
+<div class="conf-macro output-block" data-hasbody="false" 
data-macro-name="include"><h2 
id="Bookcookbook-ExtractTransformLoad(ETL)">Extract Transform Load (ETL)</h2>
 
 <p>The <a shape="rect" class="external-link" 
href="http://en.wikipedia.org/wiki/Extract,_transform,_load"; 
rel="nofollow">ETL</a> (Extract, Transform, Load) is a mechanism for loading 
data into systems or databases using some kind of <a shape="rect" 
href="data-format.html">Data Format</a> from a variety of sources; often files 
then using <a shape="rect" href="pipes-and-filters.html">Pipes and Filters</a>, 
<a shape="rect" href="message-translator.html">Message Translator</a> and 
possible other <a shape="rect" 
href="enterprise-integration-patterns.html">Enterprise Integration 
Patterns</a>.</p>
 
 <p>So you could query data from various Camel <a shape="rect" 
href="components.html">Components</a> such as <a shape="rect" 
href="file2.html">File</a>, <a shape="rect" href="http.html">HTTP</a> or <a 
shape="rect" href="jpa.html">JPA</a>, perform multiple patterns such as <a 
shape="rect" href="splitter.html">Splitter</a> or <a shape="rect" 
href="message-translator.html">Message Translator</a> then send the messages to 
some other <a shape="rect" href="component.html">Component</a>.</p>
 
-<p>To show how this all fits together, try the <a shape="rect" 
href="etl-example.html">ETL Example</a> </p>
-<h2 id="Bookcookbook-MockComponent">Mock Component</h2><p><parameter 
ac:name=""><a shape="rect" href="testing-summary-include.html">Testing Summary 
Include</a></parameter></p><p>The Mock component provides a powerful 
declarative testing mechanism, which is similar to <a shape="rect" 
class="external-link" href="http://www.jmock.org"; rel="nofollow">jMock</a><a 
shape="rect" class="external-link" href="http://jmock.org"; rel="nofollow"></a> 
in that it allows declarative expectations to be created on any Mock endpoint 
before a test begins. Then the test is run, which typically fires messages to 
one or more endpoints, and finally the expectations can be asserted in a test 
case to ensure the system worked as expected.</p><p>This allows you to test 
various things like:</p><ul><li>The correct number of messages are received on 
each endpoint,</li><li>The correct payloads are received, in the right 
order,</li><li>Messages arrive on an endpoint in order, using some <a 
shape="rect" href="expressi
 on.html">Expression</a> to create an order testing function,</li><li>Messages 
arrive match some kind of <a shape="rect" href="predicate.html">Predicate</a> 
such as that specific headers have certain values, or that parts of the 
messages match some predicate, such as by evaluating an <a shape="rect" 
href="xpath.html">XPath</a> or <a shape="rect" href="xquery.html">XQuery</a> <a 
shape="rect" 
href="expression.html">Expression</a>.</li></ul><p><strong>Note</strong> that 
there is also the <a shape="rect" href="test.html">Test endpoint</a> which is a 
Mock endpoint, but which uses a second endpoint to provide the list of expected 
message bodies and automatically sets up the Mock endpoint assertions. In other 
words, it's a Mock endpoint that automatically sets up its assertions from some 
sample messages in a <a shape="rect" href="file2.html">File</a> or <a 
shape="rect" href="jpa.html">database</a>, for example.</p><parameter 
ac:name="title">Mock endpoints keep received Exchanges in memory i
 ndefinitely</parameter><rich-text-body><p>Remember that Mock is designed for 
testing. When you add Mock endpoints to a route, each <a shape="rect" 
href="exchange.html">Exchange</a> sent to the endpoint will be stored (to allow 
for later validation) in memory until explicitly reset or the JVM is restarted. 
If you are sending high volume and/or large messages, this may cause excessive 
memory use. If your goal is to test deployable routes inline, consider using <a 
shape="rect" href="notifybuilder.html">NotifyBuilder</a> or <a shape="rect" 
href="advicewith.html">AdviceWith</a> in your tests instead of adding Mock 
endpoints to routes directly.</p><p>From Camel 2.10 onwards there are two new 
options <code>retainFirst</code>, and <code>retainLast</code> that can be used 
to limit the number of messages the Mock endpoints keep in 
memory.</p></rich-text-body><h3 id="Bookcookbook-URIformat">URI 
format</h3><plain-text-body>mock:someName[?options]
+<p>To show how this all fits together, try the <a shape="rect" 
href="etl-example.html">ETL Example</a> </p></div>
+<div class="conf-macro output-block" data-hasbody="false" 
data-macro-name="include"><h2 id="Bookcookbook-MockComponent">Mock 
Component</h2><p><parameter ac:name=""><a shape="rect" 
href="testing-summary-include.html">Testing Summary 
Include</a></parameter></p><p>The Mock component provides a powerful 
declarative testing mechanism, which is similar to <a shape="rect" 
class="external-link" href="http://www.jmock.org"; rel="nofollow">jMock</a><a 
shape="rect" class="external-link" href="http://jmock.org"; rel="nofollow"></a> 
in that it allows declarative expectations to be created on any Mock endpoint 
before a test begins. Then the test is run, which typically fires messages to 
one or more endpoints, and finally the expectations can be asserted in a test 
case to ensure the system worked as expected.</p><p>This allows you to test 
various things like:</p><ul><li>The correct number of messages are received on 
each endpoint,</li><li>The correct payloads are received, in the right 
order,</li><l
 i>Messages arrive on an endpoint in order, using some <a shape="rect" 
href="expression.html">Expression</a> to create an order testing 
function,</li><li>Messages arrive match some kind of <a shape="rect" 
href="predicate.html">Predicate</a> such as that specific headers have certain 
values, or that parts of the messages match some predicate, such as by 
evaluating an <a shape="rect" href="xpath.html">XPath</a> or <a shape="rect" 
href="xquery.html">XQuery</a> <a shape="rect" 
href="expression.html">Expression</a>.</li></ul><p><strong>Note</strong> that 
there is also the <a shape="rect" href="test.html">Test endpoint</a> which is a 
Mock endpoint, but which uses a second endpoint to provide the list of expected 
message bodies and automatically sets up the Mock endpoint assertions. In other 
words, it's a Mock endpoint that automatically sets up its assertions from some 
sample messages in a <a shape="rect" href="file2.html">File</a> or <a 
shape="rect" href="jpa.html">database</a>, for examp
 le.</p><parameter ac:name="title">Mock endpoints keep received Exchanges in 
memory indefinitely</parameter><rich-text-body><p>Remember that Mock is 
designed for testing. When you add Mock endpoints to a route, each <a 
shape="rect" href="exchange.html">Exchange</a> sent to the endpoint will be 
stored (to allow for later validation) in memory until explicitly reset or the 
JVM is restarted. If you are sending high volume and/or large messages, this 
may cause excessive memory use. If your goal is to test deployable routes 
inline, consider using <a shape="rect" 
href="notifybuilder.html">NotifyBuilder</a> or <a shape="rect" 
href="advicewith.html">AdviceWith</a> in your tests instead of adding Mock 
endpoints to routes directly.</p><p>From Camel 2.10 onwards there are two new 
options <code>retainFirst</code>, and <code>retainLast</code> that can be used 
to limit the number of messages the Mock endpoints keep in 
memory.</p></rich-text-body><h3 id="Bookcookbook-URIformat">URI format</h3><plai
 n-text-body>mock:someName[?options]
 </plain-text-body><p>Where <strong>someName</strong> can be any string that 
uniquely identifies the endpoint.</p><p>You can append query options to the URI 
in the following format, 
<code>?option=value&amp;option=value&amp;...</code></p><h3 
id="Bookcookbook-Options">Options</h3><parameter 
ac:name="class">confluenceTableSmall</parameter><rich-text-body><div 
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Option</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Default</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>reportGroup</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>A size to use a <a shape="rect" 
href="log.html">throughput logger</a> for reporting</p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceT
 d"><p><code>retainFirst</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>Camel 2.10:</strong> To only keep first X 
number of messages in memory.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>retainLast</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>Camel 2.10:</strong> To only keep last X number 
of messages in memory.</p></td></tr></tbody></table></div></rich-text-body><h3 
id="Bookcookbook-SimpleExample.1">Simple Example</h3><p>Here's a simple example 
of Mock endpoint in use. First, the endpoint is resolved on the context. Then 
we set an expectation, and then, after the test has run, we assert that our 
expectations have been met.</p><plain-text-body>MockEndpoint resultEndpoint = 
context.resolveEndpoint("mock:foo", MockEndpoint.class);
 
 resultEndpoint.expectedMessageCount(2);
@@ -986,9 +986,9 @@ resultEndpoint.assertIsSatisfied();
 </plain-text-body><p>You can also define this as that 2nd message (0 index 
based) should arrive no later than 0-2 seconds after the 
previous:</p><plain-text-body>mock.message(1).arrives().noLaterThan(2).seconds().afterPrevious();
 </plain-text-body><p>You can also use between to set a lower bound. For 
example suppose that it should be between 1-4 
seconds:</p><plain-text-body>mock.message(1).arrives().between(1, 
4).seconds().afterPrevious();
 </plain-text-body><p>You can also set the expectation on all messages, for 
example to say that the gap between them should be at most 1 
second:</p><plain-text-body>mock.allMessages().arrives().noLaterThan(1).seconds().beforeNext();
-</plain-text-body><parameter ac:name="title">time 
units</parameter><rich-text-body><p>In the example above we use 
<code>seconds</code> as the time unit, but Camel offers 
<code>milliseconds</code>, and <code>minutes</code> as 
well.</p></rich-text-body><p><parameter ac:name=""><a shape="rect" 
href="endpoint-see-also.html">Endpoint See Also</a></parameter></p><ul><li><a 
shape="rect" href="spring-testing.html">Spring Testing</a></li><li><a 
shape="rect" href="testing.html">Testing</a></li></ul>
-<h2 id="Bookcookbook-Testing">Testing</h2><p>Testing is a crucial activity in 
any piece of software development or integration. Typically Camel Riders use 
various different <a shape="rect" href="components.html">technologies</a> wired 
together in a variety of <a shape="rect" 
href="enterprise-integration-patterns.html">patterns</a> with different <a 
shape="rect" href="languages.html">expression languages</a> together with 
different forms of <a shape="rect" href="bean-integration.html">Bean 
Integration</a> and <a shape="rect" href="dependency-injection.html">Dependency 
Injection</a> so its very easy for things to go wrong! <img class="emoticon 
emoticon-smile" 
src="https://cwiki.apache.org/confluence/s/en_GB/7701/d7b403a44466e5e8970db7530201039d865e79e1/_/images/icons/emoticons/smile.svg";
 data-emoticon-name="smile" alt="(smile)"> . Testing is the crucial weapon to 
ensure that things work as you would expect.</p><p>Camel is a Java library so 
you can easily wire up tests in whatever unit
  testing framework you use (JUnit 3.x (deprecated), 4.x, or TestNG). However 
the Camel project has tried to make the testing of Camel as easy and powerful 
as possible so we have introduced the following features.</p><h3 
id="Bookcookbook-TestingMechanisms">Testing Mechanisms</h3><p>The following 
mechanisms are supported:</p><div class="table-wrap"><table 
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Component</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><a shape="rect" 
href="camel-test.html">Camel Test</a></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>camel-test</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Is a standalone Java library letting you 
easily create Camel test cases using a single Java class for all your 
configuration and routing wit
 hout using <a shape="rect" href="cdi.html">CDI</a>, <a shape="rect" 
href="spring.html">Spring</a> or <a shape="rect" href="guice.html">Guice</a> 
for <a shape="rect" href="dependency-injection.html">Dependency 
Injection</a>&#160;which does not require an in-depth knowledge of Spring + 
Spring Test or Guice. &#160;Supports JUnit 3.x (deprecated) and JUnit 4.x based 
tests.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><a 
shape="rect" href="cdi-testing.html">CDI Testing</a></td><td colspan="1" 
rowspan="1" class="confluenceTd"><code>camel-test-cdi</code></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>Provides a JUnit 4 runner that 
bootstraps a test environment using CDI so that you don't have to be familiar 
with any CDI testing frameworks and can concentrate on the testing logic of 
your Camel CDI applications. Testing frameworks like&#160;<a shape="rect" 
class="external-link" href="http://arquillian.org/"; 
rel="nofollow">Arquillian</a>&#160;or&#160;<a shape="re
 ct" class="external-link" href="https://ops4j1.jira.com/wiki/display/PAXEXAM4"; 
rel="nofollow">PAX Exam</a>, can be used for more advanced test cases, where 
you need to configure your system under test in a very fine-grained way or 
target specific CDI containers.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><a shape="rect" href="spring-testing.html">Spring 
Testing</a></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>camel-test-spring</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Supports JUnit 3.x (deprecated) or JUnit 
4.x based tests that bootstrap a test environment using Spring without needing 
to be familiar with Spring Test. The plain JUnit 3.x/4.x based tests work very 
similar to the test support classes in 
<strong><code>camel-test</code></strong>.</p><p>Also supports Spring Test based 
tests that use the declarative style of test configuration and injection common 
in Spring Test. The Spring Test based tests provide fe
 ature parity with the plain JUnit 3.x/4.x based testing 
approach.</p><p><strong>Note</strong>: 
<strong><code>camel-test-spring</code></strong> is a new component from 
<strong>Camel 2.10</strong>. For older Camel release use 
<strong><code>camel-test</code></strong> which has built-in <a shape="rect" 
href="spring-testing.html">Spring Testing</a>.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><a shape="rect" 
href="blueprint-testing.html">Blueprint Testing</a></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>camel-test-blueprint</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.10:</strong> 
Provides the ability to do unit testing on blueprint 
configurations</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><a shape="rect" href="guice.html">Guice</a></p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>camel-guice</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><spa
 n style="color: rgb(255,0,0);"><strong>Deprecated</strong></span></p><p>Uses 
<a shape="rect" href="guice.html">Guice</a> to dependency inject your test 
classes</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Camel TestNG</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>camel-testng</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><span style="color: 
rgb(255,0,0);"><strong>Deprecated</strong></span></p><p>Supports plain TestNG 
based tests&#160;with or without <a shape="rect" 
href="cdi.html">CDI</a>,&#160;<a shape="rect" 
href="spring.html">Spring</a>&#160;or&#160;<a shape="rect" 
href="guice.html">Guice</a>&#160;for&#160;<a shape="rect" 
href="dependency-injection.html">Dependency Injection</a>&#160;which does not 
require an in-depth knowledge of CDI, Spring + Spring Test or Guice. 
&#160;</p><p>From <strong>Camel 2.10</strong>: this component supports Spring 
Test&#160;based tests that use the declarative style of test configuration
  and injection common in Spring Test and described in more detail under <a 
shape="rect" href="spring-testing.html">Spring 
Testing</a>.</p></td></tr></tbody></table></div><p>In all approaches the test 
classes look pretty much the same in that they all reuse the <a shape="rect" 
href="bean-integration.html">Camel binding and injection 
annotations</a>.</p><h4 id="Bookcookbook-CamelTestExample">Camel Test 
Example</h4><p>Here is the <a shape="rect" href="camel-test.html">Camel 
Test</a> <a shape="rect" class="external-link" 
href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-test/src/test/java/org/apache/camel/test/patterns/FilterTest.java";>example</a>:<plain-text-body>{snippet:lang=java|id=example|url=camel/trunk/components/camel-test/src/test/java/org/apache/camel/test/patterns/FilterTest.java}</plain-text-body>Notice
 how it derives from the Camel helper class 
<strong><code>CamelTestSupport</code></strong> but has no CDI, Spring or Guice 
dependency injection configuration 
 but instead overrides the <strong><code>createRouteBuilder()</code></strong> 
method.</p><h4 id="Bookcookbook-CDITestExample">CDI Test Example</h4><p>Here is 
the <a shape="rect" href="cdi-testing.html">CDI Testing</a> <a shape="rect" 
class="external-link" 
href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-test-cdi/src/test/java/org/apache/camel/test/cdi/FilterTest.java";>example</a>:<plain-text-body>{snippet:lang=java|id=example|url=camel/trunk/components/camel-test-cdi/src/test/java/org/apache/camel/test/cdi/FilterTest.java}</plain-text-body>You
 can find more testing patterns illustrated in the 
<strong><code>camel-example-cdi-test</code></strong> example&#160;and the test 
classes that come with it.</p><h4 
id="Bookcookbook-SpringTestwithXMLConfigExample">Spring Test with XML Config 
Example</h4><p>Here is the <a shape="rect" href="spring-testing.html">Spring 
Testing</a> <a shape="rect" class="external-link" 
href="http://svn.apache.org/repos/asf/camel/trunk/components/ca
 
mel-spring/src/test/java/org/apache/camel/spring/patterns/FilterTest.java">example
 using XML 
Config</a>:<plain-text-body>{snippet:lang=java|id=example|url=camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/patterns/FilterTest.java}</plain-text-body>Notice
 that we use <strong><code>@DirtiesContext</code></strong> on the test methods 
to force <a shape="rect" href="spring-testing.html">Spring Testing</a> to 
automatically reload the <code><a shape="rect" 
href="camelcontext.html">CamelContext</a></code> after each test method - this 
ensures that the tests don't clash with each other, e.g., one test method 
sending to an endpoint that is then reused in another test method.</p><p>Also 
note the use of <strong><code>@ContextConfiguration</code></strong> to indicate 
that by default we should look for the <a shape="rect" class="external-link" 
href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/patterns/Filte
 rTest-context.xml"><code>FilterTest-context.xml</code> on the classpath</a> to 
configure the test case which looks like 
this:<plain-text-body>{snippet:lang=xml|id=example|url=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/patterns/FilterTest-context.xml}</plain-text-body></p><h4
 id="Bookcookbook-SpringTestwithJavaConfigExample">Spring Test with Java Config 
Example</h4><p>Here is the <a shape="rect" href="spring-testing.html">Spring 
Testing</a> <a shape="rect" class="external-link" 
href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/patterns/FilterTest.java";>example
 using Java Config</a>.</p><p>For more information see <a shape="rect" 
href="spring-java-config.html">Spring Java 
Config</a>.<plain-text-body>{snippet:lang=java|id=example|url=camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/patterns/FilterTest.java}</plain-text-bo
 dy>This is similar to the XML Config example above except that there is no XML 
file and instead the nested <strong><code>ContextConfig</code></strong> class 
does all of the configuration; so your entire test case is contained in a 
single Java class. We currently have to reference by class name this class in 
the <strong><code>@ContextConfiguration</code></strong> which is a bit ugly. 
Please vote for <a shape="rect" class="external-link" 
href="http://jira.springframework.org/browse/SJC-238"; 
rel="nofollow">SJC-238</a> to address this and make Spring Test work more 
cleanly with Spring JavaConfig.</p><p>Its totally optional but for 
the&#160;<strong><code>ContextConfig</code></strong> implementation we derive 
from <strong><code>SingleRouteCamelConfiguration</code></strong> which is a 
helper Spring Java Config class which will configure the 
<strong><code>CamelContext</code></strong> for us and then register the 
<strong><code>RouteBuilder</code></strong> we create.</p><p>Since <strong>Camel
  2.11.0</strong> you can use the 
<strong><code>CamelSpringJUnit4ClassRunner</code></strong> with 
<strong><code>CamelSpringDelegatingTestContextLoader</code></strong> like <a 
shape="rect" class="external-link" 
href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/CamelSpringDelegatingTestContextLoaderTest.java";>example
 using Java Config with 
<code>CamelSpringJUnit4ClassRunner</code></a>:<plain-text-body>{snippet:lang=java|id=example|url=camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/CamelSpringDelegatingTestContextLoaderTest.java}</plain-text-body></p><h4
 
id="Bookcookbook-SpringTestwithXMLConfigandDeclarativeConfigurationExample">Spring
 Test with XML Config and Declarative Configuration Example</h4><p>Here is a 
Camel test support enhanced&#160;<a shape="rect" 
href="spring-testing.html">Spring Testing</a>&#160;<a shape="rect" 
class="external-link" 
 
href="https://svn.apache.org/repos/asf/camel/trunk/components/camel-test-spring/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerPlainTest.java";>example
 using XML Config and pure Spring Test based configuration of the Camel 
Context</a>:<plain-text-body>{snippet:lang=java|id=e1|url=camel/trunk/components/camel-test-spring/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerPlainTest.java}</plain-text-body>Notice
 how a custom test runner is used with 
the&#160;<strong><code>@RunWith</code></strong>&#160;annotation to support the 
features of&#160;<strong><code>CamelTestSupport</code></strong>&#160;through 
annotations on the test class. See&#160;<a shape="rect" 
href="spring-testing.html">Spring Testing</a>&#160;for a list of annotations 
you can use in your tests.</p><h4 id="Bookcookbook-BlueprintTest">Blueprint 
Test</h4><p>Here is the <a shape="rect" href="blueprint-testing.html">Blueprint 
Testing</a> <a shape="rect" class="external-link" href="ht
 
tp://svn.apache.org/repos/asf/camel/trunk/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/DebugBlueprintTest.java">example
 using XML 
Config</a>:<plain-text-body>{snippet:lang=java|id=example|url=camel/trunk/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/DebugBlueprintTest.java}</plain-text-body>Also
 notice the use of <strong><code>getBlueprintDescriptors</code></strong> to 
indicate that by default we should look for the <a shape="rect" 
class="external-link" 
href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/camelContext.xml";><code>camelContext.xml</code>
 in the package</a> to configure the test case which looks like 
this:<plain-text-body>{snippet:lang=xml|id=example|url=camel/trunk/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/camelContext.xml}</plain-text-body></p><h3
 id="Bookcookbook-TestingEndpoints">Te
 sting Endpoints</h3><p>Camel provides a number of endpoints which can make 
testing easier.</p><div class="table-wrap"><table 
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><a shape="rect" 
href="dataset.html">DataSet</a></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>For load &amp; soak testing this endpoint provides a 
way to create huge numbers of messages for sending to <a shape="rect" 
href="components.html">Components</a> and asserting that they are consumed 
correctly</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><a shape="rect" href="mock.html">Mock</a></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>For testing routes and 
mediation rules using mocks and allowing assertions to be added to an 
endpoint</p></td></tr><tr><td colspan="1" rowspan="1" class
 ="confluenceTd"><p><a shape="rect" href="test.html">Test</a></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>Creates a <a shape="rect" 
href="mock.html">Mock</a> endpoint which expects to receive all the message 
bodies that could be polled from the given underlying 
endpoint</p></td></tr></tbody></table></div><p>The main endpoint is the <a 
shape="rect" href="mock.html">Mock</a> endpoint which allows expectations to be 
added to different endpoints; you can then run your tests and assert that your 
expectations are met at the end.</p><h3 
id="Bookcookbook-Stubbingoutphysicaltransporttechnologies">Stubbing out 
physical transport technologies</h3><p>If you wish to test out a route but want 
to avoid actually using a real physical transport (for example to unit test a 
transformation route rather than performing a full integration test) then the 
following endpoints can be useful.</p><div class="table-wrap"><table 
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class=
 "confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><a shape="rect" 
href="direct.html">Direct</a></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Direct invocation of the consumer from the producer so 
that single threaded (non-SEDA) in VM invocation is performed which can be 
useful to mock out physical transports</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><a shape="rect" 
href="seda.html">SEDA</a></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Delivers messages asynchronously to consumers via a <a 
shape="rect" class="external-link" 
href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/BlockingQueue.html";
 rel="nofollow">java.util.concurrent.BlockingQueue</a> which is good for 
testing asynchronous transports</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><a shape="rect" href="stub.html">Stub
 </a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Works like <a 
shape="rect" href="seda.html">SEDA</a> but does not validate the endpoint URI, 
which makes stubbing much easier.</p></td></tr></tbody></table></div><h3 
id="Bookcookbook-Testingexistingroutes">Testing existing routes</h3><p>Camel 
provides some features to aid during testing of existing routes where you 
cannot or will not use <a shape="rect" href="mock.html">Mock</a> etc. For 
example you may have a production ready route which you want to test with some 
3rd party API which sends messages into this route.</p><div 
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><a shape="rect" 
href="notifybuilder.html">NotifyBuilder</a></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Allows you to be notifi
 ed when a certain condition has occurred. For example when the route has 
completed five messages. You can build complex expressions to match your 
criteria when to be notified.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><a shape="rect" 
href="advicewith.html">AdviceWith</a></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Allows you to <strong>advice</strong> or 
<strong>enhance</strong> an existing route using a <a shape="rect" 
href="routebuilder.html">RouteBuilder</a> style. For example you can add 
interceptors to intercept sending outgoing messages to assert those messages 
are as expected.</p></td></tr></tbody></table></div>
-<h2 id="Bookcookbook-CamelTest">Camel Test</h2><p>As a simple alternative to 
using <a shape="rect" href="cdi-testing.html">CDI Testing</a>,&#160;<a 
shape="rect" href="spring-testing.html">Spring Testing</a> or <a shape="rect" 
href="guice.html">Guice</a> the <strong>camel-test</strong> module was 
introduced so you can perform powerful <a shape="rect" 
href="testing.html">Testing</a> of your <a shape="rect" 
href="enterprise-integration-patterns.html">Enterprise Integration Patterns</a> 
easily.</p><parameter ac:name="tile">JUnit or 
TestNG</parameter><rich-text-body><p>The 
<strong><code>camel-test</code></strong> JAR is using JUnit. There is an 
alternative <strong><code>camel-testng</code></strong> JAR (from <strong>Camel 
2.8</strong>) using the <a shape="rect" class="external-link" 
href="http://testng.org/doc/index.html"; rel="nofollow">TestNG</a> test 
framework.</p></rich-text-body><h3 id="Bookcookbook-Addingtoyourpom.xml">Adding 
to your&#160;<code>pom.xml</code></h3><p>To get started u
 sing Camel Test you will need to add an entry to your 
<strong><code>pom.xml</code></strong>:</p><h4 
id="Bookcookbook-JUnit">JUnit</h4><parameter 
ac:name="">xml</parameter><plain-text-body>&lt;dependency&gt;
+</plain-text-body><parameter ac:name="title">time 
units</parameter><rich-text-body><p>In the example above we use 
<code>seconds</code> as the time unit, but Camel offers 
<code>milliseconds</code>, and <code>minutes</code> as 
well.</p></rich-text-body><p><parameter ac:name=""><a shape="rect" 
href="endpoint-see-also.html">Endpoint See Also</a></parameter></p><ul><li><a 
shape="rect" href="spring-testing.html">Spring Testing</a></li><li><a 
shape="rect" href="testing.html">Testing</a></li></ul></div>
+<div class="conf-macro output-block" data-hasbody="false" 
data-macro-name="include"><h2 id="Bookcookbook-Testing">Testing</h2><p>Testing 
is a crucial activity in any piece of software development or integration. 
Typically Camel Riders use various different <a shape="rect" 
href="components.html">technologies</a> wired together in a variety of <a 
shape="rect" href="enterprise-integration-patterns.html">patterns</a> with 
different <a shape="rect" href="languages.html">expression languages</a> 
together with different forms of <a shape="rect" 
href="bean-integration.html">Bean Integration</a> and <a shape="rect" 
href="dependency-injection.html">Dependency Injection</a> so its very easy for 
things to go wrong! <img class="emoticon emoticon-smile" 
src="https://cwiki.apache.org/confluence/s/en_GB/7701/d7b403a44466e5e8970db7530201039d865e79e1/_/images/icons/emoticons/smile.svg";
 data-emoticon-name="smile" alt="(smile)"> . Testing is the crucial weapon to 
ensure that things work as you would ex
 pect.</p><p>Camel is a Java library so you can easily wire up tests in 
whatever unit testing framework you use (JUnit 3.x (deprecated), 4.x, or 
TestNG). However the Camel project has tried to make the testing of Camel as 
easy and powerful as possible so we have introduced the following 
features.</p><h3 id="Bookcookbook-TestingMechanisms">Testing 
Mechanisms</h3><p>The following mechanisms are supported:</p><div 
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Component</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><a shape="rect" 
href="camel-test.html">Camel Test</a></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>camel-test</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Is a standalone Java library letting you 
easily create C
 amel test cases using a single Java class for all your configuration and 
routing without using <a shape="rect" href="cdi.html">CDI</a>, <a shape="rect" 
href="spring.html">Spring</a> or <a shape="rect" href="guice.html">Guice</a> 
for <a shape="rect" href="dependency-injection.html">Dependency 
Injection</a>&#160;which does not require an in-depth knowledge of Spring + 
Spring Test or Guice. &#160;Supports JUnit 3.x (deprecated) and JUnit 4.x based 
tests.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><a 
shape="rect" href="cdi-testing.html">CDI Testing</a></td><td colspan="1" 
rowspan="1" class="confluenceTd"><code>camel-test-cdi</code></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>Provides a JUnit 4 runner that 
bootstraps a test environment using CDI so that you don't have to be familiar 
with any CDI testing frameworks and can concentrate on the testing logic of 
your Camel CDI applications. Testing frameworks like&#160;<a shape="rect" 
class="external-link" h
 ref="http://arquillian.org/"; rel="nofollow">Arquillian</a>&#160;or&#160;<a 
shape="rect" class="external-link" 
href="https://ops4j1.jira.com/wiki/display/PAXEXAM4"; rel="nofollow">PAX 
Exam</a>, can be used for more advanced test cases, where you need to configure 
your system under test in a very fine-grained way or target specific CDI 
containers.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><a shape="rect" href="spring-testing.html">Spring 
Testing</a></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>camel-test-spring</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Supports JUnit 3.x (deprecated) or JUnit 
4.x based tests that bootstrap a test environment using Spring without needing 
to be familiar with Spring Test. The plain JUnit 3.x/4.x based tests work very 
similar to the test support classes in 
<strong><code>camel-test</code></strong>.</p><p>Also supports Spring Test based 
tests that use the declarative style of test confi
 guration and injection common in Spring Test. The Spring Test based tests 
provide feature parity with the plain JUnit 3.x/4.x based testing 
approach.</p><p><strong>Note</strong>: 
<strong><code>camel-test-spring</code></strong> is a new component from 
<strong>Camel 2.10</strong>. For older Camel release use 
<strong><code>camel-test</code></strong> which has built-in <a shape="rect" 
href="spring-testing.html">Spring Testing</a>.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><a shape="rect" 
href="blueprint-testing.html">Blueprint Testing</a></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>camel-test-blueprint</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.10:</strong> 
Provides the ability to do unit testing on blueprint 
configurations</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><a shape="rect" href="guice.html">Guice</a></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code
 >camel-guice</code></p></td><td colspan="1" rowspan="1" 
 >class="confluenceTd"><p><span style="color: 
 >rgb(255,0,0);"><strong>Deprecated</strong></span></p><p>Uses <a shape="rect" 
 >href="guice.html">Guice</a> to dependency inject your test 
 >classes</p></td></tr><tr><td colspan="1" rowspan="1" 
 >class="confluenceTd"><p>Camel TestNG</p></td><td colspan="1" rowspan="1" 
 >class="confluenceTd"><p><code>camel-testng</code></p></td><td colspan="1" 
 >rowspan="1" class="confluenceTd"><p><span style="color: 
 >rgb(255,0,0);"><strong>Deprecated</strong></span></p><p>Supports plain TestNG 
 >based tests&#160;with or without <a shape="rect" 
 >href="cdi.html">CDI</a>,&#160;<a shape="rect" 
 >href="spring.html">Spring</a>&#160;or&#160;<a shape="rect" 
 >href="guice.html">Guice</a>&#160;for&#160;<a shape="rect" 
 >href="dependency-injection.html">Dependency Injection</a>&#160;which does not 
 >require an in-depth knowledge of CDI, Spring + Spring Test or Guice. 
 >&#160;</p><p>From <strong>Camel 2.10</strong>: this component suppor
 ts Spring Test&#160;based tests that use the declarative style of test 
configuration and injection common in Spring Test and described in more detail 
under <a shape="rect" href="spring-testing.html">Spring 
Testing</a>.</p></td></tr></tbody></table></div><p>In all approaches the test 
classes look pretty much the same in that they all reuse the <a shape="rect" 
href="bean-integration.html">Camel binding and injection 
annotations</a>.</p><h4 id="Bookcookbook-CamelTestExample">Camel Test 
Example</h4><p>Here is the <a shape="rect" href="camel-test.html">Camel 
Test</a> <a shape="rect" class="external-link" 
href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-test/src/test/java/org/apache/camel/test/patterns/FilterTest.java";>example</a>:<plain-text-body>{snippet:lang=java|id=example|url=camel/trunk/components/camel-test/src/test/java/org/apache/camel/test/patterns/FilterTest.java}</plain-text-body>Notice
 how it derives from the Camel helper class <strong><code>CamelTestSupport
 </code></strong> but has no CDI, Spring or Guice dependency injection 
configuration but instead overrides the 
<strong><code>createRouteBuilder()</code></strong> method.</p><h4 
id="Bookcookbook-CDITestExample">CDI Test Example</h4><p>Here is the <a 
shape="rect" href="cdi-testing.html">CDI Testing</a> <a shape="rect" 
class="external-link" 
href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-test-cdi/src/test/java/org/apache/camel/test/cdi/FilterTest.java";>example</a>:<plain-text-body>{snippet:lang=java|id=example|url=camel/trunk/components/camel-test-cdi/src/test/java/org/apache/camel/test/cdi/FilterTest.java}</plain-text-body>You
 can find more testing patterns illustrated in the 
<strong><code>camel-example-cdi-test</code></strong> example&#160;and the test 
classes that come with it.</p><h4 
id="Bookcookbook-SpringTestwithXMLConfigExample">Spring Test with XML Config 
Example</h4><p>Here is the <a shape="rect" href="spring-testing.html">Spring 
Testing</a> <a shape="rect" c
 lass="external-link" 
href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/patterns/FilterTest.java";>example
 using XML 
Config</a>:<plain-text-body>{snippet:lang=java|id=example|url=camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/patterns/FilterTest.java}</plain-text-body>Notice
 that we use <strong><code>@DirtiesContext</code></strong> on the test methods 
to force <a shape="rect" href="spring-testing.html">Spring Testing</a> to 
automatically reload the <code><a shape="rect" 
href="camelcontext.html">CamelContext</a></code> after each test method - this 
ensures that the tests don't clash with each other, e.g., one test method 
sending to an endpoint that is then reused in another test method.</p><p>Also 
note the use of <strong><code>@ContextConfiguration</code></strong> to indicate 
that by default we should look for the <a shape="rect" class="external-link" 
href="http://svn.apache.org/repos/asf/camel/tru
 
nk/components/camel-spring/src/test/resources/org/apache/camel/spring/patterns/FilterTest-context.xml"><code>FilterTest-context.xml</code>
 on the classpath</a> to configure the test case which looks like 
this:<plain-text-body>{snippet:lang=xml|id=example|url=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/patterns/FilterTest-context.xml}</plain-text-body></p><h4
 id="Bookcookbook-SpringTestwithJavaConfigExample">Spring Test with Java Config 
Example</h4><p>Here is the <a shape="rect" href="spring-testing.html">Spring 
Testing</a> <a shape="rect" class="external-link" 
href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/patterns/FilterTest.java";>example
 using Java Config</a>.</p><p>For more information see <a shape="rect" 
href="spring-java-config.html">Spring Java 
Config</a>.<plain-text-body>{snippet:lang=java|id=example|url=camel/trunk/components/camel-spring-javaconfig/src/t
 
est/java/org/apache/camel/spring/javaconfig/patterns/FilterTest.java}</plain-text-body>This
 is similar to the XML Config example above except that there is no XML file 
and instead the nested <strong><code>ContextConfig</code></strong> class does 
all of the configuration; so your entire test case is contained in a single 
Java class. We currently have to reference by class name this class in the 
<strong><code>@ContextConfiguration</code></strong> which is a bit ugly. Please 
vote for <a shape="rect" class="external-link" 
href="http://jira.springframework.org/browse/SJC-238"; 
rel="nofollow">SJC-238</a> to address this and make Spring Test work more 
cleanly with Spring JavaConfig.</p><p>Its totally optional but for 
the&#160;<strong><code>ContextConfig</code></strong> implementation we derive 
from <strong><code>SingleRouteCamelConfiguration</code></strong> which is a 
helper Spring Java Config class which will configure the 
<strong><code>CamelContext</code></strong> for us and then register
  the <strong><code>RouteBuilder</code></strong> we create.</p><p>Since 
<strong>Camel 2.11.0</strong> you can use the 
<strong><code>CamelSpringJUnit4ClassRunner</code></strong> with 
<strong><code>CamelSpringDelegatingTestContextLoader</code></strong> like <a 
shape="rect" class="external-link" 
href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/CamelSpringDelegatingTestContextLoaderTest.java";>example
 using Java Config with 
<code>CamelSpringJUnit4ClassRunner</code></a>:<plain-text-body>{snippet:lang=java|id=example|url=camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/CamelSpringDelegatingTestContextLoaderTest.java}</plain-text-body></p><h4
 
id="Bookcookbook-SpringTestwithXMLConfigandDeclarativeConfigurationExample">Spring
 Test with XML Config and Declarative Configuration Example</h4><p>Here is a 
Camel test support enhanced&#160;<a shape="rect" href=
 "spring-testing.html">Spring Testing</a>&#160;<a shape="rect" 
class="external-link" 
href="https://svn.apache.org/repos/asf/camel/trunk/components/camel-test-spring/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerPlainTest.java";>example
 using XML Config and pure Spring Test based configuration of the Camel 
Context</a>:<plain-text-body>{snippet:lang=java|id=e1|url=camel/trunk/components/camel-test-spring/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerPlainTest.java}</plain-text-body>Notice
 how a custom test runner is used with 
the&#160;<strong><code>@RunWith</code></strong>&#160;annotation to support the 
features of&#160;<strong><code>CamelTestSupport</code></strong>&#160;through 
annotations on the test class. See&#160;<a shape="rect" 
href="spring-testing.html">Spring Testing</a>&#160;for a list of annotations 
you can use in your tests.</p><h4 id="Bookcookbook-BlueprintTest">Blueprint 
Test</h4><p>Here is the <a shape="rect" href="blueprin
 t-testing.html">Blueprint Testing</a> <a shape="rect" class="external-link" 
href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/DebugBlueprintTest.java";>example
 using XML 
Config</a>:<plain-text-body>{snippet:lang=java|id=example|url=camel/trunk/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/DebugBlueprintTest.java}</plain-text-body>Also
 notice the use of <strong><code>getBlueprintDescriptors</code></strong> to 
indicate that by default we should look for the <a shape="rect" 
class="external-link" 
href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/camelContext.xml";><code>camelContext.xml</code>
 in the package</a> to configure the test case which looks like 
this:<plain-text-body>{snippet:lang=xml|id=example|url=camel/trunk/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/bluepr
 int/camelContext.xml}</plain-text-body></p><h3 
id="Bookcookbook-TestingEndpoints">Testing Endpoints</h3><p>Camel provides a 
number of endpoints which can make testing easier.</p><div 
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><a shape="rect" 
href="dataset.html">DataSet</a></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>For load &amp; soak testing this endpoint provides a 
way to create huge numbers of messages for sending to <a shape="rect" 
href="components.html">Components</a> and asserting that they are consumed 
correctly</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><a shape="rect" href="mock.html">Mock</a></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>For testing routes and 
mediation rules using mocks and allowing asse
 rtions to be added to an endpoint</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><a shape="rect" href="test.html">Test</a></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>Creates a <a shape="rect" 
href="mock.html">Mock</a> endpoint which expects to receive all the message 
bodies that could be polled from the given underlying 
endpoint</p></td></tr></tbody></table></div><p>The main endpoint is the <a 
shape="rect" href="mock.html">Mock</a> endpoint which allows expectations to be 
added to different endpoints; you can then run your tests and assert that your 
expectations are met at the end.</p><h3 
id="Bookcookbook-Stubbingoutphysicaltransporttechnologies">Stubbing out 
physical transport technologies</h3><p>If you wish to test out a route but want 
to avoid actually using a real physical transport (for example to unit test a 
transformation route rather than performing a full integration test) then the 
following endpoints can be useful.</p><div class="tabl
 e-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><a shape="rect" 
href="direct.html">Direct</a></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Direct invocation of the consumer from the producer so 
that single threaded (non-SEDA) in VM invocation is performed which can be 
useful to mock out physical transports</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><a shape="rect" 
href="seda.html">SEDA</a></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Delivers messages asynchronously to consumers via a <a 
shape="rect" class="external-link" 
href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/BlockingQueue.html";
 rel="nofollow">java.util.concurrent.BlockingQueue</a> which is good for 
testing asynchronous transports</p></td></tr><tr><td c
 olspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" 
href="stub.html">Stub</a></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Works like <a shape="rect" href="seda.html">SEDA</a> 
but does not validate the endpoint URI, which makes stubbing much 
easier.</p></td></tr></tbody></table></div><h3 
id="Bookcookbook-Testingexistingroutes">Testing existing routes</h3><p>Camel 
provides some features to aid during testing of existing routes where you 
cannot or will not use <a shape="rect" href="mock.html">Mock</a> etc. For 
example you may have a production ready route which you want to test with some 
3rd party API which sends messages into this route.</p><div 
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><a shape="rect" 
href="notifybuilder.html">NotifyBuilder</a>
 </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Allows you to be 
notified when a certain condition has occurred. For example when the route has 
completed five messages. You can build complex expressions to match your 
criteria when to be notified.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><a shape="rect" 
href="advicewith.html">AdviceWith</a></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Allows you to <strong>advice</strong> or 
<strong>enhance</strong> an existing route using a <a shape="rect" 
href="routebuilder.html">RouteBuilder</a> style. For example you can add 
interceptors to intercept sending outgoing messages to assert those messages 
are as expected.</p></td></tr></tbody></table></div></div>

[... 99 lines stripped ...]

Reply via email to