[ 
https://issues.apache.org/jira/browse/CAMEL-14296?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16996309#comment-16996309
 ] 

michael elbaz commented on CAMEL-14296:
---------------------------------------

[~acosentino] I was just closing and reopen for more precision, i write some 
tests until i point the issue.

> Camel advice with
> -----------------
>
>                 Key: CAMEL-14296
>                 URL: https://issues.apache.org/jira/browse/CAMEL-14296
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-test
>    Affects Versions: 2.24.2, 3.0.0
>            Reporter: michael elbaz
>            Priority: Major
>
> This test pass only if i directly use out (MockEnpoint) and not 
> out.getEndpointUri() or string representation but only when i use adviceWith 
> (is weird because i was always doing that in past and never faced this 
> situation)
> {code:java}
> package com.demo.camel;
> import org.apache.camel.EndpointInject;
> import org.apache.camel.RoutesBuilder;
> import org.apache.camel.builder.AdviceWithRouteBuilder;
> import org.apache.camel.builder.RouteBuilder;
> import org.apache.camel.component.mock.MockEndpoint;
> import org.apache.camel.test.junit4.CamelTestSupport;
> import org.junit.Before;
> import org.junit.Test;
> public class AdviceWithFailTest extends CamelTestSupport {
>     @EndpointInject(uri = "mock:out")
>     private MockEndpoint out;
>     @Override
>     @Before
>     public void setUp() throws Exception {
>         super.setUp();
>        // Commenting this one or using out and not out.getEndpointUri() will 
> make this test pass
>         context.getRouteDefinition(out.getEndpointUri()).adviceWith(context, 
> adviceWithRouteBuilder());
>     }
>     @Override
>     protected RoutesBuilder createRouteBuilder() throws Exception {
>         return new RouteBuilder() {
>             @Override
>             public void configure() throws Exception {
>                 from("timer:foo?repeatCount=1")
>                         .setBody(constant("test"))
>                         .routeId(out.getEndpointUri())
>                         .to(out.getEndpointUri());
>                 // Worked one is weird !
>                 // .to(out);
>             }
>         };
>     }
>     @Test
>     public void test() throws InterruptedException {
>         out.expectedMessageCount(1);
>         out.assertIsSatisfied();
>     }
>     private AdviceWithRouteBuilder adviceWithRouteBuilder() {
>         return new AdviceWithRouteBuilder() {
>             @Override
>             public void configure() throws Exception {
>                 weaveAddFirst().setBody(constant("test"));
>             }
>         };
>     }
> }
> {code}
> I see endpoint replacement but the context shutdown immediately 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to