Luca Burgazzoli created CAMEL-15852:
---------------------------------------
Summary: 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
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)