2007/11/6, Roman Kalukiewicz <[EMAIL PROTECTED]>:
> 2007/10/25, Nicky Sandhu <[EMAIL PROTECTED]>:
> >
> > Hi Hendrik,
> > Good catch. I have opened an issue
> > (https://issues.apache.org/activemq/browse/CAMEL-191) and submitted a patch
> > for review.
> > Nicky
>
> I can see the same problem with exception() construct.
>
> exception(Exception.class).setBody(constant("error!!!!!!")).to("log:test");
>
> unfortunately this doesn't work as exeption is not cleared.
>
> I've created CAMEL-210 issue to track this.
>
> Romek
here is the test case we can use:
import org.apache.camel.ContextTestSupport;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
public class ExceptionTest extends ContextTestSupport {
MockEndpoint endEndpoint;
@Override
protected void setUp() throws Exception {
super.setUp();
endEndpoint = getMockEndpoint("mock:end");
}
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
exception(Exception.class).setBody(constant("exception")).to("mock:end");
from("direct:start").process(new Processor() {
public void process(Exchange exchange) throws Exception {
throw new Exception();
}
}).to("mock:end");
}
};
}
public void testException() throws InterruptedException {
endEndpoint.expectedBodiesReceived("exception");
endEndpoint.expectedMessageCount(1);
template.sendBody("direct:start", "test");
MockEndpoint.assertIsSatisfied(endEndpoint);
}
}