diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PersistentQueueBindingEncoding.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PersistentQueueBindingEncoding.java index 555bce15bf..e753395434 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PersistentQueueBindingEncoding.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PersistentQueueBindingEncoding.java @@ -538,7 +538,9 @@ public class PersistentQueueBindingEncoding implements EncodingSupport, QueueBin private SimpleString createMetadata() { StringBuilder metadata = new StringBuilder(); - metadata.append("user=").append(user).append(";"); + if (user != null) { + metadata.append("user=").append(user).append(";"); + } return SimpleString.toSimpleString(metadata.toString()); } } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/PostOffice.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/PostOffice.java index 2b31668e84..b54448f8d9 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/PostOffice.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/PostOffice.java @@ -101,6 +101,14 @@ public interface PostOffice extends ActiveMQComponent { QueueBinding updateQueue(QueueConfiguration queueConfiguration) throws Exception; + /** + * @param queueConfiguration + * @param forceUpdate Setting to true will make null values override current values too + * @return + * @throws Exception + */ + QueueBinding updateQueue(QueueConfiguration queueConfiguration, boolean forceUpdate) throws Exception; + List listQueuesForAddress(SimpleString address) throws Exception; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java index 930f21f0c4..0d6f89d271 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java @@ -63,7 +63,6 @@ import org.apache.activemq.artemis.core.server.RoutingContext; import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType; import org.apache.activemq.artemis.core.server.group.GroupingHandler; import org.apache.activemq.artemis.core.server.impl.AddressInfo; -import org.apache.activemq.artemis.core.server.impl.QueueConfigurationUtils; import org.apache.activemq.artemis.core.server.impl.QueueManagerImpl; import org.apache.activemq.artemis.core.server.impl.RoutingContextImpl; import org.apache.activemq.artemis.core.server.management.ManagementService; @@ -619,6 +618,11 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding @Override public QueueBinding updateQueue(QueueConfiguration queueConfiguration) throws Exception { + return updateQueue(queueConfiguration, false); + } + + @Override + public QueueBinding updateQueue(QueueConfiguration queueConfiguration, boolean forceUpdate) throws Exception { synchronized (this) { final QueueBinding queueBinding = (QueueBinding) addressManager.getBinding(queueConfiguration.getName()); if (queueBinding == null) { @@ -649,91 +653,71 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding } } - QueueConfigurationUtils.applyDynamicQueueDefaults(queueConfiguration, addressSettingsRepository.getMatch(queueConfiguration.getAddress().toString())); - - // atomic update, reset to defaults if value == null - // maxConsumers - if (queue.getMaxConsumers() != queueConfiguration.getMaxConsumers()) { + //atomic update + if ((forceUpdate || queueConfiguration.getMaxConsumers() != null) && !Objects.equals(queue.getMaxConsumers(), queueConfiguration.getMaxConsumers())) { changed = true; queue.setMaxConsumer(queueConfiguration.getMaxConsumers()); } - // routingType - if (queue.getRoutingType() != queueConfiguration.getRoutingType()) { + if ((forceUpdate || queueConfiguration.getRoutingType() != null) && !Objects.equals(queue.getRoutingType(), queueConfiguration.getRoutingType())) { changed = true; queue.setRoutingType(queueConfiguration.getRoutingType()); } - // purgeOnNoConsumers - if (queue.isPurgeOnNoConsumers() != queueConfiguration.isPurgeOnNoConsumers()) { + if ((forceUpdate || queueConfiguration.isPurgeOnNoConsumers() != null) && !Objects.equals(queue.isPurgeOnNoConsumers(), queueConfiguration.isPurgeOnNoConsumers())) { changed = true; queue.setPurgeOnNoConsumers(queueConfiguration.isPurgeOnNoConsumers()); } - // enabled - if (queue.isEnabled() != queueConfiguration.isEnabled()) { + if ((forceUpdate || queueConfiguration.isEnabled() != null) && !Objects.equals(queue.isEnabled(), queueConfiguration.isEnabled())) { changed = true; queue.setEnabled(queueConfiguration.isEnabled()); } - // exclusive - if (queue.isExclusive() != queueConfiguration.isExclusive()) { + if ((forceUpdate || queueConfiguration.isExclusive() != null) && !Objects.equals(queue.isExclusive(), queueConfiguration.isExclusive())) { changed = true; queue.setExclusive(queueConfiguration.isExclusive()); } - // groupRebalance - if (queue.isGroupRebalance() != queueConfiguration.isGroupRebalance()) { + if ((forceUpdate || queueConfiguration.isGroupRebalance() != null) && !Objects.equals(queue.isGroupRebalance(), queueConfiguration.isGroupRebalance())) { changed = true; queue.setGroupRebalance(queueConfiguration.isGroupRebalance()); } - // groupBuckets - if (queue.getGroupBuckets() != queueConfiguration.getGroupBuckets()) { + if ((forceUpdate || queueConfiguration.getGroupBuckets() != null) && !Objects.equals(queue.getGroupBuckets(), queueConfiguration.getGroupBuckets())) { changed = true; queue.setGroupBuckets(queueConfiguration.getGroupBuckets()); } - // groupFirstKey - // Objects.equals() performs the null check for us - if (!Objects.equals(queue.getGroupFirstKey(), queueConfiguration.getGroupFirstKey())) { + if ((forceUpdate || queueConfiguration.getGroupFirstKey() != null) && !Objects.equals(queueConfiguration.getGroupFirstKey(), queue.getGroupFirstKey())) { changed = true; queue.setGroupFirstKey(queueConfiguration.getGroupFirstKey()); } - // nonDestructive - if (queue.isNonDestructive() != queueConfiguration.isNonDestructive()) { + if ((forceUpdate || queueConfiguration.isNonDestructive() != null) && !Objects.equals(queue.isNonDestructive(), queueConfiguration.isNonDestructive())) { changed = true; queue.setNonDestructive(queueConfiguration.isNonDestructive()); } - // consumersBeforeDispatch - if (queue.getConsumersBeforeDispatch() != queueConfiguration.getConsumersBeforeDispatch()) { + if ((forceUpdate || queueConfiguration.getConsumersBeforeDispatch() != null) && !Objects.equals(queueConfiguration.getConsumersBeforeDispatch(), queue.getConsumersBeforeDispatch())) { changed = true; queue.setConsumersBeforeDispatch(queueConfiguration.getConsumersBeforeDispatch()); } - // delayBeforeDispatch - if (queue.getDelayBeforeDispatch() != queueConfiguration.getDelayBeforeDispatch()) { + if ((forceUpdate || queueConfiguration.getDelayBeforeDispatch() != null) && !Objects.equals(queueConfiguration.getDelayBeforeDispatch(), queue.getDelayBeforeDispatch())) { changed = true; queue.setDelayBeforeDispatch(queueConfiguration.getDelayBeforeDispatch()); } - // filter - // There's no default ActiveMQDefaultConfiguration setting for a filter - final Filter newFilter = FilterImpl.createFilter(queueConfiguration.getFilterString()); - if (!Objects.equals(queue.getFilter(), newFilter)) { + final SimpleString empty = new SimpleString(""); + Filter oldFilter = FilterImpl.createFilter(queue.getFilter() == null ? empty : queue.getFilter().getFilterString()); + Filter newFilter = FilterImpl.createFilter(queueConfiguration.getFilterString() == null ? empty : queueConfiguration.getFilterString()); + if ((forceUpdate || newFilter != null) && !Objects.equals(oldFilter, newFilter)) { changed = true; queue.setFilter(newFilter); } - // configurationManaged - if (queueConfiguration.isConfigurationManaged() != queue.isConfigurationManaged()) { - queue.setConfigurationManaged(queueConfiguration.isConfigurationManaged()); + if ((forceUpdate || queueConfiguration.isConfigurationManaged() != null) && !Objects.equals(queueConfiguration.isConfigurationManaged(), queue.isConfigurationManaged())) { changed = true; + queue.setConfigurationManaged(queueConfiguration.isConfigurationManaged()); } - if (logger.isDebugEnabled()) { - if (queueConfiguration.getUser() == null && queue.getUser() != null) { - logger.debug("Ignoring updating Queue to a NULL user"); - } - } - if (queueConfiguration.getUser() != null && !queueConfiguration.getUser().equals(queue.getUser())) { + if ((forceUpdate || queueConfiguration.getUser() != null) && !Objects.equals(queueConfiguration.getUser(), queue.getUser())) { changed = true; queue.setUser(queueConfiguration.getUser()); } - // ringSize - if (queue.getRingSize() != queueConfiguration.getRingSize()) { + if ((forceUpdate || queueConfiguration.getRingSize() != null) && !Objects.equals(queueConfiguration.getRingSize(), queue.getRingSize())) { changed = true; queue.setRingSize(queueConfiguration.getRingSize()); } + if (changed) { final long txID = storageManager.generateID(); try { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java index 5934bc5007..3bbc721503 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java @@ -790,6 +790,15 @@ public interface ActiveMQServer extends ServiceComponent { */ Queue updateQueue(QueueConfiguration queueConfiguration) throws Exception; + /** + * @param queueConfiguration the {@code QueueConfiguration} to use + * @param forceUpdate If true, no null check is performed and unset queueConfiguration values are reset to null + * @return the updated {@code Queue} instance + * @throws Exception + * @see #updateQueue(QueueConfiguration) + */ + Queue updateQueue(QueueConfiguration queueConfiguration, boolean forceUpdate) throws Exception; + /* * add a ProtocolManagerFactory to be used. Note if @see Configuration#isResolveProtocols is tur then this factory will * replace any factories with the same protocol diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java index 79b9c7d8fa..722e74f21d 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java @@ -48,6 +48,8 @@ import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Consumer; +import java.util.function.Supplier; import java.util.stream.Collectors; import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; @@ -3224,7 +3226,9 @@ public class ActiveMQServerImpl implements ActiveMQServer { // determine if there is an address::queue match; update it if so if (locateQueue(config.getName()) != null && locateQueue(config.getName()).getAddress().equals(config.getAddress())) { - updateQueue(config.setConfigurationManaged(true)); + config.setConfigurationManaged(true); + setUnsetQueueParamsToDefaults(config); + updateQueue(config, true); } else { // if the address::queue doesn't exist then create it try { @@ -3770,7 +3774,12 @@ public class ActiveMQServerImpl implements ActiveMQServer { @Override public Queue updateQueue(QueueConfiguration queueConfiguration) throws Exception { - final QueueBinding queueBinding = this.postOffice.updateQueue(queueConfiguration); + return updateQueue(queueConfiguration, false); + } + + @Override + public Queue updateQueue(QueueConfiguration queueConfiguration, boolean forceUpdate) throws Exception { + final QueueBinding queueBinding = this.postOffice.updateQueue(queueConfiguration, forceUpdate); if (queueBinding != null) { return queueBinding.getQueue(); } else { @@ -3983,6 +3992,33 @@ public class ActiveMQServerImpl implements ActiveMQServer { } } + private static void setDefaultIfUnset(Supplier getter, Consumer setter, T defaultValue) { + if (getter.get() == null) { + setter.accept(defaultValue); + } + } + + private static void setUnsetQueueParamsToDefaults(QueueConfiguration c) { + // Param list taken from PostOfficeImpl::updateQueue + setDefaultIfUnset(c::getMaxConsumers, c::setMaxConsumers, ActiveMQDefaultConfiguration.getDefaultMaxQueueConsumers()); + setDefaultIfUnset(c::getRoutingType, c::setRoutingType, ActiveMQDefaultConfiguration.getDefaultRoutingType()); + setDefaultIfUnset(c::isPurgeOnNoConsumers, c::setPurgeOnNoConsumers, ActiveMQDefaultConfiguration.getDefaultPurgeOnNoConsumers()); + setDefaultIfUnset(c::isEnabled, c::setEnabled, ActiveMQDefaultConfiguration.getDefaultEnabled()); + setDefaultIfUnset(c::isExclusive, c::setExclusive, ActiveMQDefaultConfiguration.getDefaultExclusive()); + setDefaultIfUnset(c::isGroupRebalance, c::setGroupRebalance, ActiveMQDefaultConfiguration.getDefaultGroupRebalance()); + setDefaultIfUnset(c::getGroupBuckets, c::setGroupBuckets, ActiveMQDefaultConfiguration.getDefaultGroupBuckets()); + setDefaultIfUnset(c::getGroupFirstKey, c::setGroupFirstKey, ActiveMQDefaultConfiguration.getDefaultGroupFirstKey()); + setDefaultIfUnset(c::isNonDestructive, c::setNonDestructive, ActiveMQDefaultConfiguration.getDefaultNonDestructive()); + setDefaultIfUnset(c::getConsumersBeforeDispatch, c::setConsumersBeforeDispatch, ActiveMQDefaultConfiguration.getDefaultConsumersBeforeDispatch()); + setDefaultIfUnset(c::getDelayBeforeDispatch, c::setDelayBeforeDispatch, ActiveMQDefaultConfiguration.getDefaultDelayBeforeDispatch()); + setDefaultIfUnset(c::getFilterString, c::setFilterString, new SimpleString("")); + // Defaults to false automatically as per isConfigurationManaged() JavaDoc + setDefaultIfUnset(c::isConfigurationManaged, c::setConfigurationManaged, false); + // Setting to null might have side effects + setDefaultIfUnset(c::getUser, c::setUser, null); + setDefaultIfUnset(c::getRingSize, c::setRingSize, ActiveMQDefaultConfiguration.getDefaultRingSize()); + } + private void deployReloadableConfigFromConfiguration() throws Exception { if (configurationReloadDeployed.compareAndSet(false, true)) { ActiveMQServerLogger.LOGGER.reloadingConfiguration("security"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/RedeployTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/RedeployTest.java index 1ff0a89bc2..c868c8a4b3 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/RedeployTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/RedeployTest.java @@ -39,6 +39,7 @@ import javax.jms.Session; import javax.jms.TextMessage; import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.core.postoffice.Binding; @@ -296,7 +297,7 @@ public class RedeployTest extends ActiveMQTestBase { Path brokerXML = getTestDirfile().toPath().resolve("broker.xml"); Files.copy(configFile.openStream(), brokerXML, StandardCopyOption.REPLACE_EXISTING); - + brokerXML.toFile().setLastModified(System.currentTimeMillis() + 1000); final ReusableLatch latch = new ReusableLatch(1); Runnable tick = latch::countDown; server.getActiveMQServer().getReloadManager().setTick(tick); @@ -397,6 +398,40 @@ public class RedeployTest extends ActiveMQTestBase { doTestRemoveFilter(RedeployTest.class.getClassLoader().getResource("reload-queue-filter-removed.xml")); } + /** + * This one is here just to make sure it's possible to change queue parameters one by one without setting the others + * to null. + * @throws Exception + */ + @Test + public void testQueuePartialReconfiguration() throws Exception { + + Path brokerXML = getTestDirfile().toPath().resolve("broker.xml"); + URL url = RedeployTest.class.getClassLoader().getResource("reload-empty.xml"); + Files.copy(url.openStream(), brokerXML); + + EmbeddedActiveMQ embeddedActiveMQ = new EmbeddedActiveMQ(); + embeddedActiveMQ.setConfigResourcePath(brokerXML.toUri().toString()); + embeddedActiveMQ.start(); + + try { + + embeddedActiveMQ.getActiveMQServer().createQueue(new QueueConfiguration("virtualQueue").setUser("bob")); + embeddedActiveMQ.getActiveMQServer().updateQueue(new QueueConfiguration("virtualQueue").setFilterString("foo")); + + LocalQueueBinding queueBinding = (LocalQueueBinding) embeddedActiveMQ.getActiveMQServer().getPostOffice() + .getBinding(new SimpleString("virtualQueue")); + org.apache.activemq.artemis.core.server.Queue queue = queueBinding.getQueue(); + + assertEquals(new SimpleString("bob"), queue.getUser()); + assertEquals(new SimpleString("foo"), queue.getFilter().getFilterString()); + + } finally { + embeddedActiveMQ.stop(); + } + + } + @Test public void testRedeployQueueDefaults() throws Exception { @@ -413,37 +448,37 @@ public class RedeployTest extends ActiveMQTestBase { .getBinding(new SimpleString("myQueue")); org.apache.activemq.artemis.core.server.Queue queue = queueBinding.getQueue(); - assertNotEquals(queue.getMaxConsumers(), ActiveMQDefaultConfiguration.getDefaultMaxQueueConsumers()); - assertNotEquals(queue.getRoutingType(), RoutingType.MULTICAST); - assertNotEquals(queue.isPurgeOnNoConsumers(), ActiveMQDefaultConfiguration.getDefaultPurgeOnNoConsumers()); - assertNotEquals(queue.isEnabled(), ActiveMQDefaultConfiguration.getDefaultEnabled()); - assertNotEquals(queue.isExclusive(), ActiveMQDefaultConfiguration.getDefaultExclusive()); - assertNotEquals(queue.isGroupRebalance(), ActiveMQDefaultConfiguration.getDefaultGroupRebalance()); - assertNotEquals(queue.getGroupBuckets(), ActiveMQDefaultConfiguration.getDefaultGroupBuckets()); - assertNotEquals(queue.getGroupFirstKey(), ActiveMQDefaultConfiguration.getDefaultGroupFirstKey()); - assertNotEquals(queue.isNonDestructive(), ActiveMQDefaultConfiguration.getDefaultNonDestructive()); - assertNotEquals(queue.getConsumersBeforeDispatch(), ActiveMQDefaultConfiguration.getDefaultConsumersBeforeDispatch()); - assertNotEquals(queue.getDelayBeforeDispatch(), ActiveMQDefaultConfiguration.getDefaultDelayBeforeDispatch()); - assertNotEquals(queue.getFilter(), null); - assertNotEquals(queue.getUser(), "jdoe"); - assertNotEquals(queue.getRingSize(), ActiveMQDefaultConfiguration.getDefaultRingSize()); + assertNotEquals(ActiveMQDefaultConfiguration.getDefaultMaxQueueConsumers(), queue.getMaxConsumers()); + assertNotEquals(RoutingType.MULTICAST, queue.getRoutingType()); + assertNotEquals(ActiveMQDefaultConfiguration.getDefaultPurgeOnNoConsumers(), queue.isPurgeOnNoConsumers()); + assertNotEquals(ActiveMQDefaultConfiguration.getDefaultEnabled(), queue.isEnabled()); + assertNotEquals(ActiveMQDefaultConfiguration.getDefaultExclusive(), queue.isExclusive()); + assertNotEquals(ActiveMQDefaultConfiguration.getDefaultGroupRebalance(), queue.isGroupRebalance()); + assertNotEquals(ActiveMQDefaultConfiguration.getDefaultGroupBuckets(), queue.getGroupBuckets()); + assertNotEquals(ActiveMQDefaultConfiguration.getDefaultGroupFirstKey(), queue.getGroupFirstKey()); + assertNotEquals(ActiveMQDefaultConfiguration.getDefaultNonDestructive(), queue.isNonDestructive()); + assertNotEquals(ActiveMQDefaultConfiguration.getDefaultConsumersBeforeDispatch(), queue.getConsumersBeforeDispatch()); + assertNotEquals(ActiveMQDefaultConfiguration.getDefaultDelayBeforeDispatch(), queue.getDelayBeforeDispatch()); + assertNotNull(queue.getFilter()); + assertEquals(new SimpleString("jdoe"), queue.getUser()); + assertNotEquals(ActiveMQDefaultConfiguration.getDefaultRingSize(), queue.getRingSize()); deployBrokerConfig(embeddedActiveMQ, newConfig); - assertEquals(queue.getMaxConsumers(), ActiveMQDefaultConfiguration.getDefaultMaxQueueConsumers()); - assertEquals(queue.getRoutingType(), RoutingType.MULTICAST); - assertEquals(queue.isPurgeOnNoConsumers(), ActiveMQDefaultConfiguration.getDefaultPurgeOnNoConsumers()); - assertEquals(queue.isEnabled(), ActiveMQDefaultConfiguration.getDefaultEnabled()); - assertEquals(queue.isExclusive(), ActiveMQDefaultConfiguration.getDefaultExclusive()); - assertEquals(queue.isGroupRebalance(), ActiveMQDefaultConfiguration.getDefaultGroupRebalance()); - assertEquals(queue.getGroupBuckets(), ActiveMQDefaultConfiguration.getDefaultGroupBuckets()); - assertEquals(queue.getGroupFirstKey(), ActiveMQDefaultConfiguration.getDefaultGroupFirstKey()); - assertEquals(queue.isNonDestructive(), ActiveMQDefaultConfiguration.getDefaultNonDestructive()); - assertEquals(queue.getConsumersBeforeDispatch(), ActiveMQDefaultConfiguration.getDefaultConsumersBeforeDispatch()); - assertEquals(queue.getDelayBeforeDispatch(), ActiveMQDefaultConfiguration.getDefaultDelayBeforeDispatch()); - assertEquals(queue.getFilter(), null); - assertEquals(queue.getUser(), null); - assertEquals(queue.getRingSize(), ActiveMQDefaultConfiguration.getDefaultRingSize()); + assertEquals(ActiveMQDefaultConfiguration.getDefaultMaxQueueConsumers(), queue.getMaxConsumers()); + assertEquals(RoutingType.MULTICAST, queue.getRoutingType()); + assertEquals(ActiveMQDefaultConfiguration.getDefaultPurgeOnNoConsumers(), queue.isPurgeOnNoConsumers()); + assertEquals(ActiveMQDefaultConfiguration.getDefaultEnabled(), queue.isEnabled()); + assertEquals(ActiveMQDefaultConfiguration.getDefaultExclusive(), queue.isExclusive()); + assertEquals(ActiveMQDefaultConfiguration.getDefaultGroupRebalance(), queue.isGroupRebalance()); + assertEquals(ActiveMQDefaultConfiguration.getDefaultGroupBuckets(), queue.getGroupBuckets()); + assertEquals(ActiveMQDefaultConfiguration.getDefaultGroupFirstKey(), queue.getGroupFirstKey()); + assertEquals(ActiveMQDefaultConfiguration.getDefaultNonDestructive(), queue.isNonDestructive()); + assertEquals(ActiveMQDefaultConfiguration.getDefaultConsumersBeforeDispatch(), queue.getConsumersBeforeDispatch()); + assertEquals(ActiveMQDefaultConfiguration.getDefaultDelayBeforeDispatch(), queue.getDelayBeforeDispatch()); + assertNull(queue.getFilter()); + assertNull(queue.getUser()); + assertEquals(ActiveMQDefaultConfiguration.getDefaultRingSize(), queue.getRingSize()); } finally { embeddedActiveMQ.stop(); diff --git a/tests/integration-tests/src/test/resources/reload-empty.xml b/tests/integration-tests/src/test/resources/reload-empty.xml new file mode 100644 index 0000000000..73fab42480 --- /dev/null +++ b/tests/integration-tests/src/test/resources/reload-empty.xml @@ -0,0 +1,80 @@ + + + + + + + + 0.0.0.0 + + 100 + + false + + false + + + NIO + + ./data/paging + + ./data/bindings + + ./data/journal + + ./data/large-messages + + 2 + + -1 + + + 40000 + + + + + + tcp://0.0.0.0:61616?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576 + + + tcp://0.0.0.0:5672?protocols=AMQP + + + tcp://0.0.0.0:61613?protocols=STOMP + + + tcp://0.0.0.0:5445?protocols=HORNETQ,STOMP + + + tcp://0.0.0.0:1883?protocols=MQTT + + + + + diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakePostOffice.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakePostOffice.java index d617f64adc..274c50dc4e 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakePostOffice.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakePostOffice.java @@ -84,6 +84,11 @@ public class FakePostOffice implements PostOffice { @Override public QueueBinding updateQueue(QueueConfiguration queueConfiguration) throws Exception { + return updateQueue(queueConfiguration, false); + } + + @Override + public QueueBinding updateQueue(QueueConfiguration queueConfiguration, boolean forceUpdate) throws Exception { return null; }