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 2022/04/18 20:58:33 UTC

[camel-quarkus] 11/11: paho: expand test coverage #3720

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

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

commit 265312b6abab53c2e026551c0b6c4fc8d6506679
Author: aldettinger <al...@gmail.com>
AuthorDate: Tue Apr 12 16:19:31 2022 +0200

    paho: expand test coverage #3720
---
 .../camel/quarkus/component/paho/PahoResource.java | 105 ++++++++++++++++-----
 .../paho/src/main/resources/application.properties |  17 ++++
 .../paho/src/main/resources/clientkeystore.jks     | Bin 0 -> 2263 bytes
 .../camel/quarkus/component/paho/it/PahoTest.java  |  33 +++++--
 .../component/paho/it/PahoTestResource.java        |  84 +++++++++++++++++
 .../paho/src/test/resources/certs/ca.key           |  30 ++++++
 .../paho/src/test/resources/certs/ca.pem           |  22 +++++
 .../paho/src/test/resources/certs/server.key       |  27 ++++++
 .../paho/src/test/resources/certs/server.pem       |  20 ++++
 .../paho/src/test/resources/mosquitto.conf         |  14 +++
 .../paho/src/test/resources/password.conf          |  17 ++++
 11 files changed, 338 insertions(+), 31 deletions(-)

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 68282cb497..a182c5c095 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
@@ -16,7 +16,10 @@
  */
 package org.apache.camel.quarkus.component.paho;
 
+import java.io.InputStream;
 import java.net.URI;
+import java.nio.file.Files;
+import java.nio.file.StandardCopyOption;
 
 import javax.enterprise.context.ApplicationScoped;
 import javax.inject.Inject;
@@ -32,53 +35,77 @@ import javax.ws.rs.core.Response;
 
 import org.apache.camel.ConsumerTemplate;
 import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.paho.PahoConstants;
+import org.eclipse.microprofile.config.ConfigProvider;
 import org.eclipse.paho.client.mqttv3.MqttException;
