Thomas Gantenbein created CAMEL-20545:
-----------------------------------------
Summary: AdviceWith -> replaceFromWith fails when using several
templated routes
Key: CAMEL-20545
URL: https://issues.apache.org/jira/browse/CAMEL-20545
Project: Camel
Issue Type: Bug
Components: camel-main, camel-spring-boot
Affects Versions: 4.4.0
Reporter: Thomas Gantenbein
Given the following route template
{code:java}
routeTemplate("myRouteTemplate")
.templateParameter("message")
.from("timer:myTimer?period=5000")
.log("{{message}}");
{code}
And given the following two routes based on that template
{code:java}
templatedRoute("myRouteTemplate")
.parameter("message", "hello from first template")
.routeId("firstroute");
templatedRoute("myRouteTemplate")
.parameter("message", "hello from second template")
.routeId("secondroute");
{code}
a JUnit test annotated with
{code:java}
@CamelMainTest(replaceRouteFromWith = {"firstroute=direct:start"}){code}
will fail with
??Failed to start route secondroute because of Multiple consumers for the same
endpoint is not allowed: direct://start??
See
[https://github.com/thomas-gantenbein-tga/camel-advicewithtest/blob/master/src/test/java/com/acme/ReplaceFromWithAnnotationTest.java]
for such a JUnit test that will fail.
The same happens with Spring Boot test, see
[https://github.com/thomas-gantenbein-tga/advicewithtest_springboot/blob/master/src/test/java/com/acme/WithAdviceWithAnnotationTest.java].
Tests _do_ pass when the context is already started when advising it, see
https://github.com/thomas-gantenbein-tga/advicewithtest_springboot/blob/master/src/test/java/com/acme/NoAdviceWithAnnotationTest.java#L38.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)