Author: buildbot
Date: Fri Apr 17 11:20:03 2015
New Revision: 948005
Log:
Production update by buildbot for camel
Modified:
websites/production/camel/content/book-cookbook.html
websites/production/camel/content/book-in-one-page.html
websites/production/camel/content/book-pattern-appendix.html
websites/production/camel/content/cache/main.pageCache
websites/production/camel/content/camel-test.html
websites/production/camel/content/dead-letter-channel.html
Modified: websites/production/camel/content/book-cookbook.html
==============================================================================
--- websites/production/camel/content/book-cookbook.html (original)
+++ websites/production/camel/content/book-cookbook.html Fri Apr 17 11:20:03
2015
@@ -2038,54 +2038,30 @@ public class DebugBlueprintTest extends
<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 5 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="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>
-
- <div class="aui-message hint shadowed information-macro">
+<h2 id="Bookcookbook-CamelTest">Camel Test</h2><p>As a simple alternative to
using <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> <div class="aui-message hint shadowed information-macro">
<span class="aui-icon icon-hint">Icon</span>
<div class="message-content">
-
-<p>The <code>camel-test</code> JAR is using JUnit. There is an alternative
<code>camel-testng</code> JAR (Camel 2.8 onwards) using the <a shape="rect"
class="external-link" href="http://testng.org/doc/index.html"
rel="nofollow">TestNG</a> test framework.</p>
+ <p>The <code>camel-test</code> JAR is using JUnit.
There is an alternative <code>camel-testng</code> JAR (Camel 2.8 onwards) using
the <a shape="rect" class="external-link"
href="http://testng.org/doc/index.html" rel="nofollow">TestNG</a> test
framework.</p>
</div>
</div>
-
-
-<h3 id="Bookcookbook-Addingtoyourpom.xml">Adding to your pom.xml</h3>
-
-<p>To get started using Camel Test you will need to add an entry to your
pom.xml</p>
-
-<h4 id="Bookcookbook-JUnit">JUnit</h4>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
-<dependency>
+<h3 id="Bookcookbook-Addingtoyourpom.xml">Adding to your pom.xml</h3><p>To get
started using Camel Test you will need to add an entry to your pom.xml</p><h4
id="Bookcookbook-JUnit">JUnit</h4><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test</artifactId>
<version>${camel-version}</version>
<scope>test</scope>
</dependency>
]]></script>
-</div></div>
-
-<h4 id="Bookcookbook-TestNG">TestNG</h4>
-
-<p><strong>Available as of Camel 2.8</strong></p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
-<dependency>
+</div></div><h4 id="Bookcookbook-TestNG">TestNG</h4><p><strong>Available as of
Camel 2.8</strong></p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-testng</artifactId>
<version>${camel-version}</version>
<scope>test</scope>
</dependency>
]]></script>
-</div></div>
-
-<p>You might also want to add slf4j and log4j to ensure nice logging messages
(and maybe adding a <a shape="rect" class="external-link"
href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-test/src/test/resources/log4j.properties">log4j.properties</a>
file into your src/test/resources directory).</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
-<dependency>
+</div></div><p>You might also want to add slf4j and log4j to ensure nice
logging messages (and maybe adding a <a shape="rect" class="external-link"
href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-test/src/test/resources/log4j.properties">log4j.properties</a>
file into your src/test/resources directory).</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<scope>test</scope>
@@ -2096,15 +2072,7 @@ public class DebugBlueprintTest extends
<scope>test</scope>
</dependency>
]]></script>
-</div></div>
-
-<h3 id="Bookcookbook-Writingyourtest">Writing your test</h3>
-
-<p>You firstly need to derive from the class
<strong>CamelTestSupport</strong> (org.apache.camel.test.CamelTestSupport,
org.apache.camel.test.junit4.CamelTestSupport, or
org.apache.camel.testng.CamelTestSupport for JUnit 3.x, JUnit 4.x, and TestNG,
respectively) and typically you will need to override the
<strong>createRouteBuilder()</strong>
or <strong>createRouteBuilders()</strong> method to create routes to
be tested.</p>
-
-<p>Here is an <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>.</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
+</div></div><h3 id="Bookcookbook-Writingyourtest">Writing your test</h3><p>You
firstly need to derive from the class
<strong>CamelTestSupport</strong> (org.apache.camel.test.CamelTestSupport,
org.apache.camel.test.junit4.CamelTestSupport, or
org.apache.camel.testng.CamelTestSupport for JUnit 3.x, JUnit 4.x, and TestNG,
respectively) and typically you will need to override the
<strong>createRouteBuilder()</strong>
or <strong>createRouteBuilders()</strong> method to create routes to
be tested.</p><p>Here is an <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>.</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[
public class FilterTest extends CamelTestSupport {
@@ -2144,49 +2112,14 @@ public class FilterTest extends CamelTes
}
}
]]></script>
-</div></div>
-
-<p>Notice how you can use the various <a shape="rect"
href="bean-integration.html">Camel binding and injection annotations</a> to
inject individual <a shape="rect" href="endpoint.html">Endpoint</a> objects -
particularly the <a shape="rect" href="mock.html">Mock endpoints</a> which are
very useful for <a shape="rect" href="testing.html">Testing</a>. Also you can
inject <a shape="rect" href="pojo-producing.html">producer objects such as
ProducerTemplate or some application code interface</a> for sending messages or
invoking services.</p>
-
-<h4 id="Bookcookbook-FeaturesProvidedbyCamelTestSupport">Features Provided by
CamelTestSupport</h4>
-
-<p>The various <strong>CamelTestSupport</strong> classes provide a standard
set of behaviors relating to the CamelContext used to host the route(s) under
test.  The classes provide a number of methods that allow a test to alter
the configuration of the CamelContext used.  The following table describes
the available customization methods and the default behavior of tests that are
built from a <strong>CamelTestSupport</strong> class.</p>
-<div class="table-wrap"><table class="confluenceTable"><tbody><tr><th
colspan="1" rowspan="1" class="confluenceTh"><p> Method Name </p></th><th
colspan="1" rowspan="1" class="confluenceTh"><p> Description </p></th><th
colspan="1" rowspan="1" class="confluenceTh"><p> Default Behavior
</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> boolean
isUseRouteBuilder() </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> If the route builders from returned
from <strong>createRouteBuilder()</strong> or
<strong>createRouteBuilders()</strong> should be added to the CamelContext used
in the test should be started. </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> Returns true.
 <strong>createRouteBuilder()</strong> or <strong>createRouteBuilders()</strong>
are invoked and the CamelContext is started automatically.
</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> boolean
isUseAdviceWith() <br clear="none" class="at
l-forced-newline"> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> If the CamelContext use in the test should be
automatically started before test methods are invoked. <br clear="none"
class="atl-forced-newline">
-Override when using <a shape="rect" href="advicewith.html">advice
with</a> and return true.  This helps in knowing the adviceWith is to
be used, and the CamelContext will not be started before the
advice with takes place. This delay helps by ensuring the advice with has been
property setup before the CamelContext is started.</p>
- <div class="aui-message hint shadowed information-macro">
+</div></div><p>Notice how you can use the various <a shape="rect"
href="bean-integration.html">Camel binding and injection annotations</a> to
inject individual <a shape="rect" href="endpoint.html">Endpoint</a> objects -
particularly the <a shape="rect" href="mock.html">Mock endpoints</a> which are
very useful for <a shape="rect" href="testing.html">Testing</a>. Also you can
inject <a shape="rect" href="pojo-producing.html">producer objects such as
ProducerTemplate or some application code interface</a> for sending messages or
invoking services.</p><h4
id="Bookcookbook-FeaturesProvidedbyCamelTestSupport">Features Provided by
CamelTestSupport</h4><p>The various <strong>CamelTestSupport</strong> classes
provide a standard set of behaviors relating to the CamelContext used to host
the route(s) under test.  The classes provide a number of methods that
allow a test to alter the configuration of the CamelContext used.  The
following table describes the available customization met
hods and the default behavior of tests that are built from
a <strong>CamelTestSupport</strong> class.</p><div
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1"
rowspan="1" class="confluenceTh"><p>Method Name</p></th><th colspan="1"
rowspan="1" class="confluenceTh"><p>Description</p></th><th colspan="1"
rowspan="1" class="confluenceTh"><p>Default Behavior</p></th></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>boolean
isUseRouteBuilder()</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>If the route builders from returned
from <strong>createRouteBuilder()</strong> or
<strong>createRouteBuilders()</strong> should be added to the CamelContext used
in the test should be started.</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Returns true.
 <strong>createRouteBuilder()</strong> or <strong>createRouteBuilders()</strong>
