You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by jb...@apache.org on 2023/12/05 20:31:16 UTC
(activemq-artemis) branch main updated: NO-JIRA skeleton test for MQTT
This is an automated email from the ASF dual-hosted git repository.
jbertram pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
The following commit(s) were added to refs/heads/main by this push:
new afe0e889c5 NO-JIRA skeleton test for MQTT
afe0e889c5 is described below
commit afe0e889c510450ea722d4e607c9d651aef08f0c
Author: Justin Bertram <jb...@apache.org>
AuthorDate: Tue Dec 5 14:30:30 2023 -0600
NO-JIRA skeleton test for MQTT
---
.../artemis/tests/integration/mqtt5/MQTT5Test.java | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/MQTT5Test.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/MQTT5Test.java
index b55e61e047..41eb7b16aa 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/MQTT5Test.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/MQTT5Test.java
@@ -59,6 +59,28 @@ public class MQTT5Test extends MQTT5TestSupport {
super(protocol);
}
+ @Test(timeout = DEFAULT_TIMEOUT)
+ public void testSimpleSendReceive() throws Exception {
+ String topic = RandomUtil.randomString();
+
+ CountDownLatch latch = new CountDownLatch(1);
+ MqttClient subscriber = createPahoClient("subscriber");
+ subscriber.connect();
+ subscriber.setCallback(new DefaultMqttCallback() {
+ @Override
+ public void messageArrived(String topic, MqttMessage message) throws Exception {
+ log.info("Message received from {}", topic);
+ latch.countDown();
+ }
+ });
+ subscriber.subscribe(topic, AT_LEAST_ONCE);
+
+ MqttClient producer = createPahoClient("producer");
+ producer.connect();
+ producer.publish(topic, "myMessage".getBytes(StandardCharsets.UTF_8), 1, false);
+ assertTrue(latch.await(500, TimeUnit.MILLISECONDS));
+ }
+
/*
* Ensure that the broker adds a timestamp on the message when sending via MQTT
*/