Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-15852

properties binding: issues binding to map when the key contains a dot

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.7.0
    • Component/s: camel-core-engine
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      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:

       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();
      });
      

      This code fails as resource.getMetadata() return an empty map, if the properties are then changed to:

       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",
      );
      

      Then the test succeeds.

        Attachments

          Activity

            People

            • Assignee:
              davsclaus Claus Ibsen
              Reporter:
              lb Luca Burgazzoli

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment