camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAMEL-11543) Camel doesn't support @TestPropertySource
Date Fri, 14 Jul 2017 17:44:00 GMT

    [ https://issues.apache.org/jira/browse/CAMEL-11543?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16087674#comment-16087674
] 

Claus Ibsen commented on CAMEL-11543:
-------------------------------------

Contributions with a implementation of this is welcome, such as a github PR
http://camel.apache.org/contributing

> Camel doesn't support @TestPropertySource
> -----------------------------------------
>
>                 Key: CAMEL-11543
>                 URL: https://issues.apache.org/jira/browse/CAMEL-11543
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-test
>    Affects Versions: 2.18.1
>         Environment: Spring 4.1 onwards
>            Reporter: Marc Carter
>              Labels: spring
>
> Vanilla Spring test passes:
> {code:java}
> @RunWith(SpringJUnit4ClassRunner.class)
> @ContextConfiguration(classes= PropTest.class)
> @Configuration
> @TestPropertySource(properties = "key=value")
> public class PropTest {
>     @Value("${key}") private String key;
>     @Test
>     public void test() {
>         assertThat(key, is("value"));
>     }
> }
> {code}
> Camel test fails (first two lines only changed):
> {code:java}
> @RunWith(CamelSpringRunner.class)
> @BootstrapWith(CamelTestContextBootstrapper.class)
> @ContextConfiguration(classes= PropTest.class)
> @Configuration
> @TestPropertySource(properties = "key=value")
> public class PropTest {
>     @Value("${key}") private String key;
>     @Test
>     public void test() {
>         assertThat(key, is("value"));
>     }
> }
> {code}
> This would appear to be related to the comment in [@TestPropertySource|https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/test/context/TestPropertySource.html]
> bq. @TestPropertySource is enabled if the configured context loader honors it. Every
SmartContextLoader that is a subclass of either AbstractGenericContextLoader or AbstractGenericWebContextLoader
provides automatic support for @TestPropertySource
> {{CamelSpringTestContextLoader}} does not extend AbstractGenericContextLoader but its
parent AbstractContextLoader so ignores the annotation.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message