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

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


The following commit(s) were added to refs/heads/main by this push:
     new 4f3748f132 paho: add test case for RFC3986 style urls #3758
4f3748f132 is described below

commit 4f3748f13231eeba519a331cf135fbd5bd3c0266
Author: aldettinger <aldettin...@gmail.com>
AuthorDate: Thu Apr 28 18:35:52 2022 +0200

    paho: add test case for RFC3986 style urls #3758
---
 .../apache/camel/quarkus/component/paho/PahoResource.java | 15 +++++++++++++++
 .../apache/camel/quarkus/component/paho/it/PahoTest.java  | 11 +++++++++++
 2 files changed, 26 insertions(+)

diff --git 
a/integration-tests/paho/src/main/java/org/apache/camel/quarkus/component/paho/PahoResource.java
 
b/integration-tests/paho/src/main/java/org/apache/camel/quarkus/component/paho/PahoResource.java
index a182c5c095..54f40dd3bb 100644
--- 
a/integration-tests/paho/src/main/java/org/apache/camel/quarkus/component/paho/PahoResource.java
+++ 
b/integration-tests/paho/src/main/java/org/apache/camel/quarkus/component/paho/PahoResource.java
@@ -125,6 +125,21 @@ public class PahoResource {
                 String.class);
     }
 
+    @Path("/sendReceiveWithRfc3986AuthorityShouldSucceed")
+    @GET
+    @Produces(MediaType.TEXT_PLAIN)
+    public String 
sendReceiveWithRfc3986AuthorityShouldSucceed(@QueryParam("message") String 
message) {
+
+        // Change the brokerUrl to an RFC3986 form
+        String tcpUrl = 
ConfigProvider.getConfig().getValue("paho.broker.tcp.url", String.class);
+        tcpUrl = tcpUrl.replaceAll("tcp://([^:]*):(.*)", 
"tcp://user:password@$1:$2");
+
+        producerTemplate.requestBody("paho:rfc3986?retained=true&brokerUrl=" + 
tcpUrl,
+                message);
+        return consumerTemplate.receiveBody("paho:rfc3986?brokerUrl=" + 
tcpUrl, 5000,
+                String.class);
+    }
+
     private String brokerUrl(String protocol) {
         return ConfigProvider.getConfig().getValue("paho.broker." + protocol + 
".url", String.class);
     }
diff --git 
a/integration-tests/paho/src/test/java/org/apache/camel/quarkus/component/paho/it/PahoTest.java
 
b/integration-tests/paho/src/test/java/org/apache/camel/quarkus/component/paho/it/PahoTest.java
index d0df6651cf..7da88ec23b 100644
--- 
a/integration-tests/paho/src/test/java/org/apache/camel/quarkus/component/paho/it/PahoTest.java
+++ 
b/integration-tests/paho/src/test/java/org/apache/camel/quarkus/component/paho/it/PahoTest.java
@@ -89,4 +89,15 @@ class PahoTest {
                 .statusCode(200)
                 .body(is(message));
     }
+
+    @Test
+    public void sendReceiveWithRfc3986AuthorityShouldSucceed() {
+        String message = "sendReceiveWithRfc3986AuthorityShouldSucceed message 
content: 3bfe3754-cea4-488c-9534-f70d2a1a7c23";
+        RestAssured.given()
+                .queryParam("message", message)
+                .get("/paho/sendReceiveWithRfc3986AuthorityShouldSucceed")
+                .then()
+                .statusCode(200)
+                .body(is(message));
+    }
 }

Reply via email to