I've added the following snippet to my test class but still face the same issue
@Override
public boolean isUseAdviceWith() {
return true;
}
BTW, I extend the class org.apache.camel.test.spring.CamelSpringTestSupport.
I've found the documentation in the last section here:
http://camel.apache.org/advicewith.html
The mentioned example is slightly different because the Java DSL is used and
not Spring DSL so the starting of the route is controlled by
CamelSpringTestSupport after the advice with.
Any ideas?
________________________________
Von: Claus Ibsen <[email protected]>
Gesendet: Freitag, 27. Oktober 2017 17:36:50
An: [email protected]
Betreff: Re: Sprint Unit test fails when OnCompletion configured
Make sure to configure your unit test that you are using advice with
There is a alert box about this in the docs
On Fri, Oct 27, 2017 at 5:31 PM, Oliver Wulff <[email protected]> wrote:
> It's failing with the same error in version 2.18.5, 2.19.3 and 2.20.0 as well.
>
> ________________________________
> Von: Oliver Wulff
> Gesendet: Freitag, 27. Oktober 2017 17:27:06
> An: [email protected]
> Betreff: AW: Sprint Unit test fails when OnCompletion configured
>
>
> Sorry for missing this important information. It's 2.17.6
>
> ________________________________
> Von: Claus Ibsen <[email protected]>
> Gesendet: Freitag, 27. Oktober 2017 16:51:27
> An: [email protected]
> Betreff: Re: Sprint Unit test fails when OnCompletion configured
>
> What version of CAmel do you use
>
> On Fri, Oct 27, 2017 at 4:12 PM, Oliver Wulff <[email protected]> wrote:
>> 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
>>
>>
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2