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 9a7a526e0dc CAMEL-18812 Fix REST DSL configuration placeholder for id
9a7a526e0dc is described below
commit 9a7a526e0dcee8486ad251cf085c6522f8b51e75
Author: Claus Ibsen <[email protected]>
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)