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

[jira] [Created] (CAMEL-15402) Spring components extending RouteBuilder not found during tests

Bert Koorengevel created CAMEL-15402:
----------------------------------------

             Summary: Spring components extending RouteBuilder not found during tests
                 Key: CAMEL-15402
                 URL: https://issues.apache.org/jira/browse/CAMEL-15402
             Project: Camel
          Issue Type: Bug
          Components: camel-spring-boot, camel-test
    Affects Versions: 3.4.2
         Environment: Spring Boot 2.3.2, JUnit5 that comes with the former, Java 11, Maven 3.6

 
            Reporter: Bert Koorengevel


Having written a couple of tests for pieces of routes within a Camel application, I have noticed that testing routes defined by components annotated with @Consume("direct:xyz") work quite well, but components that extend the class org.apache.camel.builder.RouteBuilder suffer from the following issue.

The component scanning by Spring encounters these components fine. If they are autowired in the test, then those fields have a value as expected. But when the test route has to invoke it, then delivery fails throwing a DirectConsumerNotAvailableException.

The work-around is to invoke camelContext.addRoutes

Demonstration of the issue:
[https://github.com/BertKoor/camelCase/blob/master/src/test/java/nl/ordina/bertkoor/camelcase/service/CamelHealthServiceClientTest.java] 



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