Skip to content

Commit

Permalink
ARTEMIS-4212 fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jbertram authored and clebertsuconic committed Apr 28, 2023
1 parent 1fa5c76 commit acd6605
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,8 @@ public interface Bindings extends UnproposalListener {
void forEach(BiConsumer<String, Binding> bindingConsumer);

int size();

default boolean contains(Class clazz) {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,17 @@ public int size() {
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
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;
Expand Down Expand Up @@ -1809,7 +1810,7 @@ public AutoCreateResult checkAutoCreate(final QueueConfiguration queueConfig) th
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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public void testAutoCreateOnTopicManySends() throws Exception {
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++) {
Expand Down

0 comments on commit acd6605

Please sign in to comment.