You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2022/12/14 14:24:10 UTC

[camel] branch main updated (3ea0740370b -> b759c75b8cb)

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

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


    from 3ea0740370b camel-ldap - Add docs about LDAP injection
     new 384df4dbc05 CAMEL-18812 Fix REST DSL configuration placeholder for id
     new b759c75b8cb Fix REST DSL configuration placeholder for id (#8902)

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../java/org/apache/camel/model/RouteDefinitionHelper.java   |  2 +-
 .../org/apache/camel/component/rest/FromRestGetTest.java     | 12 +++++++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)


[camel] 02/02: Fix REST DSL configuration placeholder for id (#8902)

Posted by da...@apache.org.
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

commit b759c75b8cb4edbb289bf3ef9d70fe2fc6fd8e53
Author: Nikola Glidzic <94...@users.noreply.github.com>
AuthorDate: Wed Dec 14 15:22:13 2022 +0100

    Fix REST DSL configuration placeholder for id (#8902)
---
 .../src/main/java/org/apache/camel/model/RouteDefinitionHelper.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java b/core/camel-core-model/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java
index 90e21b986c0..b0e32f7c954 100644
--- a/core/camel-core-model/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java
+++ b/core/camel-core-model/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java
@@ -152,7 +152,7 @@ public final class RouteDefinitionHelper {
                 if (rest != null && route.isRest()) {
                     VerbDefinition verb = findVerbDefinition(rest, route.getInput().getEndpointUri());
                     if (verb != null) {
-                        String id = verb.getId();
+                        String id = context.resolvePropertyPlaceholders(verb.getId());
                         if (verb.hasCustomIdAssigned() && ObjectHelper.isNotEmpty(id) && !customIds.contains(id)) {
                             route.setId(id);
                             customIds.add(id);


[camel] 01/02: CAMEL-18812 Fix REST DSL configuration placeholder for id

Posted by da...@apache.org.
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

commit 384df4dbc055a993444fff3422aa92dbcdf2e64d
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Dec 14 15:22:24 2022 +0100

    CAMEL-18812 Fix REST DSL configuration placeholder for id
---
 .../org/apache/camel/component/rest/FromRestGetTest.java     | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestGetTest.java b/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestGetTest.java
index 8e243836009..70b6792c43a 100644
--- a/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestGetTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestGetTest.java
@@ -19,12 +19,14 @@ package org.apache.camel.component.rest;
 import java.util.Arrays;
 
 import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Route;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.model.ToDefinition;
 import org.apache.camel.model.rest.CollectionFormat;
 import org.apache.camel.model.rest.RestDefinition;
 import org.apache.camel.model.rest.RestParamType;
 import org.apache.camel.spi.Registry;
+import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -60,6 +62,7 @@ public class FromRestGetTest extends ContextTestSupport {
         assertEquals("/say/bye", rest.getPath());
         assertEquals(2, rest.getVerbs().size());
         assertEquals("application/json", rest.getVerbs().get(0).getConsumes());
+        assertEquals("{{mySpecialId}}", rest.getVerbs().get(0).getId());
 
         assertEquals(2, rest.getVerbs().get(0).getParams().size());
         assertEquals(RestParamType.header, rest.getVerbs().get(0).getParams().get(0).getType());
@@ -104,6 +107,9 @@ public class FromRestGetTest extends ContextTestSupport {
         assertEquals("Hello World", out);
         String out2 = template.requestBody("seda:get-say-bye", "Me", String.class);
         assertEquals("Bye World", out2);
+
+        Route route = context.getRoute("scott");
+        Assertions.assertNotNull(route);
     }
 
     @Override
@@ -111,10 +117,14 @@ public class FromRestGetTest extends ContextTestSupport {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
+                context.getPropertiesComponent().addInitialProperty("mySpecialId", "scott");
+
                 restConfiguration().host("localhost");
                 rest("/say/hello").get().to("direct:hello");
 
-                rest("/say/bye").get().consumes("application/json").param().type(RestParamType.header)
+                rest("/say/bye").get()
+                        .id("{{mySpecialId}}")
+                        .consumes("application/json").param().type(RestParamType.header)
                         .description("header param description1").dataType("integer")
                         .allowableValues("1", "2", "3", "4").defaultValue("1").name("header_count").required(true).endParam()
                         .param().type(RestParamType.query)