Author: buildbot
Date: Wed Aug 23 22:19:52 2017
New Revision: 1017198

Log:
Production update by buildbot for camel

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

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

Modified: websites/production/camel/content/spring-boot.html
==============================================================================
--- websites/production/camel/content/spring-boot.html (original)
+++ websites/production/camel/content/spring-boot.html Wed Aug 23 22:19:52 2017
@@ -322,7 +322,58 @@ camel.springboot.xmlRests = classpath:co
       </delete>
    </rest>
  &lt;/rests&gt;]]></script>
-</div></div><p>&#160;</p><p><br clear="none"></p><h3 
id="SpringBoot-SeeAlso">See Also</h3>
+</div></div><h3 id="SpringBoot-UnitTests">Unit Tests</h3><p>Below is a sample 
unit test set up for camel spring-boot.&#160;</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[@ActiveProfiles(&quot;test&quot;)
+@RunWith(CamelSpringBootRunner.class)
+@SpringBootTest
+@DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
+@DisableJmx(true)
+public class MyRouteTest extends CamelTestSupport {
+
+       @Autowired
+       private CamelContext camelContext;
+
+       @Override
+       protected CamelContext createCamelContext() throws Exception {
+               return camelContext;
+       }
+
+       @EndpointInject(uri = &quot;direct:myEndpoint&quot;)
+       private ProducerTemplate endpoint;
+
+       @Override
+       public void setUp() throws Exception {
+               super.setUp();
+               RouteDefinition definition = 
context().getRouteDefinitions().get(0);
+               definition.adviceWith(context(), new RouteBuilder() {
+                       @Override
+                       public void configure() throws Exception {
+                               
onException(Exception.class).maximumRedeliveries(0);
+                       }
+               });
+       }
+
+       @Override
+       public String isMockEndpointsAndSkip() {
+               return &quot;myEndpoint:put*&quot;;
+       }
+
+       @Test
+       public void shouldSucceed() throws Exception {
+               assertNotNull(camelContext);
+               assertNotNull(endpoint);
+               
+               String expectedValue = &quot;expectedValue&quot;;
+               MockEndpoint mock = 
getMockEndpoint(&quot;mock:myEndpoint:put&quot;);
+               mock.expectedMessageCount(1);
+               mock.allMessages().body().isEqualTo(expectedValue);
+               
mock.allMessages().header(MY_HEADER).isEqualTo(&quot;testHeader&quot;);
+               endpoint.sendBodyAndHeader(&quot;test&quot;, MY_HEADER, 
&quot;testHeader&quot;);
+               
+               mock.assertIsSatisfied();
+       }
+}]]></script>
+</div></div><p><br clear="none"></p><h3 id="SpringBoot-SeeAlso">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></div>
         </td>
         <td valign="top">


Reply via email to