JiriOndrusek commented on issue #4362: URL: https://github.com/apache/camel-quarkus/issues/4362#issuecomment-1369885091
The problem is caused by the usage of the `javax.enterprise.inject.Produces` in the test (line https://github.com/guhilling/camel-quarkus-demos/blob/main/src/test/java/de/hilling/camel/SampleRouteBuilderTest.java#L35). The `CamelQuarkusTestSupport` aims to help replace Camel's CamelTestSupport tests. `@Produce` can not be used with them and CamrlQuarkusTestSupport does not work with them easily. Using @Produce to create routeBuilders is not recommanded. Here are some problems caused by the differences of lifecycle in Camel and CamelQuarkus: • Application is started once for all the tests together. Therefore all @Produces methods are applied together - in case there were several Test classes each producing its own route builder - this will force application to create all routes at the start (even if they are not necessary for the first test class) • Support of `CamelTestSupport` like tests forces camel-quarkus to emulate several lifecycle actions without stopping the application. Which leads for example to stopping and removing routes and creating them again for another test method/classes. • . Fully supported style of registering RouteBuilders is to use overriding method. Please replace following code (lines https://github.com/guhilling/camel-quarkus-demos/blob/main/src/test/java/de/hilling/camel/SampleRouteBuilderTest.java#L33-L39) ``` @Configuration public static class TestConfig { @Produces RoutesBuilder route() { return new SampleRouteBuilder(); } } ``` with ``` @Override protected RouteBuilder createRouteBuilder() { return new SampleRouteBuilder(); } ``` and the tests will finish successfully. I've added the suggestion to not use @Produce with RouteBuilders int the documentation. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org