Can you log a JIRA ticket so we can improve testing camel-spring-boot.
We may end up having to do a camel-test-spring-boot module etc. There
has been a few other reports on some testing stuff that don't work as
well when you use a bunch of spring annotations etc.

You can find a link to jira here
http://camel.apache.org/support.html

On Thu, Nov 19, 2015 at 11:46 AM, yuncil <[email protected]> wrote:
> I have a problem with the property-mechanism in JUnit-Tests. In my
> application I just have to annotade my config-class to use property
> placeholders.
>
> @Configuration
> @PropertySource("classpath:my.properties")
> public class MyServiceConfigurator extends WsConfigurerAdapter {
>
> ...
>
> }
>
> Afterwards I can use properties this way: "{{someProperty}}", pretty cool
> and simple.
>
> I tried the same in my Junit-Test-Class.
>
> @RunWith(CamelSpringJUnit4ClassRunner.class)
> @ContextConfiguration(classes = {MyServiceConfigurator.class,
> MyServiceTests.TestConfig.class}, loader =
> CamelSpringDelegatingTestContextLoader.class)
> @MockEndpointsAndSkip(value = "spring-ws:*")
> @PropertySource("classpath:my.properties")
> public class MyServiceTests {
>
> ...
>
> }
>
> But this annotation hasn't any effects there. So I end up doing this:
>
> //static class within the Junits-test-class
>     @Configuration
>     @TestPropertySource("classpath:my.properties")
>     public static class TestConfig extends SingleRouteCamelConfiguration {
>
>         @Bean
>         @Override
>         public RouteBuilder route() {
>             return new MyServiceRoutes();
>         }
>
>         @Bean
>         public static PropertySourcesPlaceholderConfigurer configurer() {
>             return new PropertySourcesPlaceholderConfigurer();
>         }
>     }
>
> Now I can use my properties but not with the known syntax: "{{myProperty}}"
> but with "${myProperty}". Consequently I must change the code everytime I
> want to use the JunitTests.
>
> Has someone a simple explanation how to use properties within a Camel,
> Spring-Boot, Webservice-Project, especially within the JunitTest-classes.
>
> My project setup:
>
> Camel 2.16.0
> Spring-Boot 1.2.7
>
> Thanks in advance
>
> best regards
>
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/How-to-get-properties-working-in-camelTest-and-spring-tp5774102.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



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

Reply via email to