You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2011/08/27 18:02:37 UTC

[jira] [Assigned] (CAMEL-4388) Exeptions cannot be propagated to the parent route when using LogEIP

     [ https://issues.apache.org/jira/browse/CAMEL-4388?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen reassigned CAMEL-4388:
----------------------------------

    Assignee: Claus Ibsen

> Exeptions cannot be propagated to the parent route when using LogEIP
> --------------------------------------------------------------------
>
>                 Key: CAMEL-4388
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4388
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.7.1
>            Reporter: Sergey Zhemzhitsky
>            Assignee: Claus Ibsen
>         Attachments: LogProcessor.patch
>
>
> Here is unit test that demonstrates the problem.
> For the unit test pass successfully it's necessary to delete LogEIP from the route.
> {code}
> package org.apache.camel.impl;
> import org.apache.camel.Exchange;
> import org.apache.camel.Processor;
> import org.apache.camel.builder.RouteBuilder;
> import org.apache.camel.test.junit4.CamelTestSupport;
> import org.junit.Test;
> public class PropagateExceptionTest extends CamelTestSupport {
>     @Test
>     public void failure() throws Exception {
>         getMockEndpoint("mock:handleFailure").whenAnyExchangeReceived(new Processor() {
>             @Override
>             public void process(Exchange exchange) throws Exception {
>                 throw new RuntimeException("TEST EXCEPTION");
>             }
>         });
>         getMockEndpoint("mock:exceptionFailure").expectedMessageCount(1);
>         sendBody("direct:startFailure", "Hello World");
>         assertMockEndpointsSatisfied();
>     }
>     @Test
>     public void success() throws Exception {
>         getMockEndpoint("mock:handleSuccess").whenAnyExchangeReceived(new Processor() {
>             @Override
>             public void process(Exchange exchange) throws Exception {
>                 throw new RuntimeException("TEST EXCEPTION");
>             }
>         });
>         getMockEndpoint("mock:exceptionSuccess").expectedMessageCount(1);
>         sendBody("direct:startSuccess", "Hello World");
>         assertMockEndpointsSatisfied();
>     }
>     @Override
>     protected RouteBuilder[] createRouteBuilders() throws Exception {
>         return new RouteBuilder[] {
>                 new RouteBuilder() {
>                     public void configure() throws Exception {
>                         from("direct:startFailure")
>                             .onException(Throwable.class)
>                                 .to("mock:exceptionFailure")
>                                 .end()
>                             .to("direct:handleFailure")
>                             .to("mock:resultFailure");
>                         from("direct:handleFailure")
>                             .errorHandler(noErrorHandler())
>                             .log("FAULTY LOG")
>                             .to("mock:handleFailure");
>                     }
>                 },
>                 new RouteBuilder() {
>                     public void configure() throws Exception {
>                         from("direct:startSuccess")
>                             .onException(Throwable.class)
>                                 .to("mock:exceptionSuccess")
>                                 .end()
>                             .to("direct:handleSuccess")
>                             .to("mock:resultSuccess");
>                         from("direct:handleSuccess")
>                             .errorHandler(noErrorHandler())
>                             .to("mock:handleSuccess");
>                     }
>                 }
>         };
>     }
> }
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira