You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2021/03/23 08:47:00 UTC

[jira] [Comment Edited] (CAMEL-16230) Placeholders not Working with CamelSpringBootTest and AdviceWith

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

Claus Ibsen edited comment on CAMEL-16230 at 3/23/21, 8:46 AM:
---------------------------------------------------------------

This is only those special methods in AdviceWithRoyteBuilder like the mockEndpointAndSkip you are using. You can resolve the placeholder first with

String pattern = getContext().resolvePropertyPlaceholders("{{camel.placeholder}}");
route.mockEndpointsAndSkip(pattern);


was (Author: davsclaus):
This is only those special methods in AdviceWithRoyteBuilder like the mockEndpointAndSkip you are using. You can resolve the placeholder first with

String pattern = getContext().resolvePropertyPlaceholders("{{camel.placeholder");
route.mockEndpointsAndSkip(pattern);

> Placeholders not Working with CamelSpringBootTest and AdviceWith
> ----------------------------------------------------------------
>
>                 Key: CAMEL-16230
>                 URL: https://issues.apache.org/jira/browse/CAMEL-16230
>             Project: Camel
>          Issue Type: Improvement
>          Components: tests
>    Affects Versions: 3.7.2
>            Reporter: Alex
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 3.10.0
>
>
> Unable to use camel placeholders in a CamelSpringBootTest:
>  This does not work:
> {code}
>         AdviceWith.adviceWith(camelContext, "person-import", route -> {
>             route.replaceFromWith("direct:csv");
>             route.mockEndpointsAndSkip("{{camel.placeholder}}");
>         });
> {code}
> This does:
> {code}
>         AdviceWith.adviceWith(camelContext, "person-import", route -> {
>             route.replaceFromWith("direct:csv");
>             route.mockEndpointsAndSkip("jpa:MyEntity");
>         });
> {code}
> My route is defined like so:
> {code}
>         from("{{camel.person.csv.file}}")
>                 .id("person-import")
>                 .unmarshal(bindy)
>                 .process(new CamelLogger())
>                 .to("{{camel.placeholder}}")
>         ;
> {code}
> My placeholder is application.yaml of Spring Boot
> {code}
> camel:
>   placeholder: "jpa:MyEntity"
> {code}
> Please advise
> Best Regards
> Alex



--
This message was sent by Atlassian Jira
(v8.3.4#803005)