Modified: websites/production/camel/content/book-in-one-page.html
==============================================================================
--- websites/production/camel/content/book-in-one-page.html (original)
+++ websites/production/camel/content/book-in-one-page.html Wed Mar  9 15:22:14 
2016
@@ -2144,6 +2144,7 @@ resultEndpoint.assertIsSatisfied();
 ]]></script>
 </div></div><p>There are some examples of the Mock endpoint in use in the <a 
shape="rect" class="external-link" 
href="http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/";>camel-core
 processor tests</a>.</p><h3 
id="BookInOnePage-Mockingexistingendpoints">Mocking existing 
endpoints</h3><p><strong>Available as of Camel 2.7</strong></p><p>Camel now 
allows you to automatically mock existing endpoints in your Camel 
routes.</p><div class="confluence-information-macro 
confluence-information-macro-information"><p class="title">How it 
works</p><span class="aui-icon aui-icon-small aui-iconfont-info 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p><strong>Important:</strong> The 
endpoints are still in action. What happens differently is that a <a 
shape="rect" href="mock.html">Mock</a> endpoint is injected and receives the 
message first and then delegates the message to the target endpoint. You can 
view this as 
 a kind of intercept and delegate or endpoint 
listener.</p></div></div><p>Suppose you have the given route below:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeHeader 
panelHeader pdl" style="border-bottom-width: 1px;"><b>Route</b></div><div 
class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
+// tag::route[]
 @Override
 protected RouteBuilder createRouteBuilder() throws Exception {
     return new RouteBuilder() {
@@ -2155,9 +2156,11 @@ protected RouteBuilder createRouteBuilde
         }
     };
 }
+// end::route[]
 ]]></script>
 </div></div><p>You can then use the <code>adviceWith</code> feature in Camel 
to mock all the endpoints in a given route from your unit test, as shown 
below:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeHeader panelHeader pdl" style="border-bottom-width: 
1px;"><b>adviceWith mocking all endpoints</b></div><div class="codeContent 
panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
+// tag::e1[]
 public void testAdvisedMockEndpoints() throws Exception {
     // advice the first route using the inlined AdviceWith route builder
     // which has extended capabilities than the regular route builder
@@ -2188,12 +2191,14 @@ public void testAdvisedMockEndpoints() t
     assertNotNull(context.hasEndpoint(&quot;mock:direct:foo&quot;));
     assertNotNull(context.hasEndpoint(&quot;mock:log:foo&quot;));
 }
+// end::e1[]
 ]]></script>
 </div></div><p>Notice that the mock endpoints is given the uri 
<code>mock:&lt;endpoint&gt;</code>, for example <code>mock:direct:foo</code>. 
Camel logs at <code>INFO</code> level the endpoints being mocked:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[INFO  Adviced endpoint [direct://foo] with 
mock endpoint [mock:direct:foo]
 ]]></script>
 </div></div><div class="confluence-information-macro 
confluence-information-macro-information"><p class="title">Mocked endpoints are 
without parameters</p><span class="aui-icon aui-icon-small aui-iconfont-info 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>Endpoints which are mocked will 
have their parameters stripped off. For example the endpoint 
"log:foo?showAll=true" will be mocked to the following endpoint "mock:log:foo". 
Notice the parameters have been removed.</p></div></div><p>Its also possible to 
only mock certain endpoints using a pattern. For example to mock all 
<code>log</code> endpoints you do as shown:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeHeader panelHeader pdl" 
style="border-bottom-width: 1px;"><b>adviceWith mocking only log endpoints 
using a pattern</b></div><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
+// tag::e2[]
 public void testAdvisedMockEndpointsWithPattern() throws Exception {
     // advice the first route using the inlined AdviceWith route builder
     // which has extended capabilities than the regular route builder
@@ -2224,9 +2229,11 @@ public void testAdvisedMockEndpointsWith
     assertNull(context.hasEndpoint(&quot;mock:direct:start&quot;));
     assertNull(context.hasEndpoint(&quot;mock:direct:foo&quot;));
 }
+// end::e2[]
 ]]></script>
 </div></div><p>The pattern supported can be a wildcard or a regular 
expression. See more details about this at <a shape="rect" 
href="intercept.html">Intercept</a> as its the same matching function used by 
Camel.</p><div class="confluence-information-macro 
confluence-information-macro-information"><span class="aui-icon aui-icon-small 
aui-iconfont-info confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>Mind that mocking endpoints causes 
the messages to be copied when they arrive on the mock.<br clear="none"> That 
means Camel will use more memory. This may not be suitable when you send in a 
lot of messages.</p></div></div><h4 
id="BookInOnePage-Mockingexistingendpointsusingthecamel-testcomponent">Mocking 
existing endpoints using the <code>camel-test</code> component</h4><p>Instead 
of using the <code>adviceWith</code> to instruct Camel to mock endpoints, you 
can easily enable this behavior when using the <code>camel-test</code> Test 
Kit.<br clear=
 "none"> The same route can be tested as follows. Notice that we return 
<code>"*"</code> from the <code>isMockEndpoints</code> method, which tells 
Camel to mock all endpoints.<br clear="none"> If you only want to mock all 
<code>log</code> endpoints you can return <code>"log*"</code> instead.</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeHeader 
panelHeader pdl" style="border-bottom-width: 1px;"><b>isMockEndpoints using 
camel-test kit</b></div><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
+// tag::e1[]
 public class IsMockEndpointsJUnit4Test extends CamelTestSupport {
 
     @Override
@@ -2271,9 +2278,11 @@ public class IsMockEndpointsJUnit4Test e
         };
     }
 }
+// end::e1[]
 ]]></script>
 </div></div><h4 id="BookInOnePage-MockingexistingendpointswithXMLDSL">Mocking 
existing endpoints with XML DSL</h4><p>If you do not use the 
<code>camel-test</code> component for unit testing (as shown above) you can use 
a different approach when using XML files for routes.<br clear="none"> The 
solution is to create a new XML file used by the unit test and then include the 
intended XML file which has the route you want to test.</p><p>Suppose we have 
the route in the <code>camel-route.xml</code> file:</p><div class="code panel 
pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" 
style="border-bottom-width: 1px;"><b>camel-route.xml</b></div><div 
class="codeContent panelContent pdl">
 <script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
+&lt;!-- tag::e1[] --&gt;
 &lt;!-- this camel route is in the camel-route.xml file --&gt;
 &lt;camelContext xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
 
@@ -2292,14 +2301,17 @@ public class IsMockEndpointsJUnit4Test e
     &lt;/route&gt;
 
 &lt;/camelContext&gt;
+&lt;!-- end::e1[] --&gt;
 ]]></script>
 </div></div><p>Then we create a new XML file as follows, where we include the 
<code>camel-route.xml</code> file and define a spring bean with the class 
<code>org.apache.camel.impl.InterceptSendToMockEndpointStrategy</code> which 
tells Camel to mock all endpoints:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeHeader panelHeader pdl" 
style="border-bottom-width: 1px;"><b>test-camel-route.xml</b></div><div 
class="codeContent panelContent pdl">
 <script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
+&lt;!-- tag::e1[] --&gt;
 &lt;!-- the Camel route is defined in another XML file --&gt;
 &lt;import resource=&quot;camel-route.xml&quot;/&gt;
 
 &lt;!-- bean which enables mocking all endpoints --&gt;
 &lt;bean id=&quot;mockAllEndpoints&quot; 
class=&quot;org.apache.camel.impl.InterceptSendToMockEndpointStrategy&quot;/&gt;
+&lt;!-- end::e1[] --&gt;
 ]]></script>
 </div></div><p>Then in your unit test you load the new XML file 
(<code>test-camel-route.xml</code>) instead of 
<code>camel-route.xml</code>.</p><p>To only mock all <a shape="rect" 
href="log.html">Log</a> endpoints you can define the pattern in the constructor 
for the bean:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
 <script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;bean id=&quot;mockAllEndpoints&quot; 