are invoked and the CamelContext is started
automatically.</p></td></tr><tr><td col
span="1" rowspan="1" class="confluenceTd"><p>boolean
isUseAdviceWith()</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>If the CamelContext use in the test should be
automatically started before test methods are invoked. <br clear="none"
class="atl-forced-newline"> Override when using <a shape="rect"
href="advicewith.html">advice with</a> and return true.  This helps
in knowing the adviceWith is to be used, and the CamelContext will
not be started before the advice with takes place. This delay helps by
ensuring the advice with has been property setup before
the CamelContext is started.</p> <div class="aui-message hint
shadowed information-macro">
<span class="aui-icon icon-hint">Icon</span>
<div class="message-content">
<p>Its important to start the CamelContext
manually from the unit test after you are done doing all the advice with.</p>
</div>
</div>
-
-<p><br clear="none" class="atl-forced-newline"> </p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> Returns false.  the CamelContext is
started automatically before test methods are invoked. </p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p> boolean
isCreateCamelContextPerClass() <br clear="none" class="atl-forced-newline">
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> See <a
shape="rect"
href="#Bookcookbook-SetupCamelContextonceperclass,orpereverytestmethod">Setup
CamelContext once per class, or per every test method</a>. </p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> The CamelContext and routes
are recreated for each test method. </p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p> String isMockEndpoints() </p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> Triggers the auto-mocking of
endpoints whose URIs match the provided filter.  The default filter
is null which disable
s this feature.  Return "*"  to match all endpoints.
 See org.apache.camel.impl.InterceptSendToMockEndpointStrategy for more
