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

Claus Ibsen commented on CAMEL-15852:
-------------------------------------

Ah yeah dont use dots in keys - didnt you learn that in school ;)

Yeah lets add support for this, should be possible somewhere in the PBS class 
somewhere ;)

> properties binding: issues binding to map when the key contains a do
> --------------------------------------------------------------------
>
>                 Key: CAMEL-15852
>                 URL: https://issues.apache.org/jira/browse/CAMEL-15852
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core-engine
>            Reporter: Luca Burgazzoli
>            Priority: Minor
>             Fix For: 3.7.0
>
>
> I'm trying to bind some properties to an object that has a filed of type 
> Map<String, Object> and it looks like that when the keys for the map contain 
> a dot, the the mapping fails.
> As example:
> {code:java}
>  Map<String, Object> properties = mapOf(
>     "resources[0].name", "knative3",
>     "resources[0].type", "endpoint",
>     "resources[0].metadata[knative.apiVersion]", "serving.knative.dev/v1",
>     "resources[0].metadata[knative.kind]", "Service",
> );
> CamelContext context = new DefaultCamelContext();
> KnativeEnvironment env = 
> KnativeEnvironment.mandatoryLoadFromProperties(context, properties);
> List<KnativeResource> res = env.lookup(Knative.Type.endpoint, 
> "knative3").collect(Collectors.toList());
> assertThat(res).hasSize(1);
> assertThat(res).first().satisfies(resource  -> {
>     assertThat(resource.getName()).isEqualTo("knative3");
>     assertThat(resource.getMetadata()).isNotEmpty();
> });
> {code}
> This code fails as resource.getMetadata() return an empty map, if the 
> properties are then changed to:
> {code:java}
>  Map<String, Object> properties = mapOf(
>     "resources[0].name", "knative3",
>     "resources[0].type", "endpoint",
>     "resources[0].metadata[knative_apiVersion]", "serving.knative.dev/v1",
>     "resources[0].metadata[knative_kind]", "Service",
> );
> {code}
> Then the test succeeds. 



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

Reply via email to