class=&quot;org.apache.camel.impl.InterceptSendToMockEndpointStrategy&quot;&gt;
@@ -2308,6 +2320,7 @@ public class IsMockEndpointsJUnit4Test e
 ]]></script>
 </div></div><h4 
id="BookInOnePage-Mockingendpointsandskipsendingtooriginalendpoint">Mocking 
endpoints and skip sending to original endpoint</h4><p><strong>Available as of 
Camel 2.10</strong></p><p>Sometimes you want to easily mock and skip sending to 
a certain endpoints. So the message is detoured and send to the mock endpoint 
only. From Camel 2.10 onwards you can now use the 
<code>mockEndpointsAndSkip</code> method using <a shape="rect" 
href="advicewith.html">AdviceWith</a> or the <a shape="rect" class="unresolved" 
href="#">Test Kit</a>. The example below will skip sending to the two endpoints 
<code>"direct:foo"</code>, and <code>"direct:bar"</code>.</p><div class="code 
panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" 
style="border-bottom-width: 1px;"><b>adviceWith mock and skip sending to 
endpoints</b></div><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
+// tag::e1[]
 public void testAdvisedMockEndpointsWithSkip() throws Exception {
     // advice the first route using the inlined AdviceWith route builder
     // which has extended capabilities than the regular route builder
@@ -2331,9 +2344,11 @@ public void testAdvisedMockEndpointsWith
     SedaEndpoint seda = context.getEndpoint(&quot;seda:foo&quot;, 
SedaEndpoint.class);
     assertEquals(0, seda.getCurrentQueueSize());
 }
+// end::e1[]
 ]]></script>
 </div></div><p>The same example using the <a shape="rect" 
href="testing.html">Test Kit</a></p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeHeader panelHeader pdl" 
style="border-bottom-width: 1px;"><b>isMockEndpointsAndSkip using camel-test 
kit</b></div><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
+// tag::e1[]
 public class IsMockEndpointsAndSkipJUnit4Test extends CamelTestSupport {
 
     @Override
@@ -2370,6 +2385,7 @@ public class IsMockEndpointsAndSkipJUnit
         };
     }
 }
+// end::e1[]
 ]]></script>
 </div></div><h3 id="BookInOnePage-Limitingthenumberofmessagestokeep">Limiting 
the number of messages to keep</h3><p><strong>Available as of Camel 
2.10</strong></p><p>The <a shape="rect" href="mock.html">Mock</a> endpoints 
will by default keep a copy of every <a shape="rect" 
href="exchange.html">Exchange</a> that it received. So if you test with a lot 
of messages, then it will consume memory.<br clear="none"> From Camel 2.10 
onwards we have introduced two options <code>retainFirst</code> and 
<code>retainLast</code> that can be used to specify to only keep N'th of the 
first and/or last <a shape="rect" href="exchange.html">Exchange</a>s.</p><p>For 
example in the code below, we only want to retain a copy of the first 5 and 
last 5 <a shape="rect" href="exchange.html">Exchange</a>s the mock 
receives.</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[  MockEndpoint mock = 
getMockEndpoint(&quot;mock:data&quot;);
@@ -3742,11 +3758,11 @@ The tutorial has been designed in two pa
 While not actual tutorials you might find working through the source of the 
various <a shape="rect" href="examples.html">Examples</a> useful.</li></ul>
 
 <h2 id="BookInOnePage-TutorialonSpringRemotingwithJMS">Tutorial on Spring 
Remoting with JMS</h2><p>&#160;</p><div class="confluence-information-macro 
confluence-information-macro-information"><p class="title">Thanks</p><span 
class="aui-icon aui-icon-small aui-iconfont-info 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>This tutorial was kindly donated 
to Apache Camel by Martin Gilday.</p></div></div><h2 
id="BookInOnePage-Preface">Preface</h2><p>This tutorial aims to guide the 
reader through the stages of creating a project which uses Camel to facilitate 
the routing of messages from a JMS queue to a <a shape="rect" 
class="external-link" href="http://www.springramework.org"; 
rel="nofollow">Spring</a> service. The route works in a synchronous fashion 
returning a response to the client.</p><p><style type="text/css">/*<![CDATA[*/
-div.rbtoc1457266670132 {padding: 0px;}
-div.rbtoc1457266670132 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1457266670132 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1457536774712 {padding: 0px;}
+div.rbtoc1457536774712 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1457536774712 li {margin-left: 0px;padding-left: 0px;}
 
-/*]]>*/</style></p><div class="toc-macro rbtoc1457266670132">
+/*]]>*/</style></p><div class="toc-macro rbtoc1457536774712">
 <ul class="toc-indentation"><li><a shape="rect" 
href="#BookInOnePage-TutorialonSpringRemotingwithJMS">Tutorial on Spring 
Remoting with JMS</a></li><li><a shape="rect" 
href="#BookInOnePage-Preface">Preface</a></li><li><a shape="rect" 
href="#BookInOnePage-Prerequisites">Prerequisites</a></li><li><a shape="rect" 
href="#BookInOnePage-Distribution">Distribution</a></li><li><a shape="rect" 
href="#BookInOnePage-About">About</a></li><li><a shape="rect" 
href="#BookInOnePage-CreatetheCamelProject">Create the Camel Project</a>
 <ul class="toc-indentation"><li><a shape="rect" 
href="#BookInOnePage-UpdatethePOMwithDependencies">Update the POM with 
Dependencies</a></li></ul>
 </li><li><a shape="rect" href="#BookInOnePage-WritingtheServer">Writing the 
Server</a>
@@ -5861,11 +5877,11 @@ So we completed the last piece in the pi
 <p>This example has been removed from <strong>Camel 2.9</strong> onwards. 
Apache Axis 1.4 is a very old and unsupported framework. We encourage users to 
use <a shape="rect" href="cxf.html">CXF</a> instead of Axis.</p></div></div>
 
 <style type="text/css">/*<![CDATA[*/
-div.rbtoc1457266670560 {padding: 0px;}
-div.rbtoc1457266670560 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1457266670560 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1457536776170 {padding: 0px;}
+div.rbtoc1457536776170 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1457536776170 li {margin-left: 0px;padding-left: 0px;}
 
-/*]]>*/</style><div class="toc-macro rbtoc1457266670560">
+/*]]>*/</style><div class="toc-macro rbtoc1457536776170">
 <ul class="toc-indentation"><li><a shape="rect" 
href="#BookInOnePage-TutorialusingAxis1.4withApacheCamel">Tutorial using Axis 
1.4 with Apache Camel</a>
 <ul class="toc-indentation"><li><a shape="rect" 
href="#BookInOnePage-Prerequisites">Prerequisites</a></li><li><a shape="rect" 
href="#BookInOnePage-Distribution">Distribution</a></li><li><a shape="rect" 
href="#BookInOnePage-Introduction">Introduction</a></li><li><a shape="rect" 
href="#BookInOnePage-SettinguptheprojecttorunAxis">Setting up the project to 
run Axis</a>
 <ul class="toc-indentation"><li><a shape="rect" 
href="#BookInOnePage-Maven2">Maven 2</a></li><li><a shape="rect" 
href="#BookInOnePage-wsdl">wsdl</a></li><li><a shape="rect" 
href="#BookInOnePage-ConfiguringAxis">Configuring Axis</a></li><li><a 
shape="rect" href="#BookInOnePage-RunningtheExample">Running the 
Example</a></li></ul>
@@ -17320,11 +17336,11 @@ template.send(&quot;direct:alias-verify&
 ]]></script>
 </div></div><p></p><h3 id="BookInOnePage-SeeAlso.28">See Also</h3>
 <ul><li><a shape="rect" href="configuring-camel.html">Configuring 