details on the registration of the mock endpoints. </p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> Disabled </p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p> boolean isUseDebugger() </p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> If this method returns true,
the <strong>debugBefore(Exchange exchange, Processor processor,
ProcessorDefinition<?> definition, String id, String
label)</strong> and <br clear="none" class="atl-forced-newline">
-<strong>debugAfter(Exchange exchange, Processor processor,
ProcessorDefinition<?> definition, String id, String label, long
timeTaken)</strong> methods are invoked for each processor in the
registered routes. </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> Disabled.  The methods are not invoked during the
test. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>
int getShutdownTimeout() </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> Returns the number of seconds that Camel should wait
for graceful shutdown.  Useful for decreasing test times when a message is
still in flight at the end of the test. </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> Returns 10 seconds. </p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p> boolean useJmx() </p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> If JMX should be disabled on the
CamelContext used in the test. </p></td><td colspan="
1" rowspan="1" class="confluenceTd"><p> JMX is disabled. </p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p> JndiRegistry createRegistry()
<br clear="none" class="atl-forced-newline"> </p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> Provides a hook for adding objects into
the registry.  Override this method to bind objects to the registry before
test methods are invoked. </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> An empty registry is initialized.
</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>
useOverridePropertiesWithPropertiesComponent </p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> <strong>Camel 2.10:</strong> Allows to
add/override properties when <a shape="rect"
href="using-propertyplaceholder.html">Using PropertyPlaceholder</a> in Camel.
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> null
</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>
ignoreMissin
gLocationWithPropertiesComponent </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> <strong>Camel 2.10:</strong> Allows to control if
Camel should ignore missing locations for properties. </p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> null </p></td></tr></tbody></table></div>
-
-
-<h3 id="Bookcookbook-JNDI">JNDI</h3>
-
-<p>Camel uses a <a shape="rect" href="registry.html">Registry</a> to allow you
to configure <a shape="rect" href="component.html">Component</a> or <a
shape="rect" href="endpoint.html">Endpoint</a> instances or <a shape="rect"
href="bean-integration.html">Beans used in your routes</a>. If you are not
using <a shape="rect" href="spring.html">Spring</a> or <a shape="rect"
class="unresolved" href="#">OSGi</a> then <a shape="rect"
href="jndi.html">JNDI</a> is used as the default registry implementation.</p>
-
-<p>So you will also need to create a <strong>jndi.properties</strong> file in
your <strong>src/test/resources</strong> directory so that there is a default
registry available to initialise the <a shape="rect"
href="camelcontext.html">CamelContext</a>.</p>
-
-<p>Here is <a shape="rect" class="external-link"
href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-test/src/test/resources/jndi.properties">an
example jndi.properties file</a></p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[
-java.naming.factory.initial =
org.apache.camel.util.jndi.CamelInitialContextFactory
-]]></script>
-</div></div>
-
-<h3 id="Bookcookbook-Dynamicallyassigningports">Dynamically assigning
ports</h3>
-
-<p><strong>Available as of Camel 2.7</strong></p>
-
-<p>Tests that use port numbers will fail if that port is already on use.
<code>AvailablePortFinder</code> provides methods for finding unused port
numbers at runtime.</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[
-// Get the next available port number starting from the default starting port
of 1024
+</td><td colspan="1" rowspan="1" class="confluenceTd"><p>Returns false.
 the CamelContext is started automatically before test methods are
invoked.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>boolean isCreateCamelContextPerClass()</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>See <a shape="rect"
href="#Bookcookbook-SetupCamelContextonceperclass,orpereverytestmethod">Setup
CamelContext once per class, or per every test method</a>.</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>The CamelContext and routes are
recreated for each test method.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>String isMockEndpoints()</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Triggers the auto-mocking of endpoints
whose URIs match the provided filter.  The default filter is null
which disables this feature.  Return "*"  to match all endpoints.
 See org.apache.camel.impl.Intercep
tSendToMockEndpointStrategy for more details on the registration of
the mock endpoints.</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Disabled</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>boolean isUseDebugger()</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>If this method returns true,
the <strong>debugBefore(Exchange exchange, Processor processor,
ProcessorDefinition<?> definition, String id, String
label)</strong> and <br clear="none" class="atl-forced-newline">
<strong>debugAfter(Exchange exchange, Processor processor,
ProcessorDefinition<?> definition, String id, String label, long
timeTaken)</strong> methods are invoked for each processor in the
registered routes.</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Disabled.  The methods are not invoked during the
test.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>int
getShutdownTimeout()<
/p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Returns the number
of seconds that Camel should wait for graceful shutdown.  Useful for
decreasing test times when a message is still in flight at the end of the
test.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Returns 10
seconds.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>boolean useJmx()</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>If JMX should be disabled on the CamelContext used in
the test.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>JMX is
disabled.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>JndiRegistry createRegistry()</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Provides a hook for adding objects into the
registry.  Override this method to bind objects to the registry before
test methods are invoked.</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>An empty registry is initialized
.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>useOverridePropertiesWithPropertiesComponent</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.10:</strong>
Allows to add/override properties when <a shape="rect"
href="using-propertyplaceholder.html">Using PropertyPlaceholder</a> in
Camel.</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>null</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>ignoreMissingLocationWithPropertiesComponent</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.10:</strong>
Allows to control if Camel should ignore missing locations for
properties.</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>null</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd">boolean isDumpRouteStats</td><td colspan="1" rowspan="1"
class="confluenceTd"><strong>Camel 2.16:</strong> If enabled, then Camel will
dump all route statistics into XML files in the ta
rget/camel-route-stats directory. These XML files contains information about
"route coverage" of all the routes that was used during the unit test. This
allows tooling to inspect these XML files and generate nice route coverage
reports.</td><td colspan="1" rowspan="1"
class="confluenceTd">Disabled.</td></tr></tbody></table></div><h3
id="Bookcookbook-JNDI">JNDI</h3><p>Camel uses a <a shape="rect"
href="registry.html">Registry</a> to allow you to configure <a shape="rect"
href="component.html">Component</a> or <a shape="rect"
href="endpoint.html">Endpoint</a> instances or <a shape="rect"
href="bean-integration.html">Beans used in your routes</a>. If you are not
using <a shape="rect" href="spring.html">Spring</a> or <a shape="rect"
class="unresolved" href="#">OSGi</a> then <a shape="rect"
href="jndi.html">JNDI</a> is used as the default registry
implementation.</p><p>So you will also need to create a
<strong>jndi.properties</strong> file in your
<strong>src/test/resources</strong> dire
ctory so that there is a default registry available to initialise the <a
shape="rect" href="camelcontext.html">CamelContext</a>.</p><p>Here is <a
shape="rect" class="external-link"
href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-test/src/test/resources/jndi.properties">an
example jndi.properties file</a></p><h3
id="Bookcookbook-Dynamicallyassigningports">Dynamically assigning
ports</h3><p><strong>Available as of Camel 2.7</strong></p><p>Tests that use
port numbers will fail if that port is already on use.
<code>AvailablePortFinder</code> provides methods for finding unused port
numbers at runtime.</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[// Get the next available port number
starting from the default starting port of 1024
int port1 = AvailablePortFinder.getNextAvailable();
/*
* Get another port. Note that just getting a port number does not reserve it
so
@@ -2194,38 +2127,21 @@ int port1 = AvailablePortFinder.getNextA
*/
int port2 = AvailablePortFinder.getNextAvailable(port1 + 1);
]]></script>
-</div></div>
-
-
-<h3 id="Bookcookbook-SetupCamelContextonceperclass,orpereverytestmethod">Setup
CamelContext once per class, or per every test method</h3>
-
-<p><strong>Available as of Camel 2.8</strong></p>
-
-<p>The <a shape="rect" href="camel-test.html">Camel Test</a> kit will by
default setup and shutdown <a shape="rect"
href="camelcontext.html">CamelContext</a> per every test method in your test
class. So for example if you have 3 test methods, then <a shape="rect"
href="camelcontext.html">CamelContext</a> is started and shutdown after each
test, that is 3 times.</p>
-
- <div class="aui-message success shadowed information-macro">
+</div></div><h3
id="Bookcookbook-SetupCamelContextonceperclass,orpereverytestmethod">Setup
CamelContext once per class, or per every test method</h3><p><strong>Available
as of Camel 2.8</strong></p><p>The <a shape="rect" href="camel-test.html">Camel
Test</a> kit will by default setup and shutdown <a shape="rect"
href="camelcontext.html">CamelContext</a> per every test method in your test
class. So for example if you have 3 test methods, then <a shape="rect"
href="camelcontext.html">CamelContext</a> is started and shutdown after each
test, that is 3 times.</p> <div class="aui-message success shadowed
information-macro">
<p class="title">TestNG</p>
<span class="aui-icon icon-success">Icon</span>
<div class="message-content">
-
-<p>This feature is also supported in camel-testng</p>
+ <p>This feature is also supported in
camel-testng</p>
</div>
</div>
-
-
<div class="aui-message problem shadowed information-macro">
<p class="title">Beware</p>
<span class="aui-icon icon-problem">Icon</span>
<div class="message-content">
-
-<p>When using this the <a shape="rect"
href="camelcontext.html">CamelContext</a> will keep state between tests, so
have that in mind. So if your unit tests start to fail for no apparent reason,
it could be due this fact. So use this feature with a bit of care.</p>
+ <p>When using this the <a shape="rect"
href="camelcontext.html">CamelContext</a> will keep state between tests, so
have that in mind. So if your unit tests start to fail for no apparent reason,
it could be due this fact. So use this feature with a bit of care.</p>
</div>
</div>
-
-
-<p>You may want to do this once, to share the <a shape="rect"
href="camelcontext.html">CamelContext</a> between test methods, to speedup unit
testing. This requires to use JUnit 4! In your unit test method you have to
extend the <code>org.apache.camel.test.junit4.CamelTestSupport</code> or the
<code>org.apache.camel.test.junit4.CamelSpringTestSupport</code> test class and
override the <code>isCreateCamelContextPerClass</code> method and return
<code>true</code> as shown in the following example:</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader
panelHeader pdl" style="border-bottom-width: 1px;"><b>Setup CamelContext once
per class</b></div><div class="codeContent panelContent pdl">
+<p>You may want to do this once, to share the <a shape="rect"
href="camelcontext.html">CamelContext</a> between test methods, to speedup unit
testing. This requires to use JUnit 4! In your unit test method you have to
extend the <code>org.apache.camel.test.junit4.CamelTestSupport</code> or the
<code>org.apache.camel.test.junit4.CamelSpringTestSupport</code> test class and
override the <code>isCreateCamelContextPerClass</code> method and return
<code>true</code> as shown in the following example:</p><div class="code panel
pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl"
style="border-bottom-width: 1px;"><b>Setup CamelContext once per
class</b></div><div class="codeContent panelContent pdl">
<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[
public class FilterCreateCamelContextPerClassTest extends CamelTestSupport {
@@ -2267,12 +2183,10 @@ public class FilterCreateCamelContextPer
}
}
]]></script>
+</div></div><h3 id="Bookcookbook-SeeAlso.1">See Also</h3><ul><li><a
shape="rect" href="testing.html">Testing</a></li><li><a shape="rect"
href="mock.html">Mock</a></li><li><a shape="rect"
href="test.html">Test</a></li></ul><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[java.naming.factory.initial =
org.apache.camel.util.jndi.CamelInitialContextFactory
+]]></script>
</div></div>
-
-
-<h3 id="Bookcookbook-SeeAlso.1">See Also</h3>
-
-<ul><li><a shape="rect" href="testing.html">Testing</a></li><li><a
shape="rect" href="mock.html">Mock</a></li><li><a shape="rect"
href="test.html">Test</a></li></ul>
<h2 id="Bookcookbook-SpringTesting">Spring Testing</h2><p><a shape="rect"
href="testing.html">Testing</a> is a crucial part of any development or
integration work. The Spring Framework offers a number of features that makes
it easy to test while using Spring for Inversion of Control which works with
JUnit 3.x, JUnit 4.x, and <a shape="rect" class="external-link"
href="http://testng.org" rel="nofollow">TestNG</a>.</p><p>We can use Spring for
IoC and the Camel <a shape="rect" href="mock.html">Mock</a> and <a shape="rect"
href="test.html">Test</a> endpoints to create sophisticated integration/unit
tests that are easy to run and debug inside your IDE.  There are three
supported approaches for testing with Spring in Camel.</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>Testing Frameworks Supported</p></th><th colspan="1"
rowspan="1" class="conflu
enceTh"><p>Description</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>Required Camel Test Dependencies</p></th></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p>CamelSpringTestSupport</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><ul><li>JUnit 3.x (deprecated)</li><li>JUnit
4.x</li><li>TestNG - <strong>Camel 2.8</strong></li></ul></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Provided by
org.apache.camel.test.CamelSpringTestSupport,
org.apache.camel.test.junit4.CamelSpringTestSupport, and
org.apache.camel.testng.CamelSpringTestSupport.  These base classes
provide <a shape="rect"
href="camel-test.html#CamelTest-FeaturesProvidedbyCamelTestSupport">feature
parity</a> with the simple CamelTestSupport classes from <a
shape="rect" href="camel-test.html">Camel Test</a> but do not support
Spring annotations on the test class such as
<strong>@Autowired</strong>, <strong>@DirtiesContext</strong>,
and <strong>@ContextCo
nfiguration</strong>.</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><ul><li>JUnit 3.x (deprecated) -
camel-test-spring</li><li>JUnit 4.x - camel-test-spring</li><li>TestNG -
camel-test-ng</li></ul></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>Plain Spring Test</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><ul><li>JUnit 3.x</li><li>JUnit
4.x</li><li>TestNG</li></ul></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Extend the abstract base classes
(org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests, org.springframework.test.context.junit38.AbstractJUnit4SpringContextTests,
etc.) provided in Spring Test or use the Spring Test JUnit4 runner.
 These approaches support both the Camel annotations and Spring
