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> </rests>]]></script> -</div></div><p> </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. </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("test") +@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 = "direct:myEndpoint") + 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 "myEndpoint:put*"; + } + + @Test + public void shouldSucceed() throws Exception { + assertNotNull(camelContext); + assertNotNull(endpoint); + + String expectedValue = "expectedValue"; + MockEndpoint mock = getMockEndpoint("mock:myEndpoint:put"); + mock.expectedMessageCount(1); + mock.allMessages().body().isEqualTo(expectedValue); + mock.allMessages().header(MY_HEADER).isEqualTo("testHeader"); + endpoint.sendBodyAndHeader("test", MY_HEADER, "testHeader"); + + 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">