Camel</a></li><li><a shape="rect" 
href="component.html">Component</a></li><li><a shape="rect" 
href="endpoint.html">Endpoint</a></li><li><a shape="rect" 
href="getting-started.html">Getting Started</a></li></ul><ul><li><a 
shape="rect" href="crypto.html">Crypto</a> Crypto is also available as a <a 
shape="rect" href="data-format.html">Data Format</a></li></ul> <h2 
id="BookInOnePage-CXFComponent">CXF Component</h2><div 
class="confluence-information-macro confluence-information-macro-note"><span 
class="aui-icon aui-icon-small aui-iconfont-warning 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>When using CXF as a consumer, the 
<a shape="rect" href="cxf-bean-component.html">CXF Bean Component</a> allows 
you to factor out how message payloads are received from their processing as a 
RESTful or SOAP web service. This has the potential of using a multitude of 
transports to consume web 
 services. The bean component's configuration is also simpler and provides the 
fastest method to implement web services using Camel and 
CXF.</p></div></div><div class="confluence-information-macro 
confluence-information-macro-tip"><span class="aui-icon aui-icon-small 
aui-iconfont-approve confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>When using CXF in streaming modes 
(see DataFormat option), then also read about <a shape="rect" 
href="stream-caching.html">Stream caching</a>.</p></div></div><p>The 
<strong>cxf:</strong> component provides integration with <a shape="rect" 
href="http://cxf.apache.org";>Apache CXF</a> for connecting to JAX-WS services 
hosted in CXF.</p><p><style type="text/css">/*<![CDATA[*/
-div.rbtoc1457266673441 {padding: 0px;}
-div.rbtoc1457266673441 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1457266673441 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1457536830281 {padding: 0px;}
+div.rbtoc1457536830281 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1457536830281 li {margin-left: 0px;padding-left: 0px;}
 
-/*]]>*/</style></p><div class="toc-macro rbtoc1457266673441">
+/*]]>*/</style></p><div class="toc-macro rbtoc1457536830281">
 <ul class="toc-indentation"><li><a shape="rect" 
href="#BookInOnePage-CXFComponent">CXF Component</a>
 <ul class="toc-indentation"><li><a shape="rect" 
href="#BookInOnePage-URIformat">URI format</a></li><li><a shape="rect" 
href="#BookInOnePage-Options">Options</a>
 <ul class="toc-indentation"><li><a shape="rect" 
href="#BookInOnePage-Thedescriptionsofthedataformats">The descriptions of the 
dataformats</a>
@@ -23069,6 +23085,7 @@ resultEndpoint.assertIsSatisfied();
 ]]></script>
 </div></div><p>There are some examples of the Mock endpoint in use in the <a 
shape="rect" class="external-link" 
href="http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/";>camel-core
 processor tests</a>.</p><h3 
id="BookInOnePage-Mockingexistingendpoints.1">Mocking existing 
endpoints</h3><p><strong>Available as of Camel 2.7</strong></p><p>Camel now 
allows you to automatically mock existing endpoints in your Camel 
routes.</p><div class="confluence-information-macro 
confluence-information-macro-information"><p class="title">How it 
works</p><span class="aui-icon aui-icon-small aui-iconfont-info 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p><strong>Important:</strong> The 
endpoints are still in action. What happens differently is that a <a 
shape="rect" href="mock.html">Mock</a> endpoint is injected and receives the 
message first and then delegates the message to the target endpoint. You can 
view this a
 s a kind of intercept and delegate or endpoint 
listener.</p></div></div><p>Suppose you have the given route below:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeHeader 
panelHeader pdl" style="border-bottom-width: 1px;"><b>Route</b></div><div 
class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
+// tag::route[]
 @Override
 protected RouteBuilder createRouteBuilder() throws Exception {
     return new RouteBuilder() {
@@ -23080,9 +23097,11 @@ protected RouteBuilder createRouteBuilde
         }
     };
 }
+// end::route[]
 ]]></script>
 </div></div><p>You can then use the <code>adviceWith</code> feature in Camel 
to mock all the endpoints in a given route from your unit test, as shown 
below:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeHeader panelHeader pdl" style="border-bottom-width: 
1px;"><b>adviceWith mocking all endpoints</b></div><div class="codeContent 
panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
+// tag::e1[]
 public void testAdvisedMockEndpoints() throws Exception {
     // advice the first route using the inlined AdviceWith route builder
     // which has extended capabilities than the regular route builder
@@ -23113,12 +23132,14 @@ public void testAdvisedMockEndpoints() t
     assertNotNull(context.hasEndpoint(&quot;mock:direct:foo&quot;));
     assertNotNull(context.hasEndpoint(&quot;mock:log:foo&quot;));
 }
+// end::e1[]
 ]]></script>
 </div></div><p>Notice that the mock endpoints is given the uri 
<code>mock:&lt;endpoint&gt;</code>, for example <code>mock:direct:foo</code>. 
Camel logs at <code>INFO</code> level the endpoints being mocked:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[INFO  Adviced endpoint [direct://foo] with 
mock endpoint [mock:direct:foo]
 ]]></script>
 </div></div><div class="confluence-information-macro 
confluence-information-macro-information"><p class="title">Mocked endpoints are 
without parameters</p><span class="aui-icon aui-icon-small aui-iconfont-info 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>Endpoints which are mocked will 
have their parameters stripped off. For example the endpoint 
"log:foo?showAll=true" will be mocked to the following endpoint "mock:log:foo". 
Notice the parameters have been removed.</p></div></div><p>Its also possible to 
only mock certain endpoints using a pattern. For example to mock all 
<code>log</code> endpoints you do as shown:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeHeader panelHeader pdl" 
style="border-bottom-width: 1px;"><b>adviceWith mocking only log endpoints 
using a pattern</b></div><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
+// tag::e2[]
 public void testAdvisedMockEndpointsWithPattern() throws Exception {
     // advice the first route using the inlined AdviceWith route builder
     // which has extended capabilities than the regular route builder
@@ -23149,9 +23170,11 @@ public void testAdvisedMockEndpointsWith
     assertNull(context.hasEndpoint(&quot;mock:direct:start&quot;));
     assertNull(context.hasEndpoint(&quot;mock:direct:foo&quot;));
 }
+// end::e2[]
 ]]></script>
 </div></div><p>The pattern supported can be a wildcard or a regular 
expression. See more details about this at <a shape="rect" 
href="intercept.html">Intercept</a> as its the same matching function used by 
Camel.</p><div class="confluence-information-macro 
confluence-information-macro-information"><span class="aui-icon aui-icon-small 
aui-iconfont-info confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>Mind that mocking endpoints causes 
the messages to be copied when they arrive on the mock.<br clear="none"> That 
means Camel will use more memory. This may not be suitable when you send in a 
lot of messages.</p></div></div><h4 
id="BookInOnePage-Mockingexistingendpointsusingthecamel-testcomponent.1">Mocking
 existing endpoints using the <code>camel-test</code> component</h4><p>Instead 
of using the <code>adviceWith</code> to instruct Camel to mock endpoints, you 
can easily enable this behavior when using the <code>camel-test</code> Test 
Kit.<br clea
 r="none"> The same route can be tested as follows. Notice that we return 
<code>"*"</code> from the <code>isMockEndpoints</code> method, which tells 
Camel to mock all endpoints.<br clear="none"> If you only want to mock all 
<code>log</code> endpoints you can return <code>"log*"</code> instead.</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeHeader 
panelHeader pdl" style="border-bottom-width: 1px;"><b>isMockEndpoints using 
camel-test kit</b></div><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
+// tag::e1[]
 public class IsMockEndpointsJUnit4Test extends CamelTestSupport {
 
     @Override
@@ -23196,9 +23219,11 @@ public class IsMockEndpointsJUnit4Test e
         };
     }
 }
+// end::e1[]
 ]]></script>
 </div></div><h4 
id="BookInOnePage-MockingexistingendpointswithXMLDSL.1">Mocking existing 
endpoints with XML DSL</h4><p>If you do not use the <code>camel-test</code> 
component for unit testing (as shown above) you can use a different approach 
when using XML files for routes.<br clear="none"> The solution is to create a 
new XML file used by the unit test and then include the intended XML file which 
has the route you want to test.</p><p>Suppose we have the route in the 
<code>camel-route.xml</code> file:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeHeader panelHeader pdl" 
style="border-bottom-width: 1px;"><b>camel-route.xml</b></div><div 
class="codeContent panelContent pdl">
 <script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
