activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [activemq-artemis] branch master updated: ARTEMIS-2753 Expanding wildcard fix to Advisories
Date Thu, 07 May 2020 17:35:44 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new 9571ca1  ARTEMIS-2753 Expanding wildcard fix to Advisories
9571ca1 is described below

commit 9571ca16dbb5c74b077a04b61268babdc6019211
Author: Clebert Suconic <clebertsuconic@apache.org>
AuthorDate: Thu May 7 12:16:35 2020 -0400

    ARTEMIS-2753 Expanding wildcard fix to Advisories
---
 .../artemis/core/protocol/openwire/amq/AMQConsumer.java   |  7 +------
 .../artemis/core/protocol/openwire/amq/AMQSession.java    | 15 +++++++--------
 .../core/protocol/openwire/amq/AMQConsumerTest.java       |  3 ++-
 3 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConsumer.java
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConsumer.java
index cefd027..7e6be43 100644
--- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConsumer.java
+++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConsumer.java
@@ -139,12 +139,7 @@ public class AMQConsumer {
          }
       }
 
-      SimpleString destinationName;
-      if (openwireDestination.isTemporary()) {
-         destinationName = new SimpleString(openwireDestination.getPhysicalName());
-      } else {
-         destinationName = new SimpleString(session.convertWildcard(openwireDestination.getPhysicalName()));
-      }
+      SimpleString destinationName = new SimpleString(session.convertWildcard(openwireDestination));
 
       if (openwireDestination.isTopic()) {
          SimpleString queueName = createTopicSubscription(info.isDurable(), info.getClientId(),
destinationName.toString(), info.getSubscriptionName(), selector, destinationName);
diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java
index af7a194..106983f 100644
--- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java
+++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java
@@ -183,12 +183,7 @@ public class AMQSession implements SessionCallback {
          }
          if (openWireDest.isQueue()) {
             openWireDest = protocolManager.virtualTopicConsumerToFQQN(openWireDest);
-            SimpleString queueName;
-            if (!openWireDest.isTemporary()) {
-               queueName = new SimpleString(convertWildcard(openWireDest.getPhysicalName()));
-            } else {
-               queueName = new SimpleString(openWireDest.getPhysicalName());
-            }
+            SimpleString queueName = new SimpleString(convertWildcard(openWireDest));
 
             if (!checkAutoCreateQueue(queueName, openWireDest.isTemporary())) {
                throw new InvalidDestinationException("Destination doesn't exist: " + queueName);
@@ -522,8 +517,12 @@ public class AMQSession implements SessionCallback {
       connection.enableTtl();
    }
 
-   public String convertWildcard(String physicalName) {
-      return OPENWIRE_WILDCARD.convert(physicalName, server.getConfiguration().getWildcardConfiguration());
+   public String convertWildcard(ActiveMQDestination openWireDest) {
+      if (openWireDest.isTemporary() || AdvisorySupport.isAdvisoryTopic(openWireDest)) {
+         return openWireDest.getPhysicalName();
+      } else {
+         return OPENWIRE_WILDCARD.convert(openWireDest.getPhysicalName(), server.getConfiguration().getWildcardConfiguration());
+      }
    }
 
    public ServerSession getCoreSession() {
diff --git a/artemis-protocols/artemis-openwire-protocol/src/test/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConsumerTest.java
b/artemis-protocols/artemis-openwire-protocol/src/test/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConsumerTest.java
index b25881b..5c1a879 100644
--- a/artemis-protocols/artemis-openwire-protocol/src/test/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConsumerTest.java
+++ b/artemis-protocols/artemis-openwire-protocol/src/test/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConsumerTest.java
@@ -28,6 +28,7 @@ import org.apache.activemq.artemis.core.server.MessageReference;
 import org.apache.activemq.artemis.core.server.ServerSession;
 import org.apache.activemq.artemis.core.server.SlowConsumerDetectionListener;
 import org.apache.activemq.artemis.core.server.impl.ServerConsumerImpl;
+import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.command.ActiveMQTopic;
 import org.apache.activemq.command.ConsumerInfo;
 import org.junit.Assert;
@@ -63,7 +64,7 @@ public class AMQConsumerTest {
       Mockito.when(session.getConnection()).thenReturn(Mockito.mock(OpenWireConnection.class));
       Mockito.when(session.getCoreServer()).thenReturn(Mockito.mock(ActiveMQServer.class));
       Mockito.when(session.getCoreSession()).thenReturn(coreSession);
-      Mockito.when(session.convertWildcard(ArgumentMatchers.any(String.class))).thenReturn("");
+      Mockito.when(session.convertWildcard(ArgumentMatchers.any(ActiveMQDestination.class))).thenReturn("");
 
       ConsumerInfo info = new ConsumerInfo();
       info.setPrefetchSize(prefetchSize);


Mime
View raw message