From 0443128b8145b4d0149bb2e6d1a139daabe93ff7 Mon Sep 17 00:00:00 2001 From: Justin Bertram Date: Wed, 27 May 2020 10:01:25 -0500 Subject: [PATCH] ARTEMIS-2783 user not set on shared queue --- .../core/server/impl/ServerSessionImpl.java | 2 +- .../jms/jms2client/SharedConsumerTest.java | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) 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 e5b0950ffa..d2ea24ad99 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 @@ -1041,7 +1041,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener { server.checkQueueCreationLimit(getUsername()); - server.createSharedQueue(queueConfiguration); + server.createSharedQueue(queueConfiguration.setUser(getUsername())); } @Deprecated diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/jms2client/SharedConsumerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/jms2client/SharedConsumerTest.java index 72ef99ca92..fdf2375de7 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/jms2client/SharedConsumerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/jms2client/SharedConsumerTest.java @@ -25,6 +25,7 @@ import java.util.Random; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.core.postoffice.Binding; +import org.apache.activemq.artemis.core.postoffice.impl.LocalQueueBinding; import org.apache.activemq.artemis.tests.util.JMSTestBase; import org.junit.Before; import org.junit.Test; @@ -68,6 +69,23 @@ public class SharedConsumerTest extends JMSTestBase { } } + @Test + public void sharedDurableSubUser() throws Exception { + try (JMSContext context = cf.createContext("foo", "bar")) { + context.createSharedDurableConsumer(topic1, "mySharedCon"); + boolean found = false; + for (Binding binding : server.getPostOffice().getBindingsForAddress(SimpleString.toSimpleString(topic1.getTopicName())).getBindings()) { + found = true; + assertTrue(binding instanceof LocalQueueBinding); + assertEquals("mySharedCon", ((LocalQueueBinding)binding).getQueue().getName().toString()); + assertNotNull(((LocalQueueBinding)binding).getQueue().getUser()); + assertEquals("foo", ((LocalQueueBinding)binding).getQueue().getUser().toString()); + } + + assertTrue(found); + } + } + @Test public void sharedDurableUnsubscribeNewTopic() throws Exception { context = cf.createContext();