Hi all
I've got a very simple route which reads from a file, does some processing and
then sends it by mail. I've also created a unit test based on
CamelSpringTestSupport where I mock the smtp endpoint and update the consuming
endpoint:
@Override
protected void doPostSetup() throws Exception {
context.getRouteDefinition(ROUTE_ID).adviceWith(context, new
AdviceWithRouteBuilder() {
@Override
public void configure() throws Exception {
replaceFromWith("direct:teststart");
weaveAddFirst().convertBodyTo(String.class);
weaveAddLast().log(LoggingLevel.DEBUG, "End: ${body}");
}
});
@Override
public String isMockEndpointsAndSkip() {
return "smtp*";
}
This is the route:
<onCompletion>
<to uri="jms:topic:MON?disableReplyTo=true" />
</onCompletion>
<route id="email-deliver">
<from uri="file://{{src.folder}}?include=.*.xml" />
<unmarshal>
<jaxb contextPath="com.example.email.jaxb"/>
</unmarshal>
<process ref="dummy" />
<to uri="smtp://{{smtp.hostname}}?contentType=text/html" />
</route>
When I run the maven project without <onCompletion> it works but if I activate
<onCompletion> it fails with the following error:
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 4.577 sec <<<
FAILURE! - in com.example.email.CamelRouteTest
testSendingMail(com.example.email.CamelRouteTest) Time elapsed: 4.514 sec <<<
ERROR!
java.lang.IllegalArgumentException: There are no outputs which matches: * in
the route: Route(email-deliver)[[From[direct:teststart]] ->
[onCompletion[[To[jms:topic:MON?disableReplyTo=true]]],
Unmarshal[org.apache.camel.model.dataformat.JaxbDataFormat@7ea08277],
process[ref:dummy], To[smtp://{{smtp.hostname}}?contentType=text/html]]]
at
org.apache.camel.builder.AdviceWithTasks$3.task(AdviceWithTasks.java:305)
at
org.apache.camel.model.RouteDefinition.adviceWith(RouteDefinition.java:281)
at com.example.email.CamelRouteTest.doPostSetup(CamelRouteTest.java:37)
Results :
Tests in error:
CamelRouteTest>CamelTestSupport.setUp:240->doPostSetup:37 ยป IllegalArgument
Th...
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
I've searched in the internet for this error "There are no outputs which
matches: *" but haven't found anything which explains why I've discovered this
behaviour.
What do I have to change to fix the unit test.
Thanks for your feedback
Oli