You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pp...@apache.org on 2020/09/09 08:34:25 UTC
[camel-quarkus] branch master updated: Tests for #1563 contextPath
ignored for platform-http with REST DSL
This is an automated email from the ASF dual-hosted git repository.
ppalaga pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/master by this push:
new ef739ea Tests for #1563 contextPath ignored for platform-http with REST DSL
ef739ea is described below
commit ef739ea094b6c75afd83b57dc8274aed121ea5c1
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Fri Aug 21 19:53:25 2020 +0200
Tests for #1563 contextPath ignored for platform-http with REST DSL
---
.../platform/http/it/PlatformHttpRouteBuilder.java | 7 +++++++
.../component/http/server/it/PlatformHttpTest.java | 22 ++++++++++++----------
2 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/integration-tests/platform-http/src/main/java/org/apache/camel/quarkus/component/platform/http/it/PlatformHttpRouteBuilder.java b/integration-tests/platform-http/src/main/java/org/apache/camel/quarkus/component/platform/http/it/PlatformHttpRouteBuilder.java
index 7f96885..bee8045 100644
--- a/integration-tests/platform-http/src/main/java/org/apache/camel/quarkus/component/platform/http/it/PlatformHttpRouteBuilder.java
+++ b/integration-tests/platform-http/src/main/java/org/apache/camel/quarkus/component/platform/http/it/PlatformHttpRouteBuilder.java
@@ -27,11 +27,18 @@ import org.apache.camel.Exchange;
import org.apache.camel.attachment.AttachmentMessage;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.webhook.WebhookConfiguration;
+import org.apache.camel.model.rest.RestBindingMode;
public class PlatformHttpRouteBuilder extends RouteBuilder {
@SuppressWarnings("unchecked")
@Override
public void configure() {
+ restConfiguration().component("platform-http").bindingMode(RestBindingMode.off)
+ // and output using pretty print
+ .dataFormatProperty("prettyPrint", "true")
+ // setup context path and port number that api will use
+ .contextPath("my-context");
+
rest()
.get("/platform-http/rest-get")
.route()
diff --git a/integration-tests/platform-http/src/test/java/org/apache/camel/quarkus/component/http/server/it/PlatformHttpTest.java b/integration-tests/platform-http/src/test/java/org/apache/camel/quarkus/component/http/server/it/PlatformHttpTest.java
index df8a957..72e983b 100644
--- a/integration-tests/platform-http/src/test/java/org/apache/camel/quarkus/component/http/server/it/PlatformHttpTest.java
+++ b/integration-tests/platform-http/src/test/java/org/apache/camel/quarkus/component/http/server/it/PlatformHttpTest.java
@@ -53,11 +53,11 @@ class PlatformHttpTest {
@Test
public void rest() throws Throwable {
- RestAssured.get("/platform-http/rest-get")
+ RestAssured.get("/my-context/platform-http/rest-get")
.then().body(equalTo("GET: /rest-get"));
RestAssured.given()
.contentType("text/plain")
- .post("/platform-http/rest-post")
+ .post("/my-context/platform-http/rest-post")
.then().body(equalTo("POST: /rest-post"));
}
@@ -65,13 +65,13 @@ class PlatformHttpTest {
public void consumes() throws Throwable {
RestAssured.given()
.contentType("application/json")
- .post("/platform-http/rest-post")
+ .post("/my-context/platform-http/rest-post")
.then()
.statusCode(415);
RestAssured.given()
.contentType("text/plain")
- .post("/platform-http/rest-post")
+ .post("/my-context/platform-http/rest-post")
.then()
.statusCode(200);
@@ -93,14 +93,14 @@ class PlatformHttpTest {
RestAssured.given()
.accept("application/json")
.contentType("text/plain")
- .post("/platform-http/rest-post")
+ .post("/my-context/platform-http/rest-post")
.then()
.statusCode(406);
RestAssured.given()
.accept("text/plain")
.contentType("text/plain")
- .post("/platform-http/rest-post")
+ .post("/my-context/platform-http/rest-post")
.then()
.statusCode(200);
@@ -123,9 +123,9 @@ class PlatformHttpTest {
public void invalidMethod() {
RestAssured.post("/platform-http/hello")
.then().statusCode(405);
- RestAssured.post("/platform-http/rest-get")
+ RestAssured.post("/my-context/platform-http/rest-get")
.then().statusCode(405);
- RestAssured.get("/platform-http/rest-post")
+ RestAssured.get("/my-context/platform-http/rest-post")
.then().statusCode(405);
}
@@ -234,7 +234,7 @@ class PlatformHttpTest {
@Test
public void pathParam() throws Exception {
RestAssured.given()
- .get("/platform-http/hello-by-name/Kermit")
+ .get("/my-context/platform-http/hello-by-name/Kermit")
.then()
.statusCode(200)
.body(equalTo("Hello Kermit"));
@@ -250,9 +250,11 @@ class PlatformHttpTest {
.body()
.asString();
+ System.out.println("path = " + path);
+
RestAssured.given()
.urlEncodingEnabled(false)
- .post(path)
+ .post("/my-context" + path)
.then()
.statusCode(200)
.body(equalTo("Hello Camel Quarkus Webhook"));