camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r885242 - in /websites/production/camel/content: cache/main.pageCache spring-java-config.html
Date Sat, 02 Nov 2013 22:19:05 GMT
Author: buildbot
Date: Sat Nov  2 22:19:04 2013
New Revision: 885242

Log:
Production update by buildbot for camel

Modified:
    websites/production/camel/content/cache/main.pageCache
    websites/production/camel/content/spring-java-config.html

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

Modified: websites/production/camel/content/spring-java-config.html
==============================================================================
--- websites/production/camel/content/spring-java-config.html (original)
+++ websites/production/camel/content/spring-java-config.html Sat Nov  2 22:19:04 2013
@@ -111,7 +111,7 @@
 
 <p>Note that this library is totally optional; you could just wire Camel together yourself
with Java Config.</p>
 
-<h3><a shape="rect" name="SpringJavaConfig-Commoncases"></a>Common cases</h3>
+<h3><a shape="rect" name="SpringJavaConfig-Configuration"></a>Configuration</h3>
 
 <p>The most common case of using JavaConfig with Camel would be to create configuration
with defined list of routes to be used by router.</p>
 
@@ -146,9 +146,64 @@ public class MyRouteConfiguration extend
 ]]></script>
 </div></div>
 
-<h3><a shape="rect" name="SpringJavaConfig-Otherexamples"></a>Other examples</h3>
+<h3><a shape="rect" name="SpringJavaConfig-Testing"></a>Testing</h3>
 
-<p>The following <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/patterns/FilterTest.java">example
using Java Config</a> is actually a <a shape="rect" href="spring-testing.html" title="Spring
Testing">Spring Testing</a> based unit test.</p>
+<p>Since <b>Camel 2.11.0</b> you can use the <tt>CamelSpringJUnit4ClassRunner</tt>
with <tt>CamelSpringDelegatingTestContextLoader</tt>. This is the recommended
way to test Java Config and Camel integration.</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+@RunWith(CamelSpringJUnit4ClassRunner.class)
+@ContextConfiguration(
+        classes = {CamelSpringDelegatingTestContextLoaderTest.TestConfig.class},
+        // Since Camel 2.11.0 
+        loader = CamelSpringDelegatingTestContextLoader.class
+)
+@MockEndpoints
+public class CamelSpringDelegatingTestContextLoaderTest {
+    @EndpointInject(uri = "mock:direct:end")
+    protected MockEndpoint endEndpoint;
+
+    @EndpointInject(uri = "mock:direct:error")
+    protected MockEndpoint errorEndpoint;
+
+    @Produce(uri = "direct:test")
+    protected ProducerTemplate testProducer;
+
+    @Configuration
+    public static class TestConfig extends SingleRouteCamelConfiguration {
+        @Bean
+        @Override
+        public RouteBuilder route() {
+            return new RouteBuilder() {
+                @Override
+                public void configure() throws Exception {
+                    from("direct:test").errorHandler(deadLetterChannel("direct:error")).to("direct:end");
+
+                    from("direct:error").log("Received message on direct:error endpoint.");
+
+                    from("direct:end").log("Received message on direct:end endpoint.");
+                }
+            };
+        }
+    }
+
+    @Test
+    public void testRoute() throws InterruptedException {
+        endEndpoint.expectedMessageCount(1);
+        errorEndpoint.expectedMessageCount(0);
+
+        testProducer.sendBody("&lt;name&gt;test&lt;/name&gt;");
+
+        endEndpoint.assertIsSatisfied();
+        errorEndpoint.assertIsSatisfied();
+    }
+}
+]]></script>
+</div></div>
+
+<p>If you wish to create a collection of <b>RouteBuilder</b> instances
then derive from the <b>CamelConfiguration</b> helper class and implement the
<b>routes()</b> method. Keep in mind that (starting from the Camel 2.13.0) if
you don't override <b>routes()</b> method, then <b>CamelConfiguration</b>
will use all <b>RouteBuilder</b> instances available in the Spring context.</p>
+
+<p>The following <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/patterns/FilterTest.java">example
using Java Config</a> demonstrates how to test Java Config integration with Camel 2.10
and lower. Keep in mind that <tt>JavaConfigContextLoader</tt> is deprecated and
could be removed in the future versions of Camel on the behalf of the <tt>CamelSpringDelegatingTestContextLoader</tt>.</p>
 
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
 <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