+&lt;!-- tag::e1[] --&gt;
 &lt;!-- this camel route is in the camel-route.xml file --&gt;
 &lt;camelContext xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
 
@@ -23217,14 +23242,17 @@ public class IsMockEndpointsJUnit4Test e
     &lt;/route&gt;
 
 &lt;/camelContext&gt;
+&lt;!-- end::e1[] --&gt;
 ]]></script>
 </div></div><p>Then we create a new XML file as follows, where we include the 
<code>camel-route.xml</code> file and define a spring bean with the class 
<code>org.apache.camel.impl.InterceptSendToMockEndpointStrategy</code> which 
tells Camel to mock all endpoints:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeHeader panelHeader pdl" 
style="border-bottom-width: 1px;"><b>test-camel-route.xml</b></div><div 
class="codeContent panelContent pdl">
 <script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
+&lt;!-- tag::e1[] --&gt;
 &lt;!-- the Camel route is defined in another XML file --&gt;
 &lt;import resource=&quot;camel-route.xml&quot;/&gt;
 
 &lt;!-- bean which enables mocking all endpoints --&gt;
 &lt;bean id=&quot;mockAllEndpoints&quot; 
class=&quot;org.apache.camel.impl.InterceptSendToMockEndpointStrategy&quot;/&gt;
+&lt;!-- end::e1[] --&gt;
 ]]></script>
 </div></div><p>Then in your unit test you load the new XML file 
(<code>test-camel-route.xml</code>) instead of 
<code>camel-route.xml</code>.</p><p>To only mock all <a shape="rect" 
href="log.html">Log</a> endpoints you can define the pattern in the constructor 
for the bean:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
 <script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;bean id=&quot;mockAllEndpoints&quot; 
class=&quot;org.apache.camel.impl.InterceptSendToMockEndpointStrategy&quot;&gt;
@@ -23233,6 +23261,7 @@ public class IsMockEndpointsJUnit4Test e
 ]]></script>
 </div></div><h4 
id="BookInOnePage-Mockingendpointsandskipsendingtooriginalendpoint.1">Mocking 
endpoints and skip sending to original endpoint</h4><p><strong>Available as of 
Camel 2.10</strong></p><p>Sometimes you want to easily mock and skip sending to 
a certain endpoints. So the message is detoured and send to the mock endpoint 
only. From Camel 2.10 onwards you can now use the 
<code>mockEndpointsAndSkip</code> method using <a shape="rect" 
href="advicewith.html">AdviceWith</a> or the <a shape="rect" class="unresolved" 
href="#">Test Kit</a>. The example below will skip sending to the two endpoints 
<code>"direct:foo"</code>, and <code>"direct:bar"</code>.</p><div class="code 
panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" 
style="border-bottom-width: 1px;"><b>adviceWith mock and skip sending to 
endpoints</b></div><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
+// tag::e1[]
 public void testAdvisedMockEndpointsWithSkip() throws Exception {
     // advice the first route using the inlined AdviceWith route builder
     // which has extended capabilities than the regular route builder
@@ -23256,9 +23285,11 @@ public void testAdvisedMockEndpointsWith
     SedaEndpoint seda = context.getEndpoint(&quot;seda:foo&quot;, 
SedaEndpoint.class);
     assertEquals(0, seda.getCurrentQueueSize());
 }
+// end::e1[]
 ]]></script>
 </div></div><p>The same example using the <a shape="rect" 
href="testing.html">Test Kit</a></p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeHeader panelHeader pdl" 
style="border-bottom-width: 1px;"><b>isMockEndpointsAndSkip using camel-test 
kit</b></div><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
+// tag::e1[]
 public class IsMockEndpointsAndSkipJUnit4Test extends CamelTestSupport {
 
     @Override
@@ -23295,6 +23326,7 @@ public class IsMockEndpointsAndSkipJUnit
         };
     }
 }
+// end::e1[]
 ]]></script>
 </div></div><h3 
