You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by cl...@apache.org on 2024/03/19 12:02:00 UTC

(camel) branch camel-4.4.x updated: CAMEL-20559 camel-jbang-plugin-k run command error on a multi-valued trait property (#13521) (#13534)

This is an automated email from the ASF dual-hosted git repository.

claudio4j pushed a commit to branch camel-4.4.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-4.4.x by this push:
     new e61f688752e CAMEL-20559 camel-jbang-plugin-k run command error on a multi-valued trait property (#13521) (#13534)
e61f688752e is described below

commit e61f688752e254432beae0fc8a7232bcf2f74572
Author: Claudio Miranda <cl...@claudius.com.br>
AuthorDate: Tue Mar 19 09:01:54 2024 -0300

    CAMEL-20559 camel-jbang-plugin-k run command error on a multi-valued trait property (#13521) (#13534)
    
    https://issues.apache.org/jira/browse/CAMEL-20559
    (cherry picked from commit 988e4cafc702f86199061e11924ebad73d9c65ab)
---
 .../jbang/core/commands/k/KubernetesHelper.java    |  1 +
 .../jbang/core/commands/k/IntegrationRunTest.java  | 34 ++++++++++++++++++++++
 2 files changed, 35 insertions(+)

diff --git a/dsl/camel-jbang/camel-jbang-plugin-k/src/main/java/org/apache/camel/dsl/jbang/core/commands/k/KubernetesHelper.java b/dsl/camel-jbang/camel-jbang-plugin-k/src/main/java/org/apache/camel/dsl/jbang/core/commands/k/KubernetesHelper.java
index 85dff123daa..61944dc85b7 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-k/src/main/java/org/apache/camel/dsl/jbang/core/commands/k/KubernetesHelper.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-k/src/main/java/org/apache/camel/dsl/jbang/core/commands/k/KubernetesHelper.java
@@ -56,6 +56,7 @@ public final class KubernetesHelper {
         OBJECT_MAPPER = JsonMapper.builder()
                 .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
                 .enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING)
+                .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
                 .enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING)
                 .disable(JsonParser.Feature.AUTO_CLOSE_SOURCE)
                 .enable(MapperFeature.BLOCK_UNSAFE_POLYMORPHIC_BASE_TYPES)
diff --git a/dsl/camel-jbang/camel-jbang-plugin-k/src/test/java/org/apache/camel/dsl/jbang/core/commands/k/IntegrationRunTest.java b/dsl/camel-jbang/camel-jbang-plugin-k/src/test/java/org/apache/camel/dsl/jbang/core/commands/k/IntegrationRunTest.java
index aaf3e182098..249a3c7b66a 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-k/src/test/java/org/apache/camel/dsl/jbang/core/commands/k/IntegrationRunTest.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-k/src/test/java/org/apache/camel/dsl/jbang/core/commands/k/IntegrationRunTest.java
@@ -537,6 +537,40 @@ class IntegrationRunTest extends KubeBaseTest {
                       servicePortName: http""", printer.getOutput());
     }
 
+    @Test
+    public void shouldUseTraitWithListItem() throws Exception {
+        IntegrationRun command = createCommand();
+        command.filePaths = new String[] { "classpath:route.yaml" };
+        command.traits
+                = new String[] { "toleration.taints=camel.apache.org/master:NoExecute:300", "camel.properties=camel.foo=bar" };
+        command.output = "yaml";
+        command.doCall();
+
+        Assertions.assertEquals("""
+                apiVersion: camel.apache.org/v1
+                kind: Integration
+                metadata:
+                  annotations:
+                    camel.apache.org/operator.id: camel-k
+                  name: route
+                spec:
+                  flows:
+                  - additionalProperties:
+                      from:
+                        uri: timer:tick
+                        steps:
+                        - set-body:
+                            constant: Hello Camel !!!
+                        - to: log:info
+                  traits:
+                    camel:
+                      properties:
+                      - camel.foo=bar
+                    toleration:
+                      taints:
+                      - camel.apache.org/master:NoExecute:300""", printer.getOutput());
+    }
+
     @Test
     public void shouldUseCompression() throws Exception {
         IntegrationRun command = createCommand();