You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2023/04/28 13:54:25 UTC
[activemq-artemis] 02/02: ARTEMIS-4212 fix tests
This is an automated email from the ASF dual-hosted git repository.
clebertsuconic pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
commit acd6605ebfca2d2a7db94fd6687827a5280a5c6c
Author: Justin Bertram <jb...@apache.org>
AuthorDate: Thu Apr 27 14:34:42 2023 -0500
ARTEMIS-4212 fix tests
---
.../org/apache/activemq/artemis/core/postoffice/Bindings.java | 4 ++++
.../activemq/artemis/core/postoffice/impl/BindingsImpl.java | 11 +++++++++++
.../activemq/artemis/core/server/impl/ServerSessionImpl.java | 3 ++-
.../artemis/tests/integration/amqp/QueueAutoCreationTest.java | 2 +-
4 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/Bindings.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/Bindings.java
index 6ac2c0ca05..21d37ec02f 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/Bindings.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/Bindings.java
@@ -62,4 +62,8 @@ public interface Bindings extends UnproposalListener {
void forEach(BiConsumer<String, Binding> bindingConsumer);
int size();
+
+ default boolean contains(Class clazz) {
+ return false;
+ }
}
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/BindingsImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/BindingsImpl.java
index 632df2a4af..252ae9b782 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/BindingsImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/BindingsImpl.java
@@ -200,6 +200,17 @@ public final class BindingsImpl implements Bindings {
return bindingsNameMap.size();
}
+ @Override
+ public boolean contains(Class clazz) {
+ for (Binding binding : getBindings()) {
+ if (clazz.isInstance(binding)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
@Override
public Message redistribute(final Message message,
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
index 6d85381bd2..5720c49820 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
@@ -64,6 +64,7 @@ import org.apache.activemq.artemis.core.postoffice.Bindings;
import org.apache.activemq.artemis.core.postoffice.PostOffice;
import org.apache.activemq.artemis.core.postoffice.QueueBinding;
import org.apache.activemq.artemis.core.postoffice.RoutingStatus;
+import org.apache.activemq.artemis.core.postoffice.impl.LocalQueueBinding;
import org.apache.activemq.artemis.core.protocol.core.CoreRemotingConnection;
import org.apache.activemq.artemis.core.remoting.CertificateUtil;
import org.apache.activemq.artemis.core.remoting.CloseListener;
@@ -1809,7 +1810,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
if (server.locateQueue(unPrefixedQueue) == null) {
// The queue doesn't exist.
Bindings bindings = server.getPostOffice().lookupBindingsForAddress(unPrefixedAddress);
- if (bindings != null && !queueConfig.isFqqn()) {
+ if (bindings != null && bindings.contains(LocalQueueBinding.class) && !queueConfig.isFqqn()) {
// The address has another queue with a different name, which is fine. Just ignore it.
result = AutoCreateResult.EXISTED;
} else if (addressSettings.isAutoCreateQueues() || queueConfig.isTemporary()) {
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/QueueAutoCreationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/QueueAutoCreationTest.java
index 802df9c095..1453a8dba5 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/QueueAutoCreationTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/QueueAutoCreationTest.java
@@ -143,7 +143,7 @@ public class QueueAutoCreationTest extends JMSClientTestSupport {
Connection connection = factory.createConnection();
SimpleString addressName = UUIDGenerator.getInstance().generateSimpleStringUUID();
logger.debug("Address is {}", addressName);
- clientSession.createAddress(addressName, RoutingType.ANYCAST, false);
+ clientSession.createAddress(addressName, RoutingType.MULTICAST, false);
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
for (int i = 0; i < 10; i++) {