id="BookInOnePage-Limitingthenumberofmessagestokeep.1">Limiting the number of 
messages to keep</h3><p><strong>Available as of Camel 2.10</strong></p><p>The 
<a shape="rect" href="mock.html">Mock</a> endpoints will by default keep a copy 
of every <a shape="rect" href="exchange.html">Exchange</a> that it received. So 
if you test with a lot of messages, then it will consume memory.<br 
clear="none"> From Camel 2.10 onwards we have introduced two options 
<code>retainFirst</code> and <code>retainLast</code> that can be used to 
specify to only keep N'th of the first and/or last <a shape="rect" 
href="exchange.html">Exchange</a>s.</p><p>For example in the code below, we 
only want to retain a copy of the first 5 and last 5 <a shape="rect" 
href="exchange.html">Exchange</a>s the mock receives.</p><div class="code panel 
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[  MockEndpoint mock = 
getMockEndpoint(&quot;mock:data&quot;);
@@ -26181,18 +26213,7 @@ The body of the message must be a map (a
 </div></div><div class="confluence-information-macro 
confluence-information-macro-information"><p 
class="title">Dependencies</p><span class="aui-icon aui-icon-small 
aui-iconfont-info confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>As of Camel 2.8 this component 
ships with Spring-WS 2.0.x which (like the rest of Camel) requires Spring 
3.0.x.</p><p>Earlier Camel versions shipped Spring-WS 1.5.9 which is compatible 
with Spring 2.5.x and 3.0.x. In order to run earlier versions of 
<code>camel-spring-ws</code> on Spring 2.5.x you need to add the 
<code>spring-webmvc</code> module from Spring 2.5.x. In order to run Spring-WS 
1.5.9 on Spring 3.0.x you need to exclude the OXM module from Spring 3.0.x as 
this module is also included in Spring-WS 1.5.9 (see <a shape="rect" 
class="external-link" 
href="http://stackoverflow.com/questions/3313314/can-spring-ws-1-5-be-used-with-spring-3";
 rel="nofollow">this post</a>)</p></div></div><h3 id="BookInOnePage-UR
 Iformat.66">URI format</h3><p>The URI scheme for this component is as 
follows</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[spring-ws:[mapping-type:]address[?options]
 ]]></script>
-</div></div><p>To expose a web service <strong>mapping-type</strong> needs to 
be set to any of the following:</p><div class="confluenceTableSmall">
-<div class="table-wrap"><table class="confluenceTable"><tbody><tr><th 
colspan="1" rowspan="1" class="confluenceTh"><p> Mapping type </p></th><th 
colspan="1" rowspan="1" class="confluenceTh"><p> Description 
</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> 
<code>rootqname</code> </p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p> Offers the option to map web service requests based on 
the qualified name of the root element contained in the message. 
</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> 
<code>soapaction</code> </p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p> Used to map web service requests based on the SOAP 
action specified in the header of the message. </p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p> <code>uri</code> </p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p> In order to map web service 
requests that target a specific URI. </p></td></tr><tr><td colspan="1" 
rowspan="1"
  class="confluenceTd"><p> <code>xpathresult</code> </p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p> Used to map web service requests based on 
the evaluation of an XPath <code>expression</code> against the incoming 
message. The result of the evaluation should match the XPath result specified 
in the endpoint URI. </p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p> <code>beanname</code> </p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p> Allows you to reference an 
<code>org.apache.camel.component.spring.ws.bean.CamelEndpointDispatcher</code> 
object in order to integrate with existing (legacy) <a shape="rect" 
class="external-link" 
href="http://static.springsource.org/spring-ws/sites/1.5/reference/html/server.html#server-endpoint-mapping";
 rel="nofollow">endpoint mappings</a> like 
<code>PayloadRootQNameEndpointMapping</code>, 
<code>SoapActionEndpointMapping</code>, etc </p></td></tr></tbody></table></div>
-</div><p>As a consumer the <strong>address</strong> should contain a value 
relevant to the specified mapping-type (e.g. a SOAP action, XPath expression). 
As a producer the address should be set to the URI of the web service your 
calling upon.</p><p>You can append query <strong>options</strong> to the URI in 
the following format, 
<code>?option=value&amp;option=value&amp;...</code></p><h3 
id="BookInOnePage-Options.72">Options</h3><div class="confluenceTableSmall">
-<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> Required? </p></th><th colspan="1" 
rowspan="1" class="confluenceTh"><p> Description </p></th></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p> <code>soapAction</code> 
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> No </p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p> SOAP action to include inside 
a SOAP request when accessing remote web services </p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p> 
<code>wsAddressingAction</code> </p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p> No </p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p> WS-Addressing 1.0 action header to include when 
accessing web services. The <code>To</code> header is set to the 
<em>address</em> of the web service as specified in the endpoint URI (default 
Spri
 ng-WS behavior). </p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p> <code>expression</code> </p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p> Only when <em>mapping-type</em> is 
<code>xpathresult</code> </p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p> XPath expression to use in the process of mapping web 
service requests, should match the result specified by <code>xpathresult</code> 
</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> 
<code>timeout</code> </p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p> No </p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p> <strong>Camel 2.10:</strong> Sets the socket read 
timeout (in milliseconds) while invoking a webservice using the producer, see 
<a shape="rect" class="external-link" 
href="http://docs.oracle.com/javase/6/docs/api/java/net/URLConnection.html#setReadTimeout(int)"
 rel="nofollow">URLConnection.setReadTimeout()</a> and <a shape="rect" 
class="external-
 link" 
href="http://static.springsource.org/spring-ws/site/apidocs/org/springframework/ws/transport/http/CommonsHttpMessageSender.html#setReadTimeout(int)"
 rel="nofollow">CommonsHttpMessageSender.setReadTimeout()</a>. &#160;This 
option works when using the built-in message sender 
implementations:&#160;<em>CommonsHttpMessageSender</em>&#160;and&#160;<em>HttpUrlConnectionMessageSender</em>.
 &#160;One of these implementations will be used by default for HTTP based 
services unless you customize the Spring WS configuration options supplied to 
the component. &#160;If you are using a non-standard sender, it is assumed that 
you will handle your own timeout configuration.<br clear="none" 
class="atl-forced-newline">
-<strong>Camel 2.12:</strong>&#160;The built-in message 
sender&#160;<em>HttpComponentsMessageSender</em>&#160;is considered 
<strong>instead of</strong>&#160;<em>CommonsHttpMessageSender</em>&#160;which 
has been deprecated, see <a shape="rect" class="external-link" 
href="http://static.springsource.org/spring-ws/site/apidocs/org/springframework/ws/transport/http/HttpComponentsMessageSender.html#setReadTimeout(int)"
 rel="nofollow">HttpComponentsMessageSender.setReadTimeout()</a>. 
</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> 
<code>sslContextParameters</code> </p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p> No </p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p> <strong>Camel 2.10:</strong>&#160;Reference to 
an&#160;<code>org.apache.camel.util.jsse.SSLContextParameters</code> 
in&#160;the&#160;<a shape="rect" class="external-link" 
href="http://camel.apache.org/registry.html";>Registry</a>. &#160;See&#160;<a 
shape="rect" class="external-link" h
 
ref="http://camel.apache.org/http4.html#HTTP4-UsingtheJSSEConfigurationUtility";>Using
 the JSSE Configuration Utility</a>. &#160;This option works when using the 
built-in message sender 
implementations:&#160;<em>CommonsHttpMessageSender</em>&#160;and&#160;<em>HttpUrlConnectionMessageSender</em>.
 &#160;One of these implementations will be used by default for HTTP based 
services unless you customize the Spring WS configuration options supplied to 
the component. &#160;If you are using a non-standard sender, it is assumed that 
you will handle your own TLS configuration.<br clear="none" 
class="atl-forced-newline">
-<strong>Camel 2.12:</strong>&#160;The built-in message 
sender&#160;<em>HttpComponentsMessageSender</em>&#160;is considered 
<strong>instead of</strong>&#160;<em>CommonsHttpMessageSender</em>&#160;which 
has been deprecated. </p></td></tr></tbody></table></div>
-</div><h4 id="BookInOnePage-Registrybasedoptions">Registry based 
options</h4><p>The following options can be specified in the registry (most 
likely a Spring ApplicationContext) and referenced from the endpoint URI using 
the # notation.</p><div class="confluenceTableSmall">
-<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> Required? </p></th><th colspan="1" 
rowspan="1" class="confluenceTh"><p> Description </p></th></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p> 
<code>webServiceTemplate</code> </p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p> No </p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p> Option to provide a custom <a shape="rect" 
class="external-link" 
href="http://static.springsource.org/spring-ws/sites/1.5/apidocs/org/springframework/ws/client/core/WebServiceTemplate.html";
 rel="nofollow">WebServiceTemplate</a>. This allows for full control over  
client-side web services handling; like adding a custom interceptor or 
specifying a fault resolver, message sender or message factory. 
</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> 
<code>messageSender</code> 
 </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> No </p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p> Option to provide a custom <a 
shape="rect" class="external-link" 
href="http://static.springsource.org/spring-ws/sites/1.5/apidocs/org/springframework/ws/transport/WebServiceMessageSender.html";
 rel="nofollow">WebServiceMessageSender</a>. For example to perform 
authentication or use alternative transports </p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p> <code>messageFactory</code> </p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p> No </p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p> Option to provide a custom <a shape="rect" 
class="external-link" 
href="http://static.springsource.org/spring-ws/sites/1.5/apidocs/org/springframework/ws/WebServiceMessageFactory.html";
 rel="nofollow">WebServiceMessageFactory</a>. For example when you want Apache 
Axiom to handle web service messages instead of SAAJ </p></td></tr><tr><td co
 lspan="1" rowspan="1" class="confluenceTd"><p> <code>transformerFactory</code> 
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> No </p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p> Option to override default 
TransformerFactory. The provided transformer factory must be of type 
<code>javax.xml.transform.TransformerFactory</code> </p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p> <code>endpointMapping</code> 
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> Only when 
<em>mapping-type</em> is <code>rootqname</code>, <code>soapaction</code>, 
<code>uri</code> or <code>xpathresult</code> </p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p> Reference to an instance of 
<code>org.apache.camel.component.spring.ws.bean.CamelEndpointMapping</code> in 
the Registry/ApplicationContext. Only one bean is required in the registry to 
serve all Camel/Spring-WS endpoints. This bean is auto-discovered by the <a 
shape="rect" class="external-
 link" 
href="http://static.springsource.org/spring-ws/sites/1.5/apidocs/org/springframework/ws/server/MessageDispatcher.html";
 rel="nofollow">MessageDispatcher</a> and used to map requests to Camel 
endpoints based on characteristics specified on the endpoint (like root QName, 
SOAP action, etc) </p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p> <code>messageFilter</code> </p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p> No </p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p> <strong>Camel 2.10.3</strong> Option to provide a 
custom MessageFilter. For example when you want to process your headers or 
attachments by your own. </p></td></tr></tbody></table></div>
-
-</div><h3 id="BookInOnePage-Messageheaders">Message headers</h3><div 
class="confluenceTableSmall">
-<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> Type </p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p> Description </p></th></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p> 
<code>CamelSpringWebserviceEndpointUri</code> </p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p> String </p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p> URI of the web service your accessing as a 
client, overrides <em>address</em> part of the endpoint URI 
</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> 
<code>CamelSpringWebserviceSoapAction</code> </p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p> String </p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p> Header to specify the SOAP action of the 
message, overrides <code>soapAction</code> option if present 
</p></td></tr><tr><td colspan="1
 " rowspan="1" class="confluenceTd"><p> 
<code>CamelSpringWebserviceAddressingAction</code> </p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p> URI </p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p> Use this header to specify the WS-Addressing action of 
the message, overrides <code>wsAddressingAction</code> option if present 
</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> 
<code>CamelSpringWebserviceSoapHeader</code> </p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p> Source </p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p> <strong>Camel 2.11.1:</strong> Use this 
header to specify/access the SOAP headers of the message. 
</p></td></tr></tbody></table></div>
-</div><h2 id="BookInOnePage-Accessingwebservices">Accessing web 
services</h2><p>To call a web service at <code><a shape="rect" 
class="external-link" href="http://foo.com/bar"; 
rel="nofollow">http://foo.com/bar</a></code> simply define a route:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
+</div></div><p>To expose a web service <strong>mapping-type</strong> needs to 
be set to any of the following:</p><div class="confluenceTableSmall"><div 
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Mapping type</p></th><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>rootqname</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Offers the option to map web service 
requests based on the qualified name of the root element contained in the 
message.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>soapaction</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Used to map web service requests based on 
the SOAP action specified in the header of the message.</p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>uri</code></p></td><td 
colspan="1" rowspan="1" cl
 ass="confluenceTd"><p>In order to map web service requests that target a 
specific URI.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>xpathresult</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Used to map web service requests based on 
the evaluation of an XPath <code>expression</code> against the incoming 
message. The result of the evaluation should match the XPath result specified 
in the endpoint URI.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>beanname</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Allows you to reference an 
<code>org.apache.camel.component.spring.ws.bean.CamelEndpointDispatcher</code> 
object in order to integrate with existing (legacy) <a shape="rect" 
class="external-link" 
href="http://static.springsource.org/spring-ws/sites/1.5/reference/html/server.html#server-endpoint-mapping";
 rel="nofollow">endpoint mappings</a> like 
<code>PayloadRootQNameEndpointMapping</code>,
  <code>SoapActionEndpointMapping</code>, 
etc</p></td></tr></tbody></table></div></div><p>As a consumer the 
<strong>address</strong> should contain a value relevant to the specified 
mapping-type (e.g. a SOAP action, XPath expression). As a producer the address 
should be set to the URI of the web service your calling upon.</p><p>You can 
append query <strong>options</strong> to the URI in the following format, 
<code>?option=value&amp;option=value&amp;...</code></p><h3 
id="BookInOnePage-Options.72">Options</h3><div 
class="confluenceTableSmall"><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>Required?</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>soapAction</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>No</p></td><td colspan="1" 
rowspa
 n="1" class="confluenceTd"><p>SOAP action to include inside a SOAP request 
when accessing remote web services</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>wsAddressingAction</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>No</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>WS-Addressing 1.0 action header to include when 
accessing web services. The <code>To</code> header is set to the 
<em>address</em> of the web service as specified in the endpoint URI (default 
Spring-WS behavior).</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd">outputAction</td><td colspan="1" rowspan="1" 
class="confluenceTd">No</td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><span style="color: rgb(0,0,0);">Signifies the value 
for the response WS-Addressing Action<span style="color: 
rgb(119,183,103);">&#160;</span>header that is provided by the 
method.</span>&#160;</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd">
 faultAction</td><td colspan="1" rowspan="1" class="confluenceTd">No</td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><span style="color: 
rgb(0,0,0);"><span style="line-height: 1.42857;">Signifies the value for the 
faultAction response WS-Addressing</span><span style="line-height: 
1.42857;"><span style="color: rgb(119,183,103);">&#160;</span></span><span 
style="line-height: 1.42857;">Fault Action</span><span style="line-height: 
1.42857;">&#160;</span><span style="line-height: 1.42857;">header that is 
provided by the method.</span></span></p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd">faultTo</td><td colspan="1" rowspan="1" 
class="confluenceTd"><span>No</span></td><td colspan="1" rowspan="1" 
class="confluenceTd"><span style="color: rgb(0,0,0);">Signifies the value for 
the faultAction response WS-Addressing FaultTo header that is provided by the 
method.</span></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd">replyTo</td><td colspan="1" rowspan="1"
  class="confluenceTd"><span>No</span></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><span style="color: rgb(0,0,0);">Signifies the value 
for the replyTo response WS-Addressing<span style="color: 
rgb(119,183,103);">&#160;</span>ReplyTo header that is provided by the 
method.</span></p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>expression</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Only when <em>mapping-type</em> is 
<code>xpathresult</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>XPath expression to use in the process of mapping web 
service requests, should match the result specified by 
<code>xpathresult</code></p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>timeout</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>No</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>Camel 2.10:</strong> Sets the socket read 
timeout (in milliseconds) while invo
 king a webservice using the producer, see <a shape="rect" 
class="external-link" 
href="http://docs.oracle.com/javase/6/docs/api/java/net/URLConnection.html#setReadTimeout(int)"
 rel="nofollow">URLConnection.setReadTimeout()</a> and <a shape="rect" 
class="external-link" 
href="http://static.springsource.org/spring-ws/site/apidocs/org/springframework/ws/transport/http/CommonsHttpMessageSender.html#setReadTimeout(int)"
 rel="nofollow">CommonsHttpMessageSender.setReadTimeout()</a>. &#160;This 
option works when using the built-in message sender 
implementations:&#160;<em>CommonsHttpMessageSender</em>&#160;and&#160;<em>HttpUrlConnectionMessageSender</em>.
 &#160;One of these implementations will be used by default for HTTP based 
services unless you customize the Spring WS configuration options supplied to 
the component. &#160;If you are using a non-standard sender, it is assumed that 
you will handle your own timeout configuration.<br clear="none" 
class="atl-forced-newline"> <strong>Camel 2.12:<
 /strong>&#160;The built-in message 
sender&#160;<em>HttpComponentsMessageSender</em>&#160;is considered 
<strong>instead of</strong>&#160;<em>CommonsHttpMessageSender</em>&#160;which 
has been deprecated, see <a shape="rect" class="external-link" 
href="http://static.springsource.org/spring-ws/site/apidocs/org/springframework/ws/transport/http/HttpComponentsMessageSender.html#setReadTimeout(int)"
 
rel="nofollow">HttpComponentsMessageSender.setReadTimeout()</a>.</p></td></tr><tr><td
 colspan="1" rowspan="1" 
class="confluenceTd"><p><code>sslContextParameters</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>No</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>Camel 2.10:</strong>&#160;Reference 
to an&#160;<code>org.apache.camel.util.jsse.SSLContextParameters</code> 
in&#160;the&#160;<a shape="rect" class="external-link" 
href="http://camel.apache.org/registry.html";>Registry</a>. &#160;See&#160;<a 
shape="rect" class="external-link" href="http://camel.apache.o
 rg/http4.html#HTTP4-UsingtheJSSEConfigurationUtility">Using the JSSE 
Configuration Utility</a>. &#160;This option works when using the built-in 
message sender 
implementations:&#160;<em>CommonsHttpMessageSender</em>&#160;and&#160;<em>HttpUrlConnectionMessageSender</em>.
 &#160;One of these implementations will be used by default for HTTP based 
services unless you customize the Spring WS configuration options supplied to 
the component. &#160;If you are using a non-standard sender, it is assumed that 
you will handle your own TLS configuration.<br clear="none" 
class="atl-forced-newline"> <strong>Camel 2.12:</strong>&#160;The built-in 
message sender&#160;<em>HttpComponentsMessageSender</em>&#160;is considered 
<strong>instead of</strong>&#160;<em>CommonsHttpMessageSender</em>&#160;which 
has been deprecated.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>webServiceTemplate</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>No</p></td><td colspan="
 1" rowspan="1" class="confluenceTd"><p>Option to provide a custom <a 
shape="rect" class="external-link" 
href="http://static.springsource.org/spring-ws/sites/1.5/apidocs/org/springframework/ws/client/core/WebServiceTemplate.html";
 rel="nofollow">WebServiceTemplate</a>. This allows for full control over 
client-side web services handling; like adding a custom interceptor or 
specifying a fault resolver, message sender or message 
factory.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>messageSender</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>No</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Option to provide a custom <a shape="rect" 
class="external-link" 
href="http://static.springsource.org/spring-ws/sites/1.5/apidocs/org/springframework/ws/transport/WebServiceMessageSender.html";
 rel="nofollow">WebServiceMessageSender</a>. For example to perform 
authentication or use alternative transports</p></td></tr><tr><td colspan="1" 
row
 span="1" class="confluenceTd"><p><code>messageFactory</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>No</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Option to provide a custom <a shape="rect" 
class="external-link" 
href="http://static.springsource.org/spring-ws/sites/1.5/apidocs/org/springframework/ws/WebServiceMessageFactory.html";
 rel="nofollow">WebServiceMessageFactory</a>. For example when you want Apache 
Axiom to handle web service messages instead of SAAJ</p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>endpointMapping</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Only when <em>mapping-type</em> is 
<code>rootqname</code>, <code>soapaction</code>, <code>uri</code> or 
<code>xpathresult</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Reference to an instance of <code><a shape="rect" 
class="external-link" href="http://org.apache.camel.component.spring.ws"; 
rel="nofollow">org.apache.ca
 mel.component.spring.ws</a>.bean.CamelEndpointMapping</code> in the 
Registry/ApplicationContext. Only one bean is required in the registry to serve 
all Camel/Spring-WS endpoints. This bean is auto-discovered by the <a 
shape="rect" class="external-link" 
href="http://static.springsource.org/spring-ws/sites/1.5/apidocs/org/springframework/ws/server/MessageDispatcher.html";
 rel="nofollow">MessageDispatcher</a> and used to map requests to Camel 
endpoints based on characteristics specified on the endpoint (like root QName, 
SOAP action, etc)</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd">endpointDispatcher</td><td colspan="1" rowspan="1" 
class="confluenceTd">No</td><td colspan="1" rowspan="1" 
class="confluenceTd">&#160;Spring {@link <a shape="rect" class="external-link" 
href="http://org.springframework.ws"; 
rel="nofollow">org.springframework.ws</a>.server.endpoint.MessageEndpoint} for 
dispatching messages received by Spring-WS to a Camel endpoint, to integrate 
with existin
 g (legacy) endpoint mappings like PayloadRootQNameEndpointMapping, 
