Hi

I got time to work on this today and got this working
https://issues.apache.org/jira/browse/CAMEL-9332

There is a few tests here showing how it now works
https://github.com/apache/camel/tree/master/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/mockendpoints

You basically use the @RunWith(CamelSpringBootJUnit4ClassRunner.class)



On Fri, Apr 15, 2016 at 2:48 PM, Jeff Segal <jeffrey.se...@gmail.com> wrote:
> I may be in the same boat. May I ask - did you rip out Spring Boot entirely
> or just use vanilla camel-spring + Spring Boot? I'm hoping just the latter.
>
> On Fri, Apr 15, 2016 at 2:29 AM, David Bennison <david.benni...@metapack.com
>> wrote:
>
>> Fortunately I am not too far into my project so I've branched and ripped
>> out Camel Spring Boot (which is a shame). I lost a few days with this issue
>> and it makes me wonder what other problems may be lurking. They really
>> should have done what Chris Love suggested on CAMEL-7963 and highlighted in
>> the Docs the annotations that don't work, preferably with any known
>> workarounds.
>>
>> BTW once I ripped out Camel Spring Boot the @UseAdviceWith worked.
>> ________________________________________
>> From: Jeff Segal <jeffrey.se...@gmail.com>
>> Sent: 14 April 2016 18:18
>> To: users@camel.apache.org
>> Subject: Re: camel-spring-boot + @UseAdviceWith
>>
>> Exactly - I had the same suspicion with regard to Camel-7963 but was hoping
>> to be proven wrong here. I have not gotten any further unfortunately. I'm
>> planning on trying a few work-arounds but it's unclear what the typical
>> setup ought to be. I would think that others would be in the same boat if
>> they want to apply integration tests to their routes while using
>> camel-spring-boot.
>>
>> Jeff
>>
>> On Thu, Apr 14, 2016 at 5:16 AM, David Bennison <
>> david.benni...@metapack.com
>> > wrote:
>>
>> > Our problem looks similar to this one with @MockEndpoints raised back in
>> > 2015 against Camel 2.16.0.
>> >
>> > http://grokbase.com/t/camel/users/15bgwdeftt/spring-boot-test-mocks
>> >
>> > The reason given by Joakim Bjørnstad appears to explain what we are
>> > experiencing.
>> >
>> > The last comment on https://issues.apache.org/jira/browse/CAMEL-7963
>> is:-
>> >
>> > "I still need to add support for Spring test annotations like
>> > @MockEndpoints"
>> >
>> > So perhaps they never got done. I had problems with @MockEndpoints as
>> > well. I am also experiencing strangeness with NotifyBuilder but that
>> could
>> > be unrelated.
>> > ________________________________________
>> > From: Jeff Segal <jeffrey.se...@gmail.com>
>> > Sent: 12 April 2016 16:46
>> > To: users@camel.apache.org
>> > Subject: camel-spring-boot + @UseAdviceWith
>> >
>> > All,
>> >
>> > I'm currently creating a camel-spring-boot project and would like to add
>> > some tests using @UseAdviceWith but am hitting a few issues. I couldn't
>> > find an example that fit that use case exactly, so I've played around
>> with
>> > different things to no avail.
>> >
>> > Specifically, I found that when I use @ContextConfiguration to specify my
>> > main Spring app config, my use of
>> > @BootstrapWith(CamelTestContextBootstrapper.class) is honored (i.e. I can
>> > step through it in a debugger during startup) and I can see
>> @UseAdviceWith
>> > being used in CamelSpringTestContextLoader.handleCamelContextStartup().
>> > However, when I @Autowire my CamelContext into my test class, Spring
>> > startup fails because it can't find my CamelContext Spring bean (even
>> when
>> > I explicitly include a @Configuration that extends CamelConfiguration,
>> > which explicitly creates a CamelContext @Bean). I need a reference to my
>> > CamelContext so that I can start it once I'm done setting up my routeWith
>> > advice.
>> >
>> > One last thing: when I use @SpringApplicationConfiguration instead of
>> > @ContextConfiguration, Spring is able to find the CamelContext bean but
>> it
>> > ignores my @BootstrapWith(CamelTestContextBootstrapper.class) &
>> > @UseAdviceWith and thus just starts up the CamelContext automatically
>> > rather than waiting for me to start it manually (after my routeWith
>> > advice).
>> >
>> > Any pointers on what I might be doing wrong would be great. In summary:
>> >
>> > Honoring @UseAdviceWith but no CamelContext Spring bean:
>> >
>> > @ContextConfiguration(classes = {ApplicationConfig.class})
>> > @RunWith(CamelSpringJUnit4ClassRunner.class)
>> > @BootstrapWith(CamelTestContextBootstrapper.class)
>> > @UseAdviceWith
>> > @Slf4j
>> > public class MyTest {
>> >
>> >     @Autowired
>> >     CamelContext camelContext;
>> >
>> >     @Test
>> >     public void test() throws InterruptedException {
>> >         log.info("Starting test...");
>> >         Thread.sleep(1000 * 60);
>> >     }
>> >
>> > }
>> >
>> > Have a CamelContext Spring bean but NOT honoring @UseAdviceWith:
>> >
>> > @SpringApplicationConfiguration(classes = {ApplicationConfig.class})
>> > @RunWith(CamelSpringJUnit4ClassRunner.class)
>> > @BootstrapWith(CamelTestContextBootstrapper.class)
>> > @UseAdviceWith
>> > @Slf4j
>> > public class MyTest {
>> >
>> >     @Autowired
>> >     CamelContext camelContext;
>> >
>> >     @Test
>> >     public void test() throws InterruptedException {
>> >         log.info("Starting test...");
>> >         Thread.sleep(1000 * 60);
>> >     }
>> >
>> > }
>> >
>> > Thanks!
>> > Jeff
>> > This email is confidential and may be privileged. If you are not the
>> > intended recipient, please notify the sender immediately and delete the
>> > email from your computer. You should not copy the email, use it for any
>> > purpose or disclose its contents to any other person. Please note that
>> any
>> > views or opinions presented in this email may be personal to the author
>> and
>> > do not necessarily represent the views or opinions of MetaPack. It is the
>> > responsibility of the recipient to check this email for the presence of
>> > viruses. MetaPack accepts no liability for any damage caused by any virus
>> > transmitted by this email. MetaPack Registered Office: 4th Floor, 200
>> > Gray’s Inn Road London WC1X 8XZ. Registered in England No. 03870530. VAT
>> No
>> > 945 7723 86.
>> >
>> This email is confidential and may be privileged. If you are not the
>> intended recipient, please notify the sender immediately and delete the
>> email from your computer. You should not copy the email, use it for any
>> purpose or disclose its contents to any other person. Please note that any
>> views or opinions presented in this email may be personal to the author and
>> do not necessarily represent the views or opinions of MetaPack. It is the
>> responsibility of the recipient to check this email for the presence of
>> viruses. MetaPack accepts no liability for any damage caused by any virus
>> transmitted by this email. MetaPack Registered Office: 4th Floor, 200
>> Gray’s Inn Road London WC1X 8XZ. Registered in England No. 03870530. VAT No
>> 945 7723 86.
>>



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to