@@ -200,61 +255,7 @@ public class FilterTest extends Abstract
 ]]></script>
 </div></div>
 
-<p>The <b>@ContextConfiguration</b> annotation tells the <a shape="rect"
href="spring-testing.html" title="Spring Testing">Spring Testing</a> framework to
load the <b>ContextConfig</b> class as the configuration to use. This class derives
from <b>SingleRouteCamelConfiguration</b> which is a helper Spring Java Config
class which will configure the CamelContext for us and then register the RouteBuilder we create.</p>
-
-<p>If you wish to create a collection of <b>RouteBuilder</b> instances
then derive from the <b>CamelConfiguration</b> helper class and implement the
<b>routes()</b> method. Keep in mind that (starting from the Camel 2.13.0) if
you don't override <b>routes()</b> method, then <b>CamelConfiguration</b>
will use all <b>RouteBuilder</b> instances available in the Spring context.</p>
-
-<p>Since <b>Camel 2.11.0</b> you can use the CamelSpringJUnit4ClassRunner
with CamelSpringDelegatingTestContextLoader like <a shape="rect" class="external-link"
href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/CamelSpringDelegatingTestContextLoaderTest.java">example
using Java Config with CamelSpringJUnit4ClassRunner</a>.<br clear="none">
-</p><div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-@RunWith(CamelSpringJUnit4ClassRunner.class)
-@ContextConfiguration(
-        classes = {CamelSpringDelegatingTestContextLoaderTest.TestConfig.class},
-        // Since Camel 2.11.0 
-        loader = CamelSpringDelegatingTestContextLoader.class
-)
-@MockEndpoints
-public class CamelSpringDelegatingTestContextLoaderTest {
-    @EndpointInject(uri = "mock:direct:end")
-    protected MockEndpoint endEndpoint;
-
-    @EndpointInject(uri = "mock:direct:error")
-    protected MockEndpoint errorEndpoint;
-
-    @Produce(uri = "direct:test")
-    protected ProducerTemplate testProducer;
-
-    @Configuration
-    public static class TestConfig extends SingleRouteCamelConfiguration {
-        @Bean
-        @Override
-        public RouteBuilder route() {
-            return new RouteBuilder() {
-                @Override
-                public void configure() throws Exception {
-                    from("direct:test").errorHandler(deadLetterChannel("direct:error")).to("direct:end");
-
-                    from("direct:error").log("Received message on direct:error endpoint.");
-
-                    from("direct:end").log("Received message on direct:end endpoint.");
-                }
-            };
-        }
-    }
-
-    @Test
-    public void testRoute() throws InterruptedException {
-        endEndpoint.expectedMessageCount(1);
-        errorEndpoint.expectedMessageCount(0);
-
-        testProducer.sendBody("&lt;name&gt;test&lt;/name&gt;");
-
-        endEndpoint.assertIsSatisfied();
-        errorEndpoint.assertIsSatisfied();
-    }
-}
-]]></script>
-</div></div>.</div>
+<p>The <b>@ContextConfiguration</b> annotation tells the <a shape="rect"
href="spring-testing.html" title="Spring Testing">Spring Testing</a> framework to
load the <b>ContextConfig</b> class as the configuration to use. This class derives
from <b>SingleRouteCamelConfiguration</b> which is a helper Spring Java Config
class which will configure the CamelContext for us and then register the RouteBuilder we create.</p></div>
         </td>
         <td valign="top">
           <div class="navigation">



Mime
View raw message