Author: buildbot
Date: Mon Mar 26 13:22:04 2012
New Revision: 810062
Log:
Production update by buildbot for camel
Modified:
websites/production/camel/content/book-component-appendix.html
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-2100-release.html
websites/production/camel/content/mock.html
Modified: websites/production/camel/content/book-component-appendix.html
==============================================================================
--- websites/production/camel/content/book-component-appendix.html (original)
+++ websites/production/camel/content/book-component-appendix.html Mon Mar 26
13:22:04 2012
@@ -10850,7 +10850,9 @@ You can get the IoSession from the messa
<p><b>Note</b> that there is also the <a shape="rect" href="test.html"
title="Test">Test endpoint</a> which is a Mock endpoint, but which uses a
second endpoint to provide the list of expected message bodies and
automatically sets up the Mock endpoint assertions. In other words, it's a Mock
endpoint that automatically sets up its assertions from some sample messages in
a <a shape="rect" href="file2.html" title="File2">File</a> or <a shape="rect"
href="jpa.html" title="JPA">database</a>, for example.</p>
-<div class="panelMacro"><table class="warningMacro"><colgroup span="1"><col
span="1" width="24"><col span="1"></colgroup><tr><td colspan="1" rowspan="1"
valign="top"><img align="middle"
src="https://cwiki.apache.org/confluence/images/icons/emoticons/forbidden.gif"
width="16" height="16" alt="" border="0"></td><td colspan="1"
rowspan="1"><b>Mock endpoints keep received Exchanges in memory
indefinitely</b><br clear="none">Remember that Mock is designed for testing.
When you add Mock endpoints to a route, each <a shape="rect"
href="exchange.html" title="Exchange">Exchange</a> sent to the endpoint will be
stored (to allow for later validation) in memory until explicitly reset or the
JVM is restarted. If you are sending high volume and/or large messages, this
may cause excessive memory use. If your goal is to test deployable routes
inline, consider using <a shape="rect" href="notifybuilder.html"
title="NotifyBuilder">NotifyBuilder</a> or <a shape="rect"
href="advicewith.html"
title="AdviceWith">AdviceWith</a> in your tests instead of adding Mock
endpoints to routes directly.</td></tr></table></div>
+<div class="panelMacro"><table class="warningMacro"><colgroup span="1"><col
span="1" width="24"><col span="1"></colgroup><tr><td colspan="1" rowspan="1"
valign="top"><img align="middle"
src="https://cwiki.apache.org/confluence/images/icons/emoticons/forbidden.gif"
width="16" height="16" alt="" border="0"></td><td colspan="1"
rowspan="1"><b>Mock endpoints keep received Exchanges in memory
indefinitely</b><br clear="none">Remember that Mock is designed for testing.
When you add Mock endpoints to a route, each <a shape="rect"
href="exchange.html" title="Exchange">Exchange</a> sent to the endpoint will be
stored (to allow for later validation) in memory until explicitly reset or the
JVM is restarted. If you are sending high volume and/or large messages, this
may cause excessive memory use. If your goal is to test deployable routes
inline, consider using <a shape="rect" href="notifybuilder.html"
title="NotifyBuilder">NotifyBuilder</a> or <a shape="rect"
href="advicewith.html"
title="AdviceWith">AdviceWith</a> in your tests instead of adding Mock
endpoints to routes directly.
+
+<p>From Camel 2.10 onwards there is two new options <tt>retainFirst</tt>, and
<tt>retainLast</tt> that can be used to limit the number of messages the Mock
endpoints keep in memory.</p></td></tr></table></div>
<h3><a shape="rect" name="BookComponentAppendix-URIformat"></a>URI format</h3>
@@ -11221,6 +11223,29 @@ The solution is to create a new XML file
</pre>
</div></div>
+<h3><a shape="rect"
name="BookComponentAppendix-Limitingthenumberofmessagestokeep"></a>Limiting the
number of messages to keep</h3>
+<p><b>Available as of Camel 2.10</b></p>
+
+<p>The <a shape="rect" href="mock.html" title="Mock">Mock</a> endpoints will
by default keep a copy of every <a shape="rect" href="exchange.html"
title="Exchange">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 <tt>retainFirst</tt>
and <tt>retainLast</tt> that can be used to specify to only keep N'th of the
first and/or last <a shape="rect" href="exchange.html"
title="Exchange">Exchange</a>s.</p>
+
+<p>For example in the code below, we only want to retrain a copy of the first
5 and last 5 <a shape="rect" href="exchange.html"
title="Exchange">Exchange</a>s the mock receives.</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
+<pre class="code-java">
+ MockEndpoint mock = getMockEndpoint(<span
class="code-quote">"mock:data"</span>);
+ mock.setRetainFirst(5);
+ mock.setRetainLast(5);
+ mock.expectedMessageCount(2000);
+
+ ...
+
+ mock.assertIsSatisfied();
+</pre>
+</div></div>
+
+<p>Using this have some limitations. As the <tt>getExchanges()</tt> and
<tt>getReceivedExchanges()</tt> method on the <tt>MockEndpoint</tt>, will only
return the retained copies of the <a shape="rect" href="exchange.html"
title="Exchange">Exchange</a>s. So in the example above, the list will contain
10 <a shape="rect" href="exchange.html" title="Exchange">Exchange</a>s; the
first five, and the last five.<br clear="none">
+Using the <tt>retainFirst</tt> and <tt>retainLast</tt> options have
<b>limitations</b> on which expectation methods you can use. For example the
expectedXXX methods that works on message bodies, headers, etc. will only
operate on the retrained messages. In the example above they can only test the
expectations on the 10 retained messages.</p>
+
<h3><a shape="rect"
name="BookComponentAppendix-Testingwitharrivaltimes"></a>Testing with arrival
times</h3>
<p><b>Available as of Camel 2.7</b></p>
Modified: websites/production/camel/content/book-cookbook.html
==============================================================================
--- websites/production/camel/content/book-cookbook.html (original)
+++ websites/production/camel/content/book-cookbook.html Mon Mar 26 13:22:04
2012
@@ -1103,7 +1103,9 @@ See the <a shape="rect" href="bean-integ
<p><b>Note</b> that there is also the <a shape="rect" href="test.html"
title="Test">Test endpoint</a> which is a Mock endpoint, but which uses a
second endpoint to provide the list of expected message bodies and
automatically sets up the Mock endpoint assertions. In other words, it's a Mock
endpoint that automatically sets up its assertions from some sample messages in
a <a shape="rect" href="file2.html" title="File2">File</a> or <a shape="rect"
href="jpa.html" title="JPA">database</a>, for example.</p>
-<div class="panelMacro"><table class="warningMacro"><colgroup span="1"><col
span="1" width="24"><col span="1"></colgroup><tr><td colspan="1" rowspan="1"
valign="top"><img align="middle"
src="https://cwiki.apache.org/confluence/images/icons/emoticons/forbidden.gif"
width="16" height="16" alt="" border="0"></td><td colspan="1"
rowspan="1"><b>Mock endpoints keep received Exchanges in memory
indefinitely</b><br clear="none">Remember that Mock is designed for testing.
When you add Mock endpoints to a route, each <a shape="rect"
href="exchange.html" title="Exchange">Exchange</a> sent to the endpoint will be
stored (to allow for later validation) in memory until explicitly reset or the
JVM is restarted. If you are sending high volume and/or large messages, this
may cause excessive memory use. If your goal is to test deployable routes
inline, consider using <a shape="rect" href="notifybuilder.html"
title="NotifyBuilder">NotifyBuilder</a> or <a shape="rect"
href="advicewith.html"
title="AdviceWith">AdviceWith</a> in your tests instead of adding Mock
endpoints to routes directly.</td></tr></table></div>
+<div class="panelMacro"><table class="warningMacro"><colgroup span="1"><col
span="1" width="24"><col span="1"></colgroup><tr><td colspan="1" rowspan="1"
valign="top"><img align="middle"
src="https://cwiki.apache.org/confluence/images/icons/emoticons/forbidden.gif"
width="16" height="16" alt="" border="0"></td><td colspan="1"
rowspan="1"><b>Mock endpoints keep received Exchanges in memory
indefinitely</b><br clear="none">Remember that Mock is designed for testing.
When you add Mock endpoints to a route, each <a shape="rect"
href="exchange.html" title="Exchange">Exchange</a> sent to the endpoint will be
stored (to allow for later validation) in memory until explicitly reset or the
JVM is restarted. If you are sending high volume and/or large messages, this
may cause excessive memory use. If your goal is to test deployable routes
inline, consider using <a shape="rect" href="notifybuilder.html"
title="NotifyBuilder">NotifyBuilder</a> or <a shape="rect"
href="advicewith.html"
title="AdviceWith">AdviceWith</a> in your tests instead of adding Mock
endpoints to routes directly.
+
+<p>From Camel 2.10 onwards there is two new options <tt>retainFirst</tt>, and
<tt>retainLast</tt> that can be used to limit the number of messages the Mock
endpoints keep in memory.</p></td></tr></table></div>
<h3><a shape="rect" name="Bookcookbook-URIformat"></a>URI format</h3>
@@ -1474,6 +1476,29 @@ The solution is to create a new XML file
</pre>
</div></div>
+<h3><a shape="rect"
name="Bookcookbook-Limitingthenumberofmessagestokeep"></a>Limiting the number
of messages to keep</h3>
+<p><b>Available as of Camel 2.10</b></p>
+
+<p>The <a shape="rect" href="mock.html" title="Mock">Mock</a> endpoints will
by default keep a copy of every <a shape="rect" href="exchange.html"
title="Exchange">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 <tt>retainFirst</tt>
and <tt>retainLast</tt> that can be used to specify to only keep N'th of the
first and/or last <a shape="rect" href="exchange.html"
title="Exchange">Exchange</a>s.</p>
+
+<p>For example in the code below, we only want to retrain a copy of the first
5 and last 5 <a shape="rect" href="exchange.html"
title="Exchange">Exchange</a>s the mock receives.</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
+<pre class="code-java">
+ MockEndpoint mock = getMockEndpoint(<span
class="code-quote">"mock:data"</span>);
+ mock.setRetainFirst(5);
+ mock.setRetainLast(5);
+ mock.expectedMessageCount(2000);
+
+ ...
+
+ mock.assertIsSatisfied();
+</pre>
+</div></div>
+
+<p>Using this have some limitations. As the <tt>getExchanges()</tt> and
<tt>getReceivedExchanges()</tt> method on the <tt>MockEndpoint</tt>, will only
return the retained copies of the <a shape="rect" href="exchange.html"
title="Exchange">Exchange</a>s. So in the example above, the list will contain
10 <a shape="rect" href="exchange.html" title="Exchange">Exchange</a>s; the
first five, and the last five.<br clear="none">
+Using the <tt>retainFirst</tt> and <tt>retainLast</tt> options have
<b>limitations</b> on which expectation methods you can use. For example the
expectedXXX methods that works on message bodies, headers, etc. will only
operate on the retrained messages. In the example above they can only test the
expectations on the 10 retained messages.</p>
+
<h3><a shape="rect" name="Bookcookbook-Testingwitharrivaltimes"></a>Testing
with arrival times</h3>
<p><b>Available as of Camel 2.7</b></p>
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 Mon Mar 26 13:22:04
2012
@@ -2230,7 +2230,9 @@ See the <a shape="rect" href="bean-integ
<p><b>Note</b> that there is also the <a shape="rect" href="test.html"
title="Test">Test endpoint</a> which is a Mock endpoint, but which uses a
second endpoint to provide the list of expected message bodies and
automatically sets up the Mock endpoint assertions. In other words, it's a Mock
endpoint that automatically sets up its assertions from some sample messages in
a <a shape="rect" href="file2.html" title="File2">File</a> or <a shape="rect"
href="jpa.html" title="JPA">database</a>, for example.</p>
-<div class="panelMacro"><table class="warningMacro"><colgroup span="1"><col
span="1" width="24"><col span="1"></colgroup><tr><td colspan="1" rowspan="1"
valign="top"><img align="middle"
src="https://cwiki.apache.org/confluence/images/icons/emoticons/forbidden.gif"
width="16" height="16" alt="" border="0"></td><td colspan="1"
rowspan="1"><b>Mock endpoints keep received Exchanges in memory
indefinitely</b><br clear="none">Remember that Mock is designed for testing.
When you add Mock endpoints to a route, each <a shape="rect"
href="exchange.html" title="Exchange">Exchange</a> sent to the endpoint will be
stored (to allow for later validation) in memory until explicitly reset or the
JVM is restarted. If you are sending high volume and/or large messages, this
may cause excessive memory use. If your goal is to test deployable routes
inline, consider using <a shape="rect" href="notifybuilder.html"
title="NotifyBuilder">NotifyBuilder</a> or <a shape="rect"
href="advicewith.html"
title="AdviceWith">AdviceWith</a> in your tests instead of adding Mock
endpoints to routes directly.</td></tr></table></div>
+<div class="panelMacro"><table class="warningMacro"><colgroup span="1"><col
span="1" width="24"><col span="1"></colgroup><tr><td colspan="1" rowspan="1"
valign="top"><img align="middle"
src="https://cwiki.apache.org/confluence/images/icons/emoticons/forbidden.gif"
width="16" height="16" alt="" border="0"></td><td colspan="1"
rowspan="1"><b>Mock endpoints keep received Exchanges in memory
indefinitely</b><br clear="none">Remember that Mock is designed for testing.
When you add Mock endpoints to a route, each <a shape="rect"
href="exchange.html" title="Exchange">Exchange</a> sent to the endpoint will be
stored (to allow for later validation) in memory until explicitly reset or the
JVM is restarted. If you are sending high volume and/or large messages, this
may cause excessive memory use. If your goal is to test deployable routes
inline, consider using <a shape="rect" href="notifybuilder.html"
title="NotifyBuilder">NotifyBuilder</a> or <a shape="rect"
href="advicewith.html"
title="AdviceWith">AdviceWith</a> in your tests instead of adding Mock
endpoints to routes directly.
+
+<p>From Camel 2.10 onwards there is two new options <tt>retainFirst</tt>, and
<tt>retainLast</tt> that can be used to limit the number of messages the Mock
endpoints keep in memory.</p></td></tr></table></div>
<h3><a shape="rect" name="BookInOnePage-URIformat"></a>URI format</h3>
@@ -2601,6 +2603,29 @@ The solution is to create a new XML file
</pre>
</div></div>
+<h3><a shape="rect"
name="BookInOnePage-Limitingthenumberofmessagestokeep"></a>Limiting the number
of messages to keep</h3>
+<p><b>Available as of Camel 2.10</b></p>
+
+<p>The <a shape="rect" href="mock.html" title="Mock">Mock</a> endpoints will
by default keep a copy of every <a shape="rect" href="exchange.html"
title="Exchange">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 <tt>retainFirst</tt>
and <tt>retainLast</tt> that can be used to specify to only keep N'th of the
first and/or last <a shape="rect" href="exchange.html"
title="Exchange">Exchange</a>s.</p>
+
+<p>For example in the code below, we only want to retrain a copy of the first
5 and last 5 <a shape="rect" href="exchange.html"
title="Exchange">Exchange</a>s the mock receives.</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
+<pre class="code-java">
+ MockEndpoint mock = getMockEndpoint(<span
class="code-quote">"mock:data"</span>);
+ mock.setRetainFirst(5);
+ mock.setRetainLast(5);
+ mock.expectedMessageCount(2000);
+
+ ...
+
+ mock.assertIsSatisfied();
+</pre>
+</div></div>
+
+<p>Using this have some limitations. As the <tt>getExchanges()</tt> and
<tt>getReceivedExchanges()</tt> method on the <tt>MockEndpoint</tt>, will only
return the retained copies of the <a shape="rect" href="exchange.html"
title="Exchange">Exchange</a>s. So in the example above, the list will contain
10 <a shape="rect" href="exchange.html" title="Exchange">Exchange</a>s; the
first five, and the last five.<br clear="none">
+Using the <tt>retainFirst</tt> and <tt>retainLast</tt> options have
<b>limitations</b> on which expectation methods you can use. For example the
expectedXXX methods that works on message bodies, headers, etc. will only
operate on the retrained messages. In the example above they can only test the
expectations on the 10 retained messages.</p>
+
<h3><a shape="rect" name="BookInOnePage-Testingwitharrivaltimes"></a>Testing
with arrival times</h3>
<p><b>Available as of Camel 2.7</b></p>
@@ -2839,7 +2864,90 @@ mock.allMessages().arrives().noLaterThan
<p>Here is a Camel test support enhanced <a shape="rect"
href="spring-testing.html" title="Spring Testing">Spring Testing</a> <a
shape="rect" class="external-link"
href="https://svn.apache.org/repos/asf/camel/trunk/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerPlainTest.java">example
using XML Config and pure Spring Test based configuration of the Camel
Context</a>.</p>
-<div class="error"><span class="error">Error formatting macro: snippet:
java.lang.IndexOutOfBoundsException: Index: 20, Size: 20</span> </div>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
+<pre class="code-java">@RunWith(CamelSpringJUnit4ClassRunner.class)
+@ContextConfiguration
+<span class="code-comment">// Put here to prevent Spring context caching
across tests and test methods since some tests inherit
+</span><span class="code-comment">// from <span
class="code-keyword">this</span> test and therefore use the same Spring
context. Also because we want to reset the
+</span><span class="code-comment">// Camel context and mock endpoints between
test methods automatically.
+</span>@DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
+<span class="code-keyword">public</span> class
CamelSpringJUnit4ClassRunnerPlainTest {
+
+ @Autowired
+ <span class="code-keyword">protected</span> CamelContext camelContext;
+
+ @Autowired
+ <span class="code-keyword">protected</span> CamelContext camelContext2;
+
+ @EndpointInject(uri = <span class="code-quote">"mock:a"</span>, context =
<span class="code-quote">"camelContext"</span>)
+ <span class="code-keyword">protected</span> MockEndpoint mockA;
+
+ @EndpointInject(uri = <span class="code-quote">"mock:b"</span>, context =
<span class="code-quote">"camelContext"</span>)
+ <span class="code-keyword">protected</span> MockEndpoint mockB;
+
+ @EndpointInject(uri = <span class="code-quote">"mock:c"</span>, context =
<span class="code-quote">"camelContext2"</span>)
+ <span class="code-keyword">protected</span> MockEndpoint mockC;
+
+ @Produce(uri = <span class="code-quote">"direct:start"</span>, context =
<span class="code-quote">"camelContext"</span>)
+ <span class="code-keyword">protected</span> ProducerTemplate start;
+
+ @Produce(uri = <span class="code-quote">"direct:start2"</span>, context =
<span class="code-quote">"camelContext2"</span>)
+ <span class="code-keyword">protected</span> ProducerTemplate start2;
+
+ @Test
+ <span class="code-keyword">public</span> void testPositive() <span
class="code-keyword">throws</span> Exception {
+ assertEquals(ServiceStatus.Started, camelContext.getStatus());
+ assertEquals(ServiceStatus.Started, camelContext2.getStatus());
+
+ mockA.expectedBodiesReceived(<span class="code-quote">"David"</span>);
+ mockB.expectedBodiesReceived(<span class="code-quote">"Hello
David"</span>);
+ mockC.expectedBodiesReceived(<span class="code-quote">"David"</span>);
+
+ start.sendBody(<span class="code-quote">"David"</span>);
+ start2.sendBody(<span class="code-quote">"David"</span>);
+
+ MockEndpoint.assertIsSatisfied(camelContext);
+ }
+
+ @Test
+ <span class="code-keyword">public</span> void testJmx() <span
class="code-keyword">throws</span> Exception {
+ assertEquals(DefaultManagementStrategy.class,
camelContext.getManagementStrategy().getClass());
+ }
+
+ @Test
+ <span class="code-keyword">public</span> void testShutdownTimeout() <span
class="code-keyword">throws</span> Exception {
+ assertEquals(10, camelContext.getShutdownStrategy().getTimeout());
+ assertEquals(TimeUnit.SECONDS,
camelContext.getShutdownStrategy().getTimeUnit());
+ }
+
+ @Test
+ <span class="code-keyword">public</span> void testStopwatch() {
+ StopWatch stopWatch = StopWatchTestExecutionListener.getStopWatch();
+
+ assertNotNull(stopWatch);
+ assertTrue(stopWatch.taken() < 100);
+ }
+
+ @Test
+ <span class="code-keyword">public</span> void testExcludedRoute() {
+ assertNotNull(camelContext.getRoute(<span
class="code-quote">"excludedRoute"</span>));
+ }
+
+ @Test
+ <span class="code-keyword">public</span> void testProvidesBreakpoint() {
+ assertNull(camelContext.getDebugger());
+ assertNull(camelContext2.getDebugger());
+ }
+
+ @SuppressWarnings(<span class="code-quote">"deprecation"</span>)
+ @Test
+ <span class="code-keyword">public</span> void testLazyLoadTypeConverters()
{
+ assertTrue(camelContext.isLazyLoadTypeConverters());
+ assertTrue(camelContext2.isLazyLoadTypeConverters());
+ }
+}
+</pre>
+</div></div>
<p>Notice how a custom test runner is used with
the <b>@RunWith</b> annotation to support the features
of <b>CamelTestSupport</b> through annotations on the test class.
 See <a shape="rect" href="spring-testing.html" title="Spring
Testing">Spring Testing</a> for a list of annotations you can use in your
tests.</p>
@@ -30836,7 +30944,9 @@ You can get the IoSession from the messa
<p><b>Note</b> that there is also the <a shape="rect" href="test.html"
title="Test">Test endpoint</a> which is a Mock endpoint, but which uses a
second endpoint to provide the list of expected message bodies and
automatically sets up the Mock endpoint assertions. In other words, it's a Mock
endpoint that automatically sets up its assertions from some sample messages in
a <a shape="rect" href="file2.html" title="File2">File</a> or <a shape="rect"
href="jpa.html" title="JPA">database</a>, for example.</p>
-<div class="panelMacro"><table class="warningMacro"><colgroup span="1"><col
span="1" width="24"><col span="1"></colgroup><tr><td colspan="1" rowspan="1"
valign="top"><img align="middle"
src="https://cwiki.apache.org/confluence/images/icons/emoticons/forbidden.gif"
width="16" height="16" alt="" border="0"></td><td colspan="1"
rowspan="1"><b>Mock endpoints keep received Exchanges in memory
indefinitely</b><br clear="none">Remember that Mock is designed for testing.
When you add Mock endpoints to a route, each <a shape="rect"
href="exchange.html" title="Exchange">Exchange</a> sent to the endpoint will be
stored (to allow for later validation) in memory until explicitly reset or the
JVM is restarted. If you are sending high volume and/or large messages, this
may cause excessive memory use. If your goal is to test deployable routes
inline, consider using <a shape="rect" href="notifybuilder.html"
title="NotifyBuilder">NotifyBuilder</a> or <a shape="rect"
href="advicewith.html"
title="AdviceWith">AdviceWith</a> in your tests instead of adding Mock
endpoints to routes directly.</td></tr></table></div>
+<div class="panelMacro"><table class="warningMacro"><colgroup span="1"><col
span="1" width="24"><col span="1"></colgroup><tr><td colspan="1" rowspan="1"
valign="top"><img align="middle"
src="https://cwiki.apache.org/confluence/images/icons/emoticons/forbidden.gif"
width="16" height="16" alt="" border="0"></td><td colspan="1"
rowspan="1"><b>Mock endpoints keep received Exchanges in memory
indefinitely</b><br clear="none">Remember that Mock is designed for testing.
When you add Mock endpoints to a route, each <a shape="rect"
href="exchange.html" title="Exchange">Exchange</a> sent to the endpoint will be
stored (to allow for later validation) in memory until explicitly reset or the
JVM is restarted. If you are sending high volume and/or large messages, this
may cause excessive memory use. If your goal is to test deployable routes
inline, consider using <a shape="rect" href="notifybuilder.html"
title="NotifyBuilder">NotifyBuilder</a> or <a shape="rect"
href="advicewith.html"
title="AdviceWith">AdviceWith</a> in your tests instead of adding Mock
endpoints to routes directly.
+
+<p>From Camel 2.10 onwards there is two new options <tt>retainFirst</tt>, and
<tt>retainLast</tt> that can be used to limit the number of messages the Mock
endpoints keep in memory.</p></td></tr></table></div>
<h3><a shape="rect" name="BookInOnePage-URIformat"></a>URI format</h3>
@@ -31207,6 +31317,29 @@ The solution is to create a new XML file
</pre>
</div></div>
+<h3><a shape="rect"
name="BookInOnePage-Limitingthenumberofmessagestokeep"></a>Limiting the number
of messages to keep</h3>
+<p><b>Available as of Camel 2.10</b></p>
+
+<p>The <a shape="rect" href="mock.html" title="Mock">Mock</a> endpoints will
by default keep a copy of every <a shape="rect" href="exchange.html"
title="Exchange">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 <tt>retainFirst</tt>
and <tt>retainLast</tt> that can be used to specify to only keep N'th of the
first and/or last <a shape="rect" href="exchange.html"
title="Exchange">Exchange</a>s.</p>
+
+<p>For example in the code below, we only want to retrain a copy of the first
5 and last 5 <a shape="rect" href="exchange.html"
title="Exchange">Exchange</a>s the mock receives.</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
+<pre class="code-java">
+ MockEndpoint mock = getMockEndpoint(<span
class="code-quote">"mock:data"</span>);
+ mock.setRetainFirst(5);
+ mock.setRetainLast(5);
+ mock.expectedMessageCount(2000);
+
+ ...
+
+ mock.assertIsSatisfied();
+</pre>
+</div></div>
+
+<p>Using this have some limitations. As the <tt>getExchanges()</tt> and
<tt>getReceivedExchanges()</tt> method on the <tt>MockEndpoint</tt>, will only
return the retained copies of the <a shape="rect" href="exchange.html"
title="Exchange">Exchange</a>s. So in the example above, the list will contain
10 <a shape="rect" href="exchange.html" title="Exchange">Exchange</a>s; the
first five, and the last five.<br clear="none">
+Using the <tt>retainFirst</tt> and <tt>retainLast</tt> options have
<b>limitations</b> on which expectation methods you can use. For example the
expectedXXX methods that works on message bodies, headers, etc. will only
operate on the retrained messages. In the example above they can only test the
expectations on the 10 retained messages.</p>
+
<h3><a shape="rect" name="BookInOnePage-Testingwitharrivaltimes"></a>Testing
with arrival times</h3>
<p><b>Available as of Camel 2.7</b></p>
Modified: websites/production/camel/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.
Modified: websites/production/camel/content/camel-2100-release.html
==============================================================================
--- websites/production/camel/content/camel-2100-release.html (original)
+++ websites/production/camel/content/camel-2100-release.html Mon Mar 26
13:22:04 2012
@@ -84,7 +84,7 @@
<p>Welcome to the 2.10.0 release with approximately XXX issues resolved -
including new features, improvements, and bug fixes, such as: </p>
-<ul><li>Internal code cleanup to reduce warnings reported by
Eclipse</li><li>Moved <a shape="rect" href="spring-testing.html" title="Spring
Testing">Spring Testing</a> from <tt>camel-test</tt> to
<tt>camel-test-spring</tt> component.</li><li>Camel <a shape="rect"
href="using-propertyplaceholder.html" title="Using
PropertyPlaceholder">Property Placeholders</a> are now supported in embedded <a
shape="rect" href="expression.html" title="Expression">Expression</a>s within
Camel routes.</li><li>Added missing options in the XML DSL for the <a
shape="rect" href="xpath.html" title="XPath">XPath</a> language to control and
set which XPath Engine to use, etc.</li><li>Added option <tt>logNamespaces</tt>
to the <a shape="rect" href="xpath.html" title="XPath">XPath</a> language to
have <tt>INFO</tt> logging of detected namespaces from message. This can be
used to troubleshoot issues where an <a shape="rect" href="xpath.html"
title="XPath">XPath</a> expression doesn't work as expected (a
s it's often a namespace conflict).</li><li>Added
<tt>replyToCacheLevelName</tt> option to the <a shape="rect" href="jms.html"
title="JMS">JMS</a> component, allowing configuration of cache levels for
persistent reply consumers when doing request/reply over JMS. Some message
brokers do not work well with caching, so users may need to set this option to
<tt>CACHE_NONE</tt>.</li><li>Added <tt>antInclude</tt> and <tt>antExclude</tt>
options to <a shape="rect" href="file2.html" title="File2">File</a> and <a
shape="rect" href="ftp2.html" title="FTP2">FTP</a> components to make it easier
to specify include/exclude filters using ANT syntax.</li><li>The <a
shape="rect" href="camel-maven-archetypes.html" title="Camel Maven
Archetypes">Camel archetypes</a> for Java and Scala no longer generate projects
with Spring dependencies.</li><li>Improved <tt>JdbcMessageIdRepository</tt> in
the <a shape="rect" href="sql-component.html" title="SQL Component">SQL</a> to
use custom SQL statements/q
ueries.</li><li>Added option to <a shape="rect" href="properties.html"
title="Properties">Properties</a> to allow silently ignoring property locations
not found, such as a .properties file.</li><li>Added
<tt>managementNamePattern</tt> attribute to <tt><camelContext></tt> to
make it very easy to customize and control the JMX naming of the Camel
application. See details at <a shape="rect"
href="camel-jmx.html#CamelJMX-CamelJMXManagementNamingStrategy">Camel JMX</a>.
For example, in OSGi environments you can explicitly configure a
<tt>managementNamePattern</tt> in case you do not want the bundleId as part of
MBean names.</li><li>Added streaming update support to <a shape="rect"
href="solr.html" title="Solr">Solr</a> as well as support for
SolrInputDocuments</li><li>Added SolrJ DirectXMLRequest support to <a
shape="rect" href="solr.html" title="Solr">Solr</a> to support XML based index
updates</li><li>Improved Camel <a shape="rect" href="mail.html"
title="Mail">Mail</a> to
support the <tt>replyTo</tt> option</li><li>Added <tt>traceEnabled</tt>
option to <a shape="rect" href="jetty.html" title="Jetty">Jetty</a> component
so you have control over whether to allow HTTP TRACE calls against your Jetty
endpoints.</li><li>Polished the <a shape="rect"
href="camel-maven-archetypes.html" title="Camel Maven Archetypes">Camel Maven
Archetypes</a> to let the projects be prepared for <a shape="rect"
href="testing.html" title="Testing">Testing</a>, and fixed any WARNs from
Maven.</li><li>Added <tt>dumpRouteStatsAsXml</tt> methods to <a shape="rect"
href="camel-jmx.html" title="Camel JMX">JMX</a> to make it easier to get the
total performance stats as XML, and in one JMX call.</li><li><a shape="rect"
href="graceful-shutdown.html" title="Graceful Shutdown">Graceful Shutdown</a>
is now more aggressive if timeout occurred during shutdown, rejecting continued
processing of messages or redeliveries.</li><li>Add <tt>ShutdownPrepared</tt>
SPI to allow custom Servic
es (also EIPs) in routes to do custom code in preparation for
shutdown.</li><li>The <tt>camel-archetype-java</tt> <a shape="rect"
href="camel-maven-archetypes.html" title="Camel Maven Archetypes">Camel Maven
Archetypes</a> is now a pure Java DSL based project (no longer
Spring)</li><li><a shape="rect" href="jms.html" title="JMS">JMS</a> consumer is
less verbose when logging uncaught exceptions thrown while processing a
message. Added <tt>errorHandlerLoggingLevel</tt>, and
<tt>errorHandlerLogStackTrace</tt> options to tweak the logging
verbosity.</li><li>Added <tt>messageId</tt> as an <a shape="rect"
href="mdc-logging.html" title="MDC logging">MDC logging</a>
key.</li><li>Improved Camel's Transaction <a shape="rect"
href="error-handler.html" title="Error Handler">Error Handler</a> logging to
better pinpoint and correlate redelivered messages (from, e.g., a JMS broker),
making the logs much easier to read.</li><li>Added a timeout option to <a
shape="rect" href="spring-web-serv
ices.html" title="Spring Web Services">Spring Web Services</a> for specifying
the read timeout while invoking a webservice.</li><li>Optimized <a shape="rect"
href="type-converter.html" title="Type Converter">Type Converter</a> registry
for possible concurrency contention when looking up a type
converter.</li><li>Improved <a shape="rect" href="simple.html"
title="Simple">Simple</a> language to work better with floating point numbers
in <a shape="rect" href="predicate.html"
title="Predicate">Predicate</a>s</li><li>Camel is now less verbose when
starting and stopping, with less being logged at <tt>INFO</tt>
level.</li><li>Add support for keyed data queues to <a shape="rect"
href="jt400.html" title="JT400">JT400</a> component.</li><li><a shape="rect"
href="idempotent-consumer.html" title="Idempotent Consumer">Idempotent
Consumer</a> is now enlisted in JMX, which allows monitoring the duplicate
message count as well as the operation to reset it.</li><li>Thread pools
registered in
<a shape="rect" href="camel-jmx.html" title="Camel JMX">JMX</a> are now
unregistered when Camel shuts them down. Note that all MBeans will be
unregistered from JMX when Camel shuts itself down. This improvement is to
unregister thread pools more eagerly, such as when routes are removed at
runtime.</li><li>Camel will now also copy the message headers for a
<tt>JmsMessage</tt> if you leverage <tt>useOriginalMessage</tt> in an
<tt>onException</tt> definition.</li><li>Added <tt>mockEndpointsAndSkip</tt> to
<a shape="rect" href="advicewith.html" title="AdviceWith">AdviceWith</a> and
the <a shape="rect" href="testing.html" title="Testing">Test
Kit</a></li><li>The <a shape="rect" href="file2.html" title="File2">File</a>
and <a shape="rect" href="ftp2.html" title="FTP2">FTP</a> components now
support filtering directories. The <tt>isDirectory</tt> method on the
<tt>GenericFile</tt> class can be used to skip unwanted directories,
accelerating file consumption.</li><li><a shape="rect
" href="smpp.html" title="SMPP">SMPP</a> connections can now be tunneled
through an HTTP proxy by configuring HTTP proxy settings.</li><li>Camel now
also checks, when starting a route dynamically, whether there would be any
violations on multiple consumers from the same <a shape="rect"
href="endpoint.html" title="Endpoint">Endpoint</a>. Previously this check only
occurred during Camel startup - now it always happens.</li><li>Stopping a
<tt>ConsumerTemplate</tt> or a <tt>ProducerTemplate</tt> will now stop and
shutdown its cache to cleanup any resources which otherwise may not have been
reclaimed until shutdown.</li><li><a shape="rect" class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/impl/ScheduledPollConsumer.html">ScheduledPollConsumer</a>
will now shutdown thread pools more eagerly, such as when stopping a
<tt>ConsumerTemplate</tt>.</li><li>Added option <tt>asyncStartListener</tt> to
<a shape="rect" href="jms.html" title
="JMS">JMS</a> to allow starting JMS consumers (e.g. routes) asynchronously.
This can be used to avoid blocking in case the JMS consumer takes long time to
establish a connection to the JMS broker.</li><li><a shape="rect"
href="wire-tap.html" title="Wire Tap">Wire Tap</a> now supports <a shape="rect"
href="error-handling-in-camel.html" title="Error handling in Camel">Error
Handling</a> when sending a tapped message to an <a shape="rect"
href="endpoint.html" title="Endpoint">Endpoint</a>.</li><li>Added the
autogenColumns, configRef and strategyRef options to the <a shape="rect"
href="csv.html" title="CSV">CSV</a> dataformat in XML DSL.</li><li><a
shape="rect" href="validation.html" title="Validation">Validator</a> component
will now fail with a better error message if resource schema refers to element
which cannot be resolved.</li><li>Added support for retrieving generated keys
from <a shape="rect" href="jdbc.html" title="JDBC">JDBC</a>
component.</li><li>Added support for Sp
ring 3.1.x.</li></ul>
+<ul><li>Internal code cleanup to reduce warnings reported by
Eclipse</li><li>Moved <a shape="rect" href="spring-testing.html" title="Spring
Testing">Spring Testing</a> from <tt>camel-test</tt> to
<tt>camel-test-spring</tt> component.</li><li>Camel <a shape="rect"
href="using-propertyplaceholder.html" title="Using
PropertyPlaceholder">Property Placeholders</a> are now supported in embedded <a
shape="rect" href="expression.html" title="Expression">Expression</a>s within
Camel routes.</li><li>Added missing options in the XML DSL for the <a
shape="rect" href="xpath.html" title="XPath">XPath</a> language to control and
set which XPath Engine to use, etc.</li><li>Added option <tt>logNamespaces</tt>
to the <a shape="rect" href="xpath.html" title="XPath">XPath</a> language to
have <tt>INFO</tt> logging of detected namespaces from message. This can be
used to troubleshoot issues where an <a shape="rect" href="xpath.html"
title="XPath">XPath</a> expression doesn't work as expected (a
s it's often a namespace conflict).</li><li>Added
<tt>replyToCacheLevelName</tt> option to the <a shape="rect" href="jms.html"
title="JMS">JMS</a> component, allowing configuration of cache levels for
persistent reply consumers when doing request/reply over JMS. Some message
brokers do not work well with caching, so users may need to set this option to
<tt>CACHE_NONE</tt>.</li><li>Added <tt>antInclude</tt> and <tt>antExclude</tt>
options to <a shape="rect" href="file2.html" title="File2">File</a> and <a
shape="rect" href="ftp2.html" title="FTP2">FTP</a> components to make it easier
to specify include/exclude filters using ANT syntax.</li><li>The <a
shape="rect" href="camel-maven-archetypes.html" title="Camel Maven
Archetypes">Camel archetypes</a> for Java and Scala no longer generate projects
with Spring dependencies.</li><li>Improved <tt>JdbcMessageIdRepository</tt> in
the <a shape="rect" href="sql-component.html" title="SQL Component">SQL</a> to
use custom SQL statements/q
ueries.</li><li>Added option to <a shape="rect" href="properties.html"
title="Properties">Properties</a> to allow silently ignoring property locations
not found, such as a .properties file.</li><li>Added
<tt>managementNamePattern</tt> attribute to <tt><camelContext></tt> to
make it very easy to customize and control the JMX naming of the Camel
application. See details at <a shape="rect"
href="camel-jmx.html#CamelJMX-CamelJMXManagementNamingStrategy">Camel JMX</a>.
For example, in OSGi environments you can explicitly configure a
<tt>managementNamePattern</tt> in case you do not want the bundleId as part of
MBean names.</li><li>Added streaming update support to <a shape="rect"
href="solr.html" title="Solr">Solr</a> as well as support for
SolrInputDocuments</li><li>Added SolrJ DirectXMLRequest support to <a
shape="rect" href="solr.html" title="Solr">Solr</a> to support XML based index
updates</li><li>Improved Camel <a shape="rect" href="mail.html"
title="Mail">Mail</a> to
support the <tt>replyTo</tt> option</li><li>Added <tt>traceEnabled</tt>
option to <a shape="rect" href="jetty.html" title="Jetty">Jetty</a> component
so you have control over whether to allow HTTP TRACE calls against your Jetty
endpoints.</li><li>Polished the <a shape="rect"
href="camel-maven-archetypes.html" title="Camel Maven Archetypes">Camel Maven
Archetypes</a> to let the projects be prepared for <a shape="rect"
href="testing.html" title="Testing">Testing</a>, and fixed any WARNs from
Maven.</li><li>Added <tt>dumpRouteStatsAsXml</tt> methods to <a shape="rect"
href="camel-jmx.html" title="Camel JMX">JMX</a> to make it easier to get the
total performance stats as XML, and in one JMX call.</li><li><a shape="rect"
href="graceful-shutdown.html" title="Graceful Shutdown">Graceful Shutdown</a>
is now more aggressive if timeout occurred during shutdown, rejecting continued
processing of messages or redeliveries.</li><li>Add <tt>ShutdownPrepared</tt>
SPI to allow custom Servic
es (also EIPs) in routes to do custom code in preparation for
shutdown.</li><li>The <tt>camel-archetype-java</tt> <a shape="rect"
href="camel-maven-archetypes.html" title="Camel Maven Archetypes">Camel Maven
Archetypes</a> is now a pure Java DSL based project (no longer
Spring)</li><li><a shape="rect" href="jms.html" title="JMS">JMS</a> consumer is
less verbose when logging uncaught exceptions thrown while processing a
message. Added <tt>errorHandlerLoggingLevel</tt>, and
<tt>errorHandlerLogStackTrace</tt> options to tweak the logging
verbosity.</li><li>Added <tt>messageId</tt> as an <a shape="rect"
href="mdc-logging.html" title="MDC logging">MDC logging</a>
key.</li><li>Improved Camel's Transaction <a shape="rect"
href="error-handler.html" title="Error Handler">Error Handler</a> logging to
better pinpoint and correlate redelivered messages (from, e.g., a JMS broker),
making the logs much easier to read.</li><li>Added a timeout option to <a
shape="rect" href="spring-web-serv
ices.html" title="Spring Web Services">Spring Web Services</a> for specifying
the read timeout while invoking a webservice.</li><li>Optimized <a shape="rect"
href="type-converter.html" title="Type Converter">Type Converter</a> registry
for possible concurrency contention when looking up a type
converter.</li><li>Improved <a shape="rect" href="simple.html"
title="Simple">Simple</a> language to work better with floating point numbers
in <a shape="rect" href="predicate.html"
title="Predicate">Predicate</a>s</li><li>Camel is now less verbose when
starting and stopping, with less being logged at <tt>INFO</tt>
level.</li><li>Add support for keyed data queues to <a shape="rect"
href="jt400.html" title="JT400">JT400</a> component.</li><li><a shape="rect"
href="idempotent-consumer.html" title="Idempotent Consumer">Idempotent
Consumer</a> is now enlisted in JMX, which allows monitoring the duplicate
message count as well as the operation to reset it.</li><li>Thread pools
registered in
<a shape="rect" href="camel-jmx.html" title="Camel JMX">JMX</a> are now
unregistered when Camel shuts them down. Note that all MBeans will be
unregistered from JMX when Camel shuts itself down. This improvement is to
unregister thread pools more eagerly, such as when routes are removed at
runtime.</li><li>Camel will now also copy the message headers for a
<tt>JmsMessage</tt> if you leverage <tt>useOriginalMessage</tt> in an
<tt>onException</tt> definition.</li><li>Added <tt>mockEndpointsAndSkip</tt> to
<a shape="rect" href="advicewith.html" title="AdviceWith">AdviceWith</a> and
the <a shape="rect" href="testing.html" title="Testing">Test
Kit</a></li><li>The <a shape="rect" href="file2.html" title="File2">File</a>
and <a shape="rect" href="ftp2.html" title="FTP2">FTP</a> components now
support filtering directories. The <tt>isDirectory</tt> method on the
<tt>GenericFile</tt> class can be used to skip unwanted directories,
accelerating file consumption.</li><li><a shape="rect
" href="smpp.html" title="SMPP">SMPP</a> connections can now be tunneled
through an HTTP proxy by configuring HTTP proxy settings.</li><li>Camel now
also checks, when starting a route dynamically, whether there would be any
violations on multiple consumers from the same <a shape="rect"
href="endpoint.html" title="Endpoint">Endpoint</a>. Previously this check only
occurred during Camel startup - now it always happens.</li><li>Stopping a
<tt>ConsumerTemplate</tt> or a <tt>ProducerTemplate</tt> will now stop and
shutdown its cache to cleanup any resources which otherwise may not have been
reclaimed until shutdown.</li><li><a shape="rect" class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/impl/ScheduledPollConsumer.html">ScheduledPollConsumer</a>
will now shutdown thread pools more eagerly, such as when stopping a
<tt>ConsumerTemplate</tt>.</li><li>Added option <tt>asyncStartListener</tt> to
<a shape="rect" href="jms.html" title
="JMS">JMS</a> to allow starting JMS consumers (e.g. routes) asynchronously.
This can be used to avoid blocking in case the JMS consumer takes long time to
establish a connection to the JMS broker.</li><li><a shape="rect"
href="wire-tap.html" title="Wire Tap">Wire Tap</a> now supports <a shape="rect"
href="error-handling-in-camel.html" title="Error handling in Camel">Error
Handling</a> when sending a tapped message to an <a shape="rect"
href="endpoint.html" title="Endpoint">Endpoint</a>.</li><li>Added the
autogenColumns, configRef and strategyRef options to the <a shape="rect"
href="csv.html" title="CSV">CSV</a> dataformat in XML DSL.</li><li><a
shape="rect" href="validation.html" title="Validation">Validator</a> component
will now fail with a better error message if resource schema refers to element
which cannot be resolved.</li><li>Added support for retrieving generated keys
from <a shape="rect" href="jdbc.html" title="JDBC">JDBC</a>
component.</li><li>Added support for Sp
ring 3.1.x.</li><li>Added <tt>retainFirst</tt>, and <tt>retainLast</tt>
options to <a shape="rect" href="mock.html" title="Mock">Mock</a>
component.</li></ul>
<h3><a shape="rect" name="Camel2.10.0Release-Fixedissues"></a>Fixed issues</h3>
Modified: websites/production/camel/content/mock.html
==============================================================================
--- websites/production/camel/content/mock.html (original)
+++ websites/production/camel/content/mock.html Mon Mar 26 13:22:04 2012
@@ -87,7 +87,9 @@
<p><b>Note</b> that there is also the <a shape="rect" href="test.html"
title="Test">Test endpoint</a> which is a Mock endpoint, but which uses a
second endpoint to provide the list of expected message bodies and
automatically sets up the Mock endpoint assertions. In other words, it's a Mock
endpoint that automatically sets up its assertions from some sample messages in
a <a shape="rect" href="file2.html" title="File2">File</a> or <a shape="rect"
href="jpa.html" title="JPA">database</a>, for example.</p>
-<div class="panelMacro"><table class="warningMacro"><colgroup span="1"><col
span="1" width="24"><col span="1"></colgroup><tr><td colspan="1" rowspan="1"
valign="top"><img align="middle"
src="https://cwiki.apache.org/confluence/images/icons/emoticons/forbidden.gif"
width="16" height="16" alt="" border="0"></td><td colspan="1"
rowspan="1"><b>Mock endpoints keep received Exchanges in memory
indefinitely</b><br clear="none">Remember that Mock is designed for testing.
When you add Mock endpoints to a route, each <a shape="rect"
href="exchange.html" title="Exchange">Exchange</a> sent to the endpoint will be
stored (to allow for later validation) in memory until explicitly reset or the
JVM is restarted. If you are sending high volume and/or large messages, this
may cause excessive memory use. If your goal is to test deployable routes
inline, consider using <a shape="rect" href="notifybuilder.html"
title="NotifyBuilder">NotifyBuilder</a> or <a shape="rect"
href="advicewith.html"
title="AdviceWith">AdviceWith</a> in your tests instead of adding Mock
endpoints to routes directly.</td></tr></table></div>
+<div class="panelMacro"><table class="warningMacro"><colgroup span="1"><col
span="1" width="24"><col span="1"></colgroup><tr><td colspan="1" rowspan="1"
valign="top"><img align="middle"
src="https://cwiki.apache.org/confluence/images/icons/emoticons/forbidden.gif"
width="16" height="16" alt="" border="0"></td><td colspan="1"
rowspan="1"><b>Mock endpoints keep received Exchanges in memory
indefinitely</b><br clear="none">Remember that Mock is designed for testing.
When you add Mock endpoints to a route, each <a shape="rect"
href="exchange.html" title="Exchange">Exchange</a> sent to the endpoint will be
stored (to allow for later validation) in memory until explicitly reset or the
JVM is restarted. If you are sending high volume and/or large messages, this
may cause excessive memory use. If your goal is to test deployable routes
inline, consider using <a shape="rect" href="notifybuilder.html"
title="NotifyBuilder">NotifyBuilder</a> or <a shape="rect"
href="advicewith.html"
title="AdviceWith">AdviceWith</a> in your tests instead of adding Mock
endpoints to routes directly.
+
+<p>From Camel 2.10 onwards there is two new options <tt>retainFirst</tt>, and
<tt>retainLast</tt> that can be used to limit the number of messages the Mock
endpoints keep in memory.</p></td></tr></table></div>
<h3><a shape="rect" name="Mock-URIformat"></a>URI format</h3>
@@ -458,6 +460,29 @@ The solution is to create a new XML file
</pre>
</div></div>
+<h3><a shape="rect" name="Mock-Limitingthenumberofmessagestokeep"></a>Limiting
the number of messages to keep</h3>
+<p><b>Available as of Camel 2.10</b></p>
+
+<p>The <a shape="rect" href="mock.html" title="Mock">Mock</a> endpoints will
by default keep a copy of every <a shape="rect" href="exchange.html"
title="Exchange">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 <tt>retainFirst</tt>
and <tt>retainLast</tt> that can be used to specify to only keep N'th of the
first and/or last <a shape="rect" href="exchange.html"
title="Exchange">Exchange</a>s.</p>
+
+<p>For example in the code below, we only want to retrain a copy of the first
5 and last 5 <a shape="rect" href="exchange.html"
title="Exchange">Exchange</a>s the mock receives.</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
+<pre class="code-java">
+ MockEndpoint mock = getMockEndpoint(<span
class="code-quote">"mock:data"</span>);
+ mock.setRetainFirst(5);
+ mock.setRetainLast(5);
+ mock.expectedMessageCount(2000);
+
+ ...
+
+ mock.assertIsSatisfied();
+</pre>
+</div></div>
+
+<p>Using this have some limitations. As the <tt>getExchanges()</tt> and
<tt>getReceivedExchanges()</tt> method on the <tt>MockEndpoint</tt>, will only
return the retained copies of the <a shape="rect" href="exchange.html"
title="Exchange">Exchange</a>s. So in the example above, the list will contain
10 <a shape="rect" href="exchange.html" title="Exchange">Exchange</a>s; the
first five, and the last five.<br clear="none">
+Using the <tt>retainFirst</tt> and <tt>retainLast</tt> options have
<b>limitations</b> on which expectation methods you can use. For example the
expectedXXX methods that works on message bodies, headers, etc. will only
operate on the retrained messages. In the example above they can only test the
expectations on the 10 retained messages.</p>
+
<h3><a shape="rect" name="Mock-Testingwitharrivaltimes"></a>Testing with
arrival times</h3>
<p><b>Available as of Camel 2.7</b></p>