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

gtully pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq.git


The following commit(s) were added to refs/heads/master by this push:
     new f3ed0c7  AMQ-5734 - additional test that verifies wildcard sub does 
not get access to unauthorised dests retain messages
f3ed0c7 is described below

commit f3ed0c7b87087244b4ba41f0d27d6a5ec5cdf06e
Author: gtully <[email protected]>
AuthorDate: Fri Nov 22 15:45:03 2019 +0000

    AMQ-5734 - additional test that verifies wildcard sub does not get access 
to unauthorised dests retain messages
---
 .../activemq/transport/mqtt/MQTTAuthTest.java      | 24 ++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git 
a/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTAuthTest.java
 
b/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTAuthTest.java
index 7ffb3e8..98ba8c9 100644
--- 
a/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTAuthTest.java
+++ 
b/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTAuthTest.java
@@ -253,6 +253,30 @@ public class MQTTAuthTest extends MQTTAuthTestSupport {
         connectionSub.subscribe(new Topic[]{new Topic("#", 
QoS.AT_LEAST_ONCE)});
         Message msg = connectionSub.receive(1, TimeUnit.SECONDS);
         assertNull("Shouldn't receive the message", msg);
+
+    }
+
+    @Test(timeout = 60 * 1000)
+    public void testWildcardRetainedSubscriptionLocked() throws Exception {
+        MQTT mqttPub = createMQTTConnection("pub", true);
+        mqttPub.setUserName("admin");
+        mqttPub.setPassword("admin");
+
+        getProxyToBroker().addTopic("one.foo");
+        BlockingConnection connectionPub = mqttPub.blockingConnection();
+        connectionPub.connect();
+        connectionPub.publish("one/foo", "test".getBytes(), QoS.AT_LEAST_ONCE, 
true);
+
+        MQTT mqttSub = createMQTTConnection("sub", true);
+        mqttSub.setUserName("user");
+        mqttSub.setPassword("password");
+        BlockingConnection connectionSub = mqttSub.blockingConnection();
+        connectionSub.connect();
+        connectionSub.subscribe(new Topic[]{new Topic("+/#", 
QoS.AT_LEAST_ONCE)});
+        Message msg = connectionSub.receive(1, TimeUnit.SECONDS);
+        assertNull("Shouldn't receive the message", msg);
+
+        assertEquals(1, getProxyToTopic("one.foo").getEnqueueCount());
     }
 
     @Test(timeout = 60 * 1000)

Reply via email to