You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Michel Erard (Jira)" <ji...@apache.org> on 2020/08/31 11:01:00 UTC

[jira] [Comment Edited] (CAMEL-15486) Mocking of Camel Endpoints breaks because adding 3rd party dependency with spring boot

    [ https://issues.apache.org/jira/browse/CAMEL-15486?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17187641#comment-17187641 ] 

Michel Erard edited comment on CAMEL-15486 at 8/31/20, 11:00 AM:
-----------------------------------------------------------------

Indeed, the line {{Starting CamelContext with name [camelContext]}} is missing in the output. I'll have a closer look.


was (Author: erard22):
Indeed, the line `Starting CamelContext with name [camelContext].` is missing in the output. I'll have a closer look.

> Mocking of Camel Endpoints breaks because adding 3rd party dependency with spring boot
> --------------------------------------------------------------------------------------
>
>                 Key: CAMEL-15486
>                 URL: https://issues.apache.org/jira/browse/CAMEL-15486
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-test
>    Affects Versions: 3.4.3
>            Reporter: Michel Erard
>            Priority: Minor
>
> As soon you add the dependency 
> {code:java}
> <dependency>            
>     <groupId>org.springframework.cloud</groupId>            
>     <artifactId>spring-cloud-contract-wiremock</artifactId>               
>     <version>2.2.3.RELEASE</version>            
>     <scope>test</scope>        
> </dependency>{code}
> to your project, the mocking of the endpoints breaks.
> I've created a simple example to reproduce the issue: 
> [https://github.com/erard22/spring-boot-camel-bug-demo]
>  
> {code:java}
> @Component
> public class SimpleCamelRoute extends RouteBuilder {
>     @Override
>     public void configure() {
>         from("direct:processMessage")
>                 .to("file:output");
>     }
> }
> {code}
> {code:java}
> @CamelSpringBootTest
> @SpringBootTest(classes = DemoApplication.class)
> @ContextConfiguration
> @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
> @MockEndpoints("file:*")
> class SimpleCamelRouteTest {
>     @Autowired
>     private CamelContext camelContext;
>     @Produce("direct:processMessage")
>     private ProducerTemplate producer;
>     @EndpointInject("mock://file:output")
>     private MockEndpoint mockCamel;
>     @Test
>     void processMessage_successful() throws Exception {
>         mockCamel.expectedBodiesReceived("foo");
>         producer.sendBodyAndHeaders("foo", Collections.emptyMap());
>         mockCamel.assertIsSatisfied();
>     }
> }
> {code}
> {code:java}
> java.lang.AssertionError: mock://file:output Received message count. Expected: <1> but was: <0>
> Expected :<1>
> Actual   :<0>
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)