Author: buildbot
Date: Wed Mar 9 17:20:26 2016
New Revision: 982326
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/cache/main.pageCache
websites/production/camel/content/camel-test.html
websites/production/camel/content/cdi-testing.html
Modified: websites/production/camel/content/book-cookbook.html
==============================================================================
--- websites/production/camel/content/book-cookbook.html (original)
+++ websites/production/camel/content/book-cookbook.html Wed Mar 9 17:20:26
2016
@@ -1081,6 +1081,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="Bookcookbook-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() {
@@ -1092,9 +1093,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
@@ -1125,12 +1128,14 @@ public void testAdvisedMockEndpoints() t
assertNotNull(context.hasEndpoint("mock:direct:foo"));
assertNotNull(context.hasEndpoint("mock:log:foo"));
}
+// end::e1[]
]]></script>
</div></div><p>Notice that the mock endpoints is given the uri
<code>mock:<endpoint></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
@@ -1161,9 +1166,11 @@ public void testAdvisedMockEndpointsWith
assertNull(context.hasEndpoint("mock:direct:start"));
assertNull(context.hasEndpoint("mock:direct:foo"));
}
+// 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="Bookcookbook-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
@@ -1208,9 +1215,11 @@ public class IsMockEndpointsJUnit4Test e
};
}
}
+// end::e1[]
]]></script>
</div></div><h4 id="Bookcookbook-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[
+<!-- tag::e1[] -->
<!-- this camel route is in the camel-route.xml file -->
<camelContext xmlns="http://camel.apache.org/schema/spring">
@@ -1229,14 +1238,17 @@ public class IsMockEndpointsJUnit4Test e
</route>
</camelContext>
+<!-- end::e1[] -->
]]></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[
+<!-- tag::e1[] -->
<!-- the Camel route is defined in another XML file -->
<import resource="camel-route.xml"/>
<!-- bean which enables mocking all endpoints -->
<bean id="mockAllEndpoints"
class="org.apache.camel.impl.InterceptSendToMockEndpointStrategy"/>
+<!-- end::e1[] -->
]]></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[<bean id="mockAllEndpoints"
class="org.apache.camel.impl.InterceptSendToMockEndpointStrategy">
@@ -1245,6 +1257,7 @@ public class IsMockEndpointsJUnit4Test e
]]></script>
</div></div><h4
id="Bookcookbook-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
@@ -1268,9 +1281,11 @@ public void testAdvisedMockEndpointsWith
SedaEndpoint seda = context.getEndpoint("seda:foo",
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
@@ -1307,6 +1322,7 @@ public class IsMockEndpointsAndSkipJUnit
};
}
}
+// end::e1[]
]]></script>
</div></div><h3 id="Bookcookbook-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("mock:data");
@@ -1743,7 +1759,7 @@ public class DebugBlueprintTest extends
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
- http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+ http://www.osgi.org/xmlns/blueprint/v1.0.0
https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
<camelContext
xmlns="http://camel.apache.org/schema/blueprint">
@@ -1782,7 +1798,7 @@ 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="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>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.xm
l</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">
+<h2 id="Bookcookbook-CamelTest">Camel Test</h2><p>As a simple alternative to
using <a shape="rect" href="cdi-testing.html">CDI Testing</a>, <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="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>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="brush: xml; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test</artifactId>
@@ -1855,7 +1871,7 @@ 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 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="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>Its important to start the
CamelContext manually from the unit test after you are done doing all the
advice with.</p></div></
div></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.Inte
rceptSendToMockEndpointStrategy 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
getShutdownTimeou
t()</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 initial
ized.</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 isDumpRouteCoverage</td><td colspan="1"
rowspan="1" class="confluenceTd"><strong>Camel 2.16:</strong> If enabled, then
Camel will dump all route coverage statistics into XML
files in the target/camel-route-coverage 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/reso
urces</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><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">
+</div></div>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.<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 an
d 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()</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="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>Its important to start the
CamelContext manually from the unit test after you are done doing all the
advice with.</p></div></div></t
d><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.InterceptSe
ndToMockEndpointStrategy 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 isDumpRouteCoverage</td><td colspan="1"
rowspan="1" class="confluenceTd"><strong>Camel 2.16:</strong> If enabled, then
Camel will dump all route coverage statistics into XML files
in the target/camel-route-coverage 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> 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><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="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[// Get the next available port number
starting from the default starting port of 1024
int port1 = AvailablePortFinder.getNextAvailable();
/*
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 17:20:26
2016
@@ -2861,7 +2861,7 @@ 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="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>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">
+<h2 id="BookInOnePage-CamelTest">Camel Test</h2><p>As a simple alternative to
using <a shape="rect" href="cdi-testing.html">CDI Testing</a>, <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="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>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="brush: xml; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test</artifactId>
@@ -2934,7 +2934,7 @@ 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 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="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>Its important to start the
CamelContext manually from the unit test after you are done doing all the
advice with.</p></div><
/div></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.In
terceptSendToMockEndpointStrategy 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
getShutdownTime
out()</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 initi
alized.</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 isDumpRouteCoverage</td><td colspan="1"
rowspan="1" class="confluenceTd"><strong>Camel 2.16:</strong> If enabled, then
Camel will dump all route coverage statistics into X
ML files in the target/camel-route-coverage 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/r
esources</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><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">
+</div></div>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.<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 a
nd 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()</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="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>Its important to start the
CamelContext manually from the unit test after you are done doing all the
advice with.</p></div></div></
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.Intercept
SendToMockEndpointStrategy 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 isDumpRouteCoverage</td><td colspan="1"
rowspan="1" class="confluenceTd"><strong>Camel 2.16:</strong> If enabled, then
Camel will dump all route coverage statistics into XML file
s in the target/camel-route-coverage 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/resource
s</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><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="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[// Get the next available port number
starting from the default starting port of 1024
int port1 = AvailablePortFinder.getNextAvailable();
/*
@@ -3758,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> </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.rbtoc1457536774712 {padding: 0px;}
-div.rbtoc1457536774712 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1457536774712 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1457543930968 {padding: 0px;}
+div.rbtoc1457543930968 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1457543930968 li {margin-left: 0px;padding-left: 0px;}
-/*]]>*/</style></p><div class="toc-macro rbtoc1457536774712">
+/*]]>*/</style></p><div class="toc-macro rbtoc1457543930968">
<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>
@@ -5877,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.rbtoc1457536776170 {padding: 0px;}
-div.rbtoc1457536776170 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1457536776170 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1457543932046 {padding: 0px;}
+div.rbtoc1457543932046 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1457543932046 li {margin-left: 0px;padding-left: 0px;}
-/*]]>*/</style><div class="toc-macro rbtoc1457536776170">
+/*]]>*/</style><div class="toc-macro rbtoc1457543932046">
<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>
@@ -17336,11 +17336,11 @@ template.send("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.rbtoc1457536830281 {padding: 0px;}
-div.rbtoc1457536830281 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1457536830281 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1457543938682 {padding: 0px;}
+div.rbtoc1457543938682 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1457543938682 li {margin-left: 0px;padding-left: 0px;}
-/*]]>*/</style></p><div class="toc-macro rbtoc1457536830281">
+/*]]>*/</style></p><div class="toc-macro rbtoc1457543938682">
<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>
Modified: websites/production/camel/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.
Modified: websites/production/camel/content/camel-test.html
==============================================================================
--- websites/production/camel/content/camel-test.html (original)
+++ websites/production/camel/content/camel-test.html Wed Mar 9 17:20:26 2016
@@ -86,7 +86,7 @@
<tbody>
<tr>
<td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 id="CamelTest-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="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>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="CamelTest-Addingtoyo
urpom.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="CamelTest-JUnit">JUnit</h4><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
+<div class="wiki-content maincontent"><h2 id="CamelTest-CamelTest">Camel
Test</h2><p>As a simple alternative to using <a shape="rect"
href="cdi-testing.html">CDI Testing</a>, <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="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>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="CamelTest-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="CamelTest-JUnit">JUnit</h4><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[<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test</artifactId>
@@ -159,7 +159,7 @@ 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="CamelTest-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 method
s 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 colspa
n="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="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>Its important to start the
CamelContext manually from the unit test after you are done doing all the
advice with.</p></div></div
></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="#CamelTest-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.InterceptS
endToMockEndpointStrategy 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 isDumpRouteCoverage</td><td colspan="1"
rowspan="1" class="confluenceTd"><strong>Camel 2.16:</strong> If enabled, then
Camel will dump all route coverage statistics into XML files
in the target/camel-route-coverage 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="CamelTest-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</st
rong> 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><h3
id="CamelTest-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">
+</div></div>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.<h4
id="CamelTest-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 t
he 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" r
owspan="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="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>Its important to start the
CamelContext manually from the unit test after you are done doing all the
advice with.</p></div></div></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="#CamelTest-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.InterceptSendToMo
ckEndpointStrategy 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 isDumpRouteCoverage</td><td colspan="1"
>rowspan="1" class="confluenceTd"><strong>Camel 2.16:</strong> If enabled,
>then Camel will dump all route coverage statistics into XML files in the
target/camel-route-coverage 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="CamelTest-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> d
irectory 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="CamelTest-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="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[// Get the next available port number
starting from the default starting port of 1024
int port1 = AvailablePortFinder.getNextAvailable();
/*