annotations, but do not have <a shape="rect"
href="camel-test.html#CamelTest-FeaturesProvidedbyCamelTestSupport">feature
parity</a> with org.apache.camel.test.CamelTestSupport, org.apache.c
amel.test.junit4.CamelTestSupport, and
org.apache.camel.testng.CamelSpringTestSupport.</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><ul><li>JUnit 3.x (deprecated) -
None</li><li>JUnit 4.x - None</li><li>TestNG -
None</li></ul></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>Camel Enhanced Spring Test</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><ul><li>JUnit 4.x - <strong>Camel
2.10</strong></li><li>TestNG - <strong>Camel 2.10</strong></li></ul></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Use the
org.apache.camel.test.junit4.CamelSpringJUnit4ClassRunner runner with
the <strong>@RunWith</strong> annotation or extend
org.apache.camel.testng.AbstractCamelTestNGSpringContextTests to enable <a
shape="rect"
href="camel-test.html#CamelTest-FeaturesProvidedbyCamelTestSupport">feature
parity</a> with org.apache.camel.test.CamelTestSupport and
org.apache.camel.test.junit4.CamelTestSupport and also support the full s
uite of Spring Test annotations such
as <strong>@Autowired</strong>, <strong>@DirtiesContext</strong>, and
<strong>@ContextConfiguration</strong>.</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><ul><li>JUnit 3.x (deprecated) -
camel-test-spring</li><li>JUnit 4.x - camel-test-spring</li><li>TestNG -
camel-test-ng</li></ul></td></tr></tbody></table></div><h3
id="Bookcookbook-CamelSpringTestSupport">CamelSpringTestSupport</h3><p>org.apache.camel.test.CamelSpringTestSupport,
org.apache.camel.test.junit4.CamelSpringTestSupport, and
org.apache.camel.testng.CamelSpringTestSupport extend their non-Spring
aware counterparts (org.apache.camel.test.CamelTestSupport,
org.apache.camel.test.junit4.CamelTestSupport, and
org.apache.camel.testng.CamelTestSupport) and deliver integration with Spring
into your test classes.  Instead of instantiating the
CamelContext and routes programmatically, these classes rely on a Spring
context to wire the needed compo
nents together.  If your test extends one of these classes, you must
provide the Spring context by implementing the following method.</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[protected abstract AbstractApplicationContext
createApplicationContext();
]]></script>
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 Fri Apr 17 11:20:03
2015
@@ -3090,54 +3090,30 @@ public class DebugBlueprintTest extends
<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 5 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="BookInOnePage-CamelTest">Camel Test</h2>
-
-<p>As a simple alternative to using <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>
-
- <div class="aui-message hint shadowed information-macro">
+<h2 id="BookInOnePage-CamelTest">Camel Test</h2><p>As a simple alternative to
using <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> <div class="aui-message hint shadowed information-macro">
<span class="aui-icon icon-hint">Icon</span>
<div class="message-content">
-
-<p>The <code>camel-test</code> JAR is using JUnit. There is an alternative
<code>camel-testng</code> JAR (Camel 2.8 onwards) using the <a shape="rect"
class="external-link" href="http://testng.org/doc/index.html"
rel="nofollow">TestNG</a> test framework.</p>
+ <p>The <code>camel-test</code> JAR is using JUnit.
There is an alternative <code>camel-testng</code> JAR (Camel 2.8 onwards) using
the <a shape="rect" class="external-link"
href="http://testng.org/doc/index.html" rel="nofollow">TestNG</a> test
framework.</p>
</div>
</div>
-
-
-<h3 id="BookInOnePage-Addingtoyourpom.xml">Adding to your pom.xml</h3>
-
-<p>To get started using Camel Test you will need to add an entry to your
pom.xml</p>
-
-<h4 id="BookInOnePage-JUnit">JUnit</h4>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
-<dependency>
+<h3 id="BookInOnePage-Addingtoyourpom.xml">Adding to your pom.xml</h3><p>To
get started using Camel Test you will need to add an entry to your
pom.xml</p><h4 id="BookInOnePage-JUnit">JUnit</h4><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test</artifactId>
<version>${camel-version}</version>
<scope>test</scope>
</dependency>
]]></script>
-</div></div>
-
-<h4 id="BookInOnePage-TestNG">TestNG</h4>
-
-<p><strong>Available as of Camel 2.8</strong></p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
-<dependency>
+</div></div><h4 id="BookInOnePage-TestNG">TestNG</h4><p><strong>Available as
of Camel 2.8</strong></p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-testng</artifactId>
<version>${camel-version}</version>
<scope>test</scope>
</dependency>
]]></script>
-</div></div>
-
-<p>You might also want to add slf4j and log4j to ensure nice logging messages
(and maybe adding a <a shape="rect" class="external-link"
href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-test/src/test/resources/log4j.properties">log4j.properties</a>
file into your src/test/resources directory).</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[
-<dependency>
+</div></div><p>You might also want to add slf4j and log4j to ensure nice
logging messages (and maybe adding a <a shape="rect" class="external-link"
href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-test/src/test/resources/log4j.properties">log4j.properties</a>
file into your src/test/resources directory).</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<scope>test</scope>
@@ -3148,15 +3124,7 @@ public class DebugBlueprintTest extends
<scope>test</scope>
</dependency>
]]></script>
-</div></div>
-
-<h3 id="BookInOnePage-Writingyourtest">Writing your test</h3>
-
-<p>You firstly need to derive from the class
<strong>CamelTestSupport</strong> (org.apache.camel.test.CamelTestSupport,
org.apache.camel.test.junit4.CamelTestSupport, or
org.apache.camel.testng.CamelTestSupport for JUnit 3.x, JUnit 4.x, and TestNG,
respectively) and typically you will need to override the
<strong>createRouteBuilder()</strong>
or <strong>createRouteBuilders()</strong> method to create routes to
be tested.</p>
-
-<p>Here is an <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>.</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
+</div></div><h3 id="BookInOnePage-Writingyourtest">Writing your
test</h3><p>You firstly need to derive from the class
<strong>CamelTestSupport</strong> (org.apache.camel.test.CamelTestSupport,
org.apache.camel.test.junit4.CamelTestSupport, or
org.apache.camel.testng.CamelTestSupport for JUnit 3.x, JUnit 4.x, and TestNG,
respectively) and typically you will need to override the
<strong>createRouteBuilder()</strong>
or <strong>createRouteBuilders()</strong> method to create routes to
be tested.</p><p>Here is an <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>.</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[
public class FilterTest extends CamelTestSupport {
@@ -3196,49 +3164,14 @@ public class FilterTest extends CamelTes
}
}
]]></script>
-</div></div>
-
-<p>Notice how you can use the various <a shape="rect"
href="bean-integration.html">Camel binding and injection annotations</a> to
inject individual <a shape="rect" href="endpoint.html">Endpoint</a> objects -
particularly the <a shape="rect" href="mock.html">Mock endpoints</a> which are
very useful for <a shape="rect" href="testing.html">Testing</a>. Also you can
inject <a shape="rect" href="pojo-producing.html">producer objects such as
ProducerTemplate or some application code interface</a> for sending messages or
invoking services.</p>
-
-<h4 id="BookInOnePage-FeaturesProvidedbyCamelTestSupport">Features Provided by
CamelTestSupport</h4>
-
-<p>The various <strong>CamelTestSupport</strong> classes provide a standard
set of behaviors relating to the CamelContext used to host the route(s) under
test.  The classes provide a number of methods that allow a test to alter
the configuration of the CamelContext used.  The following table describes
the available customization methods and the default behavior of tests that are
built from a <strong>CamelTestSupport</strong> class.</p>
-<div class="table-wrap"><table class="confluenceTable"><tbody><tr><th
colspan="1" rowspan="1" class="confluenceTh"><p> Method Name </p></th><th
colspan="1" rowspan="1" class="confluenceTh"><p> Description </p></th><th
colspan="1" rowspan="1" class="confluenceTh"><p> Default Behavior
</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> boolean
isUseRouteBuilder() </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> If the route builders from returned
from <strong>createRouteBuilder()</strong> or
<strong>createRouteBuilders()</strong> should be added to the CamelContext used
in the test should be started. </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> Returns true.
 <strong>createRouteBuilder()</strong> or <strong>createRouteBuilders()</strong>