+import org.jboss.logging.Logger;
 
 @Path("/paho")
 @ApplicationScoped
 public class PahoResource {
 
+    private static final Logger LOG = Logger.getLogger(PahoResource.class);
+
     @Inject
     ProducerTemplate producerTemplate;
 
     @Inject
     ConsumerTemplate consumerTemplate;
 
-    @Path("/paho/{queueName}")
+    private static final String KEYSTORE_FILE = "clientkeystore.jks";
+    private static final String KEYSTORE_PASSWORD = "quarkus";
+
+    @Path("/{protocol}/{queueName}")
     @GET
     @Produces(MediaType.TEXT_PLAIN)
-    public String consumePahoMessage(@PathParam("queueName") String queueName) {
-        return consumerTemplate.receiveBody("paho:" + queueName, 5000,
-                String.class);
+    public String consumePahoMessage(@PathParam("protocol") String protocol, @PathParam("queueName") String queueName) {
+        java.nio.file.Path keyStore = null;
+        if ("ssl".equals(protocol)) {
+            keyStore = copyKeyStore();
+        }
+        try {
+            return consumerTemplate.receiveBody(
+                    "paho:" + queueName + "?brokerUrl=" + brokerUrl(protocol) + sslOptions(keyStore), 5000, String.class);
+        } finally {
+            if ("ssl".equals(protocol)) {
+                removeKeyStore(keyStore);
+            }
+        }
     }
 
-    @Path("/paho/{queueName}")
+    @Path("/{protocol}/{queueName}")
     @POST
     @Consumes(MediaType.TEXT_PLAIN)
-    public Response producePahoMessage(@PathParam("queueName") String queueName, String message) throws Exception {
-        producerTemplate.sendBody("paho:" + queueName + "?retained=true", message);
+    public Response producePahoMessage(@PathParam("protocol") String protocol, @PathParam("queueName") String queueName,
+            String message) throws Exception {
+        java.nio.file.Path keyStore = null;
+        if ("ssl".equals(protocol)) {
+            keyStore = copyKeyStore();
+        }
+        try {
+            producerTemplate.sendBody(
+                    "paho:" + queueName + "?retained=true&brokerUrl=" + brokerUrl(protocol) + sslOptions(keyStore), message);
+        } finally {
+            if ("ssl".equals(protocol)) {
+                removeKeyStore(keyStore);
+            }
+        }
         return Response.created(new URI("https://camel.apache.org/")).build();
     }
 
-    @Path("/paho-ws/{queueName}")
-    @GET
-    @Produces(MediaType.TEXT_PLAIN)
-    public String consumePahoWsMessage(@PathParam("queueName") String queueName) {
-        return consumerTemplate.receiveBody("paho:" + queueName + "?brokerUrl={{broker-url.ws}}", 5000,
-                String.class);
-    }
-
-    @Path("/paho-ws/{queueName}")
+    @Path("/override/{queueName}")
     @POST
     @Consumes(MediaType.TEXT_PLAIN)
-    public Response producePahoWsMessage(@PathParam("queueName") String queueName, String message) throws Exception {
-        producerTemplate.sendBody("paho:" + queueName + "?retained=true&brokerUrl={{broker-url.ws}}", message);
+    public Response overrideQueueName(@PathParam("queueName") String queueName, String message) throws Exception {
+        producerTemplate.sendBodyAndHeader("paho:test?retained=true&brokerUrl=" + brokerUrl("tcp"), message,
+                PahoConstants.CAMEL_PAHO_OVERRIDE_TOPIC, queueName);
         return Response.created(new URI("https://camel.apache.org/")).build();
     }
 
     /**
-     * This method simulates the case where an MqqtException is thrown during a reconnection attempt
-     * in the MqttCallbackExtended instance set by the PahoConsumer on endpoint startup.
+     * This method simulates the case where an MqqtException is thrown during a
+     * reconnection attempt in the MqttCallbackExtended instance set by the
+     * PahoConsumer on endpoint startup.
      */
     @Path("/mqttExceptionDuringReconnectShouldSucceed")
     @GET
@@ -92,7 +119,41 @@ public class PahoResource {
     @GET
     @Produces(MediaType.TEXT_PLAIN)
     public String readThenWriteWithFilePersistenceShouldSucceed(@QueryParam("message") String message) throws Exception {
-        producerTemplate.requestBody("paho:withFilePersistence?retained=true&persistence=FILE", message);
-        return consumerTemplate.receiveBody("paho:withFilePersistence?persistence=FILE", 5000, String.class);
+        producerTemplate.requestBody("paho:withFilePersistence?retained=true&persistence=FILE&brokerUrl=" + brokerUrl("tcp"),
+                message);
+        return consumerTemplate.receiveBody("paho:withFilePersistence?persistence=FILE&brokerUrl=" + brokerUrl("tcp"), 5000,
+                String.class);
+    }
+
+    private String brokerUrl(String protocol) {
+        return ConfigProvider.getConfig().getValue("paho.broker." + protocol + ".url", String.class);
+    }
+
+    private String sslOptions(java.nio.file.Path keyStore) {
+        return keyStore == null
+                ? ""
+                : "&sslClientProps.com.ibm.ssl.keyStore=" + keyStore +
+                        "&sslClientProps.com.ibm.ssl.keyStorePassword=" + KEYSTORE_PASSWORD +
+                        "&sslClientProps.com.ibm.ssl.trustStore=" + keyStore +
+                        "&sslClientProps.com.ibm.ssl.trustStorePassword=" + KEYSTORE_PASSWORD;
+    }
+
+    private java.nio.file.Path copyKeyStore() {
+        java.nio.file.Path tmpKeystore = null;
+        try (InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(KEYSTORE_FILE);) {
+            tmpKeystore = Files.createTempFile("keystore-", ".jks");
+            Files.copy(in, tmpKeystore, StandardCopyOption.REPLACE_EXISTING);
+            return tmpKeystore;
+        } catch (Exception e) {
+            throw new RuntimeException("Could not copy " + KEYSTORE_FILE + " from the classpath to " + tmpKeystore, e);
+        }
+    }
+
+    private void removeKeyStore(java.nio.file.Path keystore) {
+        try {
+            Files.delete(keystore);
+        } catch (Exception e) {
+            throw new RuntimeException("Could not delete " + keystore, e);
+        }
     }
 }
diff --git a/integration-tests/paho/src/main/resources/application.properties b/integration-tests/paho/src/main/resources/application.properties
new file mode 100644
index 0000000000..cc4b9d1c89
--- /dev/null
+++ b/integration-tests/paho/src/main/resources/application.properties
@@ -0,0 +1,17 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+quarkus.native.resources.includes=*.jks
\ No newline at end of file
diff --git a/integration-tests/paho/src/main/resources/clientkeystore.jks b/integration-tests/paho/src/main/resources/clientkeystore.jks
new file mode 100644
index 0000000000..51643f16d0
Binary files /dev/null and b/integration-tests/paho/src/main/resources/clientkeystore.jks differ
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 096aac3928..d0df6651cf 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
@@ -17,11 +17,9 @@
 package org.apache.camel.quarkus.component.paho.it;
 
 import io.quarkus.test.common.QuarkusTestResource;
-import io.quarkus.test.common.ResourceArg;
 import io.quarkus.test.junit.QuarkusTest;
 import io.restassured.RestAssured;
 import io.restassured.http.ContentType;
-import org.apache.camel.quarkus.test.support.activemq.ActiveMQTestResource;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.ValueSource;
@@ -30,27 +28,44 @@ import static org.hamcrest.core.Is.is;
 import static org.hamcrest.core.StringRegularExpression.matchesRegex;
 
 @QuarkusTest
-@QuarkusTestResource(initArgs = {
-        @ResourceArg(name = "modules", value = "camel.component.paho,broker-url.ws")
-}, value = ActiveMQTestResource.class)
+@QuarkusTestResource(PahoTestResource.class)
 class PahoTest {
 
     @ParameterizedTest
-    @ValueSource(strings = { "paho", "paho-ws" })
+    @ValueSource(strings = { "tcp", "ssl", "ws" })
     public void sendReceive(String protocol) {
         String message = "Hello Camel Quarkus " + protocol;
-        String queueName = protocol + "-test-queue";
 
         RestAssured.given()
                 .contentType(ContentType.TEXT)
                 .body(message)
-                .post("/paho/{protocol}/{queueName}", protocol, queueName)
+                .post("/paho/{protocol}/{queueName}", protocol, protocol + "-test-queue")
                 .then()
                 .statusCode(201);
 
         RestAssured.given()
                 .contentType(ContentType.TEXT)
-                .get("/paho/{protocol}/{queueName}", protocol, queueName)
+                .get("/paho/{protocol}/{queueName}", protocol, protocol + "-test-queue")
+                .then()
+                .statusCode(200)
+                .body(is(message));
+    }
+
+    @Test
+    public void overrideTopic() {
+        String message = "Hello Camel Quarkus Override Topic";
+        String queue = "myoverride";
+
+        RestAssured.given()
+                .contentType(ContentType.TEXT)
+                .body(message)
+                .post("/paho/override/" + queue)
+                .then()
+                .statusCode(201);
+
+        RestAssured.given()
+                .contentType(ContentType.TEXT)
+                .get("/paho/tcp/" + queue)
                 .then()
                 .statusCode(200)
                 .body(is(message));
diff --git a/integration-tests/paho/src/test/java/org/apache/camel/quarkus/component/paho/it/PahoTestResource.java b/integration-tests/paho/src/test/java/org/apache/camel/quarkus/component/paho/it/PahoTestResource.java
new file mode 100644
index 0000000000..1a9a03e8ce
--- /dev/null
+++ b/integration-tests/paho/src/test/java/org/apache/camel/quarkus/component/paho/it/PahoTestResource.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.paho.it;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;
+import org.apache.camel.util.CollectionHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testcontainers.containers.BindMode;
+import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.containers.output.Slf4jLogConsumer;
+import org.testcontainers.containers.wait.strategy.Wait;
+import org.testcontainers.utility.TestcontainersConfiguration;
+
+public class PahoTestResource implements QuarkusTestResourceLifecycleManager {
+    private static final Logger LOGGER = LoggerFactory.getLogger(PahoTestResource.class);
+    private static final String IMAGE = "eclipse-mosquitto:1.6.15";
+    private static final int TCP_PORT = 1883;
+    private static final int SSL_PORT = 8883;
+    private static final int WS_PORT = 9001;
+    private static final String MQTT_USERNAME = "quarkus";
+    private static final String MQTT_PASSWORD = "quarkus";
+
+    private GenericContainer<?> container;
+
+    @Override
+    public Map<String, String> start() {
+        LOGGER.info(TestcontainersConfiguration.getInstance().toString());
+
+        try {
+            Map<String, String> result = new HashMap<>();
+
+            container = new GenericContainer<>(IMAGE).withExposedPorts(TCP_PORT, WS_PORT, SSL_PORT)
+                    .withClasspathResourceMapping("mosquitto.conf", "/mosquitto/config/mosquitto.conf", BindMode.READ_ONLY)
+                    .withClasspathResourceMapping("password.conf", "/etc/mosquitto/password", BindMode.READ_ONLY)
+                    .withClasspathResourceMapping("certs/ca.pem", "/etc/mosquitto/certs/ca.pem", BindMode.READ_ONLY)
+                    .withClasspathResourceMapping("certs/server.pem", "/etc/mosquitto/certs/server.pem", BindMode.READ_ONLY)
+                    .withClasspathResourceMapping("certs/server.key", "/etc/mosquitto/certs/server.key", BindMode.READ_ONLY);
+
+            container.withLogConsumer(new Slf4jLogConsumer(LOGGER))
+                    .waitingFor(Wait.forLogMessage(".* mosquitto version .* running", 1)).waitingFor(Wait.forListeningPort());
+
+            container.start();
+
+            result = CollectionHelper.mapOf("camel.component.paho.username", MQTT_USERNAME,
+                    "camel.component.paho.password", MQTT_PASSWORD, "paho.broker.tcp.url",
+                    String.format("tcp://localhost:%d", container.getMappedPort(TCP_PORT)), "paho.broker.ssl.url",
+                    String.format("ssl://localhost:%d", container.getMappedPort(SSL_PORT)), "paho.broker.ws.url",
+                    String.format("ws://localhost:%d", container.getMappedPort(WS_PORT)));
+
+            return result;
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    @Override
+    public void stop() {
+        try {
+            if (container != null) {
+                container.stop();
+            }
+        } catch (Exception e) {
+            LOGGER.warn("Exception caught while stopping the container", e);
+        }
+    }
+}
diff --git a/integration-tests/paho/src/test/resources/certs/ca.key b/integration-tests/paho/src/test/resources/certs/ca.key
new file mode 100644
index 0000000000..cd4cae6986
--- /dev/null
+++ b/integration-tests/paho/src/test/resources/certs/ca.key
@@ -0,0 +1,30 @@
+-----BEGIN RSA PRIVATE KEY-----
+Proc-Type: 4,ENCRYPTED
+DEK-Info: DES-EDE3-CBC,82C51D0B8CD84E74
+
+ParQZs7HrK6hAcDEY3OyqN2PAFEDwfpeV/43XYNr2b+tdG4TqnQ+liMiDPOJ3nSR
+luNu9Y57N/EPtjfVPCj46fNPtuYotWwxUO1Nq9fZ8Y3JjAGE0f77bDAduMIIH6aL
+oubriZ44Uav3TqBhAc7H7pdmdthuSX9wGHQ3FHWHoxS+zkTe01Lp8OYFP3aJggpR
+gFfZF+S+rUKRV1AnMBV6Eytfu5magM5qTqZ10/R0VtuN3b0vlh72WhIakXnf7orG
+P9/tRY3jl4z/ZB9q62FN6xlJSKZKXYdPQ8uYpK7z278ZGfoSsmLhXc5yAg4wnCxa
+FmsirKvmohhDnrCEuIk47RtV7S6XbYQAcDnmwYNY5qvCDTWxaCVzxJe4WcJyHaq1
+MWj/SQn8sIQcTA0XPGh/fzJ6LLJgpWV+P9T3hgBRYUoLIGd+zxxaOd+KxOdHmvsU
+sqV8v4O4KmYWKYIgaamiUHb/ahc/YKnzj9toTi3dYuZbOY6EnBvMX0+VfckGG86f
+Xn+st7/ZtylJN2O1o+BKMYwqOKhZOTzzqgLZeDuHa7AyCAyBdh7+Bw5ZHVpFrUcp
+ciNpNS8ywlgEibdIvBl/uIs/IL8uKvL7fZu6tsR/nbuhG/0THnhZtDILP04v75Oh
+h5eN/JU8NqxuykfpP6C+KjerrR/+ExEJJ8wivEDRYF4vzY9+vjNdo7+Yh4yRSwgr
+FxML9bC4CpR8zwvhhBmD6SzDvoKqM+vFnQr+g1/dFku7RCd/GeXTVK9tBJIr3974
+8BJ0j1wmJJyOaKIX+nwX/ptLiM9e9Yj7RkcOX7+V1QI9rs2f5LalXY8mulkg3tVK
+axz49F7G5vV8ODLVqXoPZqZGNtEA9J84FGkfvAb2VqlAd1Bmv7Pwv/w3i5ldRxq4
+mCVY9Pm7VEi5qunV4fBHAHQNLMy899Cu/OGXEb0ZZ+JqgKnXKXyhPHBouTDI4mZ2
+81AqS0u3/11J82SCgtwICApWCpu1T9LWYt67kZ3hteI4Vy9j9d251eCArD/HoOJe
+TCcfBAnNt2z2Ji0hKAqQQld3AV9800CAFifhAPb0/3KB48itNfhNHNIjFgym0puc
+M8VaF5oBS2g36tay9lGEiSs9u1lojRoaFB4avL4oCdFXgAWNkrO0dtZhhj65q3HP
+i0GRhCTKzQdIp6forBdMrz/oFMr117MsSdnXUd+78NKiczZMBYaoZOonmKQ1gkwe
+hePqXy+QcOowPaNOdq+T7QpBX3C7tr52lnqQ26zvaspnDOkcYZZ27JjwM619JDvh
+uAB7q8iySt985KKafN2rIY/5mVE7Nl/06m0lqzpd6aju5jmf8pUYcG2sdV509KQg
+6ZRDZELizd2T/QwhGPKSAQBfF9CgqgWUBSeMtX1gbIShbf7hycPj1SmPMGzUUn+3
+hZ1Qtou2GdtHNQj1jSlHi8YVX7qM8tfAGDZnQ+30Dx0a03uKuieN/h6VACb9fkOI
+TErii3pNuW5M/p4DPSXwW1cwQFpxs2FTZKyn7QBBPSSxymEK3mirZjFiKhtKxj/C
+E64mtbZxdPH9tzO2WiqfHW1St7XmP1FshDfaQsOOMmq0l0giluc9Lg==
+-----END RSA PRIVATE KEY-----
diff --git a/integration-tests/paho/src/test/resources/certs/ca.pem b/integration-tests/paho/src/test/resources/certs/ca.pem
new file mode 100644
index 0000000000..bc257a93eb
--- /dev/null
+++ b/integration-tests/paho/src/test/resources/certs/ca.pem
@@ -0,0 +1,22 @@
+-----BEGIN CERTIFICATE-----
+MIIDqzCCApOgAwIBAgIUU/uMzfEhx21GXTOErSxGfoqt7qUwDQYJKoZIhvcNAQEL
+BQAwZTELMAkGA1UEBhMCQ04xEDAOBgNVBAgMB0JlaWppbmcxFTATBgNVBAcMDERl
+ZmF1bHQgQ2l0eTEcMBoGA1UECgwTRGVmYXVsdCBDb21wYW55IEx0ZDEPMA0GA1UE
+AwwGdGVzdENBMB4XDTIyMDQwMTA1NDEwMloXDTI3MDMzMTA1NDEwMlowZTELMAkG
+A1UEBhMCQ04xEDAOBgNVBAgMB0JlaWppbmcxFTATBgNVBAcMDERlZmF1bHQgQ2l0
+eTEcMBoGA1UECgwTRGVmYXVsdCBDb21wYW55IEx0ZDEPMA0GA1UEAwwGdGVzdENB
+MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyfqvVSox1n+5OBhCZC1C
+OKpLVKEIalvxOQ5ezDcAeqUXfNJloP+7YeAylpOEiuxVlCvy4UScxUb98isr8Q0W
+3hNIc1O/FNJfnOPEJoaJCGb0Uq0Mq4CaZonkN8/2nolPIC8yg2b2/mIa4ZJhH94x
+KNzSiKfBMEqv8f3iGi8RhHrcMZAMosbIWZ1fIRhciJDa1xvsSFZz/gOq/D+YC/ST
+MjgTm7q1HXugHDtTFNw0XO3iY7co13fZBJjGu8AqW1K8CFZEBoJlsTByvkkEYzf4
+OMjwKO6v9dc4spRY32v7Nt8zrTz4Hg4g2QrvJWacYfi3eHkoMTdJFMVGE6COo3dS
+VwIDAQABo1MwUTAdBgNVHQ4EFgQUbkVV4nft2UZ3SqcaZqftJFleKtIwHwYDVR0j
+BBgwFoAUbkVV4nft2UZ3SqcaZqftJFleKtIwDwYDVR0TAQH/BAUwAwEB/zANBgkq
+hkiG9w0BAQsFAAOCAQEAVnGMYzl1xX5UHSTpGwpu+twd0GntIw8eSBZkLHp2GJdG
+Xh1uozTq9UTwT7F/2zCcOFhCzTZi18cK0sHBb53yS6gK5HEarZvUyqFqmXNljJxi
+I2sw640O1rAygM6lpth5Kt7038lr5MgFccU0/2AKbQUyW7tUwupf4nQACh+1xQ3J
+m+jF050eJQTtApnRuUU+XF7ITYPANJPofa9rrfbP76LQk94De3PJP5Ijll+bgjs/
+7H1hm5PFaTF3zj86i77O7Ru63T8BajolosVVWcUSmtxa/zMRLNVSLncQd40bRl1i
+mxfKR5assb31p+U/c1NH5yLtburJcB3GPyMdsmeO0w==
+-----END CERTIFICATE-----
diff --git a/integration-tests/paho/src/test/resources/certs/server.key b/integration-tests/paho/src/test/resources/certs/server.key
new file mode 100644
index 0000000000..4dd056694e
--- /dev/null
+++ b/integration-tests/paho/src/test/resources/certs/server.key
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEowIBAAKCAQEAw/UF6GOP/oy8vlzPzgRdtaoLeYnGW+DGYnbdv3qY4LWpI+BE
+MqprVUC69jvgNzwgRXmudx1DM68u1HWvXR7yA2hHPJqshlPplqeRarX7i9QwrdTg
+FimEuw3BKeYjgqE9ddtYyDTcVF6mncRB6t4S9VrkuVBlIukt0lfZVs2JuaNKpRpc
+/mQ04DcdA8QrEXTPDzpirCTC61p2OsyldhmkbvS9UpV4ur6lkCS4KJ8VZLGdJeSk
+TGI7qOe6WJS859ukmgZjnaHuEcFzLcb0ywDubsO1q+dNaKyD8ju3GFJi2LnFKwlk
+N7w+b/zq8XmAIKvp6q2AvG/jpgmVmSSrKfwSsQIDAQABAoIBAQCr/4Fz/RAC6h0x
+Kd3sgsCOF/eCcn/9XUpEWvlAfKd7dXhE2TCDGDql1e9E+kFPuiLJWIjeXH0D/Jwq
+ODH4lpTukLUWaN1N+pFpfyOQerOUhGdF7TfTvBWY6fXGhQ5eNpDvxdwjvuI12+57
+RCxnrw0M9v8T+ZEMF4f0vM8z9a0Rls097a246yAn040SjMJm4+FKWLB2/KXvh/nl
+xOFk81TKl6f7/Sx+GKCOSLasdAwp5G/8uyzNH0i2q9yPkw/OR3QutntBphBq+RGH
+pEBwshQNOwAwKlkIYiYv+KEZiL3JAZdPiV5p9HOIKtaIjzGZOFJqv/fZJLJDJZHu
+FUwO8u1RAoGBAOVX6rW8Nnf3jh1ZqZu6Qr2bHT8p41k57m5airBqlqzFZesSwErO
+X2utli11j+thZSuFG+pH70MTH2f3Me4AhOVO2wrllzo8ygjymjTWYm0217g5dYWy
+NLqhRlD2FEKdXpfTIUYc52cbYEG4/q9L2MKBws/S6cKJZN5le8LsNrVHAoGBANq7
+s4JGEsgzEhx1IwdygqdZHkiE4plmT1i4ufogw1jLl4hN8ajF6pAHuF7ZiJDlQ+QR
+M+tFrC0XEg7c23M9LgrnXRMUbKvjTsN3OnTZCKZ/U7Gimnfu4j6Lwu13l3AZLjWv
+6cOx+B3bO31caa5rbsrCJNYTiFJQtn6Kuq5eR9RHAoGANbS/1u0LSE6lbgQYLsqQ
+ZHxVffweLD/fsOHtBmD/hdf4BPNwKlRnjfypZV3ZZQJ6wZU7M0LDKc7plNwTSiu+
+8z/jFYssPcwMd8nwCJ2HkRG9tHtoJPXVWTr5D26A0hSuGRms+hE8sy16/gkHQx+c
+0/e1GhvG9/Jat6XGNKBCM3MCgYB9jVRCqNpLFBWHRC1xLueUC3F4it5O0w0kjhQi
+YQAATgyS7rqR99jmB6hquU7MbO0FUmKM35cu4pk48sj8Yte05ozkUMr39yfUxvFE
+9PckKt3tjro/sV0oLa0cBZNlgu6lXm4+KD+VU6vYD12SApS7yai/QML1DONTy2nQ
+gMmWLQKBgA3Nb5bFkb6NPHtb7JhJLB2/veuhOGN3yEEs1GFjLF5sgR8Fq+R84tWM
+tGE9mqHGkhvrTlgAdY8DRZjcBg0VimUnXNCRn5wXmhcFs44zsprdr8+2Srcit6n4
+j/6HocZNXy46lBAFY7PYUYDfDSbyFRMfx3l34lV+tc9iM8HaWfev
+-----END RSA PRIVATE KEY-----
diff --git a/integration-tests/paho/src/test/resources/certs/server.pem b/integration-tests/paho/src/test/resources/certs/server.pem
new file mode 100644
index 0000000000..ddad4073b4
--- /dev/null
+++ b/integration-tests/paho/src/test/resources/certs/server.pem
@@ -0,0 +1,20 @@
+-----BEGIN CERTIFICATE-----
+MIIDVDCCAjwCFD0B2OCkiJZYwb3trDFCX7mQ9wc1MA0GCSqGSIb3DQEBCwUAMGUx
+CzAJBgNVBAYTAkNOMRAwDgYDVQQIDAdCZWlqaW5nMRUwEwYDVQQHDAxEZWZhdWx0
+IENpdHkxHDAaBgNVBAoME0RlZmF1bHQgQ29tcGFueSBMdGQxDzANBgNVBAMMBnRl
+c3RDQTAeFw0yMjA0MDExMTQwMTBaFw0zMjAzMjkxMTQwMTBaMGgxCzAJBgNVBAYT
+AkNOMRAwDgYDVQQIDAdCZWlqaW5nMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAa
+BgNVBAoME0RlZmF1bHQgQ29tcGFueSBMdGQxEjAQBgNVBAMMCWxvY2FsaG9zdDCC
+ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMP1Behjj/6MvL5cz84EXbWq
+C3mJxlvgxmJ23b96mOC1qSPgRDKqa1VAuvY74Dc8IEV5rncdQzOvLtR1r10e8gNo
+RzyarIZT6ZankWq1+4vUMK3U4BYphLsNwSnmI4KhPXXbWMg03FRepp3EQereEvVa
+5LlQZSLpLdJX2VbNibmjSqUaXP5kNOA3HQPEKxF0zw86YqwkwutadjrMpXYZpG70
+vVKVeLq+pZAkuCifFWSxnSXkpExiO6jnuliUvOfbpJoGY52h7hHBcy3G9MsA7m7D
+tavnTWisg/I7txhSYti5xSsJZDe8Pm/86vF5gCCr6eqtgLxv46YJlZkkqyn8ErEC
+AwEAATANBgkqhkiG9w0BAQsFAAOCAQEAHFNHzAEW5x2A6dSoxopTR/SB1ffGnhfs
+6mkMBFppYYCYwJyWSgnWYsBB/m2xakyCpup1mPT6AAb8NiS2c0R9dEQsEtgwwc/j
+6KihqXSVBmux7pvMc6vLwGVYlHH7oAodS+ZPQUSs0wii++NzugRsHwwIdvGpUbVg
+Tc8VAiDHYG7z88l/m5zWsKMQp8FK1PyhTL0eDGK8eCfuWTfM2lf7ITuAjhKXLbPY
+/vHTp13/+IfuAREcl73iXm57epIgG715T6J3+jdxyqzKdkx2vkEo3dUWusu7WR73
+PsYsjXPTOI2/zUkkiVqwwIiVOLR9E332aOxeqZaqLBrYze9PHB1lPg==
+-----END CERTIFICATE-----
diff --git a/integration-tests/paho/src/test/resources/mosquitto.conf b/integration-tests/paho/src/test/resources/mosquitto.conf
new file mode 100644
index 0000000000..921dc8fc27
--- /dev/null
+++ b/integration-tests/paho/src/test/resources/mosquitto.conf
@@ -0,0 +1,14 @@
+password_file /etc/mosquitto/password
+allow_anonymous false
+
+listener 1883
+protocol mqtt
+
+listener 8883
+protocol mqtt
+cafile /etc/mosquitto/certs/ca.pem
+certfile /etc/mosquitto/certs/server.pem
+keyfile /etc/mosquitto/certs/server.key
+
+listener 9001
+protocol websockets
diff --git a/integration-tests/paho/src/test/resources/password.conf b/integration-tests/paho/src/test/resources/password.conf
new file mode 100644
index 0000000000..822b87dc60
--- /dev/null
+++ b/integration-tests/paho/src/test/resources/password.conf
@@ -0,0 +1,17 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+quarkus:$6$lEzlzdx4trOUKmNr$3qsGL/iTjrQpI5KZt15fh1gS4cetBtbeWANXOIVD+JFcMbuJy0Kh+pdcXIF9m2diq+Ge8sTU9Cb4aU4Ak2To/g==