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

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 1b3723f0e828 CAMEL-27362: camel-yaml-dsl - endpoint parameters keep 
the key of a map option as written (#30581)
1b3723f0e828 is described below

commit 1b3723f0e8284e61c89c5082db08c49d7777fbb7
Author: Claus Ibsen <[email protected]>
AuthorDate: Sun Nov 22 11:51:21 2026 +0100

    CAMEL-27362: camel-yaml-dsl - endpoint parameters keep the key of a map 
option as written (#30581)
    
    The keys under parameters: were all turned into camelCase, so an option can
    be written in dash form (bridge-endpoint). This changed the keys of a map
    option (multiValue) too, which are passed on as written, such as the cxf
    properties.ws-security.username, which became properties.wsSecurity.username
    and was ignored by CXF. The keys of a map value were changed as well.
    
    The keys are now kept as written when the parameters are parsed, and
    YamlSupport.createEndpointUri turns them into camelCase with the
    multiValue prefixes of the endpoint uri factory: a key that starts with a
    prefix (the longest, written as it is or in dash form) has only the prefix
    in camelCase. Without a factory, the whole key is in camelCase as before.
    
    - camel-yaml-dsl - a ? in a property placeholder of the uri is not a query
    An uri with an optional placeholder, such as smb:host/share/{{?dir}}, and
    parameters: failed with "Uri should not contains query parameters", as
    any ? was taken as the start of a query. A ? inside {{ }} is now skipped.
    
    - camel-yaml-dsl - shorter sentences and a camelCase option in the doc 
example
    The example of the "Option names in dash form" section used service-class,
    which the catalog checks of the documentation examples 
(CatalogDocExamplesTest
    in camel-jbang-core) report as an unknown cxf option. The example now uses
    serviceClass and keeps the map option keys in dash form; the dash form of an
    option is still explained in the text. The long sentence is split as the
    review suggested.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
    Signed-off-by: Claus Ibsen <[email protected]>
---
 .../org/apache/camel/catalog/docs/yaml-dsl.adoc    |  25 ++++
 .../common/YamlDeserializerEndpointAwareBase.java  |   2 +-
 .../dsl/yaml/common/YamlDeserializerSupport.java   |  36 ++++-
 .../apache/camel/dsl/yaml/common/YamlSupport.java  |  78 ++++++++++-
 .../dsl/yaml/common/YamlSupportOptionNameTest.java |  88 ++++++++++++
 .../camel-yaml-dsl/src/main/docs/yaml-dsl.adoc     |  25 ++++
 .../camel/dsl/yaml/ParametersMultiValueTest.java   | 153 +++++++++++++++++++++
 7 files changed, 398 insertions(+), 9 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/yaml-dsl.adoc
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/yaml-dsl.adoc
index a4c55ef1270b..04a4f765d5fc 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/yaml-dsl.adoc
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/yaml-dsl.adoc
@@ -375,6 +375,31 @@ Because the keys use underscore, then they are quoted.
 
 IMPORTANT: To use map values for parameters, then the `uri` must only refer to 
the name of the component, ie `plc4x` and not `plc4x:foo`
 
+=== Option names in dash form
+
+An option under `parameters` can be written in dash form, such as 
`service-class`, which Camel uses as
+`serviceClass`. This is not done for the keys of a map option, because Camel 
passes them on as they are written.
+
+A key can start with the prefix of a map option, such as `properties.` of the 
CXF component or `scheduler.` of a
+polling consumer. Then only the prefix is turned into camelCase, and the rest 
of the key is kept. The keys of a map
+value are kept as they are written as well.
+
+[source,yaml]
+----
+- route:
+    from:
+      uri: "direct:orders"
+      steps:
+        - to:
+            uri: "cxf://http://localhost:8080/orders";
+            parameters:
+              serviceClass: "com.foo.OrderService"
+              properties.ws-security.username: "alice"
+              properties.security.callback-handler: "#myHandler"
+----
+
+Here CXF gets the properties `ws-security.username` and 
`security.callback-handler` as they are written.
+
 == Defining beans
 
 In addition to the general support for creating beans provided by 
xref:others:main.adoc#_specifying_custom_beans[Camel Main], the YAML DSL 
provides a convenient syntax to define and configure them:
diff --git 
a/dsl/camel-yaml-dsl/camel-yaml-dsl-common/src/main/java/org/apache/camel/dsl/yaml/common/YamlDeserializerEndpointAwareBase.java
 
b/dsl/camel-yaml-dsl/camel-yaml-dsl-common/src/main/java/org/apache/camel/dsl/yaml/common/YamlDeserializerEndpointAwareBase.java
index b1d58ab10c26..da98d19fb655 100644
--- 
a/dsl/camel-yaml-dsl/camel-yaml-dsl-common/src/main/java/org/apache/camel/dsl/yaml/common/YamlDeserializerEndpointAwareBase.java
+++ 
b/dsl/camel-yaml-dsl/camel-yaml-dsl-common/src/main/java/org/apache/camel/dsl/yaml/common/YamlDeserializerEndpointAwareBase.java
@@ -51,7 +51,7 @@ public abstract class YamlDeserializerEndpointAwareBase<T> 
extends YamlDeseriali
 
             switch (propertyName) {
                 case "parameters":
-                    parameters = asScalarMap(tuple.getValueNode());
+                    parameters = asEndpointParameters(tuple.getValueNode());
                     break;
                 default:
                     if (!setProperty(target, propertyName, key.getValue(), 
val)) {
diff --git 
a/dsl/camel-yaml-dsl/camel-yaml-dsl-common/src/main/java/org/apache/camel/dsl/yaml/common/YamlDeserializerSupport.java
 
b/dsl/camel-yaml-dsl/camel-yaml-dsl-common/src/main/java/org/apache/camel/dsl/yaml/common/YamlDeserializerSupport.java
index b2baa35c1c7e..4fc36cfbd41a 100644
--- 
a/dsl/camel-yaml-dsl/camel-yaml-dsl-common/src/main/java/org/apache/camel/dsl/yaml/common/YamlDeserializerSupport.java
+++ 
b/dsl/camel-yaml-dsl/camel-yaml-dsl-common/src/main/java/org/apache/camel/dsl/yaml/common/YamlDeserializerSupport.java
@@ -370,7 +370,7 @@ public class YamlDeserializerSupport {
                     uri = YamlDeserializerSupport.asText(val);
                     break;
                 case "properties":
-                    properties = 
YamlDeserializerSupport.asScalarMap(tuple.getValueNode());
+                    properties = asEndpointParameters(tuple.getValueNode());
                     break;
                 default:
                     throw new UnsupportedFieldException(node, key);
@@ -391,7 +391,39 @@ public class YamlDeserializerSupport {
 
     public static Map<String, Object> parseParameters(NodeTuple node) {
         Node value = node.getValueNode();
-        return asScalarMap(value);
+        return asEndpointParameters(value);
+    }
+
+    /**
+     * The parameters of an endpoint, with the keys as they are written (also 
the keys of a map value), in the order
+     * they are written. {@link YamlSupport#createEndpointUri(CamelContext, 
Node, String, Map)} turns the option names
+     * into camelCase, but not the part after a multiValue prefix (such as 
properties.) that is passed on as written.
+     */
+    public static Map<String, Object> asEndpointParameters(Node node) {
+        if (node == null) {
+            return null;
+        }
+
+        final MappingNode mn = asMappingNode(node);
+        final Map<String, Object> answer = new LinkedHashMap<>();
+
+        for (NodeTuple tuple : mn.getValue()) {
+            final String key = asText(tuple.getKeyNode());
+            final Node val = tuple.getValueNode();
+
+            switch (val.getNodeType()) {
+                case SCALAR:
+                    answer.put(key, asText(val));
+                    break;
+                case MAPPING:
+                    answer.put(key, asEndpointParameters(val));
+                    break;
+                default:
+                    throw new UnsupportedNodeTypeException(val);
+            }
+        }
+
+        return answer;
     }
 
     public static void setSteps(Block target, Node node) {
diff --git 
a/dsl/camel-yaml-dsl/camel-yaml-dsl-common/src/main/java/org/apache/camel/dsl/yaml/common/YamlSupport.java
 
b/dsl/camel-yaml-dsl/camel-yaml-dsl-common/src/main/java/org/apache/camel/dsl/yaml/common/YamlSupport.java
index cd6fdddf7dfd..b80148fe9570 100644
--- 
a/dsl/camel-yaml-dsl/camel-yaml-dsl-common/src/main/java/org/apache/camel/dsl/yaml/common/YamlSupport.java
+++ 
b/dsl/camel-yaml-dsl/camel-yaml-dsl-common/src/main/java/org/apache/camel/dsl/yaml/common/YamlSupport.java
@@ -79,7 +79,7 @@ public final class YamlSupport {
             //
             return answer;
         }
-        if (uri.indexOf('?') != -1) {
+        if (hasQuery(uri)) {
             //
             // we support URIs defined as scheme only or scheme and path 
params,
             // query params are not supported so a definition like:
@@ -96,22 +96,27 @@ public final class YamlSupport {
 
         final String scheme = uri.contains(":") ? StringHelper.before(uri, 
":") : uri;
         final EndpointUriFactory factory = 
context.getCamelContextExtension().getEndpointUriFactory(scheme);
+        final boolean enabled = factory != null && factory.isEnabled(scheme);
+
+        // the option names in camelCase, but not the part after a multiValue 
prefix
+        final Map<String, Object> named
+                = optionNames(parameters, enabled ? 
factory.multiValuePrefixes().values() : Set.of());
 
         try {
-            if (factory != null && factory.isEnabled(scheme)) {
+            if (enabled) {
                 if (scheme.equals(uri)) {
                     //
                     // if the uri is expressed as simple scheme, then we can 
use the
                     // discovered EndpointUriFactory to build the uri
                     //
-                    answer = buildUri(factory, scheme, parameters);
+                    answer = buildUri(factory, scheme, named);
                 } else {
                     //
                     // otherwise we have to compose it but we can still 
leverage the
                     // discovered EndpointUriFactory to properly handle secrets
                     //
                     // in the order the parameters are written
-                    Map<String, Object> options = new 
LinkedHashMap<>(parameters);
+                    Map<String, Object> options = new LinkedHashMap<>(named);
 
                     for (String secretParameter : 
factory.secretPropertyNames()) {
                         Object val = options.get(secretParameter);
@@ -144,7 +149,7 @@ public final class YamlSupport {
                     answer += "?" + URISupport.createQueryString(flat, false);
                 }
             } else {
-                answer += "?" + createQueryString(parameters);
+                answer += "?" + createQueryString(named);
             }
         } catch (URISyntaxException e) {
             throw new InvalidEndpointException(node, "Error creating query", 
e);
@@ -153,6 +158,66 @@ public final class YamlSupport {
         return answer;
     }
 
+    /**
+     * Whether the uri has a query. A ? in a property placeholder, such as 
{{?dir}} (an optional placeholder), is not
+     * the start of a query.
+     */
+    static boolean hasQuery(String uri) {
+        int i = 0;
+        while (i < uri.length()) {
+            if (uri.startsWith("{{", i)) {
+                int end = uri.indexOf("}}", i + 2);
+                if (end == -1) {
+                    // not a placeholder
+                    return uri.indexOf('?', i) != -1;
+                }
+                i = end + 2;
+            } else if (uri.charAt(i) == '?') {
+                return true;
+            } else {
+                i++;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * The parameters with the option names in camelCase, so an option can be 
written in dash form (bridge-endpoint). A
+     * key that starts with a multiValue prefix (such as properties.) is an 
entry of a map option: only the prefix is in
+     * camelCase, and the rest is kept as written, as it is passed on as it is 
(properties.ws-security.username). The
+     * keys of a map value are kept as written as well. The parameters keep 
their order, when they have one.
+     */
+    private static Map<String, Object> optionNames(Map<String, Object> 
parameters, Collection<String> prefixes) {
+        Map<String, Object> answer = parameters instanceof LinkedHashMap ? new 
LinkedHashMap<>() : new HashMap<>();
+        for (Map.Entry<String, Object> entry : parameters.entrySet()) {
+            answer.put(optionName(entry.getKey(), prefixes), entry.getValue());
+        }
+        return answer;
+    }
+
+    /**
+     * The option name of a key in camelCase, but only the multiValue prefix 
of a key that starts with one.
+     *
+     * @param  key      the key as written
+     * @param  prefixes the multiValue prefixes of the component (such as 
properties.)
+     * @return          the option name
+     */
+    static String optionName(String key, Collection<String> prefixes) {
+        // the longest multiValue prefix (there are nested prefixes such as 
ftpClient. and ftpClient.keyStore.),
+        // written as it is or in dash form (a prefix can have a dash itself, 
such as request-model.)
+        for (int i = key.lastIndexOf('.'); i > 0; i = key.lastIndexOf('.', i - 
1)) {
+            String head = key.substring(0, i + 1);
+            if (prefixes.contains(head)) {
+                return key;
+            }
+            String camel = StringHelper.dashToCamelCase(head);
+            if (prefixes.contains(camel)) {
+                return camel + key.substring(i + 1);
+            }
+        }
+        return StringHelper.dashToCamelCase(key);
+    }
+
     /**
      * Creates the query of an endpoint uri from the parameters, not encoded 
and in the order they are written. A value
      * with & is put in RAW to keep it whole.
@@ -299,7 +364,8 @@ public final class YamlSupport {
                     final Node val = tuple.getValueNode();
 
                     if (val.getNodeType() == NodeType.SCALAR) {
-                        parameters.put(StringHelper.dashToCamelCase(key), 
YamlDeserializerSupport.asText(val));
+                        // the option names are turned into camelCase when the 
uri is created
+                        parameters.put(key, 
YamlDeserializerSupport.asText(val));
                     } else {
                         throw new InvalidNodeTypeException(node, 
NodeType.SCALAR);
                     }
diff --git 
a/dsl/camel-yaml-dsl/camel-yaml-dsl-common/src/test/java/org/apache/camel/dsl/yaml/common/YamlSupportOptionNameTest.java
 
b/dsl/camel-yaml-dsl/camel-yaml-dsl-common/src/test/java/org/apache/camel/dsl/yaml/common/YamlSupportOptionNameTest.java
new file mode 100644
index 000000000000..1162e776d517
--- /dev/null
+++ 
b/dsl/camel-yaml-dsl/camel-yaml-dsl-common/src/test/java/org/apache/camel/dsl/yaml/common/YamlSupportOptionNameTest.java
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.dsl.yaml.common;
+
+import java.util.List;
+import java.util.Set;
+
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * CAMEL-27362: only the option name of an endpoint parameter is turned into 
camelCase, not the part after a multiValue
+ * prefix.
+ */
+class YamlSupportOptionNameTest {
+
+    @Test
+    void optionNameInDashFormIsCamelCase() {
+        assertThat(YamlSupport.optionName("bridge-endpoint", 
Set.of("properties."))).isEqualTo("bridgeEndpoint");
+        assertThat(YamlSupport.optionName("bridgeEndpoint", 
Set.of("properties."))).isEqualTo("bridgeEndpoint");
+    }
+
+    @Test
+    void keyAfterMultiValuePrefixIsKept() {
+        Set<String> prefixes = Set.of("properties.");
+        assertThat(YamlSupport.optionName("properties.ws-security.username", 
prefixes))
+                .isEqualTo("properties.ws-security.username");
+        
assertThat(YamlSupport.optionName("properties.security.callback-handler", 
prefixes))
+                .isEqualTo("properties.security.callback-handler");
+    }
+
+    @Test
+    void multiValuePrefixInDashForm() {
+        assertThat(YamlSupport.optionName("ftp-client.data-timeout", 
List.of("ftpClient.")))
+                .isEqualTo("ftpClient.data-timeout");
+    }
+
+    @Test
+    void multiValuePrefixWithDash() {
+        // servicenow has the prefixes request-model. and response-model.
+        assertThat(YamlSupport.optionName("request-model.my-table", 
Set.of("request-model.", "response-model.")))
+                .isEqualTo("request-model.my-table");
+    }
+
+    @Test
+    void longestMultiValuePrefix() {
+        // ftp has the nested prefixes ftpClient. and ftpClient.keyStore.
+        Set<String> prefixes = Set.of("ftpClient.", "ftpClient.keyStore.");
+        assertThat(YamlSupport.optionName("ftp-client.key-store.key-password", 
prefixes))
+                .isEqualTo("ftpClient.keyStore.key-password");
+        assertThat(YamlSupport.optionName("ftpClient.keyStore.type", 
prefixes)).isEqualTo("ftpClient.keyStore.type");
+        assertThat(YamlSupport.optionName("ftp-client.so-timeout", 
prefixes)).isEqualTo("ftpClient.so-timeout");
+    }
+
+    @Test
+    void withoutMultiValuePrefixTheKeyIsCamelCase() {
+        // as before, such as when the component has no endpoint uri factory
+        assertThat(YamlSupport.optionName("properties.ws-security.username", 
Set.of()))
+                .isEqualTo("properties.wsSecurity.username");
+        assertThat(YamlSupport.optionName("other.ws-security", 
Set.of("properties."))).isEqualTo("other.wsSecurity");
+    }
+
+    @Test
+    void questionMarkInPlaceholderIsNotAQuery() {
+        assertThat(YamlSupport.hasQuery("smb:host/share/{{?dir}}")).isFalse();
+        assertThat(YamlSupport.hasQuery("file:{{?base}}/{{?dir}}")).isFalse();
+        assertThat(YamlSupport.hasQuery("file:{{?dir}}?noop=true")).isTrue();
+        assertThat(YamlSupport.hasQuery("file:inbox?noop=true")).isTrue();
+        assertThat(YamlSupport.hasQuery("file:inbox")).isFalse();
+        // not a placeholder, as it is not closed
+        assertThat(YamlSupport.hasQuery("file:{{?dir")).isTrue();
+    }
+}
diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/main/docs/yaml-dsl.adoc 
b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/main/docs/yaml-dsl.adoc
index a4c55ef1270b..04a4f765d5fc 100644
--- a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/main/docs/yaml-dsl.adoc
+++ b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/main/docs/yaml-dsl.adoc
@@ -375,6 +375,31 @@ Because the keys use underscore, then they are quoted.
 
 IMPORTANT: To use map values for parameters, then the `uri` must only refer to 
the name of the component, ie `plc4x` and not `plc4x:foo`
 
+=== Option names in dash form
+
+An option under `parameters` can be written in dash form, such as 
`service-class`, which Camel uses as
+`serviceClass`. This is not done for the keys of a map option, because Camel 
passes them on as they are written.
+
+A key can start with the prefix of a map option, such as `properties.` of the 
CXF component or `scheduler.` of a
+polling consumer. Then only the prefix is turned into camelCase, and the rest 
of the key is kept. The keys of a map
+value are kept as they are written as well.
+
+[source,yaml]
+----
+- route:
+    from:
+      uri: "direct:orders"
+      steps:
+        - to:
+            uri: "cxf://http://localhost:8080/orders";
+            parameters:
+              serviceClass: "com.foo.OrderService"
+              properties.ws-security.username: "alice"
+              properties.security.callback-handler: "#myHandler"
+----
+
+Here CXF gets the properties `ws-security.username` and 
`security.callback-handler` as they are written.
+
 == Defining beans
 
 In addition to the general support for creating beans provided by 
xref:others:main.adoc#_specifying_custom_beans[Camel Main], the YAML DSL 
provides a convenient syntax to define and configure them:
diff --git 
a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/test/java/org/apache/camel/dsl/yaml/ParametersMultiValueTest.java
 
b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/test/java/org/apache/camel/dsl/yaml/ParametersMultiValueTest.java
new file mode 100644
index 000000000000..ef6534575994
--- /dev/null
+++ 
b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/test/java/org/apache/camel/dsl/yaml/ParametersMultiValueTest.java
@@ -0,0 +1,153 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.dsl.yaml;
+
+import org.apache.camel.component.file.FileConsumer;
+import org.apache.camel.component.file.FileEndpoint;
+import org.apache.camel.dsl.yaml.support.YamlTestSupport;
+import org.apache.camel.model.ToDefinition;
+import org.apache.camel.support.DefaultScheduledPollConsumerScheduler;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * CAMEL-27362: the option names under parameters: are turned into camelCase, 
but the key of a map option (after a
+ * multiValue prefix such as scheduler. or properties.) is kept as written, as 
it is passed on as it is.
+ */
+class ParametersMultiValueTest extends YamlTestSupport {
+
+    @Test
+    void keyAfterMultiValuePrefixIsKept() throws Exception {
+        loadRoutes("""
+                - from:
+                    uri: direct:start
+                    steps:
+                      - to:
+                          uri: file:target/data/ParametersMultiValueTest/out
+                          parameters:
+                            auto-create: false
+                            scheduler.pool-size: 2
+                            scheduler.my-option: hello
+                """);
+
+        
assertThat(toUri()).isEqualTo("file:target/data/ParametersMultiValueTest/out"
+                                      + 
"?autoCreate=false&scheduler.pool-size=2&scheduler.my-option=hello");
+        FileEndpoint file = context.getEndpoint(toUri(), FileEndpoint.class);
+        assertThat(file.isAutoCreate()).isFalse();
+        assertThat(file.getSchedulerProperties()).containsEntry("pool-size", 
"2").containsEntry("my-option", "hello");
+    }
+
+    @Test
+    void keyOfMapOptionIsKept() throws Exception {
+        loadRoutes("""
+                - from:
+                    uri: direct:start
+                    steps:
+                      - to:
+                          uri: file:target/data/ParametersMultiValueTest/out
+                          parameters:
+                            scheduler-properties:
+                              pool-size: 2
+                              my-option: hello
+                """);
+
+        
assertThat(toUri()).isEqualTo("file:target/data/ParametersMultiValueTest/out"
+                                      + 
"?scheduler.pool-size=2&scheduler.my-option=hello");
+        FileEndpoint file = context.getEndpoint(toUri(), FileEndpoint.class);
+        assertThat(file.getSchedulerProperties()).containsEntry("pool-size", 
"2").containsEntry("my-option", "hello");
+    }
+
+    @Test
+    void otherDottedKeyIsCamelCaseAsBefore() throws Exception {
+        loadRoutes("""
+                - from:
+                    uri: direct:start
+                    steps:
+                      - to:
+                          uri: file:target/data/ParametersMultiValueTest/out
+                          parameters:
+                            Scheduler.pool-size: 2
+                """);
+
+        // not a multiValue prefix (case matters), so the key is in camelCase 
as before
+        
assertThat(toUri()).isEqualTo("file:target/data/ParametersMultiValueTest/out?Scheduler.poolSize=2");
+    }
+
+    @Test
+    void uriIsTheScheme() throws Exception {
+        loadRoutes("""
+                - from:
+                    uri: direct:start
+                    steps:
+                      - to:
+                          uri: file
+                          parameters:
+                            directory-name: 
target/data/ParametersMultiValueTest/out
+                            auto-create: false
+                            scheduler.my-option: hello
+                """);
+
+        
assertThat(toUri()).startsWith("file:target/data/ParametersMultiValueTest/out?")
+                
.contains("autoCreate=false").contains("scheduler.my-option=hello");
+        FileEndpoint file = context.getEndpoint(toUri(), FileEndpoint.class);
+        assertThat(file.isAutoCreate()).isFalse();
+        assertThat(file.getSchedulerProperties()).containsEntry("my-option", 
"hello");
+    }
+
+    @Test
+    void consumer() throws Exception {
+        loadRoutes("""
+                - from:
+                    uri: file:target/data/ParametersMultiValueTest/in
+                    parameters:
+                      initial-delay: 0
+                      scheduler.pool-size: 2
+                    steps:
+                      - to: mock:result
+                """);
+
+        
assertThat(context.getRouteDefinitions().get(0).getInput().getEndpointUri())
+                
.isEqualTo("file:target/data/ParametersMultiValueTest/in?initialDelay=0&scheduler.pool-size=2");
+
+        // a scheduler property is set on the scheduler bean, which takes a 
property name in dash form as well
+        context.start();
+        FileConsumer consumer = (FileConsumer) 
context.getRoutes().get(0).getConsumer();
+        DefaultScheduledPollConsumerScheduler scheduler = 
(DefaultScheduledPollConsumerScheduler) consumer.getScheduler();
+        assertThat(scheduler.getPoolSize()).isEqualTo(2);
+    }
+
+    @Test
+    void questionMarkInPlaceholderIsNotAQuery() throws Exception {
+        // an optional placeholder has a ?, which is not the start of a query
+        loadRoutes("""
+                - from:
+                    uri: direct:start
+                    steps:
+                      - to:
+                          uri: 
"file:target/data/ParametersMultiValueTest/{{?dir}}"
+                          parameters:
+                            auto-create: false
+                """);
+
+        
assertThat(toUri()).isEqualTo("file:target/data/ParametersMultiValueTest/{{?dir}}?autoCreate=false");
+    }
+
+    private String toUri() {
+        return ((ToDefinition) 
context.getRouteDefinitions().get(0).getOutputs().get(0)).getEndpointUri();
+    }
+}

Reply via email to