activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbert...@apache.org
Subject [1/2] activemq-artemis git commit: ARTEMIS-1215 Fix address validation on sub #
Date Wed, 14 Jun 2017 16:39:53 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master c02373561 -> 13a0a49df


ARTEMIS-1215 Fix address validation on sub #


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/f20703a1
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/f20703a1
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/f20703a1

Branch: refs/heads/master
Commit: f20703a13ec92418f27f0f916c8e266b6eeb475f
Parents: c023735
Author: Martyn Taylor <mtaylor@redhat.com>
Authored: Tue Jun 13 09:57:38 2017 +0100
Committer: Justin Bertram <jbertram@apache.org>
Committed: Wed Jun 14 11:39:39 2017 -0500

----------------------------------------------------------------------
 .../postoffice/impl/SimpleAddressManager.java   |  2 +-
 .../integration/mqtt/imported/MQTTTest.java     | 37 ++++++++++++++++++++
 2 files changed, 38 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f20703a1/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/SimpleAddressManager.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/SimpleAddressManager.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/SimpleAddressManager.java
index b6b3a5c..347ac15 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/SimpleAddressManager.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/SimpleAddressManager.java
@@ -251,7 +251,7 @@ public class SimpleAddressManager implements AddressManager {
             if (binding instanceof QueueBinding) {
                final QueueBinding queueBinding = (QueueBinding) binding;
                final RoutingType routingType = queueBinding.getQueue().getRoutingType();
-               if (!routingTypes.contains(routingType)) {
+               if (!routingTypes.contains(routingType) && binding.getAddress().equals(addressName))
{
                   throw ActiveMQMessageBundle.BUNDLE.invalidRoutingTypeDelete(routingType,
addressName.toString());
                }
             }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f20703a1/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTest.java
index 3026f97..d8db226 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTest.java
@@ -39,6 +39,8 @@ import java.util.regex.Pattern;
 
 import org.apache.activemq.artemis.api.core.RoutingType;
 import org.apache.activemq.artemis.api.core.SimpleString;
+import org.apache.activemq.artemis.core.config.CoreAddressConfiguration;
+import org.apache.activemq.artemis.core.config.CoreQueueConfiguration;
 import org.apache.activemq.artemis.core.protocol.mqtt.MQTTConnectionManager;
 import org.apache.activemq.artemis.core.protocol.mqtt.MQTTSession;
 import org.apache.activemq.artemis.core.protocol.mqtt.MQTTUtil;
@@ -1898,6 +1900,41 @@ public class MQTTTest extends MQTTTestSupport {
       assertEquals(payload, new String(message.getPayload()));
    }
 
+   @Test(timeout = 60 * 1000)
+   public void testBrokerRestartAfterSubHashWithConfigurationQueues() throws Exception {
+
+      // Add some pre configured queues
+      CoreQueueConfiguration coreQueueConfiguration = new CoreQueueConfiguration();
+      coreQueueConfiguration.setName("DLQ");
+      coreQueueConfiguration.setRoutingType(RoutingType.ANYCAST);
+      coreQueueConfiguration.setAddress("DLA");
+
+      CoreAddressConfiguration coreAddressConfiguration = new CoreAddressConfiguration();
+      coreAddressConfiguration.setName("DLA");
+      coreAddressConfiguration.addRoutingType(RoutingType.ANYCAST);
+      coreAddressConfiguration.addQueueConfiguration(coreQueueConfiguration);
+
+      getServer().getConfiguration().getAddressConfigurations().add(coreAddressConfiguration);
+
+      getServer().stop();
+      getServer().start();
+      getServer().waitForActivation(10, TimeUnit.SECONDS);
+
+      for (int i = 0; i < 2; i++) {
+         MQTT mqtt = createMQTTConnection("myClient", false);
+         BlockingConnection connection = mqtt.blockingConnection();
+         connection.connect();
+         connection.subscribe(new Topic[]{new Topic("#", QoS.AT_MOST_ONCE)});
+         connection.disconnect();
+
+         getServer().stop();
+         getServer().start();
+         getServer().waitForActivation(10, TimeUnit.SECONDS);
+      }
+
+
+   }
+
    @Test
    public void testDuplicateIDReturnsError() throws Exception {
       String clientId = "clientId";


Mime
View raw message