ARTEMIS-4212 fix tests

This commit is contained in:
Justin Bertram 2023-04-27 14:34:42 -05:00 committed by clebertsuconic
parent 1fa5c761c6
commit acd6605ebf
4 changed files with 18 additions and 2 deletions

View File

@ -62,4 +62,8 @@ public interface Bindings extends UnproposalListener {
void forEach(BiConsumer<String, Binding> bindingConsumer);
int size();
default boolean contains(Class clazz) {
return false;
}
}

View File

@ -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,

View File

@ -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()) {

View File

@ -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++) {