camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Minh Tran <darth.minhs...@gmail.com>
Subject Re: Spring Boot autoconfiguration
Date Sat, 22 Oct 2016 10:53:52 GMT
Hi

There are times when running certain unit tests without Camel  is a good thing. For example,
testing POJOs. There’s no need to startup all the routes as they’re not being used. Moving
them into a different project isn’t very practical.

> On 21 Oct 2016, at 11:39 PM, Mark Nuttall <mknuttall@gmail.com> wrote:
> 
> It might be easier and better to move that code to a different project. It
> sounds like you have non camel specific code you want to test.
> 
> On Oct 20, 2016 11:15 PM, "Minh Tran" <darth.minhster@gmail.com> wrote:
> 
>> Hi
>> 
>> I’m using Camel 2.18.0 and Spring Boot. I’m trying to write a unit test
>> that excludes any Camel from starting up.
>> 
>> Prior to 2.18.0, I could do this by simply excluding
>> CamelAutoConfiguration. But now in 2.18.0, it looks like a whole bunch of
>> other AutoConfiguration for Camel has been added. So far I’ve added about
>> 20 extra classes to exclude before I gave up. Here is what I have so far
>> 
>> @RunWith(SpringJUnit4ClassRunner.class)
>> @SpringBootTest
>> public class PlainTest {
>> 
>>        @Configuration
>>        @EnableAutoConfiguration(exclude = {
>> CamelAutoConfiguration.class, DirectComponentAutoConfiguration.class,
>> DirectVmComponentAutoConfiguration.class,
>>                        LogComponentAutoConfiguration.class,
>> PropertiesComponentAutoConfiguration.class, RestComponentAutoConfiguration
>> .class,
>>                        SchedulerComponentAutoConfiguration.class,
>> SedaComponentAutoConfiguration.class, StubComponentAutoConfiguration
>> .class,
>>                        ValidatorComponentAutoConfiguration.class,
>> VmComponentAutoConfiguration.class, XsltComponentAutoConfiguration.class,
>>                        GzipDataFormatAutoConfiguration.class,
>> SerializationDataFormatAutoConfiguration.class,
>> StringDataFormatAutoConfiguration.class,
>>                        ZipDataFormatAutoConfiguration.class,
>> BeanLanguageAutoConfiguration.class, ConstantLanguageAutoConfigurat
>> ion.class,
>>                        HeaderLanguageAutoConfiguration.class })
>>        public static class Config {
>> 
>>        }
>> 
>>        @Test
>>        public void test() {
>>                // do something
>>        }
>> }
>> 
>> 
>> Could someone tell me the proper way of excluding Camel in my unit tests?
>> Thanks.
>> 
>> 
>> 


Mime
View raw message