From db1a7c31f52e784f018df9319cd9646a60336ff5 Mon Sep 17 00:00:00 2001 From: Stuart Douglas Date: Thu, 25 Jun 2020 15:08:26 +1000 Subject: [PATCH] REST client encoding test Test for #10245 --- .../src/main/java/io/quarkus/it/rest/ClientResource.java | 7 +++++++ .../main/java/io/quarkus/it/rest/RestClientInterface.java | 5 +++++ .../src/main/java/io/quarkus/it/rest/RestInterface.java | 5 +++++ .../src/main/java/io/quarkus/it/rest/TestResource.java | 7 +++++++ .../test/java/io/quarkus/it/main/RestClientTestCase.java | 7 +++++++ 5 files changed, 31 insertions(+) diff --git a/integration-tests/main/src/main/java/io/quarkus/it/rest/ClientResource.java b/integration-tests/main/src/main/java/io/quarkus/it/rest/ClientResource.java index 13ea871fa033f..d119498c38200 100644 --- a/integration-tests/main/src/main/java/io/quarkus/it/rest/ClientResource.java +++ b/integration-tests/main/src/main/java/io/quarkus/it/rest/ClientResource.java @@ -98,6 +98,13 @@ public TestResource.MyData getDataCdi() { return restClientInterface.getData(); } + @GET + @Path("encoding") + public String testEmojis() { + return restClientInterface.echo( + "\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00"); + } + @GET @Path("async/cdi/jackson") @Produces("application/json") diff --git a/integration-tests/main/src/main/java/io/quarkus/it/rest/RestClientInterface.java b/integration-tests/main/src/main/java/io/quarkus/it/rest/RestClientInterface.java index 394a39cb2a268..85cf390a37c94 100644 --- a/integration-tests/main/src/main/java/io/quarkus/it/rest/RestClientInterface.java +++ b/integration-tests/main/src/main/java/io/quarkus/it/rest/RestClientInterface.java @@ -3,6 +3,7 @@ import javax.enterprise.context.Dependent; import javax.ws.rs.GET; import javax.ws.rs.Path; +import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import org.eclipse.microprofile.rest.client.annotation.RegisterClientHeaders; @@ -16,6 +17,10 @@ @RegisterClientHeaders public interface RestClientInterface { + @GET + @Path("/echo/{echo}") + String echo(@PathParam("echo") String echo); + @GET String get(); diff --git a/integration-tests/main/src/main/java/io/quarkus/it/rest/RestInterface.java b/integration-tests/main/src/main/java/io/quarkus/it/rest/RestInterface.java index 10e30901ae3a3..994a7e76a75bd 100644 --- a/integration-tests/main/src/main/java/io/quarkus/it/rest/RestInterface.java +++ b/integration-tests/main/src/main/java/io/quarkus/it/rest/RestInterface.java @@ -6,6 +6,7 @@ import javax.ws.rs.GET; import javax.ws.rs.Path; +import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import org.eclipse.microprofile.rest.client.annotation.RegisterClientHeaders; @@ -19,6 +20,10 @@ public interface RestInterface { @GET String get(); + @GET + @Path("/echo/{echo}") + String echo(@PathParam("echo") String echo); + @GET CompletionStage asyncGet(); diff --git a/integration-tests/main/src/main/java/io/quarkus/it/rest/TestResource.java b/integration-tests/main/src/main/java/io/quarkus/it/rest/TestResource.java index 9004783f6dbee..eb7e19d4e5a11 100644 --- a/integration-tests/main/src/main/java/io/quarkus/it/rest/TestResource.java +++ b/integration-tests/main/src/main/java/io/quarkus/it/rest/TestResource.java @@ -320,6 +320,13 @@ public MyEntity fromJson() throws Exception { } } + @GET + @Path("/echo/{echo}") + @Produces("application/json") + public String echo(@PathParam("echo") String echo) { + return echo; + } + @GET @Path("params/{path}") public void regularParams(@PathParam("path") String path, diff --git a/integration-tests/main/src/test/java/io/quarkus/it/main/RestClientTestCase.java b/integration-tests/main/src/test/java/io/quarkus/it/main/RestClientTestCase.java index 220c61e9eaae8..bdd14cc83ed3f 100644 --- a/integration-tests/main/src/test/java/io/quarkus/it/main/RestClientTestCase.java +++ b/integration-tests/main/src/test/java/io/quarkus/it/main/RestClientTestCase.java @@ -45,6 +45,13 @@ public void testMicroprofileClientCDIIntegration() { .body(is("TEST")); } + @Test + public void testEmojis() { + RestAssured.when().get("/client/encoding") + .then().body(is( + "\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00")); + } + @Test void testMicroprofileClientData() { JsonPath jsonPath = RestAssured.when().get("/client/manual/jackson").thenReturn().jsonPath();