Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id D6ADC200D2D for ; Fri, 27 Oct 2017 11:37:05 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id D076A160BDC; Fri, 27 Oct 2017 09:37:05 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 2265F1609E9 for ; Fri, 27 Oct 2017 11:37:04 +0200 (CEST) Received: (qmail 84534 invoked by uid 500); 27 Oct 2017 09:37:04 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 84520 invoked by uid 99); 27 Oct 2017 09:37:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Oct 2017 09:37:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id E663F1A1623 for ; Fri, 27 Oct 2017 09:37:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.379 X-Spam-Level: X-Spam-Status: No, score=0.379 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id DrdeKrqkcR3m for ; Fri, 27 Oct 2017 09:37:01 +0000 (UTC) Received: from mail-qt0-f177.google.com (mail-qt0-f177.google.com [209.85.216.177]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 282085FB52 for ; Fri, 27 Oct 2017 09:37:01 +0000 (UTC) Received: by mail-qt0-f177.google.com with SMTP id 8so7663267qtv.1 for ; Fri, 27 Oct 2017 02:37:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-transfer-encoding; bh=eobVwUd7eANhlN9yqdDYv43cyxTolsXve0tfAd1ErVY=; b=YmNGNOaNdKA61xiDVTvWI3yk+5VA33xyu+LfQl/owMjKNUPdeEds0oMf3C4s38kqxf cOxUGPOoQ1r5ZTjAzvvdmPPeBXiUpkp1omwP32yPHX36GH9XH9/xIZSUqW5uXHpFVvXh Obf4emIR8Sk5cTugFZNpwPmdRAspjouoYwwFJM3vDm5+xK8/mWZ57gkulSfpyBjq32uW u1dQaK77NVDNf2U+AQYcGnSYqDiuS0hES4zWKD46NR+MYxiFMnmr2dfBNGYMx5RTwJ6y sVkhtSX4EWObBk3Lk5upu+ZVoMjsXo+TvOS4e6xcpwyOcdTY3J9rbE9rangoY1iVQIOW WYLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-transfer-encoding; bh=eobVwUd7eANhlN9yqdDYv43cyxTolsXve0tfAd1ErVY=; b=k91Noq00UaOREK+IR48mGF8wTWuxLa4hrn6cJQQ7uPmjD0d2dcj2ZEh6rX72V/b16w NY/ZdYhkOsSEjvsS3K2lcbv2bamUBZZpDWO0W+F+/XKKvFXSJTA8HR9dgMmV7oZghahP Ob75PX0AEJjhSr6xT1rz4QAoyelI2qP5IdHTwmROMzr52K3/hNJoqW5S8nTCZvAXXuFg T4UqQYC0KWmhijG1/CNPa0MtFM9IOxFddl60sdIvUytEvzStpASb5j0GFQ/CurDmImGa 1T9nPFSqUC8iUjGeKCvCf12Dng07FPPdcokJmOFCTX7p3kNHGHKho4Y1uZ1vijr81/v4 tslw== X-Gm-Message-State: AMCzsaUuoMR9e7zYf1OqBChJF9xSSP+gDDon5ATEWQqz5Gnvyux+XNUN CUEoR8meTWmtsaP7UHvMuWViHHe1x7+NBq3gWM27Zat5 X-Google-Smtp-Source: ABhQp+QH2hWhTe2NEXUvtv2nS25IToKkuvXkDASN9FfYKMO/mRmZMV+n4YrZ+hQNJmei+yk1kaexDV7sxcGHO26RmYo= X-Received: by 10.237.43.99 with SMTP id p90mr39833103qtd.171.1509097019953; Fri, 27 Oct 2017 02:36:59 -0700 (PDT) MIME-Version: 1.0 Received: by 10.200.35.97 with HTTP; Fri, 27 Oct 2017 02:36:39 -0700 (PDT) In-Reply-To: References: From: Claus Ibsen Date: Fri, 27 Oct 2017 11:36:39 +0200 Message-ID: Subject: Re: CamelSpringBootRunner and AdviceWith To: "users@camel.apache.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable archived-at: Fri, 27 Oct 2017 09:37:06 -0000 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=C4=87 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 manuall= y > camelContext.start(); > ............. > ............. > } > } > > As mentioned before, the CamelSpringBootExecutionListener in 2.20.0 start= s > already the camelContext which was earlier not the case: > > public class CamelSpringBootExecutionListener extends > AbstractTestExecutionListener { > > @Override > public void prepareTestInstance(TestContext testContext) throws Excep= tion { > > ......... > > SpringCamelContext.setNoStart(false); > CamelContext camelContext =3D context.getBean(CamelContext.class)= ; > > // after our customizations we should start the CamelContext > camelContext.start(); > > } > > ........... > > } > > > 2017-10-27 9:05 GMT+02:00 Claus Ibsen : > >> Hi >> >> Can you post sample code, and have you added the @UseAdviceWith annotati= on >> >> On Tue, Oct 24, 2017 at 2:58 PM, Boris Stanojevi=C4=87 >> wrote: >> > When using CamelSpringBootRunner (camel 2.20) for my tests I'm not abl= e >> to >> > "adviceWith" my Routes any more since CamelContext is already started = by >> " >> > CamelSpringBootExecutionListener" and therefore adviceWith doesn't tak= e >> > place. >> > >> > Any suggestions? >> > >> > Many thanks!! >> >> >> >> -- >> Claus Ibsen >> ----------------- >> http://davsclaus.com @davsclaus >> Camel in Action 2: https://www.manning.com/ibsen2 >> --=20 Claus Ibsen ----------------- http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2