SoapActionEndpointMapping, etc.</td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>messageFilter</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>No</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><strong>Camel 2.10.3</strong> Option to provide a 
custom MessageFilter. For example when you want to process your headers or 
attachments by your own.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd">messageIdStrategy</td><td colspan="1" rowspan="1" 
class="confluenceTd">No</td><td colspan="1" rowspan="1" class="confluenceTd">A 
custom MessageIdStrategy to control generation of unique message 
ids</td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><span>webServiceEndpointUri</span></td><td colspan="1" 
rowspan="1" class="confluenceTd">No</td><td colspan="1" rowspan="1" 
class="confluenceTd">The default Web Service endpoint uri to use for the 
producer</t
 d></tr></tbody></table></div></div><h4 
id="BookInOnePage-Messageheaders">Message headers</h4><div 
class="confluenceTableSmall"><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>Type</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>CamelSpringWebserviceEndpointUri</code></p></td><td
 colspan="1" rowspan="1" class="confluenceTd"><p>String</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>URI of the web service your accessing as a 
client, overrides <em>address</em> part of the endpoint 
URI</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>CamelSpringWebserviceSoapAction</code></p></td><td
 colspan="1" rowspan="1" class="confluenceTd"><p>String</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Header to specify the SO
 AP action of the message, overrides <code>soapAction</code> option if 
