Hi

Yes its a bug and I logged a ticket
https://issues.apache.org/jira/browse/CAMEL-11955

On Fri, Oct 27, 2017 at 9:53 AM, Boris Stanojević
<[email protected]> wrote:
> Hi,
> sure...
>
> *@RunWith(CamelSpringBootRunner.class)*
> *@UseAdviceWith*
> @ActiveProfiles("test")
> @DirtiesContext
> public class MyRouteBuilderTest extends AbstractRouteBuilderTest {
>
>     @Autowired
>     private MyRouteBuilder routeBuilder;
>
>     @Test
>     public void testMyRoute() throws Exception {
>
>         *////* *camelContext is here already started !!!!!! :( //////*
> *        //// therefore the following customization does not take place ///*
>
> camelContext.getRouteDefinition(routeBuilder.getMainRouteId()).adviceWith(camelContext,
> new AdviceWithRouteBuilder() {
>             @Override
>             public void configure() throws Exception {
>                 interceptSendToEndpoint("direct:my-direct-endpoint")
>                         .skipSendToOriginalEndpoint()
>                         .to("mock:advised");
>             }
>         });
>
>         // Because of @UseAdviceWith, the context must be started manually
>         camelContext.start();
>         .............
>         .............
>     }
> }
>
> As mentioned before, the CamelSpringBootExecutionListener in 2.20.0 starts
> already the camelContext which was earlier not the case:
>
> public class CamelSpringBootExecutionListener extends
> AbstractTestExecutionListener {
>
>     @Override
>     public void prepareTestInstance(TestContext testContext) throws Exception 
> {
>
>         .........
>
>         SpringCamelContext.setNoStart(false);
>         CamelContext camelContext = context.getBean(CamelContext.class);
>
>         // after our customizations we should start the CamelContext
>         camelContext.start();
>
>     }
>
>     ...........
>
> }
>
>
> 2017-10-27 9:05 GMT+02:00 Claus Ibsen <[email protected]>:
>
>> Hi
>>
>> Can you post sample code, and have you added the @UseAdviceWith annotation
>>
>> On Tue, Oct 24, 2017 at 2:58 PM, Boris Stanojević
>> <[email protected]> wrote:
>> > When using CamelSpringBootRunner (camel 2.20) for my tests I'm not able
>> to
>> > "adviceWith" my Routes any more since CamelContext is already started by
>> "
>> > CamelSpringBootExecutionListener" and therefore adviceWith doesn't take
>> > place.
>> >
>> > Any suggestions?
>> >
>> > Many thanks!!
>>
>>
>>
>> --
>> 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

Reply via email to