are invoked and the CamelContext is started automatically.
</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> boolean
isUseAdviceWith() <br clear="none" class="at
l-forced-newline"> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> If the CamelContext use in the test should be
automatically started before test methods are invoked. <br clear="none"
class="atl-forced-newline">
-Override when using <a shape="rect" href="advicewith.html">advice
with</a> and return true.  This helps in knowing the adviceWith is to
be used, and the CamelContext will not be started before the
advice with takes place. This delay helps by ensuring the advice with has been
property setup before the CamelContext is started.</p>
- <div class="aui-message hint shadowed information-macro">
+</div></div><p>Notice how you can use the various <a shape="rect"
href="bean-integration.html">Camel binding and injection annotations</a> to
inject individual <a shape="rect" href="endpoint.html">Endpoint</a> objects -
particularly the <a shape="rect" href="mock.html">Mock endpoints</a> which are
very useful for <a shape="rect" href="testing.html">Testing</a>. Also you can
inject <a shape="rect" href="pojo-producing.html">producer objects such as
ProducerTemplate or some application code interface</a> for sending messages or
invoking services.</p><h4
id="BookInOnePage-FeaturesProvidedbyCamelTestSupport">Features Provided by
CamelTestSupport</h4><p>The various <strong>CamelTestSupport</strong> classes
provide a standard set of behaviors relating to the CamelContext used to host
the route(s) under test.  The classes provide a number of methods that
allow a test to alter the configuration of the CamelContext used.  The
following table describes the available customization me
thods and the default behavior of tests that are built from
a <strong>CamelTestSupport</strong> class.</p><div
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1"
rowspan="1" class="confluenceTh"><p>Method Name</p></th><th colspan="1"
rowspan="1" class="confluenceTh"><p>Description</p></th><th colspan="1"
rowspan="1" class="confluenceTh"><p>Default Behavior</p></th></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>boolean
isUseRouteBuilder()</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>If the route builders from returned
from <strong>createRouteBuilder()</strong> or
<strong>createRouteBuilders()</strong> should be added to the CamelContext used
in the test should be started.</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Returns true.
 <strong>createRouteBuilder()</strong> or <strong>createRouteBuilders()</strong>
are invoked and the CamelContext is started
automatically.</p></td></tr><tr><td co
lspan="1" rowspan="1" class="confluenceTd"><p>boolean
isUseAdviceWith()</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>If the CamelContext use in the test should be
automatically started before test methods are invoked. <br clear="none"
class="atl-forced-newline"> Override when using <a shape="rect"
href="advicewith.html">advice with</a> and return true.  This helps
in knowing the adviceWith is to be used, and the CamelContext will
not be started before the advice with takes place. This delay helps by
ensuring the advice with has been property setup before
the CamelContext is started.</p> <div class="aui-message hint
shadowed information-macro">
<span class="aui-icon icon-hint">Icon</span>
<div class="message-content">
<p>Its important to start the CamelContext
manually from the unit test after you are done doing all the advice with.</p>
</div>
</div>
-
-<p><br clear="none" class="atl-forced-newline"> </p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> Returns false.  the CamelContext is
started automatically before test methods are invoked. </p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p> boolean
isCreateCamelContextPerClass() <br clear="none" class="atl-forced-newline">
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> See <a
shape="rect"
href="#BookInOnePage-SetupCamelContextonceperclass,orpereverytestmethod">Setup
CamelContext once per class, or per every test method</a>. </p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> The CamelContext and routes
are recreated for each test method. </p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p> String isMockEndpoints() </p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> Triggers the auto-mocking of
endpoints whose URIs match the provided filter.  The default filter
is null which disabl
es this feature.  Return "*"  to match all endpoints.
 See org.apache.camel.impl.InterceptSendToMockEndpointStrategy for more
details on the registration of the mock endpoints. </p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> Disabled </p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p> boolean isUseDebugger() </p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> If this method returns true,
the <strong>debugBefore(Exchange exchange, Processor processor,
ProcessorDefinition<?> definition, String id, String
label)</strong> and <br clear="none" class="atl-forced-newline">
-<strong>debugAfter(Exchange exchange, Processor processor,
ProcessorDefinition<?> definition, String id, String label, long
timeTaken)</strong> methods are invoked for each processor in the
registered routes. </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> Disabled.  The methods are not invoked during the
test. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>
int getShutdownTimeout() </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> Returns the number of seconds that Camel should wait
for graceful shutdown.  Useful for decreasing test times when a message is
still in flight at the end of the test. </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> Returns 10 seconds. </p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p> boolean useJmx() </p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> If JMX should be disabled on the
CamelContext used in the test. </p></td><td colspan="
1" rowspan="1" class="confluenceTd"><p> JMX is disabled. </p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p> JndiRegistry createRegistry()
<br clear="none" class="atl-forced-newline"> </p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> Provides a hook for adding objects into
the registry.  Override this method to bind objects to the registry before
test methods are invoked. </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> An empty registry is initialized.
</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>
useOverridePropertiesWithPropertiesComponent </p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> <strong>Camel 2.10:</strong> Allows to
add/override properties when <a shape="rect"
href="using-propertyplaceholder.html">Using PropertyPlaceholder</a> in Camel.
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> null
</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>
ignoreMissin
gLocationWithPropertiesComponent </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> <strong>Camel 2.10:</strong> Allows to control if
Camel should ignore missing locations for properties. </p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> null </p></td></tr></tbody></table></div>
-
-
-<h3 id="BookInOnePage-JNDI">JNDI</h3>
-
-<p>Camel uses a <a shape="rect" href="registry.html">Registry</a> to allow you
to configure <a shape="rect" href="component.html">Component</a> or <a
shape="rect" href="endpoint.html">Endpoint</a> instances or <a shape="rect"
href="bean-integration.html">Beans used in your routes</a>. If you are not
using <a shape="rect" href="spring.html">Spring</a> or <a shape="rect"
class="unresolved" href="#">OSGi</a> then <a shape="rect"
href="jndi.html">JNDI</a> is used as the default registry implementation.</p>
-
-<p>So you will also need to create a <strong>jndi.properties</strong> file in
your <strong>src/test/resources</strong> directory so that there is a default
registry available to initialise the <a shape="rect"
href="camelcontext.html">CamelContext</a>.</p>
-
-<p>Here is <a shape="rect" class="external-link"
href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-test/src/test/resources/jndi.properties">an
example jndi.properties file</a></p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[
-java.naming.factory.initial =
org.apache.camel.util.jndi.CamelInitialContextFactory
-]]></script>
-</div></div>
-
-<h3 id="BookInOnePage-Dynamicallyassigningports">Dynamically assigning
ports</h3>
-
-<p><strong>Available as of Camel 2.7</strong></p>
-
-<p>Tests that use port numbers will fail if that port is already on use.
<code>AvailablePortFinder</code> provides methods for finding unused port
numbers at runtime.</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[
-// Get the next available port number starting from the default starting port
of 1024
+</td><td colspan="1" rowspan="1" class="confluenceTd"><p>Returns false.
 the CamelContext is started automatically before test methods are
invoked.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>boolean isCreateCamelContextPerClass()</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>See <a shape="rect"
href="#BookInOnePage-SetupCamelContextonceperclass,orpereverytestmethod">Setup
CamelContext once per class, or per every test method</a>.</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>The CamelContext and routes are
recreated for each test method.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>String isMockEndpoints()</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Triggers the auto-mocking of endpoints
whose URIs match the provided filter.  The default filter is null
which disables this feature.  Return "*"  to match all endpoints.
 See org.apache.camel.impl.Interce
ptSendToMockEndpointStrategy for more details on the registration of
the mock endpoints.</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Disabled</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>boolean isUseDebugger()</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>If this method returns true,
the <strong>debugBefore(Exchange exchange, Processor processor,
ProcessorDefinition<?> definition, String id, String
label)</strong> and <br clear="none" class="atl-forced-newline">
<strong>debugAfter(Exchange exchange, Processor processor,
ProcessorDefinition<?> definition, String id, String label, long
timeTaken)</strong> methods are invoked for each processor in the
registered routes.</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Disabled.  The methods are not invoked during the
test.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>int
getShutdownTimeout()
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Returns the
number of seconds that Camel should wait for graceful shutdown.  Useful
for decreasing test times when a message is still in flight at the end of the
test.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Returns 10
seconds.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>boolean useJmx()</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>If JMX should be disabled on the CamelContext used in
the test.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>JMX is
disabled.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>JndiRegistry createRegistry()</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Provides a hook for adding objects into the
registry.  Override this method to bind objects to the registry before
test methods are invoked.</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>An empty registry is initialize
d.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>useOverridePropertiesWithPropertiesComponent</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.10:</strong>
Allows to add/override properties when <a shape="rect"
href="using-propertyplaceholder.html">Using PropertyPlaceholder</a> in
Camel.</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>null</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>ignoreMissingLocationWithPropertiesComponent</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.10:</strong>
Allows to control if Camel should ignore missing locations for
properties.</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>null</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd">boolean isDumpRouteStats</td><td colspan="1" rowspan="1"
class="confluenceTd"><strong>Camel 2.16:</strong> If enabled, then Camel will
dump all route statistics into XML files in the t
arget/camel-route-stats directory. These XML files contains information about
"route coverage" of all the routes that was used during the unit test. This
allows tooling to inspect these XML files and generate nice route coverage
reports.</td><td colspan="1" rowspan="1"
class="confluenceTd">Disabled.</td></tr></tbody></table></div><h3
id="BookInOnePage-JNDI">JNDI</h3><p>Camel uses a <a shape="rect"
href="registry.html">Registry</a> to allow you to configure <a shape="rect"
href="component.html">Component</a> or <a shape="rect"
href="endpoint.html">Endpoint</a> instances or <a shape="rect"
href="bean-integration.html">Beans used in your routes</a>. If you are not
using <a shape="rect" href="spring.html">Spring</a> or <a shape="rect"
class="unresolved" href="#">OSGi</a> then <a shape="rect"
href="jndi.html">JNDI</a> is used as the default registry
implementation.</p><p>So you will also need to create a
<strong>jndi.properties</strong> file in your
<strong>src/test/resources</strong> di
rectory so that there is a default registry available to initialise the <a
shape="rect" href="camelcontext.html">CamelContext</a>.</p><p>Here is <a
shape="rect" class="external-link"
href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-test/src/test/resources/jndi.properties">an
example jndi.properties file</a></p><h3
id="BookInOnePage-Dynamicallyassigningports">Dynamically assigning
ports</h3><p><strong>Available as of Camel 2.7</strong></p><p>Tests that use
port numbers will fail if that port is already on use.
<code>AvailablePortFinder</code> provides methods for finding unused port
numbers at runtime.</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[// Get the next available port number
starting from the default starting port of 1024
int port1 = AvailablePortFinder.getNextAvailable();
/*
* Get another port. Note that just getting a port number does not reserve it
so
@@ -3246,38 +3179,21 @@ int port1 = AvailablePortFinder.getNextA
*/
int port2 = AvailablePortFinder.getNextAvailable(port1 + 1);
]]></script>
-</div></div>
-
-
-<h3
id="BookInOnePage-SetupCamelContextonceperclass,orpereverytestmethod">Setup
CamelContext once per class, or per every test method</h3>
-
-<p><strong>Available as of Camel 2.8</strong></p>
-
-<p>The <a shape="rect" href="camel-test.html">Camel Test</a> kit will by
default setup and shutdown <a shape="rect"
href="camelcontext.html">CamelContext</a> per every test method in your test
class. So for example if you have 3 test methods, then <a shape="rect"
href="camelcontext.html">CamelContext</a> is started and shutdown after each
test, that is 3 times.</p>
-
- <div class="aui-message success shadowed information-macro">
+</div></div><h3
id="BookInOnePage-SetupCamelContextonceperclass,orpereverytestmethod">Setup
CamelContext once per class, or per every test method</h3><p><strong>Available
as of Camel 2.8</strong></p><p>The <a shape="rect" href="camel-test.html">Camel
Test</a> kit will by default setup and shutdown <a shape="rect"
href="camelcontext.html">CamelContext</a> per every test method in your test
class. So for example if you have 3 test methods, then <a shape="rect"
href="camelcontext.html">CamelContext</a> is started and shutdown after each
test, that is 3 times.</p> <div class="aui-message success shadowed
information-macro">
<p class="title">TestNG</p>
<span class="aui-icon icon-success">Icon</span>
<div class="message-content">
-
-<p>This feature is also supported in camel-testng</p>
+ <p>This feature is also supported in
camel-testng</p>
</div>
</div>
-
-
<div class="aui-message problem shadowed information-macro">
<p class="title">Beware</p>
<span class="aui-icon icon-problem">Icon</span>
<div class="message-content">
-
-<p>When using this the <a shape="rect"
href="camelcontext.html">CamelContext</a> will keep state between tests, so
have that in mind. So if your unit tests start to fail for no apparent reason,
it could be due this fact. So use this feature with a bit of care.</p>
+ <p>When using this the <a shape="rect"
href="camelcontext.html">CamelContext</a> will keep state between tests, so
have that in mind. So if your unit tests start to fail for no apparent reason,
it could be due this fact. So use this feature with a bit of care.</p>
</div>
</div>
-
-
-<p>You may want to do this once, to share the <a shape="rect"
href="camelcontext.html">CamelContext</a> between test methods, to speedup unit
testing. This requires to use JUnit 4! In your unit test method you have to
extend the <code>org.apache.camel.test.junit4.CamelTestSupport</code> or the
<code>org.apache.camel.test.junit4.CamelSpringTestSupport</code> test class and
override the <code>isCreateCamelContextPerClass</code> method and return
<code>true</code> as shown in the following example:</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader
panelHeader pdl" style="border-bottom-width: 1px;"><b>Setup CamelContext once
per class</b></div><div class="codeContent panelContent pdl">
+<p>You may want to do this once, to share the <a shape="rect"
href="camelcontext.html">CamelContext</a> between test methods, to speedup unit
testing. This requires to use JUnit 4! In your unit test method you have to
extend the <code>org.apache.camel.test.junit4.CamelTestSupport</code> or the
<code>org.apache.camel.test.junit4.CamelSpringTestSupport</code> test class and
override the <code>isCreateCamelContextPerClass</code> method and return
<code>true</code> as shown in the following example:</p><div class="code panel
pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl"
style="border-bottom-width: 1px;"><b>Setup CamelContext once per
class</b></div><div class="codeContent panelContent pdl">
<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[
public class FilterCreateCamelContextPerClassTest extends CamelTestSupport {
@@ -3319,12 +3235,10 @@ public class FilterCreateCamelContextPer
}
}
]]></script>
+</div></div><h3 id="BookInOnePage-SeeAlso.1">See Also</h3><ul><li><a
shape="rect" href="testing.html">Testing</a></li><li><a shape="rect"
href="mock.html">Mock</a></li><li><a shape="rect"
href="test.html">Test</a></li></ul><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[java.naming.factory.initial =
org.apache.camel.util.jndi.CamelInitialContextFactory
+]]></script>
</div></div>
-
-
-<h3 id="BookInOnePage-SeeAlso.1">See Also</h3>
-
-<ul><li><a shape="rect" href="testing.html">Testing</a></li><li><a
shape="rect" href="mock.html">Mock</a></li><li><a shape="rect"
href="test.html">Test</a></li></ul>
<h2 id="BookInOnePage-SpringTesting">Spring Testing</h2><p><a shape="rect"
href="testing.html">Testing</a> is a crucial part of any development or
integration work. The Spring Framework offers a number of features that makes
it easy to test while using Spring for Inversion of Control which works with
JUnit 3.x, JUnit 4.x, and <a shape="rect" class="external-link"
href="http://testng.org" rel="nofollow">TestNG</a>.</p><p>We can use Spring for
IoC and the Camel <a shape="rect" href="mock.html">Mock</a> and <a shape="rect"
href="test.html">Test</a> endpoints to create sophisticated integration/unit
tests that are easy to run and debug inside your IDE.  There are three
supported approaches for testing with Spring in Camel.</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>Testing Frameworks Supported</p></th><th colspan="1"
rowspan="1" class="confl
uenceTh"><p>Description</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>Required Camel Test Dependencies</p></th></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p>CamelSpringTestSupport</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><ul><li>JUnit 3.x (deprecated)</li><li>JUnit
4.x</li><li>TestNG - <strong>Camel 2.8</strong></li></ul></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Provided by
org.apache.camel.test.CamelSpringTestSupport,
org.apache.camel.test.junit4.CamelSpringTestSupport, and
org.apache.camel.testng.CamelSpringTestSupport.  These base classes
provide <a shape="rect"
href="camel-test.html#CamelTest-FeaturesProvidedbyCamelTestSupport">feature
parity</a> with the simple CamelTestSupport classes from <a
shape="rect" href="camel-test.html">Camel Test</a> but do not support
Spring annotations on the test class such as
<strong>@Autowired</strong>, <strong>@DirtiesContext</strong>,
and <strong>@ContextC
onfiguration</strong>.</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><ul><li>JUnit 3.x (deprecated) -
camel-test-spring</li><li>JUnit 4.x - camel-test-spring</li><li>TestNG -
camel-test-ng</li></ul></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>Plain Spring Test</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><ul><li>JUnit 3.x</li><li>JUnit
4.x</li><li>TestNG</li></ul></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Extend the abstract base classes
(org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests, org.springframework.test.context.junit38.AbstractJUnit4SpringContextTests,
etc.) provided in Spring Test or use the Spring Test JUnit4 runner.
 These approaches support both the Camel annotations and Spring
annotations, but do not have <a shape="rect"
href="camel-test.html#CamelTest-FeaturesProvidedbyCamelTestSupport">feature
parity</a> with org.apache.camel.test.CamelTestSupport, org.apache.
camel.test.junit4.CamelTestSupport, and
org.apache.camel.testng.CamelSpringTestSupport.</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><ul><li>JUnit 3.x (deprecated) -
None</li><li>JUnit 4.x - None</li><li>TestNG -
None</li></ul></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>Camel Enhanced Spring Test</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><ul><li>JUnit 4.x - <strong>Camel
2.10</strong></li><li>TestNG - <strong>Camel 2.10</strong></li></ul></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Use the
org.apache.camel.test.junit4.CamelSpringJUnit4ClassRunner runner with
the <strong>@RunWith</strong> annotation or extend
org.apache.camel.testng.AbstractCamelTestNGSpringContextTests to enable <a
shape="rect"
href="camel-test.html#CamelTest-FeaturesProvidedbyCamelTestSupport">feature
parity</a> with org.apache.camel.test.CamelTestSupport and
org.apache.camel.test.junit4.CamelTestSupport and also support the full
suite of Spring Test annotations such
as <strong>@Autowired</strong>, <strong>@DirtiesContext</strong>, and
<strong>@ContextConfiguration</strong>.</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><ul><li>JUnit 3.x (deprecated) -
camel-test-spring</li><li>JUnit 4.x - camel-test-spring</li><li>TestNG -
camel-test-ng</li></ul></td></tr></tbody></table></div><h3
id="BookInOnePage-CamelSpringTestSupport">CamelSpringTestSupport</h3><p>org.apache.camel.test.CamelSpringTestSupport,
org.apache.camel.test.junit4.CamelSpringTestSupport, and
org.apache.camel.testng.CamelSpringTestSupport extend their non-Spring
aware counterparts (org.apache.camel.test.CamelTestSupport,
org.apache.camel.test.junit4.CamelTestSupport, and
org.apache.camel.testng.CamelTestSupport) and deliver integration with Spring
into your test classes.  Instead of instantiating the
CamelContext and routes programmatically, these classes rely on a Spring
context to wire the needed com
ponents together.  If your test extends one of these classes, you must
provide the Spring context by implementing the following method.</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[protected abstract AbstractApplicationContext
createApplicationContext();
]]></script>
@@ -4126,11 +4040,11 @@ While not actual tutorials you might fin
</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.rbtoc1429024691105 {padding: 0px;}
-div.rbtoc1429024691105 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1429024691105 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1429269494156 {padding: 0px;}
+div.rbtoc1429269494156 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1429269494156 li {margin-left: 0px;padding-left: 0px;}
-/*]]>*/</style></p><div class="toc-macro rbtoc1429024691105">
+/*]]>*/</style></p><div class="toc-macro rbtoc1429269494156">
<ul class="toc-indentation"><li><a shape="rect"
href="#Tutorial-JmsRemoting-TutorialonSpringRemotingwithJMS">Tutorial on Spring
Remoting with JMS</a></li><li><a shape="rect"
href="#Tutorial-JmsRemoting-Preface">Preface</a></li><li><a shape="rect"
href="#Tutorial-JmsRemoting-Prerequisites">Prerequisites</a></li><li><a
shape="rect"
href="#Tutorial-JmsRemoting-Distribution">Distribution</a></li><li><a
shape="rect" href="#Tutorial-JmsRemoting-About">About</a></li><li><a
shape="rect" href="#Tutorial-JmsRemoting-CreatetheCamelProject">Create the
Camel Project</a>
<ul class="toc-indentation"><li><a shape="rect"
href="#Tutorial-JmsRemoting-UpdatethePOMwithDependencies">Update the POM with
Dependencies</a></li></ul>
</li><li><a shape="rect" href="#Tutorial-JmsRemoting-WritingtheServer">Writing
the Server</a>
@@ -6316,11 +6230,11 @@ So we completed the last piece in the pi
<style type="text/css">/*<![CDATA[*/
-div.rbtoc1429024691449 {padding: 0px;}
-div.rbtoc1429024691449 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1429024691449 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1429269494519 {padding: 0px;}
+div.rbtoc1429269494519 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1429269494519 li {margin-left: 0px;padding-left: 0px;}
-/*]]>*/</style><div class="toc-macro rbtoc1429024691449">
+/*]]>*/</style><div class="toc-macro rbtoc1429269494519">
<ul class="toc-indentation"><li><a shape="rect"
href="#Tutorial-AXIS-Camel-TutorialusingAxis1.4withApacheCamel">Tutorial using
Axis 1.4 with Apache Camel</a>
<ul class="toc-indentation"><li><a shape="rect"
href="#Tutorial-AXIS-Camel-Prerequisites">Prerequisites</a></li><li><a
shape="rect"
href="#Tutorial-AXIS-Camel-Distribution">Distribution</a></li><li><a
shape="rect"
href="#Tutorial-AXIS-Camel-Introduction">Introduction</a></li><li><a
shape="rect" href="#Tutorial-AXIS-Camel-SettinguptheprojecttorunAxis">Setting
up the project to run Axis</a>
<ul class="toc-indentation"><li><a shape="rect"
href="#Tutorial-AXIS-Camel-Maven2">Maven 2</a></li><li><a shape="rect"
href="#Tutorial-AXIS-Camel-wsdl">wsdl</a></li><li><a shape="rect"
href="#Tutorial-AXIS-Camel-ConfiguringAxis">Configuring Axis</a></li><li><a
shape="rect" href="#Tutorial-AXIS-Camel-RunningtheExample">Running the
Example</a></li></ul>
@@ -13147,7 +13061,7 @@ RouteBuilder builder = new RouteBuilder(
<p class="title">Difference between Dead Letter Channel
and Default Error Handler</p>
<span class="aui-icon icon-success">Icon</span>
<div class="message-content">
- <p>The major difference is that <a shape="rect"
href="dead-letter-channel.html">Dead Letter Channel</a> has a dead letter queue
that whenever an <a shape="rect" href="exchange.html">Exchange</a> could not be
processed is moved to. It will <strong>always</strong> move failed exchanges to
this queue.</p><p>Unlike the <a shape="rect"
href="defaulterrorhandler.html">Default Error Handler</a> that does
<strong>not</strong> have a dead letter queue. So whenever an <a shape="rect"
href="exchange.html">Exchange</a> could not be processed the error is
propagated back to the client.</p><p><strong>Notice:</strong> You can adjust
this behavior of whether the client should be notified or not with the
<strong>handled</strong> option.</p><p>When the DeadLetterChannel moves a
message to the dead letter endpoint, then if any new exceptions is thrown
during that process, then by default the dead letter channel will handle the
new exception as well. This ensures that the De
adLetterChannel will always succeed. From <strong>Camel 2.15</strong> onwards
this behavior can be changed by setting the option
deadLetterHandleNewException=false. Then if a new exception is thrown, then the
dead letter channel will fail and propagate back that new exception (which is
the behavior of the default error handler). When a new exception occurs then
the dead letter channel logs this at WARN level. This can be turned off by
setting logNewException=false.</p>
+ <p>The Default Error Handler does very little: it
ends the Exchange immediately and propagates the thrown Exception back to the
caller.</p><p>The Dead Letter Channel lets you control behaviors including
redelivery, whether to propagate the thrown Exception to the caller (the
<strong>handled</strong> option), and where the (failed) Exchange should now be
routed to.</p><p>When the DeadLetterChannel moves a message to the dead letter
endpoint, any new Exception thrown is by default handled by the dead letter
channel as well. This ensures that the DeadLetterChannel will always succeed.
From <strong>Camel 2.15</strong> onwards this behavior can be changed by
setting the option deadLetterHandleNewException=false. Then if a new Exception
is thrown, then the dead letter channel will fail and propagate back that new
Exception (which is the behavior of the default error handler). When a new
Exception occurs then the dead letter channel logs this at WARN level. This
can be turned off by setting logNewException=false.</p>
</div>
</div>
<h3 id="BookInOnePage-Redelivery">Redelivery</h3><p>It is common for a
temporary outage or database deadlock to cause a message to fail to process;
but the chances are if its tried a few more times with some time delay then it
will complete fine. So we typically wish to use some kind of redelivery policy
to decide how many times to try redeliver a message and how long to wait before
redelivery attempts.</p><p>The <a shape="rect" class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/processor/RedeliveryPolicy.html">RedeliveryPolicy</a>
defines how the message is to be redelivered. You can customize things
like</p><ul><li>how many times a message is attempted to be redelivered before
it is considered a failure and sent to the dead letter channel</li><li>the
initial redelivery timeout</li><li>whether or not exponential backoff is used
(i.e. the time between retries increases using a backoff
multiplier)</li><li>whether to use collision avo
idance to add some randomness to the timings</li><li>delay pattern (see below
for details)</li><li><strong>Camel 2.11:</strong> whether to allow redelivery
during stopping/shutdown</li></ul><p>Once all attempts at redelivering the
message fails then the message is forwarded to the dead letter queue.</p><h3
id="BookInOnePage-AboutmovingExchangetodeadletterqueueandusinghandled">About
moving Exchange to dead letter queue and using
handled</h3><p><strong>Handled</strong> on <a shape="rect"
href="dead-letter-channel.html">Dead Letter Channel</a></p><p>When all attempts
of redelivery have failed the <a shape="rect" href="exchange.html">Exchange</a>
is moved to the dead letter queue (the dead letter endpoint). The exchange is
then complete and from the client point of view it was processed. As such the
<a shape="rect" href="dead-letter-channel.html">Dead Letter Channel</a> have
handled the <a shape="rect" href="exchange.html">Exchange</a>.</p><p>For
instance configuring the dead letter cha
nnel as:</p><p><strong>Using the <a shape="rect"
href="fluent-builders.html">Fluent Builders</a></strong></p><div class="code
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
@@ -13307,7 +13221,7 @@ public class MyRedeliverProcessor implem
}
}
]]></script>
-</div></div><p></p><h4 id="BookInOnePage-UsingThisPattern.8">Using This
Pattern</h4>
+</div></div><h3
id="BookInOnePage-HowcanIlogwhatcausedtheDeadLetterChanneltobeinvoked?">How can
I log what caused the Dead Letter Channel to be invoked?</h3><p>You often need
to know what went wrong that caused the Dead Letter Channel to be used and it
does not offer logging for this purpose. So the Dead Letter Channel's endpoint
can be set to a endpoint of our own (such
as <code>direct:deadLetterChannel</code>). We write a route to accept this
Exchange and log the Exception, then forward on to where we want the failed
Exchange moved to (which might be a DLQ queue for instance). See also <a
shape="rect" class="external-link"
href="http://stackoverflow.com/questions/13711462/logging-camel-exceptions-and-sending-to-the-dead-letter-channel"
rel="nofollow">http://stackoverflow.com/questions/13711462/logging-camel-exceptions-and-sending-to-the-dead-letter-channel</a></p><p></p><h4
id="BookInOnePage-UsingThisPattern.8">Using This Pattern</h4>
<p>If you would like to use this EIP Pattern then please read the <a
shape="rect" href="getting-started.html">Getting Started</a>, you may also find
the <a shape="rect" href="architecture.html">Architecture</a> useful
particularly the description of <a shape="rect"
href="endpoint.html">Endpoint</a> and <a shape="rect"
href="uris.html">URIs</a>. Then you could try out some of the <a shape="rect"
href="examples.html">Examples</a> first before trying this pattern out.</p><ul
class="alternate"><li><a shape="rect" href="error-handler.html">Error
Handler</a></li><li><a shape="rect" href="exception-clause.html">Exception
Clause</a></li></ul>
<h3 id="BookInOnePage-GuaranteedDelivery">Guaranteed Delivery</h3><p>Camel
supports the <a shape="rect" class="external-link"
href="http://www.enterpriseintegrationpatterns.com/GuaranteedMessaging.html"
rel="nofollow">Guaranteed Delivery</a> from the <a shape="rect"
href="enterprise-integration-patterns.html">EIP patterns</a> using among others
the following components:</p><ul><li><a shape="rect" href="file2.html">File</a>
for using file systems as a persistent store of messages</li><li><a
shape="rect" href="jms.html">JMS</a> when using persistent delivery (the
default) for working with JMS Queues and Topics for high performance,
clustering and load balancing</li><li><a shape="rect" href="jpa.html">JPA</a>
for using a database as a persistence layer, or use any of the many other
database component such as <a shape="rect" href="sql.html">SQL</a>, <a
shape="rect" href="jdbc.html">JDBC</a>, <a shape="rect"
href="ibatis.html">iBATIS</a>/<a shape="rect" href="mybatis.html">MyBatis</a>, <
a shape="rect" href="hibernate.html">Hibernate</a></li><li><a shape="rect"
href="hawtdb.html">HawtDB</a> for a lightweight key-value persistent
store</li></ul><p><img class="confluence-embedded-image
confluence-external-resource"
src="http://www.enterpriseintegrationpatterns.com/img/GuaranteedMessagingSolution.gif"
data-image-src="http://www.enterpriseintegrationpatterns.com/img/GuaranteedMessagingSolution.gif"></p><h4
id="BookInOnePage-Example.7">Example</h4><p>The following example demonstrates
illustrates the use of <a shape="rect" class="external-link"
href="http://www.enterpriseintegrationpatterns.com/GuaranteedMessaging.html"
rel="nofollow">Guaranteed Delivery</a> within the <a shape="rect"
href="jms.html">JMS</a> component. By default, a message is not considered
successfully delivered until the recipient has persisted the message locally
guaranteeing its receipt in the event the destination becomes
unavailable.</p><p><strong>Using the <a shape="rect"
href="fluent-builders.html">Fluent Builders</a></strong></p><div class="code
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
@@ -18937,11 +18851,11 @@ template.send("direct:alias-verify&
</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.rbtoc1429024711504 {padding: 0px;}
-div.rbtoc1429024711504 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1429024711504 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1429269506963 {padding: 0px;}
+div.rbtoc1429269506963 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1429269506963 li {margin-left: 0px;padding-left: 0px;}
-/*]]>*/</style></p><div class="toc-macro rbtoc1429024711504">
+/*]]>*/</style></p><div class="toc-macro rbtoc1429269506963">
<ul class="toc-indentation"><li><a shape="rect" href="#CXF-CXFComponent">CXF
Component</a>
<ul class="toc-indentation"><li><a shape="rect" href="#CXF-URIformat">URI
format</a></li><li><a shape="rect" href="#CXF-Options">Options</a>
<ul class="toc-indentation"><li><a shape="rect"
href="#CXF-Thedescriptionsofthedataformats">The descriptions of the
dataformats</a>