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 25c6941b8f133fd3f1dce785f783266406a11bc5
Author: Claus Ibsen <[email protected]>
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 ++++-
 .../java/org/apache/camel/component/rest/FromRestRouteIdTest.java  | 3 ++-
 4 files changed, 16 insertions(+), 5 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)
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestRouteIdTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestRouteIdTest.java
index dd36316200f..e4753c2869a 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestRouteIdTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/component/rest/FromRestRouteIdTest.java
@@ -42,7 +42,8 @@ public class FromRestRouteIdTest extends FromRestGetTest {
                 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)

Reply via email to