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 2021/07/14 14:55:55 UTC

[camel-quarkus] 09/13: Generalize Seda test

This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit ff910bf0bfafec379f4c98719a1ea1fea966d4d8
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Thu May 20 23:52:52 2021 +0200

    Generalize Seda test
---
 .../camel/quarkus/component/seda/it/SedaResource.java       | 13 +++++++------
 .../apache/camel/quarkus/component/seda/it/SedaTest.java    |  6 +++---
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/integration-test-groups/foundation/seda/src/main/java/org/apache/camel/quarkus/component/seda/it/SedaResource.java b/integration-test-groups/foundation/seda/src/main/java/org/apache/camel/quarkus/component/seda/it/SedaResource.java
index 1d75786..d937055 100644
--- a/integration-test-groups/foundation/seda/src/main/java/org/apache/camel/quarkus/component/seda/it/SedaResource.java
+++ b/integration-test-groups/foundation/seda/src/main/java/org/apache/camel/quarkus/component/seda/it/SedaResource.java
@@ -24,6 +24,7 @@ import javax.ws.rs.Consumes;
 import javax.ws.rs.GET;
 import javax.ws.rs.POST;
 import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
@@ -44,22 +45,22 @@ public class SedaResource {
     @Inject
     ConsumerTemplate consumerTemplate;
 
-    @Path("/get")
+    @Path("/{name}")
     @GET
     @Produces(MediaType.TEXT_PLAIN)
-    public String get() throws Exception {
-        final String message = consumerTemplate.receiveBodyNoWait("seda:foo", String.class);
+    public String get(@PathParam("name") String name) throws Exception {
+        final String message = consumerTemplate.receiveBodyNoWait("seda:" + name, String.class);
         LOG.infof("Received from seda: %s", message);
         return message;
     }
 
-    @Path("/post")
+    @Path("/{name}")
     @POST
     @Consumes(MediaType.TEXT_PLAIN)
     @Produces(MediaType.TEXT_PLAIN)
-    public Response post(String message) throws Exception {
+    public Response post(String message, @PathParam("name") String name) throws Exception {
         LOG.infof("Sending to seda: %s", message);
-        producerTemplate.sendBody("seda:foo", message);
+        producerTemplate.sendBody("seda:" + name, message);
         return Response
                 .created(new URI("https://camel.apache.org/"))
                 .build();
diff --git a/integration-test-groups/foundation/seda/src/test/java/org/apache/camel/quarkus/component/seda/it/SedaTest.java b/integration-test-groups/foundation/seda/src/test/java/org/apache/camel/quarkus/component/seda/it/SedaTest.java
index 23b3a30..9f4904b 100644
--- a/integration-test-groups/foundation/seda/src/test/java/org/apache/camel/quarkus/component/seda/it/SedaTest.java
+++ b/integration-test-groups/foundation/seda/src/test/java/org/apache/camel/quarkus/component/seda/it/SedaTest.java
@@ -27,12 +27,12 @@ import static org.hamcrest.Matchers.equalTo;
 class SedaTest {
 
     @Test
-    public void testSeda() {
+    public void seda() {
         RestAssured.given()
-                .contentType(ContentType.TEXT).body("Hello World").post("/seda/post")
+                .contentType(ContentType.TEXT).body("Hello World").post("/seda/foo")
                 .then().statusCode(201);
 
-        RestAssured.get("/seda/get").then().body(equalTo("Hello World")).statusCode(200);
+        RestAssured.get("/seda/foo").then().body(equalTo("Hello World")).statusCode(200);
     }
 
 }