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:11 UTC
[camel] 01/02: CAMEL-18812 Fix REST DSL configuration placeholder for id
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)