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

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


The following commit(s) were added to refs/heads/camel-3.18.x by this push:
     new 27cdb54f0c4 CAMEL-18812 Fix REST DSL configuration placeholder for id
27cdb54f0c4 is described below

commit 27cdb54f0c4aa1166d8acec5ee0542286b1d19ba
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Wed Dec 14 18:42:28 2022 +0100

    CAMEL-18812 Fix REST DSL configuration placeholder for id
---
 .../apache/camel/component/rest/FromRestExplicitComponentTest.java | 6 +++++-
 .../test/java/org/apache/camel/component/rest/FromRestGetTest.java | 7 +++++--
 .../apache/camel/component/rest/FromRestIdAndDescriptionTest.java  | 5 ++++-
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git 
a/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestExplicitComponentTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestExplicitComponentTest.java
index a19718ad65b..da33b3fb2cc 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestExplicitComponentTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestExplicitComponentTest.java
@@ -27,12 +27,16 @@ public class FromRestExplicitComponentTest extends 
FromRestGetTest {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
+                
context.getPropertiesComponent().addInitialProperty("mySpecialId", "scott");
+
                 // configure to use dummy-rest
                 restConfiguration().component("dummy-rest").host("localhost");
 
                 rest("/say/hello").get().to("direct:hello");
 
-                
rest("dummy-rest").path("/say/bye").get().consumes("application/json").param().type(RestParamType.header)
+                rest("dummy-rest").path("/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)
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 70b6792c43a..91946aea0bc 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
@@ -108,8 +108,11 @@ public class FromRestGetTest extends ContextTestSupport {
         String out2 = template.requestBody("seda:get-say-bye", "Me", 
String.class);
         assertEquals("Bye World", out2);
 
-        Route route = context.getRoute("scott");
-        Assertions.assertNotNull(route);
+        // some tests that inherit this class does not use dynamic id
+        if 
(context.getPropertiesComponent().resolveProperty("mySpecialId").isPresent()) {
+            Route route = context.getRoute("scott");
+            Assertions.assertNotNull(route);
+        }
     }
 
     @Override
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestIdAndDescriptionTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestIdAndDescriptionTest.java
index 47d9d40edf0..4fc77b4c78f 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestIdAndDescriptionTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestIdAndDescriptionTest.java
@@ -52,11 +52,14 @@ public class FromRestIdAndDescriptionTest extends 
FromRestGetTest {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
+                
context.getPropertiesComponent().addInitialProperty("mySpecialId", "scott");
+
                 restConfiguration().host("localhost");
                 rest("/say/hello").id("hello").description("Hello 
Service").get().id("get-say").description("Says hello to you")
                         .to("direct:hello");
 
-                rest("/say/bye").description("bye", "Bye Service", 
"en").get().description("Says bye to you")
+                rest("/say/bye").description("bye", "Bye Service", "en")
+                        .get().id("{{mySpecialId}}").description("Says bye to 
you")
                         
.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)

Reply via email to