present</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><span style="color: 
rgb(0,0,0);">CamelSpringWebserviceSoapHeader</span></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><span>Source</span></td><td colspan="1" 
rowspan="1" class="confluenceTd"><strong>Camel 2.11.1:</strong><span> Use this 
header to specify/access the SOAP headers of the 
message.</span></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>CamelSpringWebserviceAddressingAction</code></p></td><td
 colspan="1" rowspan="1" class="confluenceTd"><p>URI</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Use this header to specify the 
WS-Addressing action of the message, overrides <code>wsAddressingAction</code> 
option if present</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><span style="color: 
rgb(0,0,0);">CamelSpringWebserviceAddressingFaultTo</span></p></td><td colspan="
 1" rowspan="1" class="confluenceTd">URI</td><td colspan="1" rowspan="1" 
class="confluenceTd"><span>Use this header to specify the </span>&#160;<span 
style="color: rgb(0,0,0);">WS-Addressing FaultTo <span>, overrides faultTo 
option if present</span></span></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><span style="color: 
rgb(0,0,0);">CamelSpringWebserviceAddressingReplyTo</span></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><span>URI</span></td><td 
colspan="1" rowspan="1" class="confluenceTd"><span>Use this header to specify 
the </span><span>&#160;</span><span style="color: rgb(0,0,0);">WS-Addressing 
ReplyTo , overrides replyTo option if present</span></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p><span style="color: 
rgb(0,0,0);">CamelSpringWebserviceAddressingOutputAction</span></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><span>URI</span></td><td 
colspan="1" rowspan="1" class="confluenceTd"><span style="color: rgb(0,0,0);
 "><span>Use this header to specify the</span> WS-Addressing Action<span 
style="color: rgb(0,0,0);"> , overrides outputAction option if 
present</span></span></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><span style="color: 
rgb(0,0,0);">CamelSpringWebserviceAddressingFaultAction</span></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><span>URI</span></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><span style="color: 
rgb(0,0,0);">Use this header to specify the</span><span style="color: 
rgb(0,0,0);"> WS-Addressing <span style="color: rgb(0,0,0);">Fault 
Action</span></span><span style="color: rgb(0,0,0);"> , overrides faultAction 
option if present</span></p></td></tr></tbody></table></div></div><h2 
id="BookInOnePage-Accessingwebservices">Accessing web services</h2><p>To call a 
web service at <code><a shape="rect" class="external-link" 
href="http://foo.com/bar"; rel="nofollow">http://foo.com/bar</a></code> simply 
define a route:</p><div class="co
 de panel pdl" style="border-width: 1px;"><div class="codeContent panelContent 
pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[from(&quot;direct:example&quot;).to(&quot;spring-ws:http://foo.com/bar&quot;)
 ]]></script>
 </div></div><p>And sent a message:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">

Modified: websites/production/camel/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.

Modified: websites/production/camel/content/cdi-testing.html
==============================================================================
--- websites/production/camel/content/cdi-testing.html (original)
+++ websites/production/camel/content/cdi-testing.html Wed Mar  9 15:22:14 2016
@@ -315,7 +315,7 @@ public class PaxCdiOsgiTest {
 }
 
 ]]></script>
-</div></div><p>You can see the tests in<span style="color: 
rgb(0,0,0);">&#160;the&#160;</span><span style="color: 
rgb(0,0,0);"><code>camel-example-cdi-osgi</code>&#160;example for a complete 
working example of testing a Camel CDI application deployed in an OSGi 
container using PAX Exam.</span></p><h3 
id="CDITesting-Testing">Testing</h3><p>You can see the tests in<span 
style="color: rgb(0,0,0);">&#160;the&#160;</span><span style="color: 
rgb(0,0,0);"><code>camel-example-cdi-test</code>&#160;example for a thorough 
overview of the following testing patterns for Camel CDI 
applications.</span></p><h4 id="CDITesting-RoutesadvisingwithadviceWith"><span 
style="color: rgb(0,0,0);">Routes advising with 
<code>adviceWith</code></span></h4><p><span style="color: 
rgb(0,0,0);"><span><code><a shape="rect" 
href="advicewith.html">AdviceWith</a></code> is used for testing Camel routes 
where you can&#160;</span><em>advice</em><span>&#160;an existing route before 
its being tested. It allows to add&#160;<
 a shape="rect" class="external-link" 
href="http://camel.apache.org/intercept.html";>Intercept</a>&#160;or 
<em>weave</em> routes for testing purpose, for example using the&#160;<a 
shape="rect" 
href="mock.html">Mock</a>&#160;component</span><span>.</span></span></p><p><span
 style="color: rgb(0,0,0);">It is recommended to only advice routes which are 
