I have the following route for demo purposes
from("direct:external")
.routeId("external")
.to("http4://www.third-party.com/foo").id("ext");
For testing, I would like to * replace the http4: endpoint with a direct: endpoint * add a mock: endpoint at the end of the route for verification
I've added the following adviceWithRouteBuilder
context.getRouteDefinition("external").adviceWith(context, new AdviceWithRouteBuilder() {
@Override
public void configure() throws Exception {
weaveAddLast().to("mock:result");
weaveByToUri(".*http4://.*")
.replace()
.to("direct:foo");
}
});
This one seems to work but if I change the order of the weave*
statements, like so
public void configure() throws Exception {
weaveByToUri(".*http4://.*")
.replace()
.to("direct:foo");
weaveAddLast().to("mock:result");
}
It gives me the following error
java.lang.IllegalArgumentException: There are no outputs which matches: * in the route: Route(external)[[From[direct:external]] -> [pipeline -> [[To[direct:foo]]]]]
I would actually expect to get the same result, independent of the order.