camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [camel] 02/02: Extended camel-mqtt configuration test coverage with respect to Quality Of Service
Date Wed, 19 Sep 2018 07:20:35 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit 19f9fa1cc90fb899c4c8c8e0448252892649dd65
Author: aldettinger <aldettinger@gmail.com>
AuthorDate: Tue Sep 18 22:15:45 2018 +0200

    Extended camel-mqtt configuration test coverage with respect to Quality Of Service
---
 .../component/mqtt/MQTTConfigurationTest.java      | 41 ++++++++++++++++++----
 1 file changed, 34 insertions(+), 7 deletions(-)

diff --git a/components/camel-mqtt/src/test/java/org/apache/camel/component/mqtt/MQTTConfigurationTest.java
b/components/camel-mqtt/src/test/java/org/apache/camel/component/mqtt/MQTTConfigurationTest.java
index b79638e..24e0ad4 100644
--- a/components/camel-mqtt/src/test/java/org/apache/camel/component/mqtt/MQTTConfigurationTest.java
+++ b/components/camel-mqtt/src/test/java/org/apache/camel/component/mqtt/MQTTConfigurationTest.java
@@ -25,9 +25,9 @@ public class MQTTConfigurationTest extends MQTTBaseTest {
     @Test
     public void testBasicConfiguration() throws Exception {
         Endpoint endpoint = context.getEndpoint("mqtt:todo?byDefaultRetain=true&qualityOfService=exactlyOnce&publishTopicName="
+ TEST_TOPIC + "&subscribeTopicName=" + TEST_TOPIC
-                + "&host=" + MQTTTestSupport.getHostForMQTTEndpoint());
+                                                + "&host=" + MQTTTestSupport.getHostForMQTTEndpoint());
         assertTrue("Endpoint not a MQTTEndpoint: " + endpoint, endpoint instanceof MQTTEndpoint);
-        MQTTEndpoint mqttEndpoint = (MQTTEndpoint) endpoint;
+        MQTTEndpoint mqttEndpoint = (MQTTEndpoint)endpoint;
 
         assertEquals(mqttEndpoint.getConfiguration().getQoS(), QoS.EXACTLY_ONCE);
         assertEquals(mqttEndpoint.getConfiguration().getPublishTopicName(), TEST_TOPIC);
@@ -38,9 +38,9 @@ public class MQTTConfigurationTest extends MQTTBaseTest {
     @Test
     public void testMultipleSubscribeTopicsConfiguration() throws Exception {
         Endpoint endpoint = context.getEndpoint("mqtt:todo?byDefaultRetain=true&qualityOfService=exactlyOnce&publishTopicName="
+ TEST_TOPIC + "&subscribeTopicNames=" + TEST_TOPICS
-                + "&host=" + MQTTTestSupport.getHostForMQTTEndpoint());
+                                                + "&host=" + MQTTTestSupport.getHostForMQTTEndpoint());
         assertTrue("Endpoint not a MQTTEndpoint: " + endpoint, endpoint instanceof MQTTEndpoint);
-        MQTTEndpoint mqttEndpoint = (MQTTEndpoint) endpoint;
+        MQTTEndpoint mqttEndpoint = (MQTTEndpoint)endpoint;
 
         assertEquals(mqttEndpoint.getConfiguration().getQoS(), QoS.EXACTLY_ONCE);
         assertEquals(mqttEndpoint.getConfiguration().getPublishTopicName(), TEST_TOPIC);
@@ -50,14 +50,41 @@ public class MQTTConfigurationTest extends MQTTBaseTest {
 
     @Test
     public void testWildcardSubscribeTopicsConfiguration() throws Exception {
-        Endpoint endpoint = context.getEndpoint("mqtt:todo?byDefaultRetain=true&qualityOfService=exactlyOnce&publishTopicName="
+ TEST_TOPIC + "&subscribeTopicNames=" + TEST_TOPICS_WITH_WILDCARDS
-                + "&host=" + MQTTTestSupport.getHostForMQTTEndpoint());
+        Endpoint endpoint = context.getEndpoint("mqtt:todo?byDefaultRetain=true&qualityOfService=exactlyOnce&publishTopicName="
+ TEST_TOPIC + "&subscribeTopicNames="
+                                                + TEST_TOPICS_WITH_WILDCARDS + "&host="
+ MQTTTestSupport.getHostForMQTTEndpoint());
         assertTrue("Endpoint not a MQTTEndpoint: " + endpoint, endpoint instanceof MQTTEndpoint);
-        MQTTEndpoint mqttEndpoint = (MQTTEndpoint) endpoint;
+        MQTTEndpoint mqttEndpoint = (MQTTEndpoint)endpoint;
 
         assertEquals(mqttEndpoint.getConfiguration().getQoS(), QoS.EXACTLY_ONCE);
         assertEquals(mqttEndpoint.getConfiguration().getPublishTopicName(), TEST_TOPIC);
         assertEquals(mqttEndpoint.getConfiguration().getSubscribeTopicNames(), TEST_TOPICS_WITH_WILDCARDS);
         assertTrue(mqttEndpoint.getConfiguration().isByDefaultRetain());
     }
+
+    @Test
+    public void testExactlyOnceQualityOfServiceConfiguration() throws Exception {
+        Endpoint endpoint = context.getEndpoint("mqtt:todo?qualityOfService=exactlyOnce");
+        assertTrue("Endpoint not a MQTTEndpoint: " + endpoint, endpoint instanceof MQTTEndpoint);
+        MQTTEndpoint mqttEndpoint = (MQTTEndpoint)endpoint;
+
+        assertEquals(mqttEndpoint.getConfiguration().getQoS(), QoS.EXACTLY_ONCE);
+    }
+
+    @Test
+    public void testAtLeastOnceQualityOfServiceConfiguration() throws Exception {
+        Endpoint endpoint = context.getEndpoint("mqtt:todo?qualityOfService=AtLeastOnce");
+        assertTrue("Endpoint not a MQTTEndpoint: " + endpoint, endpoint instanceof MQTTEndpoint);
+        MQTTEndpoint mqttEndpoint = (MQTTEndpoint)endpoint;
+
+        assertEquals(mqttEndpoint.getConfiguration().getQoS(), QoS.AT_LEAST_ONCE);
+    }
+
+    @Test
+    public void testAtMostOnceQualityOfServiceConfiguration() throws Exception {
+        Endpoint endpoint = context.getEndpoint("mqtt:todo?qualityOfService=AtMostOnce");
+        assertTrue("Endpoint not a MQTTEndpoint: " + endpoint, endpoint instanceof MQTTEndpoint);
+        MQTTEndpoint mqttEndpoint = (MQTTEndpoint)endpoint;
+
+        assertEquals(mqttEndpoint.getConfiguration().getQoS(), QoS.AT_MOST_ONCE);
+    }
 }


Mime
View raw message