not started already. To meet that requirement, you can use 
the&#160;</span><code>CamelContextStartingEvent</code> event by declaring an 
observer method in which you use <code>adviceWith</code> to add a 
<code>mock</code> endpoint at the end of your Camel route<span style="color: 
rgb(0,0,0);">, e.g.:</span></p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
+</div></div><p>You can see the tests in<span style="color: 
rgb(0,0,0);">&#160;the&#160;</span><span style="color: 
rgb(0,0,0);"><code>camel-example-cdi-osgi</code>&#160;example for a complete 
working example of testing a Camel CDI application deployed in an OSGi 
container using PAX Exam.</span></p><h3 id="CDITesting-TestingPatterns">Testing 
Patterns</h3><p>You can see the tests in<span style="color: 
rgb(0,0,0);">&#160;the&#160;</span><span style="color: 
rgb(0,0,0);"><code>camel-example-cdi-test</code>&#160;example for a thorough 
overview of the following testing patterns for Camel CDI 
applications.</span></p><h4 id="CDITesting-RoutesadvisingwithadviceWith"><span 
style="color: rgb(0,0,0);">Routes advising with 
<code>adviceWith</code></span></h4><p><span style="color: 
rgb(0,0,0);"><span><code><a shape="rect" 
href="advicewith.html">AdviceWith</a></code> is used for testing Camel routes 
where you can&#160;</span><em>advice</em><span>&#160;an existing route before 
its being tested. It all
 ows to add&#160;<a shape="rect" class="external-link" 
href="http://camel.apache.org/intercept.html";>Intercept</a>&#160;or 
<em>weave</em> routes for testing purpose, for example using the&#160;<a 
shape="rect" 
href="mock.html">Mock</a>&#160;component</span><span>.</span></span></p><p><span
 style="color: rgb(0,0,0);">It is recommended to only advice routes which are 
not started already. To meet that requirement, you can use 
the&#160;</span><code>CamelContextStartingEvent</code> event by declaring an 
observer method in which you use <code>adviceWith</code> to add a 
<code>mock</code> endpoint at the end of your Camel route<span style="color: 
rgb(0,0,0);">, e.g.:</span></p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[void advice(@Observes 
CamelContextStartingEvent event,
             @Uri(&quot;mock:test&quot;) MockEndpoint messages,
             ModelCamelContext context) throws Exception {
@@ -328,7 +328,67 @@ public class PaxCdiOsgiTest {
             }
         });
 }]]></script>
-</div></div><h4 id="CDITesting-JUnitrules"><span style="color: 
rgb(0,0,0);">JUnit rules</span></h4><p><span style="color: rgb(0,0,0);">Camel 
CDI test starts the CDI container after all the JUnit class 
rules.</span></p><h3 id="CDITesting-SeeAlso">See Also</h3><ul><li><a 
shape="rect" href="cdi.html">CDI component</a></li><li><a shape="rect" 
class="external-link" href="http://arquillian.org"; rel="nofollow">Arquillian 
Web site</a></li><li><a shape="rect" class="external-link" 
href="http://arquillian.org/modules/descriptors-shrinkwrap/"; 
rel="nofollow">ShrinkWrap Descriptors</a></li><li><a shape="rect" 
class="external-link" 
href="http://arquillian.org/guides/shrinkwrap_introduction/"; 
rel="nofollow">Creating Deployable Archives with ShrinkWrap</a></li><li><a 
shape="rect" class="external-link" 
href="https://ops4j1.jira.com/wiki/display/PAXEXAM4"; rel="nofollow">PAX 
Exam</a></li></ul></div>
+</div></div><h4 id="CDITesting-Beanalternatives"><span style="color: 
rgb(0,0,0);">Bean alternatives</span></h4><p><span style="color: 
rgb(0,0,0);"><br clear="none"></span></p><h4 id="CDITesting-Testroutes"><span 
style="color: rgb(0,0,0);">Test routes</span></h4><p><span style="color: 
rgb(0,0,0);"><br clear="none"></span></p><h4 
id="CDITesting-Camelcontextcustomisation"><span style="color: 
rgb(0,0,0);">Camel context customisation</span></h4><p><span style="color: 
rgb(0,0,0);">You may need to customise your Camel contexts for testing purpose, 
for example disabling JMX management to avoid TCP port allocation conflict. You 
can do that by declaring a custom Camel context bean in your test class, 
e.g.:</span></p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[@RunWith(CamelCdiRunner.class)
+public class CamelCdiTest {
+ 
+    @Default
+    @ContextName(&quot;camel-test-cdi&quot;)
+    @ApplicationScoped
+    static class CustomCamelContext extends DefaultCamelContext {
+
+        @PostConstruct
+        void customize() {
+            disableJMX();
+        }
+    }
+}]]></script>
+</div></div><p><span style="color: rgb(0,0,0);">In that example, the custom 
Camel context bean declared in the test class will be used during the test 
execution instead of the default Camel context bean provided by the <a 
shape="rect" href="cdi.html">Camel CDI component</a>.</span></p><p><span 
style="color: rgb(0,0,0);font-weight: bold;">JUnit rules</span></p><p><span 
style="color: rgb(0,0,0);">Camel CDI test starts the CDI container after all 
the JUnit class rules have executed.</span></p><p><span style="color: 
rgb(0,0,0);">That way, you can use JUnit class rules to initialise (resp. 
clean-up) resources that your test classes would require during their execution 
before the container initialises (resp. after the container has shutdown). For 
example, you could use an embedded JMS broker like <span style="color: 
rgb(0,0,0);"><a shape="rect" class="external-link" 
href="https://activemq.apache.org/artemis/";>ActiveMQ Artemis</a> to test your 
Camel JMS application</span>, e.g.:</span></p>
 <div class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[import 
org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS;
+ 
+@RunWith(CamelCdiRunner.class)
+public class CamelCdiTest {
+ 
+    @ClassRule
+    public static final ExternalResource resources = new ExternalResource() {
+
+        private final EmbeddedJMS jms = new EmbeddedJMS();
+
+        @Override
+        protected void before() throws Exception {
+            jms.start();
+        }
+        @Override
+        protected void after() throws Exception {
+            jms.stop();
+        }
+    };
+ 
+    @Inject
+    @Uri(&quot;jms:destination&quot;)
+    private ProducerTemplate producer;
+ 
+    @Test
+    public void sendMessage() {
+        producer.sendBody(&quot;message&quot;);
+    }
+}]]></script>
+</div></div><p><span style="color: rgb(0,0,0);">Another use case is to assert 
the&#160;behaviour of your application after it has shutdown. In that case, you 
can use the <code>Verifier</code> rule, e.g.:</span></p><div class="code panel 
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[import org.junit.rules.Verifier;
+ 
+@RunWith(CamelCdiRunner.class)
+public class CamelCdiTest {
+ 
+    @ClassRule
+    public static Verifier verifier = new Verifier() {
+ 
+        @Override
+        protected void verify() {
+            // Executes after the CDI container has shutdown
+        }
+    };
+}]]></script>
+</div></div><h3 id="CDITesting-SeeAlso">See Also</h3><ul><li><a shape="rect" 
href="cdi.html">CDI component</a></li><li><a shape="rect" class="external-link" 
href="http://arquillian.org"; rel="nofollow">Arquillian Web site</a></li><li><a 
shape="rect" class="external-link" 
href="http://arquillian.org/modules/descriptors-shrinkwrap/"; 
rel="nofollow">ShrinkWrap Descriptors</a></li><li><a shape="rect" 
class="external-link" 
href="http://arquillian.org/guides/shrinkwrap_introduction/"; 
rel="nofollow">Creating Deployable Archives with ShrinkWrap</a></li><li><a 
shape="rect" class="external-link" 
href="https://ops4j1.jira.com/wiki/display/PAXEXAM4"; rel="nofollow">PAX 
Exam</a></li></ul></div>
         </td>
         <td valign="top">
           <div class="navigation">


Reply via email to