diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/xml/XmlDataImporter.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/xml/XmlDataImporter.java index d311bdf06b..027db44cb3 100644 --- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/xml/XmlDataImporter.java +++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/xml/XmlDataImporter.java @@ -41,6 +41,7 @@ import java.util.TreeSet; import io.airlift.airline.Command; import io.airlift.airline.Option; import org.apache.activemq.artemis.api.core.Message; +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.api.core.TransportConfiguration; @@ -415,7 +416,7 @@ public final class XmlDataImporter extends ActionAbstract { ClientSession.QueueQuery queueQuery = session.queueQuery(new SimpleString(queueName)); if (!queueQuery.isExists()) { - session.createQueue(address, routingType, queueName, filter, true); + session.createQueue(new QueueConfiguration(queueName).setAddress(address).setRoutingType(routingType).setFilterString(filter)); if (logger.isDebugEnabled()) { logger.debug("Binding queue(name=" + queueName + ", address=" + address + ", filter=" + filter + ")"); } @@ -457,7 +458,7 @@ public final class XmlDataImporter extends ActionAbstract { ClientSession.QueueQuery queueQuery = session.queueQuery(new SimpleString(queueName)); if (!queueQuery.isExists()) { - session.createQueue(address, RoutingType.valueOf(routingType), queueName, filter, true); + session.createQueue(new QueueConfiguration(queueName).setAddress(address).setRoutingType(RoutingType.valueOf(routingType)).setFilterString(filter)); if (logger.isDebugEnabled()) { logger.debug("Binding queue(name=" + queueName + ", address=" + address + ", filter=" + filter + ")"); } diff --git a/artemis-commons/pom.xml b/artemis-commons/pom.xml index 3b86192f0a..6cca7d8b55 100644 --- a/artemis-commons/pom.xml +++ b/artemis-commons/pom.xml @@ -76,6 +76,10 @@ commons-beanutils commons-beanutils + + org.apache.geronimo.specs + geronimo-json_1.0_spec + junit junit diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/ParameterisedAddress.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/ParameterisedAddress.java index 6a6d45c81c..155636ad26 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/ParameterisedAddress.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/ParameterisedAddress.java @@ -43,23 +43,39 @@ public class ParameterisedAddress { } private final SimpleString address; - private final QueueAttributes queueAttributes; + private final QueueConfiguration queueConfiguration; public SimpleString getAddress() { return address; } + @Deprecated public QueueAttributes getQueueAttributes() { - return queueAttributes; + return QueueAttributes.fromQueueConfiguration(queueConfiguration); } + public QueueConfiguration getQueueConfiguration() { + return queueConfiguration; + } + + @Deprecated public ParameterisedAddress(SimpleString address, QueueAttributes queueAttributes) { this.address = address; - this.queueAttributes = queueAttributes; + this.queueConfiguration = queueAttributes.toQueueConfiguration(); } + public ParameterisedAddress(SimpleString address, QueueConfiguration queueConfiguration) { + this.address = address; + this.queueConfiguration = queueConfiguration; + } + + @Deprecated public ParameterisedAddress(String address, QueueAttributes queueAttributes) { - this(SimpleString.toSimpleString(address), queueAttributes); + this(SimpleString.toSimpleString(address), queueAttributes.toQueueConfiguration()); + } + + public ParameterisedAddress(String address, QueueConfiguration queueConfiguration) { + this(SimpleString.toSimpleString(address), queueConfiguration); } public ParameterisedAddress(SimpleString address) { @@ -70,21 +86,21 @@ public class ParameterisedAddress { int index = address.indexOf('?'); if (index == -1) { this.address = SimpleString.toSimpleString(address); - this.queueAttributes = null; + this.queueConfiguration = null; } else { this.address = SimpleString.toSimpleString(address.substring(0, index)); - QueueAttributes queueAttributes = new QueueAttributes(); + QueueConfiguration queueConfiguration = new QueueConfiguration(address); try { - parseQuery(address).forEach(queueAttributes::set); + parseQuery(address).forEach(queueConfiguration::set); } catch (URISyntaxException use) { throw new IllegalArgumentException("Malformed parameters in address " + address); } - this.queueAttributes = queueAttributes; + this.queueConfiguration = queueConfiguration; } } public boolean isParameterised() { - return this.queueAttributes != null; + return this.queueConfiguration != null; } public static boolean isParameterised(String address) { diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/QueueAttributes.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/QueueAttributes.java index 24f9f34936..5f6ddb8688 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/QueueAttributes.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/QueueAttributes.java @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.api.core; import java.io.Serializable; +@Deprecated public class QueueAttributes implements Serializable { public static final String ROUTING_TYPE = "routing-type"; @@ -106,6 +107,56 @@ public class QueueAttributes implements Serializable { } } + public QueueConfiguration toQueueConfiguration() { + return new QueueConfiguration("") + .setDurable(this.getDurable()) + .setRoutingType(this.getRoutingType()) + .setExclusive(this.getExclusive()) + .setRingSize(this.getRingSize()) + .setGroupRebalance(this.getGroupRebalance()) + .setNonDestructive(this.getNonDestructive()) + .setLastValue(this.getLastValue()) + .setFilterString(this.getFilterString()) + .setMaxConsumers(this.getMaxConsumers()) + .setPurgeOnNoConsumers(this.getPurgeOnNoConsumers()) + .setConsumersBeforeDispatch(this.getConsumersBeforeDispatch()) + .setDelayBeforeDispatch(this.getDelayBeforeDispatch()) + .setGroupBuckets(this.getGroupBuckets()) + .setGroupFirstKey(this.getGroupFirstKey()) + .setLastValueKey(this.getLastValueKey()) + .setConsumerPriority(this.getConsumerPriority()) + .setAutoDelete(this.getAutoDelete()) + .setAutoDeleteMessageCount(this.getAutoDeleteMessageCount()) + .setAutoDeleteDelay(this.getAutoDeleteDelay()); + } + + public static QueueAttributes fromQueueConfiguration(QueueConfiguration queueConfiguration) { + if (queueConfiguration == null) { + return null; + } else { + return new QueueAttributes() + .setDurable(queueConfiguration.isDurable()) + .setRoutingType(queueConfiguration.getRoutingType()) + .setExclusive(queueConfiguration.isExclusive()) + .setRingSize(queueConfiguration.getRingSize()) + .setGroupRebalance(queueConfiguration.isGroupRebalance()) + .setNonDestructive(queueConfiguration.isNonDestructive()) + .setLastValue(queueConfiguration.isLastValue()) + .setFilterString(queueConfiguration.getFilterString()) + .setMaxConsumers(queueConfiguration.getMaxConsumers()) + .setPurgeOnNoConsumers(queueConfiguration.isPurgeOnNoConsumers()) + .setConsumersBeforeDispatch(queueConfiguration.getConsumersBeforeDispatch()) + .setDelayBeforeDispatch(queueConfiguration.getDelayBeforeDispatch()) + .setGroupBuckets(queueConfiguration.getGroupBuckets()) + .setGroupFirstKey(queueConfiguration.getGroupFirstKey()) + .setLastValueKey(queueConfiguration.getLastValueKey()) + .setConsumerPriority(queueConfiguration.getConsumerPriority()) + .setAutoDelete(queueConfiguration.isAutoDelete()) + .setAutoDeleteDelay(queueConfiguration.getAutoDeleteDelay()) + .setAutoDeleteMessageCount(queueConfiguration.getAutoDeleteMessageCount()); + } + } + public RoutingType getRoutingType() { return routingType; } diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/QueueConfiguration.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/QueueConfiguration.java new file mode 100644 index 0000000000..58ce01cb93 --- /dev/null +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/QueueConfiguration.java @@ -0,0 +1,841 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.activemq.artemis.api.core; + +import javax.json.JsonObject; +import javax.json.JsonObjectBuilder; +import javax.json.JsonString; +import javax.json.JsonValue; +import java.io.Serializable; +import java.io.StringReader; +import java.util.Map; +import java.util.Objects; + +import org.apache.activemq.artemis.utils.CompositeAddress; +import org.apache.activemq.artemis.utils.JsonLoader; + +/** + * This class holds all the properties required to configure a queue. The only strictly required property is + * {@code name}. Some defaults will be enforced for properties which are not explicitly set: + *

+ */ +public class QueueConfiguration implements Serializable { + + private static final long serialVersionUID = 2601016432150225938L; + + public static final String ID = "id"; + public static final String NAME = "name"; + public static final String ADDRESS = "address"; + public static final String ROUTING_TYPE = "routing-type"; + public static final String FILTER_STRING = "filter-string"; + public static final String DURABLE = "durable"; + public static final String USER = "user"; + public static final String MAX_CONSUMERS = "max-consumers"; + public static final String EXCLUSIVE = "exclusive"; + public static final String GROUP_REBALANCE = "group-rebalance"; + public static final String GROUP_BUCKETS = "group-buckets"; + public static final String GROUP_FIRST_KEY = "group-first-key"; + public static final String LAST_VALUE = "last-value"; + public static final String LAST_VALUE_KEY = "last-value-key"; + public static final String NON_DESTRUCTIVE = "non-destructive"; + public static final String PURGE_ON_NO_CONSUMERS = "purge-on-no-consumers"; + public static final String CONSUMERS_BEFORE_DISPATCH = "consumers-before-dispatch"; + public static final String DELAY_BEFORE_DISPATCH = "delay-before-dispatch"; + public static final String CONSUMER_PRIORITY = "consumer-priority"; + public static final String AUTO_DELETE = "auto-delete"; + public static final String AUTO_DELETE_DELAY = "auto-delete-delay"; + public static final String AUTO_DELETE_MESSAGE_COUNT = "auto-delete-message-count"; + public static final String RING_SIZE = "ring-size"; + public static final String CONFIGURATION_MANAGED = "configuration-managed"; + public static final String TEMPORARY = "temporary"; + public static final String AUTO_CREATE_ADDRESS = "auto-create-address"; + public static final String INTERNAL = "internal"; + public static final String TRANSIENT = "transient"; + public static final String AUTO_CREATED = "auto-created"; + + private Long id; // internal use + private SimpleString name; + private SimpleString address; + private RoutingType routingType; + private SimpleString filterString; + private Boolean durable; + private SimpleString user; + private Integer maxConsumers; + private Boolean exclusive; + private Boolean groupRebalance; + private Integer groupBuckets; + private SimpleString groupFirstKey; + private Boolean lastValue; + private SimpleString lastValueKey; + private Boolean nonDestructive; + private Boolean purgeOnNoConsumers; + private Integer consumersBeforeDispatch; + private Long delayBeforeDispatch; + private Integer consumerPriority; + private Boolean autoDelete; + private Long autoDeleteDelay; + private Long autoDeleteMessageCount; + private Long ringSize; + private Boolean configurationManaged; + private Boolean temporary; + private Boolean autoCreateAddress; + private Boolean internal; + private Boolean _transient; + private Boolean autoCreated; + + /** + * Instantiate this object and invoke {@link #setName(SimpleString)} + * + * @see #setName(SimpleString) + * + * @param name the name to use for the queue + */ + public QueueConfiguration(SimpleString name) { + setName(name); + } + + /** + * Instantiate this object and invoke {@link #setName(SimpleString)} + * + * @see #setName(SimpleString) + * + * @param name the name to use for the queue + */ + public QueueConfiguration(String name) { + this(SimpleString.toSimpleString(name)); + } + + /** + * Set the value of a parameter based on its "key" {@code String}. Valid key names and corresponding {@code static} + * {@code final} are: + *

+ * The {@code String}-based values will be converted to the proper value types based on the underlying property. For + * example, if you pass the value "TRUE" for the key "auto-created" the {@code String} "TRUE" will be converted to + * the {@code Boolean} {@code true}. + * + * @param key the key to set to the value + * @param value the value to set for the key + * @return this {@code QueueConfiguration} + */ + public QueueConfiguration set(String key, String value) { + if (key != null && value != null) { + if (key.equals(NAME)) { + setName(value); + } else if (key.equals(ADDRESS)) { + setAddress(value); + } else if (key.equals(ROUTING_TYPE)) { + setRoutingType(RoutingType.valueOf(value)); + } else if (key.equals(FILTER_STRING)) { + setFilterString(value); + } else if (key.equals(DURABLE)) { + setDurable(Boolean.valueOf(value)); + } else if (key.equals(USER)) { + setUser(SimpleString.toSimpleString(value)); + } else if (key.equals(MAX_CONSUMERS)) { + setMaxConsumers(Integer.valueOf(value)); + } else if (key.equals(EXCLUSIVE)) { + setExclusive(Boolean.valueOf(value)); + } else if (key.equals(GROUP_REBALANCE)) { + setGroupRebalance(Boolean.valueOf(value)); + } else if (key.equals(GROUP_BUCKETS)) { + setGroupBuckets(Integer.valueOf(value)); + } else if (key.equals(GROUP_FIRST_KEY)) { + setGroupFirstKey(value); + } else if (key.equals(LAST_VALUE)) { + setLastValue(Boolean.valueOf(value)); + } else if (key.equals(LAST_VALUE_KEY)) { + setLastValueKey(value); + } else if (key.equals(NON_DESTRUCTIVE)) { + setNonDestructive(Boolean.valueOf(value)); + } else if (key.equals(PURGE_ON_NO_CONSUMERS)) { + setPurgeOnNoConsumers(Boolean.valueOf(value)); + } else if (key.equals(CONSUMERS_BEFORE_DISPATCH)) { + setConsumersBeforeDispatch(Integer.valueOf(value)); + } else if (key.equals(DELAY_BEFORE_DISPATCH)) { + setDelayBeforeDispatch(Long.valueOf(value)); + } else if (key.equals(CONSUMER_PRIORITY)) { + setConsumerPriority(Integer.valueOf(value)); + } else if (key.equals(AUTO_DELETE)) { + setAutoDelete(Boolean.valueOf(value)); + } else if (key.equals(AUTO_DELETE_DELAY)) { + setAutoDeleteDelay(Long.valueOf(value)); + } else if (key.equals(AUTO_DELETE_MESSAGE_COUNT)) { + setAutoDeleteMessageCount(Long.valueOf(value)); + } else if (key.equals(RING_SIZE)) { + setRingSize(Long.valueOf(value)); + } else if (key.equals(CONFIGURATION_MANAGED)) { + setConfigurationManaged(Boolean.valueOf(value)); + } else if (key.equals(TEMPORARY)) { + setTemporary(Boolean.valueOf(value)); + } else if (key.equals(AUTO_CREATE_ADDRESS)) { + setAutoCreateAddress(Boolean.valueOf(value)); + } else if (key.equals(INTERNAL)) { + setInternal(Boolean.valueOf(value)); + } else if (key.equals(TRANSIENT)) { + setTransient(Boolean.valueOf(value)); + } else if (key.equals(AUTO_CREATED)) { + setAutoCreated(Boolean.valueOf(value)); + } + } + return this; + } + + public Long getId() { + return id; + } + + public QueueConfiguration setId(Long id) { + this.id = id; + return this; + } + + /** + * @return the name of the address; if the address is {@code null} then return the value of {@link #getName()}. + */ + public SimpleString getAddress() { + return address == null ? getName() : address; + } + + /** + * Set the name. If the fully-qualified queue name is used then it will be parsed and the corresponding values for + * {@code address} and {@code name} will be set automatically. For example if "myAddress::myQueue" is passed then the + * resulting value for {@code address} will be "myAddress" and the value for {@code name} will be "myQueue". + * + * @param address the address to use + * @return this {@code QueueConfiguration} + */ + public QueueConfiguration setAddress(SimpleString address) { + if (CompositeAddress.isFullyQualified(address)) { + this.name = CompositeAddress.extractQueueName(address); + this.address = CompositeAddress.extractAddressName(address); + } else { + this.address = address; + } + return this; + } + + /** + * @see QueueConfiguration#setAddress(SimpleString) + */ + public QueueConfiguration setAddress(String address) { + return setAddress(SimpleString.toSimpleString(address)); + } + + public SimpleString getName() { + return name; + } + + /** + * Set the name. If the fully-qualified queue name is used then it will be parsed and the corresponding values for + * {@code address} and {@code name} will be set automatically. For example if "myAddress::myQueue" is passed then the + * resulting value for {@code address} will be "myAddress" and the value for {@code name} will be "myQueue". + * + * @param name the name to use + * @return this {@code QueueConfiguration} + */ + public QueueConfiguration setName(SimpleString name) { + if (CompositeAddress.isFullyQualified(name)) { + this.name = CompositeAddress.extractQueueName(name); + this.address = CompositeAddress.extractAddressName(name); + } else { + this.name = name; + } + return this; + } + + /** + * @see QueueConfiguration#setName(SimpleString) + */ + public QueueConfiguration setName(String name) { + return setName(SimpleString.toSimpleString(name)); + } + + public RoutingType getRoutingType() { + return routingType; + } + + public QueueConfiguration setRoutingType(RoutingType routingType) { + this.routingType = routingType; + return this; + } + + public SimpleString getFilterString() { + return filterString; + } + + public QueueConfiguration setFilterString(SimpleString filterString) { + this.filterString = filterString; + return this; + } + + public QueueConfiguration setFilterString(String filterString) { + return setFilterString(filterString == null ? null : SimpleString.toSimpleString(filterString)); + } + + /** + * defaults to {@code true} + * @return + */ + public Boolean isDurable() { + return durable == null ? true : durable; + } + + public QueueConfiguration setDurable(Boolean durable) { + this.durable = durable; + return this; + } + + public SimpleString getUser() { + return user; + } + + public QueueConfiguration setUser(SimpleString user) { + this.user = user; + return this; + } + + public QueueConfiguration setUser(String user) { + return setUser(SimpleString.toSimpleString(user)); + } + + public Integer getMaxConsumers() { + return maxConsumers; + } + + public QueueConfiguration setMaxConsumers(Integer maxConsumers) { + this.maxConsumers = maxConsumers; + return this; + } + + public Boolean isExclusive() { + return exclusive; + } + + public QueueConfiguration setExclusive(Boolean exclusive) { + this.exclusive = exclusive; + return this; + } + + public Boolean isLastValue() { + return lastValue; + } + + public QueueConfiguration setLastValue(Boolean lastValue) { + this.lastValue = lastValue; + return this; + } + + public SimpleString getLastValueKey() { + return lastValueKey; + } + + public QueueConfiguration setLastValueKey(SimpleString lastValueKey) { + this.lastValueKey = lastValueKey; + return this; + } + + public QueueConfiguration setLastValueKey(String lastValueKey) { + return setLastValueKey(SimpleString.toSimpleString(lastValueKey)); + } + + public Boolean isNonDestructive() { + return nonDestructive; + } + + public QueueConfiguration setNonDestructive(Boolean nonDestructive) { + this.nonDestructive = nonDestructive; + return this; + } + + public Boolean isPurgeOnNoConsumers() { + return purgeOnNoConsumers; + } + + public QueueConfiguration setPurgeOnNoConsumers(Boolean purgeOnNoConsumers) { + this.purgeOnNoConsumers = purgeOnNoConsumers; + return this; + } + + public Integer getConsumersBeforeDispatch() { + return consumersBeforeDispatch; + } + + public QueueConfiguration setConsumersBeforeDispatch(Integer consumersBeforeDispatch) { + this.consumersBeforeDispatch = consumersBeforeDispatch; + return this; + } + + public Long getDelayBeforeDispatch() { + return delayBeforeDispatch; + } + + public QueueConfiguration setDelayBeforeDispatch(Long delayBeforeDispatch) { + this.delayBeforeDispatch = delayBeforeDispatch; + return this; + } + + public Integer getConsumerPriority() { + return consumerPriority; + } + + public QueueConfiguration setConsumerPriority(Integer consumerPriority) { + this.consumerPriority = consumerPriority; + return this; + } + + public Boolean isGroupRebalance() { + return groupRebalance; + } + + public QueueConfiguration setGroupRebalance(Boolean groupRebalance) { + this.groupRebalance = groupRebalance; + return this; + } + + public Integer getGroupBuckets() { + return groupBuckets; + } + + public QueueConfiguration setGroupBuckets(Integer groupBuckets) { + this.groupBuckets = groupBuckets; + return this; + } + + public SimpleString getGroupFirstKey() { + return groupFirstKey; + } + + public QueueConfiguration setGroupFirstKey(SimpleString groupFirstKey) { + this.groupFirstKey = groupFirstKey; + return this; + } + + public QueueConfiguration setGroupFirstKey(String groupFirstKey) { + return setGroupFirstKey(SimpleString.toSimpleString(groupFirstKey)); + } + + public Boolean isAutoDelete() { + return autoDelete; + } + + public QueueConfiguration setAutoDelete(Boolean autoDelete) { + this.autoDelete = autoDelete; + return this; + } + + public Long getAutoDeleteDelay() { + return autoDeleteDelay; + } + + public QueueConfiguration setAutoDeleteDelay(Long autoDeleteDelay) { + this.autoDeleteDelay = autoDeleteDelay; + return this; + } + + public Long getAutoDeleteMessageCount() { + return autoDeleteMessageCount; + } + + public QueueConfiguration setAutoDeleteMessageCount(Long autoDeleteMessageCount) { + this.autoDeleteMessageCount = autoDeleteMessageCount; + return this; + } + + public Long getRingSize() { + return ringSize; + } + + public QueueConfiguration setRingSize(Long ringSize) { + this.ringSize = ringSize; + return this; + } + + /** + * defaults to {@code false} + * @return + */ + public Boolean isConfigurationManaged() { + return configurationManaged == null ? false : configurationManaged; + } + + public QueueConfiguration setConfigurationManaged(Boolean configurationManaged) { + this.configurationManaged = configurationManaged; + return this; + } + + /** + * defaults to {@code false} + * @return + */ + public Boolean isTemporary() { + return temporary == null ? false : temporary; + } + + public QueueConfiguration setTemporary(Boolean temporary) { + this.temporary = temporary; + return this; + } + + public Boolean isAutoCreateAddress() { + return autoCreateAddress; + } + + public QueueConfiguration setAutoCreateAddress(Boolean autoCreateAddress) { + this.autoCreateAddress = autoCreateAddress; + return this; + } + + /** + * defaults to {@code false} + * @return + */ + public Boolean isInternal() { + return internal == null ? false : internal; + } + + public QueueConfiguration setInternal(Boolean internal) { + this.internal = internal; + return this; + } + + /** + * defaults to {@code false} + * @return + */ + public Boolean isTransient() { + return _transient == null ? false : _transient; + } + + public QueueConfiguration setTransient(Boolean _transient) { + this._transient = _transient; + return this; + } + + /** + * defaults to {@code false} + * @return + */ + public Boolean isAutoCreated() { + return autoCreated == null ? false : autoCreated; + } + + public QueueConfiguration setAutoCreated(Boolean autoCreated) { + this.autoCreated = autoCreated; + return this; + } + + /** + * This method returns a JSON-formatted {@code String} representation of this {@code QueueConfiguration}. It is a + * simple collection of key/value pairs. The keys used are referenced in {@link #set(String, String)}. + * + * @return a JSON-formatted {@code String} representation of this {@code QueueConfiguration} + */ + public String toJSON() { + JsonObjectBuilder builder = JsonLoader.createObjectBuilder(); + + if (getId() != null) { + builder.add(ID, getId()); + } + if (getName() != null) { + builder.add(NAME, getName().toString()); + } + if (getAddress() != null) { + builder.add(ADDRESS, getAddress().toString()); + } + if (getRoutingType() != null) { + builder.add(ROUTING_TYPE, getRoutingType().toString().toUpperCase()); + } + if (getFilterString() != null) { + builder.add(FILTER_STRING, getFilterString().toString()); + } + if (isDurable() != null) { + builder.add(DURABLE, isDurable()); + } + if (getUser() != null) { + builder.add(USER, getUser().toString()); + } + if (getMaxConsumers() != null) { + builder.add(MAX_CONSUMERS, getMaxConsumers()); + } + if (isExclusive() != null) { + builder.add(EXCLUSIVE, isExclusive()); + } + if (isGroupRebalance() != null) { + builder.add(GROUP_REBALANCE, isGroupRebalance()); + } + if (getGroupBuckets() != null) { + builder.add(GROUP_BUCKETS, getGroupBuckets()); + } + if (getGroupFirstKey() != null) { + builder.add(GROUP_FIRST_KEY, getGroupFirstKey().toString()); + } + if (isLastValue() != null) { + builder.add(LAST_VALUE, isLastValue()); + } + if (getLastValueKey() != null) { + builder.add(LAST_VALUE_KEY, getLastValueKey().toString()); + } + if (isNonDestructive() != null) { + builder.add(NON_DESTRUCTIVE, isNonDestructive()); + } + if (isPurgeOnNoConsumers() != null) { + builder.add(PURGE_ON_NO_CONSUMERS, isPurgeOnNoConsumers()); + } + if (getConsumersBeforeDispatch() != null) { + builder.add(CONSUMERS_BEFORE_DISPATCH, getConsumersBeforeDispatch()); + } + if (getDelayBeforeDispatch() != null) { + builder.add(DELAY_BEFORE_DISPATCH, getDelayBeforeDispatch()); + } + if (getConsumerPriority() != null) { + builder.add(CONSUMER_PRIORITY, getConsumerPriority()); + } + if (isAutoDelete() != null) { + builder.add(AUTO_DELETE, isAutoDelete()); + } + if (getAutoDeleteDelay() != null) { + builder.add(AUTO_DELETE_DELAY, getAutoDeleteDelay()); + } + if (getAutoDeleteMessageCount() != null) { + builder.add(AUTO_DELETE_MESSAGE_COUNT, getAutoDeleteMessageCount()); + } + if (getRingSize() != null) { + builder.add(RING_SIZE, getRingSize()); + } + if (isConfigurationManaged() != null) { + builder.add(CONFIGURATION_MANAGED, isConfigurationManaged()); + } + if (isTemporary() != null) { + builder.add(TEMPORARY, isTemporary()); + } + if (isAutoCreateAddress() != null) { + builder.add(AUTO_CREATE_ADDRESS, isAutoCreateAddress()); + } + if (isInternal() != null) { + builder.add(INTERNAL, isInternal()); + } + if (isTransient() != null) { + builder.add(TRANSIENT, isTransient()); + } + if (isAutoCreated() != null) { + builder.add(AUTO_CREATED, isAutoCreated()); + } + + return builder.build().toString(); + } + + /** + * This method returns a {@code QueueConfiguration} created from the JSON-formatted input {@code String}. The input + * should be a simple object of key/value pairs. Valid keys are referenced in {@link #set(String, String)}. + * + * @param jsonString + * @return the {@code QueueConfiguration} created from the JSON-formatted input {@code String} + */ + public static QueueConfiguration fromJSON(String jsonString) { + JsonObject json = JsonLoader.createReader(new StringReader(jsonString)).readObject(); + + // name is the only required value + if (!json.keySet().contains(NAME)) { + return null; + } + QueueConfiguration result = new QueueConfiguration(json.getString(NAME)); + + for (Map.Entry entry : json.entrySet()) { + result.set(entry.getKey(), entry.getValue().getValueType() == JsonValue.ValueType.STRING ? ((JsonString)entry.getValue()).getString() : entry.getValue().toString()); + } + + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + QueueConfiguration that = (QueueConfiguration) o; + + if (!Objects.equals(id, that.id)) + return false; + if (!Objects.equals(name, that.name)) + return false; + if (!Objects.equals(address, that.address)) + return false; + if (!Objects.equals(routingType, that.routingType)) + return false; + if (!Objects.equals(filterString, that.filterString)) + return false; + if (!Objects.equals(durable, that.durable)) + return false; + if (!Objects.equals(user, that.user)) + return false; + if (!Objects.equals(maxConsumers, that.maxConsumers)) + return false; + if (!Objects.equals(exclusive, that.exclusive)) + return false; + if (!Objects.equals(groupRebalance, that.groupRebalance)) + return false; + if (!Objects.equals(groupBuckets, that.groupBuckets)) + return false; + if (!Objects.equals(groupFirstKey, that.groupFirstKey)) + return false; + if (!Objects.equals(lastValue, that.lastValue)) + return false; + if (!Objects.equals(lastValueKey, that.lastValueKey)) + return false; + if (!Objects.equals(nonDestructive, that.nonDestructive)) + return false; + if (!Objects.equals(purgeOnNoConsumers, that.purgeOnNoConsumers)) + return false; + if (!Objects.equals(consumersBeforeDispatch, that.consumersBeforeDispatch)) + return false; + if (!Objects.equals(delayBeforeDispatch, that.delayBeforeDispatch)) + return false; + if (!Objects.equals(consumerPriority, that.consumerPriority)) + return false; + if (!Objects.equals(autoDelete, that.autoDelete)) + return false; + if (!Objects.equals(autoDeleteDelay, that.autoDeleteDelay)) + return false; + if (!Objects.equals(autoDeleteMessageCount, that.autoDeleteMessageCount)) + return false; + if (!Objects.equals(ringSize, that.ringSize)) + return false; + if (!Objects.equals(configurationManaged, that.configurationManaged)) + return false; + if (!Objects.equals(temporary, that.temporary)) + return false; + if (!Objects.equals(autoCreateAddress, that.autoCreateAddress)) + return false; + if (!Objects.equals(internal, that.internal)) + return false; + if (!Objects.equals(_transient, that._transient)) + return false; + if (!Objects.equals(autoCreated, that.autoCreated)) + return false; + + return true; + } + + @Override + public int hashCode() { + int result = Objects.hashCode(id); + result = 31 * result + Objects.hashCode(name); + result = 31 * result + Objects.hashCode(address); + result = 31 * result + Objects.hashCode(routingType); + result = 31 * result + Objects.hashCode(filterString); + result = 31 * result + Objects.hashCode(durable); + result = 31 * result + Objects.hashCode(user); + result = 31 * result + Objects.hashCode(maxConsumers); + result = 31 * result + Objects.hashCode(exclusive); + result = 31 * result + Objects.hashCode(groupRebalance); + result = 31 * result + Objects.hashCode(groupBuckets); + result = 31 * result + Objects.hashCode(groupFirstKey); + result = 31 * result + Objects.hashCode(lastValue); + result = 31 * result + Objects.hashCode(lastValueKey); + result = 31 * result + Objects.hashCode(nonDestructive); + result = 31 * result + Objects.hashCode(purgeOnNoConsumers); + result = 31 * result + Objects.hashCode(consumersBeforeDispatch); + result = 31 * result + Objects.hashCode(delayBeforeDispatch); + result = 31 * result + Objects.hashCode(consumerPriority); + result = 31 * result + Objects.hashCode(autoDelete); + result = 31 * result + Objects.hashCode(autoDeleteDelay); + result = 31 * result + Objects.hashCode(autoDeleteMessageCount); + result = 31 * result + Objects.hashCode(ringSize); + result = 31 * result + Objects.hashCode(configurationManaged); + result = 31 * result + Objects.hashCode(temporary); + result = 31 * result + Objects.hashCode(autoCreateAddress); + result = 31 * result + Objects.hashCode(internal); + result = 31 * result + Objects.hashCode(_transient); + result = 31 * result + Objects.hashCode(autoCreated); + return result; + } + + @Override + public String toString() { + return "QueueConfiguration [" + + "id=" + id + + ", name=" + name + + ", address=" + address + + ", routingType=" + routingType + + ", filterString=" + filterString + + ", durable=" + durable + + ", user=" + user + + ", maxConsumers=" + maxConsumers + + ", exclusive=" + exclusive + + ", groupRebalance=" + groupRebalance + + ", groupBuckets=" + groupBuckets + + ", groupFirstKey=" + groupFirstKey + + ", lastValue=" + lastValue + + ", lastValueKey=" + lastValueKey + + ", nonDestructive=" + nonDestructive + + ", purgeOnNoConsumers=" + purgeOnNoConsumers + + ", consumersBeforeDispatch=" + consumersBeforeDispatch + + ", delayBeforeDispatch=" + delayBeforeDispatch + + ", consumerPriority=" + consumerPriority + + ", autoDelete=" + autoDelete + + ", autoDeleteDelay=" + autoDeleteDelay + + ", autoDeleteMessageCount=" + autoDeleteMessageCount + + ", ringSize=" + ringSize + + ", configurationManaged=" + configurationManaged + + ", temporary=" + temporary + + ", autoCreateAddress=" + autoCreateAddress + + ", internal=" + internal + + ", transient=" + _transient + + ", autoCreated=" + autoCreated + ']'; + } +} diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/CompositeAddress.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/CompositeAddress.java index b792172d4c..b646ad38a4 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/CompositeAddress.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/CompositeAddress.java @@ -34,6 +34,10 @@ public class CompositeAddress { return address == null ? false : address.contains(SEPARATOR); } + public static boolean isFullyQualified(SimpleString address) { + return address == null ? false : isFullyQualified(address.toString()); + } + public static SimpleString extractQueueName(SimpleString name) { if (name == null) { return null; diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/JsonLoader.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/JsonLoader.java similarity index 100% rename from artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/JsonLoader.java rename to artemis-commons/src/main/java/org/apache/activemq/artemis/utils/JsonLoader.java diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ClientRequestor.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ClientRequestor.java index 3b2955b660..020887fb25 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ClientRequestor.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ClientRequestor.java @@ -18,6 +18,7 @@ package org.apache.activemq.artemis.api.core.client; import java.util.UUID; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.core.client.impl.ClientMessageImpl; @@ -51,7 +52,7 @@ public final class ClientRequestor implements AutoCloseable { requestProducer = queueSession.createProducer(requestAddress); replyQueue = new SimpleString(requestAddress + "." + UUID.randomUUID().toString()); - queueSession.createTemporaryQueue(replyQueue, replyQueue); + queueSession.createQueue(new QueueConfiguration(replyQueue).setDurable(false).setTemporary(true)); replyConsumer = queueSession.createConsumer(replyQueue); } diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ClientSession.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ClientSession.java index 59b88691d2..feba48aea9 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ClientSession.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ClientSession.java @@ -23,6 +23,7 @@ import java.util.Set; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.QueueAttributes; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.RoutingType; @@ -272,6 +273,66 @@ public interface ClientSession extends XAResource, AutoCloseable { // Queue Operations ---------------------------------------------- + /** + * This method creates a queue based on the {@link QueueConfiguration} input. See {@link QueueConfiguration} for more + * details on configuration specifics. + *

+ * Some static defaults will be enforced for properties which are not set on the {@code QueueConfiguration}: + *

+ * Some dynamic defaults will be enforced via address-settings for the corresponding unset properties: + *

+ * + * @param queueConfiguration the configuration to use when creating the queue + * @return the {@code Queue} instance that was created + * @throws Exception + */ + void createQueue(QueueConfiguration queueConfiguration) throws ActiveMQException; + + /** + * This method is essentially the same as {@link #createQueue(QueueConfiguration)} with a few key exceptions. + *

+ * If {@code durable} is {@code true} then: + *

+ * If {@code durable} is {@code false} then: + *

+ * In all instances {@code autoCreated} will be forced to {@code false} and {@code autoCreatedAddress} will be forced + * to {@code true}. + * + * @see #createQueue(QueueConfiguration) + */ + void createSharedQueue(QueueConfiguration queueConfiguration) throws ActiveMQException; + /** * Creates a non-temporary queue. * @@ -457,6 +518,7 @@ public interface ClientSession extends XAResource, AutoCloseable { * @param durable whether the queue is durable or not * @throws ActiveMQException in an exception occurs while creating the queue */ + @Deprecated void createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, boolean durable) throws ActiveMQException; /** @@ -470,6 +532,7 @@ public interface ClientSession extends XAResource, AutoCloseable { * @param durable if the queue is durable * @throws ActiveMQException in an exception occurs while creating the queue */ + @Deprecated void createSharedQueue(SimpleString address, RoutingType routingType, SimpleString queueName, boolean durable) throws ActiveMQException; /** @@ -484,6 +547,7 @@ public interface ClientSession extends XAResource, AutoCloseable { * @param durable if the queue is durable * @throws ActiveMQException in an exception occurs while creating the queue */ + @Deprecated void createSharedQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, boolean durable) throws ActiveMQException; @@ -501,6 +565,7 @@ public interface ClientSession extends XAResource, AutoCloseable { * @param lastValue if the queue is last value queue * @throws ActiveMQException in an exception occurs while creating the queue */ + @Deprecated void createSharedQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, boolean durable, Integer maxConsumers, Boolean purgeOnNoConsumers, Boolean exclusive, Boolean lastValue) throws ActiveMQException; @@ -512,6 +577,7 @@ public interface ClientSession extends XAResource, AutoCloseable { * @param queueAttributes attributes for the queue * @throws ActiveMQException in an exception occurs while creating the queue */ + @Deprecated void createSharedQueue(SimpleString address, SimpleString queueName, QueueAttributes queueAttributes) throws ActiveMQException; @@ -524,6 +590,7 @@ public interface ClientSession extends XAResource, AutoCloseable { * @param durable whether the queue is durable or not * @throws ActiveMQException in an exception occurs while creating the queue */ + @Deprecated void createQueue(String address, RoutingType routingType, String queueName, boolean durable) throws ActiveMQException; /** @@ -534,6 +601,7 @@ public interface ClientSession extends XAResource, AutoCloseable { * @param queueName the name of the queue * @throws ActiveMQException in an exception occurs while creating the queue */ + @Deprecated void createQueue(String address, RoutingType routingType, String queueName) throws ActiveMQException; /** @@ -544,6 +612,7 @@ public interface ClientSession extends XAResource, AutoCloseable { * @param queueName the name of the queue * @throws ActiveMQException in an exception occurs while creating the queue */ + @Deprecated void createQueue(SimpleString address, RoutingType routingType, SimpleString queueName) throws ActiveMQException; /** @@ -556,6 +625,7 @@ public interface ClientSession extends XAResource, AutoCloseable { * @param durable whether the queue is durable or not * @throws ActiveMQException in an exception occurs while creating the queue */ + @Deprecated void createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, boolean durable) throws ActiveMQException; @@ -569,6 +639,7 @@ public interface ClientSession extends XAResource, AutoCloseable { * @param durable whether the queue is durable or not * @throws ActiveMQException in an exception occurs while creating the queue */ + @Deprecated void createQueue(String address, RoutingType routingType, String queueName, String filter, boolean durable) throws ActiveMQException; /** @@ -582,6 +653,7 @@ public interface ClientSession extends XAResource, AutoCloseable { * @param autoCreated whether to mark this queue as autoCreated or not * @throws ActiveMQException in an exception occurs while creating the queue */ + @Deprecated void createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, boolean durable, boolean autoCreated) throws ActiveMQException; @@ -598,6 +670,7 @@ public interface ClientSession extends XAResource, AutoCloseable { * @param purgeOnNoConsumers whether to delete the contents of the queue when the last consumer disconnects * @throws ActiveMQException */ + @Deprecated void createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, boolean durable, boolean autoCreated, int maxConsumers, boolean purgeOnNoConsumers) throws ActiveMQException; @@ -616,6 +689,7 @@ public interface ClientSession extends XAResource, AutoCloseable { * @param lastValue whether the queue should be lastValue * @throws ActiveMQException */ + @Deprecated void createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, boolean durable, boolean autoCreated, int maxConsumers, boolean purgeOnNoConsumers, Boolean exclusive, Boolean lastValue) throws ActiveMQException; @@ -628,6 +702,7 @@ public interface ClientSession extends XAResource, AutoCloseable { * @param queueAttributes attributes for the queue * @throws ActiveMQException */ + @Deprecated void createQueue(SimpleString address, SimpleString queueName, boolean autoCreated, QueueAttributes queueAttributes) throws ActiveMQException; /** @@ -641,6 +716,7 @@ public interface ClientSession extends XAResource, AutoCloseable { * @param autoCreated whether to mark this queue as autoCreated or not * @throws ActiveMQException in an exception occurs while creating the queue */ + @Deprecated void createQueue(String address, RoutingType routingType, String queueName, String filter, boolean durable, boolean autoCreated) throws ActiveMQException; /** @@ -656,6 +732,7 @@ public interface ClientSession extends XAResource, AutoCloseable { * @param purgeOnNoConsumers whether to delete the contents of the queue when the last consumer disconnects * @throws ActiveMQException */ + @Deprecated void createQueue(String address, RoutingType routingType, String queueName, String filter, boolean durable, boolean autoCreated, int maxConsumers, boolean purgeOnNoConsumers) throws ActiveMQException; @@ -674,6 +751,7 @@ public interface ClientSession extends XAResource, AutoCloseable { * @param lastValue whether the queue should be lastValue * @throws ActiveMQException */ + @Deprecated void createQueue(String address, RoutingType routingType, String queueName, String filter, boolean durable, boolean autoCreated, int maxConsumers, boolean purgeOnNoConsumers, Boolean exclusive, Boolean lastValue) throws ActiveMQException; @@ -685,6 +763,7 @@ public interface ClientSession extends XAResource, AutoCloseable { * @param queueName the name of the queue * @throws ActiveMQException in an exception occurs while creating the queue */ + @Deprecated void createTemporaryQueue(SimpleString address, RoutingType routingType, SimpleString queueName) throws ActiveMQException; /** @@ -695,6 +774,7 @@ public interface ClientSession extends XAResource, AutoCloseable { * @param queueName the name of the queue * @throws ActiveMQException in an exception occurs while creating the queue */ + @Deprecated void createTemporaryQueue(String address, RoutingType routingType, String queueName) throws ActiveMQException; /** @@ -710,6 +790,7 @@ public interface ClientSession extends XAResource, AutoCloseable { * @param lastValue if the queue is last value queue * @throws ActiveMQException in an exception occurs while creating the queue */ + @Deprecated void createTemporaryQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, int maxConsumers, boolean purgeOnNoConsumers, Boolean exclusive, Boolean lastValue) throws ActiveMQException; @@ -721,6 +802,7 @@ public interface ClientSession extends XAResource, AutoCloseable { * @param queueAttributes attributes for the queue * @throws ActiveMQException in an exception occurs while creating the queue */ + @Deprecated void createTemporaryQueue(SimpleString address, SimpleString queueName, QueueAttributes queueAttributes) throws ActiveMQException; /** @@ -732,6 +814,7 @@ public interface ClientSession extends XAResource, AutoCloseable { * @param filter only messages which match this filter will be put in the queue * @throws ActiveMQException in an exception occurs while creating the queue */ + @Deprecated void createTemporaryQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter) throws ActiveMQException; /** @@ -743,6 +826,7 @@ public interface ClientSession extends XAResource, AutoCloseable { * @param filter only messages which match this filter will be put in the queue * @throws ActiveMQException in an exception occurs while creating the queue */ + @Deprecated void createTemporaryQueue(String address, RoutingType routingType, String queueName, String filter) throws ActiveMQException; /** diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java index 29ed3d7e5b..f01050aa7f 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java @@ -506,6 +506,7 @@ public interface ActiveMQServerControl { * @param name name of the queue * @param routingType The routing type used for this address, MULTICAST or ANYCAST */ + @Deprecated @Operation(desc = "Create a queue with the specified address", impact = MBeanOperationInfo.ACTION) void createQueue(@Parameter(name = "address", desc = "Address of the queue") String address, @Parameter(name = "name", desc = "Name of the queue") String name, @@ -540,6 +541,7 @@ public interface ActiveMQServerControl { * @param durable whether the queue is durable * @param routingType The routing type used for this address, MULTICAST or ANYCAST */ + @Deprecated @Operation(desc = "Create a queue with the specified address, name and durability", impact = MBeanOperationInfo.ACTION) void createQueue(@Parameter(name = "address", desc = "Address of the queue") String address, @Parameter(name = "name", desc = "Name of the queue") String name, @@ -558,6 +560,7 @@ public interface ActiveMQServerControl { * @param filter of the queue * @param durable whether the queue is durable */ + @Deprecated @Operation(desc = "Create a queue", impact = MBeanOperationInfo.ACTION) void createQueue(@Parameter(name = "address", desc = "Address of the queue") String address, @Parameter(name = "name", desc = "Name of the queue") String name, @@ -577,6 +580,7 @@ public interface ActiveMQServerControl { * @param durable whether the queue is durable * @param routingType The routing type used for this address, MULTICAST or ANYCAST */ + @Deprecated @Operation(desc = "Create a queue", impact = MBeanOperationInfo.ACTION) void createQueue(@Parameter(name = "address", desc = "Address of the queue") String address, @Parameter(name = "name", desc = "Name of the queue") String name, @@ -606,6 +610,7 @@ public interface ActiveMQServerControl { * @return a textual summary of the queue * @throws Exception */ + @Deprecated @Operation(desc = "Create a queue", impact = MBeanOperationInfo.ACTION) String createQueue(@Parameter(name = "address", desc = "Address of the queue") String address, @Parameter(name = "routingType", desc = "The routing type used for this address, MULTICAST or ANYCAST") String routingType, @@ -647,6 +652,7 @@ public interface ActiveMQServerControl { * @return a textual summary of the queue * @throws Exception */ + @Deprecated @Operation(desc = "Create a queue", impact = MBeanOperationInfo.ACTION) String createQueue(@Parameter(name = "address", desc = "Address of the queue") String address, @Parameter(name = "routingType", desc = "The routing type used for this address, MULTICAST or ANYCAST") String routingType, @@ -690,6 +696,7 @@ public interface ActiveMQServerControl { * @return a textual summary of the queue * @throws Exception */ + @Deprecated @Operation(desc = "Create a queue", impact = MBeanOperationInfo.ACTION) String createQueue(@Parameter(name = "address", desc = "Address of the queue") String address, @Parameter(name = "routingType", desc = "The routing type used for this address, MULTICAST or ANYCAST") String routingType, @@ -735,6 +742,7 @@ public interface ActiveMQServerControl { * @return a textual summary of the queue * @throws Exception */ + @Deprecated @Operation(desc = "Create a queue", impact = MBeanOperationInfo.ACTION) String createQueue(@Parameter(name = "address", desc = "Address of the queue") String address, @Parameter(name = "routingType", desc = "The routing type used for this address, MULTICAST or ANYCAST") String routingType, @@ -776,6 +784,7 @@ public interface ActiveMQServerControl { * @return a textual summary of the queue * @throws Exception */ + @Deprecated @Operation(desc = "Create a queue", impact = MBeanOperationInfo.ACTION) String createQueue(@Parameter(name = "address", desc = "Address of the queue") String address, @Parameter(name = "routingType", desc = "The routing type used for this address, MULTICAST or ANYCAST") String routingType, @@ -785,7 +794,42 @@ public interface ActiveMQServerControl { @Parameter(name = "maxConsumers", desc = "The maximum number of consumers allowed on this queue at any one time") int maxConsumers, @Parameter(name = "purgeOnNoConsumers", desc = "Delete this queue when the last consumer disconnects") boolean purgeOnNoConsumers, @Parameter(name = "autoCreateAddress", desc = "Create an address with default values should a matching address not be found") boolean autoCreateAddress) throws Exception; + /** + * Create a queue. + *
+ * This method throws a {@link org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException}) exception if the queue already exists. + * + * @param queueConfiguration the configuration of the queue in JSON format + * @return the configuration of the created queue in JSON format + * @throws Exception + */ + @Operation(desc = "Create a queue", impact = MBeanOperationInfo.ACTION) + String createQueue(@Parameter(name = "queueConfiguration", desc = "the configuration of the queue in JSON format") String queueConfiguration) throws Exception; + /** + * Create a queue. + *
+ * This method throws a {@link org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException}) exception if the queue already exists and {@code ignoreIfExists} is {@code false}. + * + * @param queueConfiguration the configuration of the queue in JSON format + * @param ignoreIfExists whether or not to simply return without an exception if the queue exists + * @return the configuration of the created queue in JSON format + * @throws Exception + */ + @Operation(desc = "Create a queue", impact = MBeanOperationInfo.ACTION) + String createQueue(@Parameter(name = "queueConfiguration", desc = "the configuration of the queue in JSON format") String queueConfiguration, + @Parameter(name = "ignoreIfExists", desc = "whether or not to try to create the queue if it exists already") boolean ignoreIfExists) throws Exception; + + + /** + * Update a queue. + * + * @param queueConfiguration the configuration of the queue in JSON format + * @return the configuration of the created queue in JSON format + * @throws Exception + */ + @Operation(desc = "Update a queue", impact = MBeanOperationInfo.ACTION) + String updateQueue(@Parameter(name = "queueConfiguration", desc = "the configuration of the queue in JSON format") String queueConfiguration) throws Exception; /** * Update a queue. @@ -835,6 +879,7 @@ public interface ActiveMQServerControl { * @return * @throws Exception */ + @Deprecated @Operation(desc = "Update a queue", impact = MBeanOperationInfo.ACTION) String updateQueue(@Parameter(name = "name", desc = "Name of the queue") String name, @Parameter(name = "routingType", desc = "The routing type used for this address, MULTICAST or ANYCAST") String routingType, @@ -861,6 +906,7 @@ public interface ActiveMQServerControl { * @return * @throws Exception */ + @Deprecated @Operation(desc = "Update a queue", impact = MBeanOperationInfo.ACTION) String updateQueue(@Parameter(name = "name", desc = "Name of the queue") String name, @Parameter(name = "routingType", desc = "The routing type used for this address, MULTICAST or ANYCAST") String routingType, @@ -894,6 +940,7 @@ public interface ActiveMQServerControl { * @return * @throws Exception */ + @Deprecated @Operation(desc = "Update a queue", impact = MBeanOperationInfo.ACTION) String updateQueue(@Parameter(name = "name", desc = "Name of the queue") String name, @Parameter(name = "routingType", desc = "The routing type used for this address, MULTICAST or ANYCAST") String routingType, @@ -929,6 +976,7 @@ public interface ActiveMQServerControl { * @return * @throws Exception */ + @Deprecated @Operation(desc = "Update a queue", impact = MBeanOperationInfo.ACTION) String updateQueue(@Parameter(name = "name", desc = "Name of the queue") String name, @Parameter(name = "routingType", desc = "The routing type used for this address, MULTICAST or ANYCAST") String routingType, @@ -956,6 +1004,7 @@ public interface ActiveMQServerControl { * @param name name of the queue * @param filter of the queue */ + @Deprecated @Operation(desc = "Deploy a queue", impact = MBeanOperationInfo.ACTION) void deployQueue(@Parameter(name = "address", desc = "Address of the queue") String address, @Parameter(name = "name", desc = "Name of the queue") String name, @@ -973,6 +1022,7 @@ public interface ActiveMQServerControl { * @param filter of the queue * @param durable whether the queue is durable */ + @Deprecated @Operation(desc = "Deploy a queue", impact = MBeanOperationInfo.ACTION) void deployQueue(@Parameter(name = "address", desc = "Address of the queue") String address, @Parameter(name = "name", desc = "Name of the queue") String name, diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java index 6684923f93..53c9c97645 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java @@ -35,6 +35,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQExceptionType; import org.apache.activemq.artemis.api.core.Message; import org.apache.activemq.artemis.api.core.QueueAttributes; +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.api.core.client.ClientConsumer; @@ -298,6 +299,23 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi createAddress(address, EnumSet.of(routingType), autoCreated); } + @Override + public void createQueue(QueueConfiguration queueConfiguration) throws ActiveMQException { + internalCreateQueue(queueConfiguration); + } + + @Override + public void createSharedQueue(QueueConfiguration queueConfiguration) throws ActiveMQException { + checkClosed(); + + startCall(); + try { + sessionContext.createSharedQueue(queueConfiguration); + } finally { + endCall(); + } + } + @Override public void createQueue(final SimpleString address, final SimpleString queueName, @@ -363,6 +381,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi /** New Queue API **/ + @Deprecated @Override public void createQueue(final SimpleString address, final RoutingType routingType, @@ -394,6 +413,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi } + @Deprecated @Override public void createQueue(final SimpleString address, final RoutingType routingType, final SimpleString queueName, final SimpleString filterString, final boolean durable, final boolean autoCreated, final int maxConsumers, final boolean purgeOnNoConsumers) throws ActiveMQException { @@ -409,6 +429,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi .setPurgeOnNoConsumers(purgeOnNoConsumers)); } + @Deprecated @Override public void createQueue(final SimpleString address, final RoutingType routingType, final SimpleString queueName, final SimpleString filterString, final boolean durable, final boolean autoCreated, final int maxConsumers, final boolean purgeOnNoConsumers, final Boolean exclusive, final Boolean lastValue) throws ActiveMQException { @@ -426,6 +447,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi .setLastValue(lastValue)); } + @Deprecated @Override public void createQueue(final SimpleString address, final SimpleString queueName, final boolean autoCreated, final QueueAttributes queueAttributes) throws ActiveMQException { internalCreateQueue(address, @@ -435,6 +457,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi queueAttributes); } + @Deprecated @Override public void createQueue(final String address, final RoutingType routingType, final String queueName, final String filterString, final boolean durable, final boolean autoCreated, final int maxConsumers, final boolean purgeOnNoConsumers) throws ActiveMQException { @@ -477,6 +500,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi createTemporaryQueue(SimpleString.toSimpleString(address), routingType, SimpleString.toSimpleString(queueName)); } + @Deprecated @Override public void createTemporaryQueue(final SimpleString address, final RoutingType routingType, @@ -500,6 +524,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi .setLastValue(lastValue)); } + @Deprecated @Override public void createTemporaryQueue(final SimpleString address, final SimpleString queueName, @@ -511,6 +536,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi queueAttributes); } + @Deprecated @Override public void createTemporaryQueue(final SimpleString address, final RoutingType routingType, @@ -533,6 +559,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi * @param durable whether the queue is durable or not * @throws ActiveMQException in an exception occurs while creating the queue */ + @Deprecated @Override public void createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, boolean durable) throws ActiveMQException { internalCreateQueue(address, @@ -595,6 +622,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi * @param lastValue if the queue is last value queue * @throws ActiveMQException in an exception occurs while creating the queue */ + @Deprecated @Override public void createSharedQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, boolean durable, Integer maxConsumers, Boolean purgeOnNoConsumers, Boolean exclusive, Boolean lastValue) throws ActiveMQException { @@ -617,16 +645,10 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi * @param queueAttributes attributes for the queue * @throws ActiveMQException in an exception occurs while creating the queue */ + @Deprecated @Override public void createSharedQueue(SimpleString address, SimpleString queueName, QueueAttributes queueAttributes) throws ActiveMQException { - checkClosed(); - - startCall(); - try { - sessionContext.createSharedQueue(address, queueName, queueAttributes); - } finally { - endCall(); - } + createSharedQueue(queueAttributes.toQueueConfiguration().setName(queueName).setAddress(address)); } /** @@ -651,6 +673,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi * @param queueName the name of the queue * @throws ActiveMQException in an exception occurs while creating the queue */ + @Deprecated @Override public void createQueue(String address, RoutingType routingType, String queueName) throws ActiveMQException { internalCreateQueue(SimpleString.toSimpleString(address), @@ -673,6 +696,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi * @param queueName the name of the queue * @throws ActiveMQException in an exception occurs while creating the queue */ + @Deprecated @Override public void createQueue(SimpleString address, RoutingType routingType, SimpleString queueName) throws ActiveMQException { internalCreateQueue(address, @@ -697,6 +721,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi * @param durable whether the queue is durable or not * @throws ActiveMQException in an exception occurs while creating the queue */ + @Deprecated @Override public void createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, boolean durable) throws ActiveMQException { @@ -1992,24 +2017,25 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi return producer; } + @Deprecated private void internalCreateQueue(final SimpleString address, final SimpleString queueName, final boolean temp, final boolean autoCreated, final QueueAttributes queueAttributes) throws ActiveMQException { + internalCreateQueue(queueAttributes.toQueueConfiguration().setName(queueName).setAddress(address).setTemporary(temp).setAutoCreated(autoCreated)); + } + + private void internalCreateQueue(final QueueConfiguration queueConfiguration) throws ActiveMQException { checkClosed(); - if (queueAttributes.getDurable() && temp) { + if (queueConfiguration.isDurable() && queueConfiguration.isTemporary()) { throw ActiveMQClientMessageBundle.BUNDLE.queueMisConfigured(); } startCall(); try { - sessionContext.createQueue(address, - queueName, - temp, - autoCreated, - queueAttributes); + sessionContext.createQueue(queueConfiguration); } finally { endCall(); } diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java index 4843aaf9e2..9e2bba745b 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java @@ -22,6 +22,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQExceptionType; import org.apache.activemq.artemis.api.core.ICoreMessage; import org.apache.activemq.artemis.api.core.Message; import org.apache.activemq.artemis.api.core.QueueAttributes; +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 static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.DISCONNECT_CONSUMER; @@ -281,6 +282,7 @@ public class ActiveMQSessionContext extends SessionContext { return this.sendAckHandler; } + @Deprecated @Override public void createSharedQueue(SimpleString address, SimpleString queueName, @@ -291,58 +293,54 @@ public class ActiveMQSessionContext extends SessionContext { Boolean purgeOnNoConsumers, Boolean exclusive, Boolean lastValue) throws ActiveMQException { - QueueAttributes queueAttributes = new QueueAttributes() - .setRoutingType(routingType) - .setFilterString(filterString) - .setDurable(durable) - .setMaxConsumers(maxConsumers) - .setPurgeOnNoConsumers(purgeOnNoConsumers) - .setExclusive(exclusive) - .setLastValue(lastValue); - createSharedQueue(address, queueName, queueAttributes); + createSharedQueue(new QueueConfiguration(queueName) + .setAddress(address) + .setRoutingType(routingType) + .setFilterString(filterString) + .setDurable(durable) + .setMaxConsumers(maxConsumers) + .setPurgeOnNoConsumers(purgeOnNoConsumers) + .setExclusive(exclusive) + .setLastValue(lastValue)); } + @Deprecated @Override public void createSharedQueue(SimpleString address, SimpleString queueName, QueueAttributes queueAttributes) throws ActiveMQException { - sessionChannel.sendBlocking(new CreateSharedQueueMessage_V2(address, queueName, - queueAttributes.getRoutingType(), - queueAttributes.getFilterString(), - queueAttributes.getDurable(), - queueAttributes.getMaxConsumers(), - queueAttributes.getPurgeOnNoConsumers(), - queueAttributes.getExclusive(), - queueAttributes.getGroupRebalance(), - queueAttributes.getGroupBuckets(), - queueAttributes.getGroupFirstKey(), - queueAttributes.getLastValue(), - queueAttributes.getLastValueKey(), - queueAttributes.getNonDestructive(), - queueAttributes.getConsumersBeforeDispatch(), - queueAttributes.getDelayBeforeDispatch(), - queueAttributes.getAutoDelete(), - queueAttributes.getAutoDeleteDelay(), - queueAttributes.getAutoDeleteMessageCount(), - true), PacketImpl.NULL_RESPONSE); + createSharedQueue(queueAttributes.toQueueConfiguration().setName(queueName).setAddress(address)); } + @Override + public void createSharedQueue(QueueConfiguration queueConfiguration) throws ActiveMQException { + sessionChannel.sendBlocking(new CreateSharedQueueMessage_V2(queueConfiguration, true), PacketImpl.NULL_RESPONSE); + } + @Deprecated @Override public void createSharedQueue(SimpleString address, SimpleString queueName, RoutingType routingType, SimpleString filterString, boolean durable) throws ActiveMQException { - createSharedQueue(address, queueName, routingType, filterString, durable, null, null, null, null); + createSharedQueue(new QueueConfiguration(queueName) + .setAddress(address) + .setRoutingType(routingType) + .setFilterString(filterString) + .setDurable(durable)); } + @Deprecated @Override public void createSharedQueue(SimpleString address, SimpleString queueName, SimpleString filterString, boolean durable) throws ActiveMQException { - createSharedQueue(address, queueName, null, filterString, durable); + createSharedQueue(new QueueConfiguration(queueName) + .setAddress(address) + .setFilterString(filterString) + .setDurable(durable)); } @Override @@ -734,24 +732,30 @@ public class ActiveMQSessionContext extends SessionContext { boolean durable, boolean temp, boolean autoCreated) throws ActiveMQException { - createQueue(address, ActiveMQDefaultConfiguration.getDefaultRoutingType(), queueName, filterString, durable, temp, ActiveMQDefaultConfiguration.getDefaultMaxQueueConsumers(), ActiveMQDefaultConfiguration.getDefaultPurgeOnNoConsumers(), autoCreated); + createQueue(new QueueConfiguration(queueName) + .setAddress(address) + .setFilterString(filterString) + .setDurable(durable) + .setTemporary(temp) + .setAutoCreated(autoCreated)); } + @Deprecated @Override public void createQueue(SimpleString address, SimpleString queueName, boolean temp, boolean autoCreated, QueueAttributes queueAttributes) throws ActiveMQException { - if (sessionChannel.getConnection().isVersionBeforeAddressChange()) { - CreateQueueMessage request = new CreateQueueMessage(address, queueName, queueAttributes.getFilterString(), queueAttributes.getDurable(), temp, true); - sessionChannel.sendBlocking(request, PacketImpl.NULL_RESPONSE); - } else { - CreateQueueMessage request = new CreateQueueMessage_V2(address, queueName, temp, autoCreated, true, queueAttributes); - sessionChannel.sendBlocking(request, PacketImpl.NULL_RESPONSE); - } + createQueue(queueAttributes + .toQueueConfiguration() + .setName(queueName) + .setAddress(address) + .setTemporary(temp) + .setAutoCreated(autoCreated)); } + @Deprecated @Override public void createQueue(SimpleString address, RoutingType routingType, @@ -764,19 +768,17 @@ public class ActiveMQSessionContext extends SessionContext { boolean autoCreated, Boolean exclusive, Boolean lastValue) throws ActiveMQException { - createQueue( - address, - queueName, - temp, - autoCreated, - new QueueAttributes() - .setRoutingType(routingType) - .setFilterString(filterString) - .setDurable(durable) - .setMaxConsumers(maxConsumers) - .setPurgeOnNoConsumers(purgeOnNoConsumers) - .setExclusive(exclusive) - .setLastValue(lastValue)); + createQueue(new QueueConfiguration(queueName) + .setAddress(address) + .setTemporary(temp) + .setAutoCreated(autoCreated) + .setRoutingType(routingType) + .setFilterString(filterString) + .setDurable(durable) + .setMaxConsumers(maxConsumers) + .setPurgeOnNoConsumers(purgeOnNoConsumers) + .setExclusive(exclusive) + .setLastValue(lastValue)); } @Deprecated @@ -790,7 +792,34 @@ public class ActiveMQSessionContext extends SessionContext { int maxConsumers, boolean purgeOnNoConsumers, boolean autoCreated) throws ActiveMQException { - createQueue(address, routingType, queueName, filterString, durable, temp, maxConsumers, purgeOnNoConsumers, autoCreated, null, null); + createQueue(new QueueConfiguration(queueName) + .setAddress(address) + .setRoutingType(routingType) + .setFilterString(filterString) + .setDurable(durable) + .setTemporary(temp) + .setMaxConsumers(maxConsumers) + .setPurgeOnNoConsumers(purgeOnNoConsumers) + .setAutoCreated(autoCreated)); + } + + @Override + public void createQueue(QueueConfiguration queueConfiguration) throws ActiveMQException { + // Set the non nullable (CreateQueueMessage_V2) queue attributes (all others have static defaults or get defaulted if null by address settings server side). + if (queueConfiguration.getMaxConsumers() == null) { + queueConfiguration.setMaxConsumers(ActiveMQDefaultConfiguration.getDefaultMaxQueueConsumers()); + } + if (queueConfiguration.isPurgeOnNoConsumers() == null) { + queueConfiguration.setPurgeOnNoConsumers(ActiveMQDefaultConfiguration.getDefaultPurgeOnNoConsumers()); + } + + if (sessionChannel.getConnection().isVersionBeforeAddressChange()) { + CreateQueueMessage request = new CreateQueueMessage(queueConfiguration, true); + sessionChannel.sendBlocking(request, PacketImpl.NULL_RESPONSE); + } else { + CreateQueueMessage request = new CreateQueueMessage_V2(queueConfiguration, true); + sessionChannel.sendBlocking(request, PacketImpl.NULL_RESPONSE); + } } @Override diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateQueueMessage.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateQueueMessage.java index 985d5f4340..694848a1b4 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateQueueMessage.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateQueueMessage.java @@ -17,6 +17,7 @@ package org.apache.activemq.artemis.core.protocol.core.impl.wireformat; import org.apache.activemq.artemis.api.core.ActiveMQBuffer; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl; @@ -34,6 +35,10 @@ public class CreateQueueMessage extends PacketImpl { protected boolean requiresResponse; + public CreateQueueMessage(final QueueConfiguration queueConfiguration, boolean requiresResponse) { + this(queueConfiguration.getAddress(), queueConfiguration.getName(), queueConfiguration.getFilterString(), queueConfiguration.isDurable(), queueConfiguration.isTemporary(), requiresResponse); + } + public CreateQueueMessage(final SimpleString address, final SimpleString queueName, final SimpleString filterString, diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateQueueMessage_V2.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateQueueMessage_V2.java index b071afab24..5b24edcb41 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateQueueMessage_V2.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateQueueMessage_V2.java @@ -18,6 +18,7 @@ package org.apache.activemq.artemis.core.protocol.core.impl.wireformat; import org.apache.activemq.artemis.api.core.ActiveMQBuffer; import org.apache.activemq.artemis.api.core.QueueAttributes; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.utils.BufferHelper; @@ -58,6 +59,7 @@ public class CreateQueueMessage_V2 extends CreateQueueMessage { private Long ringSize; + @Deprecated public CreateQueueMessage_V2(final SimpleString address, final SimpleString queueName, final boolean temporary, @@ -91,6 +93,35 @@ public class CreateQueueMessage_V2 extends CreateQueueMessage { ); } + public CreateQueueMessage_V2(final QueueConfiguration queueConfiguration, + final boolean requiresResponse) { + this( + queueConfiguration.getAddress(), + queueConfiguration.getName(), + queueConfiguration.getRoutingType(), + queueConfiguration.getFilterString(), + queueConfiguration.isDurable(), + queueConfiguration.isTemporary(), + queueConfiguration.getMaxConsumers(), + queueConfiguration.isPurgeOnNoConsumers(), + queueConfiguration.isAutoCreated(), + requiresResponse, + queueConfiguration.isExclusive(), + queueConfiguration.isGroupRebalance(), + queueConfiguration.getGroupBuckets(), + queueConfiguration.getGroupFirstKey(), + queueConfiguration.isLastValue(), + queueConfiguration.getLastValueKey(), + queueConfiguration.isNonDestructive(), + queueConfiguration.getConsumersBeforeDispatch(), + queueConfiguration.getDelayBeforeDispatch(), + queueConfiguration.isAutoDelete(), + queueConfiguration.getAutoDeleteDelay(), + queueConfiguration.getAutoDeleteMessageCount(), + queueConfiguration.getRingSize() + ); + } + public CreateQueueMessage_V2(final SimpleString address, final SimpleString queueName, final RoutingType routingType, @@ -147,6 +178,31 @@ public class CreateQueueMessage_V2 extends CreateQueueMessage { // Public -------------------------------------------------------- + public QueueConfiguration toQueueConfiguration() { + return new QueueConfiguration(queueName) + .setAddress(address) + .setDurable(durable) + .setRoutingType(routingType) + .setExclusive(exclusive) + .setGroupRebalance(groupRebalance) + .setNonDestructive(nonDestructive) + .setLastValue(lastValue) + .setFilterString(filterString) + .setMaxConsumers(maxConsumers) + .setPurgeOnNoConsumers(purgeOnNoConsumers) + .setConsumersBeforeDispatch(consumersBeforeDispatch) + .setDelayBeforeDispatch(delayBeforeDispatch) + .setGroupBuckets(groupBuckets) + .setGroupFirstKey(groupFirstKey) + .setLastValueKey(lastValueKey) + .setAutoDelete(autoDelete) + .setAutoDeleteDelay(autoDeleteDelay) + .setAutoDeleteMessageCount(autoDeleteMessageCount) + .setTemporary(temporary) + .setAutoCreated(autoCreated) + .setRingSize(ringSize); + } + @Override public String toString() { StringBuffer buff = new StringBuffer(super.getParentString()); diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateSharedQueueMessage_V2.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateSharedQueueMessage_V2.java index 015b75921c..6cbe8c92b2 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateSharedQueueMessage_V2.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/CreateSharedQueueMessage_V2.java @@ -17,6 +17,7 @@ package org.apache.activemq.artemis.core.protocol.core.impl.wireformat; import org.apache.activemq.artemis.api.core.ActiveMQBuffer; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.utils.BufferHelper; @@ -39,6 +40,31 @@ public class CreateSharedQueueMessage_V2 extends CreateSharedQueueMessage { private Long autoDeleteDelay; private Long autoDeleteMessageCount; + public CreateSharedQueueMessage_V2(final QueueConfiguration queueConfiguration, boolean requiresResponse) { + this( + queueConfiguration.getAddress(), + queueConfiguration.getName(), + queueConfiguration.getRoutingType(), + queueConfiguration.getFilterString(), + queueConfiguration.isDurable(), + queueConfiguration.getMaxConsumers(), + queueConfiguration.isPurgeOnNoConsumers(), + queueConfiguration.isExclusive(), + queueConfiguration.isGroupRebalance(), + queueConfiguration.getGroupBuckets(), + queueConfiguration.getGroupFirstKey(), + queueConfiguration.isLastValue(), + queueConfiguration.getLastValueKey(), + queueConfiguration.isNonDestructive(), + queueConfiguration.getConsumersBeforeDispatch(), + queueConfiguration.getDelayBeforeDispatch(), + queueConfiguration.isAutoDelete(), + queueConfiguration.getAutoDeleteDelay(), + queueConfiguration.getAutoDeleteMessageCount(), + requiresResponse + ); + } + public CreateSharedQueueMessage_V2(final SimpleString address, final SimpleString queueName, final RoutingType routingType, @@ -207,6 +233,28 @@ public class CreateSharedQueueMessage_V2 extends CreateSharedQueueMessage { this.autoDeleteMessageCount = autoDeleteMessageCount; } + public QueueConfiguration toQueueConfiguration() { + return new QueueConfiguration(queueName) + .setAddress(address) + .setDurable(durable) + .setRoutingType(routingType) + .setExclusive(exclusive) + .setGroupRebalance(groupRebalance) + .setNonDestructive(nonDestructive) + .setLastValue(lastValue) + .setFilterString(filterString) + .setMaxConsumers(maxConsumers) + .setPurgeOnNoConsumers(purgeOnNoConsumers) + .setConsumersBeforeDispatch(consumersBeforeDispatch) + .setDelayBeforeDispatch(delayBeforeDispatch) + .setGroupBuckets(groupBuckets) + .setGroupFirstKey(groupFirstKey) + .setLastValueKey(lastValueKey) + .setAutoDelete(autoDelete) + .setAutoDeleteDelay(autoDeleteDelay) + .setAutoDeleteMessageCount(autoDeleteMessageCount); + } + @Override public String toString() { StringBuffer buff = new StringBuffer(getParentString()); @@ -240,7 +288,7 @@ public class CreateSharedQueueMessage_V2 extends CreateSharedQueueMessage { buffer.writeSimpleString(queueName); buffer.writeNullableSimpleString(filterString); buffer.writeBoolean(durable); - buffer.writeByte(routingType.getType()); + buffer.writeByte(routingType == null ? -1 : routingType.getType()); buffer.writeBoolean(requiresResponse); BufferHelper.writeNullableInteger(buffer, maxConsumers); BufferHelper.writeNullableBoolean(buffer, purgeOnNoConsumers); diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/SessionContext.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/SessionContext.java index db27511659..1f6f4fbbce 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/SessionContext.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/SessionContext.java @@ -27,6 +27,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ICoreMessage; import org.apache.activemq.artemis.api.core.Message; import org.apache.activemq.artemis.api.core.QueueAttributes; +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.api.core.client.ClientConsumer; @@ -179,6 +180,7 @@ public abstract class SessionContext { * @param lastValue * @throws ActiveMQException */ + @Deprecated public abstract void createSharedQueue(SimpleString address, SimpleString queueName, RoutingType routingType, @@ -198,21 +200,26 @@ public abstract class SessionContext { * @param queueAttributes * @throws ActiveMQException */ + @Deprecated public abstract void createSharedQueue(SimpleString address, SimpleString queueName, QueueAttributes queueAttributes) throws ActiveMQException; + @Deprecated public abstract void createSharedQueue(SimpleString address, SimpleString queueName, RoutingType routingType, SimpleString filterString, boolean durable) throws ActiveMQException; + @Deprecated public abstract void createSharedQueue(SimpleString address, SimpleString queueName, SimpleString filterString, boolean durable) throws ActiveMQException; + public abstract void createSharedQueue(QueueConfiguration queueConfiguration) throws ActiveMQException; + public abstract void deleteQueue(SimpleString queueName) throws ActiveMQException; @Deprecated @@ -257,6 +264,8 @@ public abstract class SessionContext { boolean autoCreated, QueueAttributes queueAttributes) throws ActiveMQException; + public abstract void createQueue(QueueConfiguration queueConfiguration) throws ActiveMQException; + public abstract ClientSession.QueueQuery queueQuery(SimpleString queueName) throws ActiveMQException; public abstract void forceDelivery(ClientConsumer consumer, long sequence) throws ActiveMQException; diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQDestination.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQDestination.java index 9554b64829..10a39d78a3 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQDestination.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQDestination.java @@ -26,6 +26,7 @@ import java.util.UUID; import org.apache.activemq.artemis.api.core.Pair; import org.apache.activemq.artemis.api.core.ParameterisedAddress; import org.apache.activemq.artemis.api.core.QueueAttributes; +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.protocol.core.impl.PacketImpl; @@ -331,10 +332,7 @@ public class ActiveMQDestination extends JNDIStorable implements Destination, Se */ private SimpleString simpleAddress; - /** - * Queue parameters; - */ - private QueueAttributes queueAttributes; + private QueueConfiguration queueConfiguration; /** * Needed for serialization backwards compatibility. @@ -419,11 +417,11 @@ public class ActiveMQDestination extends JNDIStorable implements Destination, Se ParameterisedAddress parameteredAddress = new ParameterisedAddress(address); this.simpleAddress = parameteredAddress.getAddress(); this.address = parameteredAddress.getAddress().toString(); - this.queueAttributes = parameteredAddress.getQueueAttributes(); + this.queueConfiguration = parameteredAddress.getQueueConfiguration(); } else { this.simpleAddress = address; this.address = address.toString(); - this.queueAttributes = null; + this.queueConfiguration = null; } } @@ -473,8 +471,13 @@ public class ActiveMQDestination extends JNDIStorable implements Destination, Se return simpleAddress; } + @Deprecated public QueueAttributes getQueueAttributes() { - return queueAttributes; + return QueueAttributes.fromQueueConfiguration(queueConfiguration); + } + + public QueueConfiguration getQueueConfiguration() { + return queueConfiguration; } public String getName() { diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQSession.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQSession.java index c61df988fd..9fe7480fc2 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQSession.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQSession.java @@ -55,6 +55,7 @@ import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException; import org.apache.activemq.artemis.api.core.QueueAttributes; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientProducer; @@ -995,7 +996,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { SimpleString simpleAddress = queue.getSimpleAddress(); - session.createTemporaryQueue(simpleAddress, RoutingType.ANYCAST, simpleAddress); + session.createQueue(new QueueConfiguration(simpleAddress).setRoutingType(RoutingType.ANYCAST).setDurable(false).setTemporary(true)); connection.addTemporaryQueue(simpleAddress); @@ -1029,7 +1030,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { // does not exist - otherwise we would not be able to distinguish from a non existent topic and one with no // subscriptions - core has no notion of a topic - session.createTemporaryQueue(simpleAddress, simpleAddress, ActiveMQSession.REJECTING_FILTER); + session.createQueue(new QueueConfiguration(simpleAddress).setAddress(simpleAddress).setFilterString(ActiveMQSession.REJECTING_FILTER).setDurable(false).setTemporary(true)); connection.addTemporaryQueue(simpleAddress); @@ -1253,32 +1254,21 @@ public class ActiveMQSession implements QueueSession, TopicSession { } void createTemporaryQueue(ActiveMQDestination destination, RoutingType routingType, SimpleString queueName, SimpleString filter, ClientSession.AddressQuery addressQuery) throws ActiveMQException { - QueueAttributes queueAttributes = destination.getQueueAttributes() == null ? new QueueAttributes() : destination.getQueueAttributes(); - setRequiredQueueAttributesIfNotSet(queueAttributes, addressQuery, routingType, filter, false); - session.createTemporaryQueue( - destination.getSimpleAddress(), - queueName, - queueAttributes - ); + QueueConfiguration queueConfiguration = destination.getQueueConfiguration() == null ? new QueueConfiguration(queueName) : destination.getQueueConfiguration(); + setRequiredQueueConfigurationIfNotSet(queueConfiguration, addressQuery, routingType, filter, false); + session.createQueue(queueConfiguration.setName(queueName).setAddress(destination.getAddress()).setDurable(false).setTemporary(true)); } void createSharedQueue(ActiveMQDestination destination, RoutingType routingType, SimpleString queueName, SimpleString filter, boolean durable, ClientSession.AddressQuery addressQuery) throws ActiveMQException { - QueueAttributes queueAttributes = destination.getQueueAttributes() == null ? new QueueAttributes() : destination.getQueueAttributes(); - setRequiredQueueAttributesIfNotSet(queueAttributes, addressQuery, routingType, filter, durable); - session.createSharedQueue( - destination.getSimpleAddress(), - queueName, - queueAttributes); + QueueConfiguration queueConfiguration = destination.getQueueConfiguration() == null ? new QueueConfiguration(queueName) : destination.getQueueConfiguration(); + setRequiredQueueConfigurationIfNotSet(queueConfiguration, addressQuery, routingType, filter, durable); + session.createSharedQueue(queueConfiguration.setName(queueName).setAddress(destination.getAddress())); } void createQueue(ActiveMQDestination destination, RoutingType routingType, SimpleString queueName, SimpleString filter, boolean durable, boolean autoCreated, ClientSession.AddressQuery addressQuery) throws ActiveMQException { - QueueAttributes queueAttributes = destination.getQueueAttributes() == null ? new QueueAttributes() : destination.getQueueAttributes(); - setRequiredQueueAttributesIfNotSet(queueAttributes, addressQuery, routingType, filter, durable); - session.createQueue( - destination.getSimpleAddress(), - queueName, - autoCreated, - queueAttributes); + QueueConfiguration queueConfiguration = destination.getQueueConfiguration() == null ? new QueueConfiguration(queueName) : destination.getQueueConfiguration(); + setRequiredQueueConfigurationIfNotSet(queueConfiguration, addressQuery, routingType, filter, durable); + session.createQueue(queueConfiguration.setName(queueName).setAddress(destination.getAddress()).setAutoCreated(autoCreated)); } // Private ------------------------------------------------------- @@ -1340,29 +1330,26 @@ public class ActiveMQSession implements QueueSession, TopicSession { } /** - * Set the non nullable (CreateQueueMessage_V2) queue attributes (all others get defaulted if null by address settings server side). + * Set the non nullable (CreateQueueMessage_V2) queue attributes (all others have static defaults or get defaulted if null by address settings server side). * - * @param queueAttributes the provided queue attributes the client wants to set + * @param queueConfiguration the provided queue configuration the client wants to set * @param addressQuery the address settings query information (this could be removed if max consumers and purge on no consumers were null-able in CreateQueueMessage_V2) * @param routingType of the queue (multicast or anycast) * @param filter to apply on the queue * @param durable if queue is durable */ - private void setRequiredQueueAttributesIfNotSet(QueueAttributes queueAttributes, ClientSession.AddressQuery addressQuery, RoutingType routingType, SimpleString filter, boolean durable) { - if (queueAttributes.getRoutingType() == null) { - queueAttributes.setRoutingType(routingType); + private void setRequiredQueueConfigurationIfNotSet(QueueConfiguration queueConfiguration, ClientSession.AddressQuery addressQuery, RoutingType routingType, SimpleString filter, boolean durable) { + if (queueConfiguration.getRoutingType() == null) { + queueConfiguration.setRoutingType(routingType); } - if (queueAttributes.getFilterString() == null) { - queueAttributes.setFilterString(filter); + if (queueConfiguration.getFilterString() == null) { + queueConfiguration.setFilterString(filter); } - if (queueAttributes.getDurable() == null) { - queueAttributes.setDurable(durable); + if (queueConfiguration.getMaxConsumers() == null) { + queueConfiguration.setMaxConsumers(addressQuery.getDefaultMaxConsumers()); } - if (queueAttributes.getMaxConsumers() == null) { - queueAttributes.setMaxConsumers(addressQuery.getDefaultMaxConsumers()); - } - if (queueAttributes.getPurgeOnNoConsumers() == null) { - queueAttributes.setPurgeOnNoConsumers(addressQuery.isDefaultPurgeOnNoConsumers()); + if (queueConfiguration.isPurgeOnNoConsumers() == null) { + queueConfiguration.setPurgeOnNoConsumers(addressQuery.isDefaultPurgeOnNoConsumers()); } } diff --git a/artemis-jms-client/src/test/java/org/apache/activemq/artemis/jms/client/ActiveMQParameterTest.java b/artemis-jms-client/src/test/java/org/apache/activemq/artemis/jms/client/ActiveMQParameterTest.java index 1cb179da67..7324682f37 100644 --- a/artemis-jms-client/src/test/java/org/apache/activemq/artemis/jms/client/ActiveMQParameterTest.java +++ b/artemis-jms-client/src/test/java/org/apache/activemq/artemis/jms/client/ActiveMQParameterTest.java @@ -31,18 +31,18 @@ public class ActiveMQParameterTest { @Test public void testQueueParameters() { ActiveMQDestination activeMQDestination = new ActiveMQQueue("jms.queue.foo?exclusive=true"); - assertTrue(activeMQDestination.getQueueAttributes().getExclusive()); + assertTrue(activeMQDestination.getQueueConfiguration().isExclusive()); assertEquals("jms.queue.foo", activeMQDestination.getAddress()); activeMQDestination = new ActiveMQQueue("jms.queue.foo?exclusive=false"); - assertFalse(activeMQDestination.getQueueAttributes().getExclusive()); + assertFalse(activeMQDestination.getQueueConfiguration().isExclusive()); activeMQDestination = new ActiveMQQueue("jms.queue.foo?last-value=true"); - assertTrue(activeMQDestination.getQueueAttributes().getLastValue()); + assertTrue(activeMQDestination.getQueueConfiguration().isLastValue()); activeMQDestination = new ActiveMQQueue("jms.queue.foo?last-value=false"); - assertFalse(activeMQDestination.getQueueAttributes().getLastValue()); + assertFalse(activeMQDestination.getQueueConfiguration().isLastValue()); } @@ -50,14 +50,14 @@ public class ActiveMQParameterTest { public void testMultipleQueueParameters() { ActiveMQDestination activeMQDestination = new ActiveMQQueue("jms.queue.foo?last-value=true&exclusive=true"); assertEquals("jms.queue.foo", activeMQDestination.getAddress()); - assertTrue(activeMQDestination.getQueueAttributes().getLastValue()); - assertTrue(activeMQDestination.getQueueAttributes().getExclusive()); + assertTrue(activeMQDestination.getQueueConfiguration().isLastValue()); + assertTrue(activeMQDestination.getQueueConfiguration().isExclusive()); } @Test public void testNoQueueParameters() { ActiveMQDestination activeMQDestination = new ActiveMQQueue("jms.queue.foo"); assertEquals("jms.queue.foo", activeMQDestination.getAddress()); - assertNull(activeMQDestination.getQueueAttributes()); + assertNull(activeMQDestination.getQueueConfiguration()); } } diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java index a5e63390bd..c19960fee0 100644 --- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java +++ b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java @@ -32,6 +32,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import org.apache.activemq.artemis.api.core.ActiveMQAddressDoesNotExistException; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration; +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.api.core.TransportConfiguration; @@ -1079,8 +1080,7 @@ public class JMSServerManagerImpl extends CleaningActivateCallback implements JM server.addOrUpdateAddressInfo(new AddressInfo(SimpleString.toSimpleString(queueName)).addRoutingType(RoutingType.ANYCAST)); - AddressSettings as = server.getAddressSettingsRepository().getMatch(queueName); - server.createQueue(SimpleString.toSimpleString(queueName), RoutingType.ANYCAST, SimpleString.toSimpleString(queueName), SimpleString.toSimpleString(coreFilterString), null, durable, false, true, false, false, as.getDefaultMaxConsumers(), as.isDefaultPurgeOnNoConsumers(), as.isAutoCreateAddresses()); + server.createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST).setFilterString(coreFilterString).setDurable(durable), true); // create the JMS queue with the logical name jmsQueueName and keeps queueName for its *core* queue name queues.put(queueName, ActiveMQDestination.createQueue(queueName, jmsQueueName)); diff --git a/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/ActiveMQConsumerResource.java b/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/ActiveMQConsumerResource.java index 34bf67c581..967d971d06 100644 --- a/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/ActiveMQConsumerResource.java +++ b/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/ActiveMQConsumerResource.java @@ -17,6 +17,7 @@ package org.apache.activemq.artemis.junit; import org.apache.activemq.artemis.api.core.ActiveMQException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -103,7 +104,7 @@ public class ActiveMQConsumerResource extends AbstractActiveMQClientResource { if (!session.queueQuery(queueName).isExists() && autoCreateQueue) { log.warn("{}: queue does not exist - creating queue: address = {}, name = {}", this.getClass().getSimpleName(), queueName.toString(), queueName.toString()); session.createAddress(queueName, RoutingType.MULTICAST, true); - session.createQueue(queueName, queueName); + session.createQueue(new QueueConfiguration(queueName)); } consumer = session.createConsumer(queueName, browseOnly); } catch (ActiveMQException amqEx) { diff --git a/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/ActiveMQDynamicProducerResource.java b/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/ActiveMQDynamicProducerResource.java index f9c6274649..612ab45018 100644 --- a/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/ActiveMQDynamicProducerResource.java +++ b/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/ActiveMQDynamicProducerResource.java @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.junit; import java.util.Map; import org.apache.activemq.artemis.api.core.ActiveMQException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ServerLocator; @@ -81,7 +82,7 @@ public class ActiveMQDynamicProducerResource extends ActiveMQProducerResource { try { if (address != null && !session.addressQuery(address).isExists() && autoCreateQueue) { log.warn("queue does not exist - creating queue: address = {}, name = {}", address.toString(), address.toString()); - session.createQueue(address, address); + session.createQueue(new QueueConfiguration(address)); } producer = session.createProducer((SimpleString) null); } catch (ActiveMQException amqEx) { @@ -116,7 +117,7 @@ public class ActiveMQDynamicProducerResource extends ActiveMQProducerResource { try { if (autoCreateQueue && !session.addressQuery(targetAddress).isExists()) { log.warn("queue does not exist - creating queue: address = {}, name = {}", address.toString(), address.toString()); - session.createQueue(targetAddress, targetAddress); + session.createQueue(new QueueConfiguration(targetAddress)); } } catch (ActiveMQException amqEx) { throw new ActiveMQClientResourceException(String.format("Queue creation failed for queue: address = %s, name = %s", address.toString(), address.toString())); diff --git a/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/ActiveMQProducerResource.java b/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/ActiveMQProducerResource.java index 102a0872c2..33ae4d26d3 100644 --- a/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/ActiveMQProducerResource.java +++ b/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/ActiveMQProducerResource.java @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.junit; import java.util.Map; import org.apache.activemq.artemis.api.core.ActiveMQException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientProducer; @@ -123,7 +124,7 @@ public class ActiveMQProducerResource extends AbstractActiveMQClientResource { try { if (!session.addressQuery(address).isExists() && autoCreateQueue) { log.warn("{}: queue does not exist - creating queue: address = {}, name = {}", this.getClass().getSimpleName(), address.toString(), address.toString()); - session.createQueue(address, address); + session.createQueue(new QueueConfiguration(address)); } producer = session.createProducer(address); } catch (ActiveMQException amqEx) { diff --git a/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/EmbeddedActiveMQResource.java b/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/EmbeddedActiveMQResource.java index c201127e98..6ae3c6ab9c 100644 --- a/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/EmbeddedActiveMQResource.java +++ b/artemis-junit/src/main/java/org/apache/activemq/artemis/junit/EmbeddedActiveMQResource.java @@ -21,6 +21,7 @@ import java.util.List; import java.util.Map; import org.apache.activemq.artemis.api.core.ActiveMQException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; @@ -358,11 +359,9 @@ public class EmbeddedActiveMQResource extends ExternalResource { } public Queue createQueue(SimpleString address, SimpleString name) { - SimpleString filter = null; - boolean temporary = false; Queue queue = null; try { - queue = server.getActiveMQServer().createQueue(address, RoutingType.MULTICAST, name, filter, isUseDurableQueue(), temporary, server.getActiveMQServer().getAddressSettingsRepository().getMatch(address.toString()).getDefaultMaxConsumers(), server.getActiveMQServer().getAddressSettingsRepository().getMatch(address.toString()).isDefaultPurgeOnNoConsumers(), true); + queue = server.getActiveMQServer().createQueue(new QueueConfiguration(name).setAddress(address).setDurable(isUseDurableQueue())); } catch (Exception ex) { throw new EmbeddedActiveMQResourceException(String.format("Failed to create queue: queueName = %s, name = %s", address.toString(), name.toString()), ex); } @@ -379,9 +378,8 @@ public class EmbeddedActiveMQResource extends ExternalResource { } public void createSharedQueue(SimpleString address, SimpleString name, SimpleString user) { - SimpleString filter = null; try { - server.getActiveMQServer().createSharedQueue(address, RoutingType.MULTICAST, name, filter, user, isUseDurableQueue()); + server.getActiveMQServer().createSharedQueue(new QueueConfiguration(name).setAddress(address).setRoutingType(RoutingType.MULTICAST).setDurable(isUseDurableQueue()).setUser(user)); } catch (Exception ex) { throw new EmbeddedActiveMQResourceException(String.format("Failed to create shared queue: queueName = %s, name = %s, user = %s", address.toString(), name.toString(), user.toString()), ex); } diff --git a/artemis-junit/src/test/java/org/apache/activemq/artemis/junit/EmbeddedActiveMQResourceCustomConfigurationTest.java b/artemis-junit/src/test/java/org/apache/activemq/artemis/junit/EmbeddedActiveMQResourceCustomConfigurationTest.java index e6613e23c0..0ee10be34e 100644 --- a/artemis-junit/src/test/java/org/apache/activemq/artemis/junit/EmbeddedActiveMQResourceCustomConfigurationTest.java +++ b/artemis-junit/src/test/java/org/apache/activemq/artemis/junit/EmbeddedActiveMQResourceCustomConfigurationTest.java @@ -18,8 +18,8 @@ package org.apache.activemq.artemis.junit; import java.util.List; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.core.config.Configuration; -import org.apache.activemq.artemis.core.config.CoreQueueConfiguration; import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl; import org.apache.activemq.artemis.core.server.Queue; import org.junit.After; @@ -37,7 +37,7 @@ public class EmbeddedActiveMQResourceCustomConfigurationTest { static final String TEST_QUEUE = "test.queue"; static final String TEST_ADDRESS = "test.address"; - CoreQueueConfiguration queueConfiguration = new CoreQueueConfiguration().setAddress(TEST_ADDRESS).setName(TEST_QUEUE); + QueueConfiguration queueConfiguration = new QueueConfiguration(TEST_QUEUE).setAddress(TEST_ADDRESS); Configuration customConfiguration = new ConfigurationImpl().setPersistenceEnabled(false).setSecurityEnabled(true).addQueueConfiguration(queueConfiguration); private EmbeddedActiveMQResource server = new EmbeddedActiveMQResource(customConfiguration); diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallback.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallback.java index 08f0794a8e..f9d689ecb0 100644 --- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallback.java +++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallback.java @@ -25,6 +25,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException; import org.apache.activemq.artemis.api.core.ActiveMQSecurityException; import org.apache.activemq.artemis.api.core.Message; +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.api.core.client.ActiveMQClient; @@ -252,7 +253,7 @@ public class AMQPSessionCallback implements SessionCallback { RoutingType routingType, SimpleString filter) throws Exception { try { - serverSession.createQueue(address, queueName, routingType, filter, true, false); + serverSession.createQueue(new QueueConfiguration(queueName).setAddress(address).setRoutingType(routingType).setFilterString(filter).setTemporary(true).setDurable(false)); } catch (ActiveMQSecurityException se) { throw ActiveMQAMQPProtocolMessageBundle.BUNDLE.securityErrorCreatingTempDestination(se.getMessage()); } @@ -263,7 +264,7 @@ public class AMQPSessionCallback implements SessionCallback { SimpleString queueName, SimpleString filter) throws Exception { try { - serverSession.createQueue(address, queueName, routingType, filter, false, true, 1, false, false); + serverSession.createQueue(new QueueConfiguration(queueName).setAddress(address).setRoutingType(routingType).setFilterString(filter).setMaxConsumers(1)); } catch (ActiveMQSecurityException se) { throw ActiveMQAMQPProtocolMessageBundle.BUNDLE.securityErrorCreatingConsumer(se.getMessage()); } @@ -274,7 +275,7 @@ public class AMQPSessionCallback implements SessionCallback { SimpleString queueName, SimpleString filter) throws Exception { try { - serverSession.createSharedQueue(address, queueName, routingType, filter, true, -1, false, false, false); + serverSession.createSharedQueue(new QueueConfiguration(queueName).setAddress(address).setRoutingType(routingType).setFilterString(filter)); } catch (ActiveMQQueueExistsException alreadyExists) { // nothing to be done.. just ignore it. if you have many consumers all doing the same another one probably already done it } catch (ActiveMQSecurityException se) { @@ -287,7 +288,7 @@ public class AMQPSessionCallback implements SessionCallback { SimpleString queueName, SimpleString filter) throws Exception { try { - serverSession.createSharedQueue(address, queueName, routingType, filter, false, -1, false, false, false); + serverSession.createSharedQueue(new QueueConfiguration(queueName).setAddress(address).setRoutingType(routingType).setFilterString(filter).setDurable(false)); } catch (ActiveMQSecurityException se) { throw ActiveMQAMQPProtocolMessageBundle.BUNDLE.securityErrorCreatingConsumer(se.getMessage()); } catch (ActiveMQQueueExistsException e) { @@ -300,7 +301,7 @@ public class AMQPSessionCallback implements SessionCallback { if (!queueQueryResult.isExists() && queueQueryResult.isAutoCreateQueues() && autoCreate) { try { - serverSession.createQueue(queueName, queueName, routingType, null, false, true, true); + serverSession.createQueue(new QueueConfiguration(queueName).setRoutingType(routingType).setAutoCreated(true)); } catch (ActiveMQQueueExistsException e) { // The queue may have been created by another thread in the mean time. Catch and do nothing. } @@ -342,7 +343,7 @@ public class AMQPSessionCallback implements SessionCallback { if (manager.getServer().locateQueue(unPrefixedAddress) == null) { if (addressSettings.isAutoCreateQueues()) { try { - serverSession.createQueue(address, address, routingType, null, false, true, true); + serverSession.createQueue(new QueueConfiguration(address).setRoutingType(routingType).setAutoCreated(true)); } catch (ActiveMQQueueExistsException e) { // The queue may have been created by another thread in the mean time. Catch and do nothing. } diff --git a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTPublishManager.java b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTPublishManager.java index b473a87c1e..adf7b1af62 100644 --- a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTPublishManager.java +++ b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTPublishManager.java @@ -27,6 +27,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQIllegalStateException; import org.apache.activemq.artemis.api.core.ICoreMessage; import org.apache.activemq.artemis.api.core.Message; import org.apache.activemq.artemis.api.core.Pair; +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.io.IOCallback; @@ -101,7 +102,9 @@ public class MQTTPublishManager { private void createManagementQueue() throws Exception { Queue q = session.getServer().locateQueue(managementAddress); if (q == null) { - session.getServer().createQueue(managementAddress, RoutingType.ANYCAST, managementAddress, null, MQTTUtil.DURABLE_MESSAGES, false); + session.getServer().createQueue(new QueueConfiguration(managementAddress) + .setRoutingType(RoutingType.ANYCAST) + .setDurable(MQTTUtil.DURABLE_MESSAGES)); } } diff --git a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTRetainMessageManager.java b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTRetainMessageManager.java index 841c7c847b..147c30ba3a 100644 --- a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTRetainMessageManager.java +++ b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTRetainMessageManager.java @@ -18,6 +18,7 @@ package org.apache.activemq.artemis.core.protocol.mqtt; import org.apache.activemq.artemis.api.core.Message; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.core.server.BindingQueryResult; import org.apache.activemq.artemis.core.server.MessageReference; @@ -49,7 +50,7 @@ public class MQTTRetainMessageManager { Queue queue = session.getServer().locateQueue(retainAddress); if (queue == null) { - queue = session.getServer().createQueue(retainAddress, retainAddress, null, true, false); + queue = session.getServer().createQueue(new QueueConfiguration(retainAddress)); } queue.deleteAllReferences(); diff --git a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTSubscriptionManager.java b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTSubscriptionManager.java index 501c26bf85..160c62303f 100644 --- a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTSubscriptionManager.java +++ b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTSubscriptionManager.java @@ -26,6 +26,7 @@ import java.util.concurrent.ConcurrentMap; import org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException; import org.apache.activemq.artemis.api.core.FilterConstants; +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.server.ActiveMQMessageBundle; @@ -121,7 +122,7 @@ public class MQTTSubscriptionManager { private Queue findOrCreateQueue(BindingQueryResult bindingQueryResult, AddressInfo addressInfo, SimpleString queue, int qos) throws Exception { if (addressInfo.getRoutingTypes().contains(RoutingType.MULTICAST)) { - return session.getServerSession().createQueue(addressInfo.getName(), queue, RoutingType.MULTICAST, managementFilter, false, MQTTUtil.DURABLE_MESSAGES && qos >= 0, false); + return session.getServerSession().createQueue(new QueueConfiguration(queue).setAddress(addressInfo.getName()).setFilterString(managementFilter).setDurable(MQTTUtil.DURABLE_MESSAGES && qos >= 0)); } if (addressInfo.getRoutingTypes().contains(RoutingType.ANYCAST)) { @@ -137,7 +138,7 @@ public class MQTTSubscriptionManager { return session.getServer().locateQueue(name); } else { try { - return session.getServerSession().createQueue(addressInfo.getName(), addressInfo.getName(), RoutingType.ANYCAST, managementFilter, false, MQTTUtil.DURABLE_MESSAGES && qos >= 0, false); + return session.getServerSession().createQueue(new QueueConfiguration(addressInfo.getName()).setRoutingType(RoutingType.ANYCAST).setFilterString(managementFilter).setDurable(MQTTUtil.DURABLE_MESSAGES && qos >= 0)); } catch (ActiveMQQueueExistsException e) { return session.getServer().locateQueue(addressInfo.getName()); } diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java index 3a106cca1a..4e6601f91e 100644 --- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java +++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java @@ -45,6 +45,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQNonExistentQueueException; import org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException; import org.apache.activemq.artemis.api.core.ActiveMQRemoteDisconnectException; import org.apache.activemq.artemis.api.core.ActiveMQSecurityException; +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.client.ActiveMQClientLogger; @@ -817,19 +818,19 @@ public class OpenWireConnection extends AbstractRemotingConnection implements Se SimpleString qName = SimpleString.toSimpleString(dest.getPhysicalName()); if (server.locateQueue(qName) == null) { AddressSettings addressSettings = server.getAddressSettingsRepository().getMatch(dest.getPhysicalName()); - AddressInfo addressInfo = new AddressInfo(qName, dest.isTopic() ? RoutingType.MULTICAST : RoutingType.ANYCAST); - if (AdvisorySupport.isAdvisoryTopic(dest) && protocolManager.isSuppressInternalManagementObjects()) { - addressInfo.setInternal(true); - } if (dest.isQueue() && (addressSettings.isAutoCreateQueues() || dest.isTemporary())) { try { - internalSession.createQueue(addressInfo, qName, null, dest.isTemporary(), !dest.isTemporary(), !dest.isTemporary()); + internalSession.createQueue(new QueueConfiguration(qName).setRoutingType(RoutingType.ANYCAST).setDurable(!dest.isTemporary()).setTemporary(dest.isTemporary()).setAutoCreated(!dest.isTemporary())); created = true; } catch (ActiveMQQueueExistsException exists) { // The queue may have been created by another thread in the mean time. Catch and do nothing. } } else if (dest.isTopic() && (addressSettings.isAutoCreateAddresses() || dest.isTemporary())) { try { + AddressInfo addressInfo = new AddressInfo(qName, RoutingType.MULTICAST); + if (AdvisorySupport.isAdvisoryTopic(dest) && protocolManager.isSuppressInternalManagementObjects()) { + addressInfo.setInternal(true); + } if (internalSession.getAddress(addressInfo.getName()) == null) { internalSession.createAddress(addressInfo, !dest.isTemporary()); created = true; diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConsumer.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConsumer.java index 6f64379aa6..eb4ce407e1 100644 --- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConsumer.java +++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConsumer.java @@ -33,6 +33,7 @@ import org.apache.activemq.advisory.AdvisorySupport; import org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException; import org.apache.activemq.artemis.api.core.ICoreMessage; import org.apache.activemq.artemis.api.core.Message; +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.client.impl.ClientConsumerImpl; @@ -42,7 +43,6 @@ import org.apache.activemq.artemis.core.server.MessageReference; import org.apache.activemq.artemis.core.server.QueueQueryResult; import org.apache.activemq.artemis.core.server.ServerConsumer; import org.apache.activemq.artemis.core.server.SlowConsumerDetectionListener; -import org.apache.activemq.artemis.core.server.impl.AddressInfo; import org.apache.activemq.artemis.core.server.impl.ServerConsumerImpl; import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.core.transaction.Transaction; @@ -149,7 +149,8 @@ public class AMQConsumer { ((ServerConsumerImpl)serverConsumer).setPreAcknowledge(preAck); } else { try { - session.getCoreServer().createQueue(destinationName, RoutingType.ANYCAST, destinationName, null, true, false); + session.getCoreServer().createQueue(new QueueConfiguration(destinationName) + .setRoutingType(RoutingType.ANYCAST)); } catch (ActiveMQQueueExistsException e) { // ignore } @@ -180,13 +181,6 @@ public class AMQConsumer { SimpleString queueName; - AddressInfo addressInfo = session.getCoreServer().getAddressInfo(address); - if (addressInfo != null) { - addressInfo.addRoutingType(RoutingType.MULTICAST); - } else { - addressInfo = new AddressInfo(address, RoutingType.MULTICAST); - } - addressInfo.setInternal(internalAddress); if (isDurable) { queueName = org.apache.activemq.artemis.jms.client.ActiveMQDestination.createQueueNameForSubscription(true, clientID, subscriptionName); if (info.getDestination().isComposite()) { @@ -212,15 +206,15 @@ public class AMQConsumer { session.getCoreSession().deleteQueue(queueName); // Create the new one - session.getCoreSession().createQueue(addressInfo, queueName, selector, false, true); + session.getCoreSession().createQueue(new QueueConfiguration(queueName).setAddress(address).setFilterString(selector).setInternal(internalAddress)); } } else { - session.getCoreSession().createQueue(addressInfo, queueName, selector, false, true); + session.getCoreSession().createQueue(new QueueConfiguration(queueName).setAddress(address).setFilterString(selector).setInternal(internalAddress)); } } else { queueName = new SimpleString(UUID.randomUUID().toString()); - session.getCoreSession().createQueue(addressInfo, queueName, selector, true, false); + session.getCoreSession().createQueue(new QueueConfiguration(queueName).setAddress(address).setFilterString(selector).setDurable(false).setTemporary(true).setInternal(internalAddress)); } return queueName; diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java index 87a41eed10..8183449c4d 100644 --- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java +++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java @@ -29,6 +29,7 @@ import javax.jms.ResourceAllocationException; import org.apache.activemq.advisory.AdvisorySupport; import org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException; +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.io.IOCallback; @@ -248,7 +249,7 @@ public class AMQSession implements SessionCallback { routingTypeToUse = as.getDefaultAddressRoutingType(); } } - coreSession.createQueue(addressToUse, queueNameToUse, routingTypeToUse, null, isTemporary, true, true); + coreSession.createQueue(new QueueConfiguration(queueNameToUse).setAddress(addressToUse).setRoutingType(routingTypeToUse).setTemporary(isTemporary).setAutoCreated(true)); connection.addKnownDestination(queueName); } else { hasQueue = false; diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java index 2709c16a08..32c09dab07 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java @@ -36,6 +36,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException; import org.apache.activemq.artemis.api.core.ActiveMQSecurityException; import org.apache.activemq.artemis.api.core.ICoreMessage; +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.api.core.client.ActiveMQClient; @@ -301,7 +302,7 @@ public final class StompConnection implements RemotingConnection { // only auto create the queue if the address is ANYCAST if (effectiveAddressRoutingType == RoutingType.ANYCAST && addressSettings.isAutoCreateQueues() && manager.getServer().locateQueue(simpleQueue) == null) { - session.createQueue(simpleQueue, simpleQueue, routingType == null ? addressSettings.getDefaultQueueRoutingType() : routingType, null, false, true, true); + session.createQueue(new QueueConfiguration(simpleQueue).setRoutingType(effectiveAddressRoutingType).setAutoCreated(true)); } } catch (ActiveMQQueueExistsException e) { // ignore diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompSession.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompSession.java index d7e2ddcc8b..c373ff7b2d 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompSession.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompSession.java @@ -29,6 +29,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException; import org.apache.activemq.artemis.api.core.ICoreMessage; import org.apache.activemq.artemis.api.core.Message; import org.apache.activemq.artemis.api.core.Pair; +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.message.impl.CoreMessage; @@ -267,14 +268,14 @@ public class StompSession implements SessionCallback { queueName = SimpleString.toSimpleString(clientID + "." + durableSubscriptionName); if (manager.getServer().locateQueue(queueName) == null) { try { - session.createQueue(address, queueName, selectorSimple, false, true); + session.createQueue(new QueueConfiguration(queueName).setAddress(address).setFilterString(selectorSimple)); } catch (ActiveMQQueueExistsException e) { // ignore; can be caused by concurrent durable subscribers } } } else { queueName = UUIDGenerator.getInstance().generateSimpleStringUUID(); - session.createQueue(address, queueName, selectorSimple, true, false); + session.createQueue(new QueueConfiguration(queueName).setAddress(address).setFilterString(selectorSimple).setDurable(false).setTemporary(true)); } } final ServerConsumer consumer = session.createConsumer(consumerID, queueName, multicast ? null : selectorSimple, false, false, 0); diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/VersionedStompFrameHandler.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/VersionedStompFrameHandler.java index bac1c244f2..682d590f18 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/VersionedStompFrameHandler.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/VersionedStompFrameHandler.java @@ -16,8 +16,6 @@ */ package org.apache.activemq.artemis.core.protocol.stomp; -import static org.apache.activemq.artemis.core.protocol.stomp.ActiveMQStompProtocolMessageBundle.BUNDLE; - import java.nio.charset.StandardCharsets; import java.util.concurrent.ScheduledExecutorService; @@ -31,9 +29,10 @@ import org.apache.activemq.artemis.core.protocol.stomp.Stomp.Headers; import org.apache.activemq.artemis.core.protocol.stomp.v10.StompFrameHandlerV10; import org.apache.activemq.artemis.core.protocol.stomp.v11.StompFrameHandlerV11; import org.apache.activemq.artemis.core.protocol.stomp.v12.StompFrameHandlerV12; -import org.apache.activemq.artemis.core.server.impl.AddressInfo; import org.apache.activemq.artemis.utils.ExecutorFactory; +import static org.apache.activemq.artemis.core.protocol.stomp.ActiveMQStompProtocolMessageBundle.BUNDLE; + public abstract class VersionedStompFrameHandler { protected StompConnection connection; @@ -372,7 +371,7 @@ public abstract class VersionedStompFrameHandler { if (typeHeader != null) { routingType = RoutingType.valueOf(typeHeader); } else { - routingType = connection.getSession().getCoreSession().getAddressAndRoutingType(new AddressInfo(new SimpleString(destination))).getRoutingType(); + routingType = connection.getSession().getCoreSession().getRoutingTypeFromPrefix(new SimpleString(destination), null); } return routingType; } diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQMessageHandler.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQMessageHandler.java index 2e2e7c1a79..1cb6bb431e 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQMessageHandler.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQMessageHandler.java @@ -30,6 +30,7 @@ import java.util.Map; import java.util.UUID; import org.apache.activemq.artemis.api.core.ActiveMQException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientSession.QueueQuery; @@ -123,7 +124,7 @@ public class ActiveMQMessageHandler implements MessageHandler, FailoverEventList QueueQuery subResponse = session.queueQuery(queueName); if (!subResponse.isExists()) { - session.createQueue(activation.getAddress(), queueName, selectorString, true); + session.createQueue(new QueueConfiguration(queueName).setAddress(activation.getAddress()).setFilterString(selectorString)); } else { // The check for already exists should be done only at the first session // As a deployed MDB could set up multiple instances in order to process messages in parallel. @@ -148,7 +149,7 @@ public class ActiveMQMessageHandler implements MessageHandler, FailoverEventList session.deleteQueue(queueName); // Create the new one - session.createQueue(activation.getAddress(), queueName, selectorString, true); + session.createQueue(new QueueConfiguration(queueName).setAddress(activation.getAddress()).setFilterString(selectorString)); } } consumer = (ClientConsumerInternal) session.createConsumer(queueName, null, false); @@ -157,7 +158,7 @@ public class ActiveMQMessageHandler implements MessageHandler, FailoverEventList if (activation.isTopic()) { if (activation.getTopicTemporaryQueue() == null) { tempQueueName = new SimpleString(UUID.randomUUID().toString()); - session.createTemporaryQueue(activation.getAddress(), tempQueueName, selectorString); + session.createQueue(new QueueConfiguration(tempQueueName).setAddress(activation.getAddress()).setFilterString(selectorString).setDurable(false).setTemporary(true)); activation.setTopicTemporaryQueue(tempQueueName); } else { tempQueueName = activation.getTopicTemporaryQueue(); @@ -165,7 +166,7 @@ public class ActiveMQMessageHandler implements MessageHandler, FailoverEventList if (!queueQuery.isExists()) { // this is because we could be using remote servers (in cluster maybe) // and the queue wasn't created on that node yet. - session.createTemporaryQueue(activation.getAddress(), tempQueueName, selectorString); + session.createQueue(new QueueConfiguration(tempQueueName).setAddress(activation.getAddress()).setFilterString(selectorString).setDurable(false).setTemporary(true)); } } } else { diff --git a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/QueueDestinationsResource.java b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/QueueDestinationsResource.java index fe47680b26..9f79624f46 100644 --- a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/QueueDestinationsResource.java +++ b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/QueueDestinationsResource.java @@ -30,6 +30,7 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import org.apache.activemq.artemis.api.core.ActiveMQException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientSession; import org.apache.activemq.artemis.jms.client.ActiveMQDestination; @@ -67,9 +68,9 @@ public class QueueDestinationsResource { ClientSession.QueueQuery query = session.queueQuery(new SimpleString(queueName)); if (!query.isExists()) { if (queue.getSelector() != null) { - session.createQueue(queueName, queueName, queue.getSelector(), queue.isDurable()); + session.createQueue(new QueueConfiguration(queueName).setFilterString(queue.getSelector()).setDurable(queue.isDurable())); } else { - session.createQueue(queueName, queueName, queue.isDurable()); + session.createQueue(new QueueConfiguration(queueName).setDurable(queue.isDurable())); } } else { diff --git a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/QueueServiceManager.java b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/QueueServiceManager.java index c589104148..2907daa3c5 100644 --- a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/QueueServiceManager.java +++ b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/QueueServiceManager.java @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.rest.queue; import java.util.ArrayList; import java.util.List; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientSession; import org.apache.activemq.artemis.api.core.RoutingType; @@ -86,11 +87,11 @@ public class QueueServiceManager extends DestinationServiceManager { ClientSession.AddressQuery query = session.addressQuery(SimpleString.toSimpleString(queueName)); if (!query.isExists()) { session.createAddress(SimpleString.toSimpleString(queueName), RoutingType.ANYCAST, true); - session.createQueue(SimpleString.toSimpleString(queueName), RoutingType.ANYCAST, SimpleString.toSimpleString(queueName), queueDeployment.isDurableSend()); + session.createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST).setDurable(queueDeployment.isDurableSend())); } else { ClientSession.QueueQuery qquery = session.queueQuery(SimpleString.toSimpleString(queueName)); if (!qquery.isExists()) { - session.createQueue(SimpleString.toSimpleString(queueName), RoutingType.ANYCAST, SimpleString.toSimpleString(queueName), queueDeployment.isDurableSend()); + session.createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST).setDurable(queueDeployment.isDurableSend())); } } } diff --git a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/PushSubscriptionsResource.java b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/PushSubscriptionsResource.java index ce4e5d2d06..dd9cfd6be3 100644 --- a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/PushSubscriptionsResource.java +++ b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/PushSubscriptionsResource.java @@ -32,6 +32,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicLong; import org.apache.activemq.artemis.api.core.ActiveMQException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientSession; import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; @@ -76,11 +77,7 @@ public class PushSubscriptionsResource { try { session = sessionFactory.createSession(); - if (durable) { - session.createQueue(destination, subscriptionName, true); - } else { - session.createTemporaryQueue(destination, subscriptionName); - } + session.createQueue(new QueueConfiguration(subscriptionName).setAddress(destination).setDurable(durable).setTemporary(!durable)); return session; } catch (ActiveMQException e) { throw new RuntimeException(e); diff --git a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/SubscriptionsResource.java b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/SubscriptionsResource.java index 1d6602e377..9862e3e639 100644 --- a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/SubscriptionsResource.java +++ b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/SubscriptionsResource.java @@ -34,6 +34,7 @@ import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicLong; import org.apache.activemq.artemis.api.core.ActiveMQException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientSession; import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; @@ -186,11 +187,7 @@ public class SubscriptionsResource implements TimeoutTask.Callback { if (!subscriptionExists(subscriptionName)) { session = sessionFactory.createSession(); - if (durable) { - session.createQueue(destination, subscriptionName, true); - } else { - session.createTemporaryQueue(destination, subscriptionName); - } + session.createQueue(new QueueConfiguration(subscriptionName).setAddress(destination).setDurable(durable).setTemporary(!durable)); } QueueConsumer consumer = createConsumer(durable, autoAck, subscriptionName, selector, timeout, deleteWhenIdle); queueConsumers.put(consumer.getId(), consumer); diff --git a/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/test/FindDestinationTest.java b/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/test/FindDestinationTest.java index 7deab4d785..7faa5c4d53 100644 --- a/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/test/FindDestinationTest.java +++ b/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/test/FindDestinationTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.rest.test; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.core.server.impl.AddressInfo; @@ -32,7 +33,7 @@ public class FindDestinationTest extends MessageTestBase { public void testFindQueue() throws Exception { String testName = "testFindQueue"; server.getActiveMQServer().addAddressInfo(new AddressInfo(SimpleString.toSimpleString(testName), RoutingType.MULTICAST)); - server.getActiveMQServer().createQueue(new SimpleString(testName), RoutingType.MULTICAST, new SimpleString(testName), null, false, false); + server.getActiveMQServer().createQueue(new QueueConfiguration(testName).setDurable(false)); ClientRequest request = new ClientRequest(TestPortProvider.generateURL("/queues/" + testName)); @@ -63,7 +64,9 @@ public class FindDestinationTest extends MessageTestBase { @Test public void testFindTopic() throws Exception { server.getActiveMQServer().addAddressInfo(new AddressInfo(SimpleString.toSimpleString("testTopic"), RoutingType.MULTICAST)); - server.getActiveMQServer().createQueue(new SimpleString("testTopic"), RoutingType.MULTICAST, new SimpleString("testTopic"), null, false, false); + server.getActiveMQServer().createQueue(new QueueConfiguration("testTopic") + .setRoutingType(RoutingType.MULTICAST) + .setDurable(false)); ClientRequest request = new ClientRequest(TestPortProvider.generateURL("/topics/testTopic")); ClientResponse response = request.head(); diff --git a/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/test/RawAckTest.java b/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/test/RawAckTest.java index 025785a3a6..e9468ffea4 100644 --- a/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/test/RawAckTest.java +++ b/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/test/RawAckTest.java @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.rest.test; import java.util.HashMap; import org.apache.activemq.artemis.api.core.Message; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; @@ -68,7 +69,7 @@ public class RawAckTest { SimpleString addr = SimpleString.toSimpleString("testQueue"); activeMQServer.addAddressInfo(new AddressInfo(addr, RoutingType.MULTICAST)); - activeMQServer.createQueue(addr, RoutingType.MULTICAST, addr, null, false, false); + activeMQServer.createQueue(new QueueConfiguration(addr).setDurable(false)); session = sessionFactory.createSession(true, true); producer = session.createProducer(addr); session.start(); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/Configuration.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/Configuration.java index ac1b51cda1..9578977295 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/Configuration.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/Configuration.java @@ -23,6 +23,7 @@ import java.util.Map; import java.util.Properties; import java.util.Set; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.core.server.metrics.ActiveMQMetricsPlugin; import org.apache.activemq.artemis.core.server.plugin.ActiveMQServerFederationPlugin; import org.apache.activemq.artemis.core.server.plugin.ActiveMQServerAddressPlugin; @@ -463,15 +464,28 @@ public interface Configuration { /** * Returns the queues configured for this server. */ + @Deprecated List getQueueConfigurations(); + + List getQueueConfigs(); + /** * Sets the queues configured for this server. */ + @Deprecated Configuration setQueueConfigurations(List configs); + /** + * Sets the queues configured for this server. + */ + Configuration setQueueConfigs(List configs); + + @Deprecated Configuration addQueueConfiguration(CoreQueueConfiguration config); + Configuration addQueueConfiguration(QueueConfiguration config); + /** * Returns the addresses configured for this server. */ diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/CoreAddressConfiguration.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/CoreAddressConfiguration.java index 069222a3c6..948d1ce252 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/CoreAddressConfiguration.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/CoreAddressConfiguration.java @@ -21,6 +21,7 @@ import java.util.ArrayList; import java.util.EnumSet; import java.util.List; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.RoutingType; public class CoreAddressConfiguration implements Serializable { @@ -29,7 +30,7 @@ public class CoreAddressConfiguration implements Serializable { private EnumSet routingTypes = EnumSet.noneOf(RoutingType.class); - private List queueConfigurations = new ArrayList<>(); + private List queueConfigurations = new ArrayList<>(); public CoreAddressConfiguration() { } @@ -52,17 +53,39 @@ public class CoreAddressConfiguration implements Serializable { return this; } - public CoreAddressConfiguration setQueueConfigurations(List queueConfigurations) { + @Deprecated + public CoreAddressConfiguration setQueueConfigurations(List coreQueueConfigurations) { + for (CoreQueueConfiguration coreQueueConfiguration : coreQueueConfigurations) { + queueConfigurations.add(coreQueueConfiguration.toQueueConfiguration()); + } + return this; + } + + public CoreAddressConfiguration setQueueConfigs(List queueConfigurations) { this.queueConfigurations = queueConfigurations; return this; } public CoreAddressConfiguration addQueueConfiguration(CoreQueueConfiguration queueConfiguration) { + this.queueConfigurations.add(queueConfiguration.toQueueConfiguration()); + return this; + } + + public CoreAddressConfiguration addQueueConfiguration(QueueConfiguration queueConfiguration) { this.queueConfigurations.add(queueConfiguration); return this; } + @Deprecated public List getQueueConfigurations() { + List result = new ArrayList<>(); + for (QueueConfiguration queueConfiguration : queueConfigurations) { + result.add(CoreQueueConfiguration.fromQueueConfiguration(queueConfiguration)); + } + return result; + } + + public List getQueueConfigs() { return queueConfigurations; } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/CoreQueueConfiguration.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/CoreQueueConfiguration.java index b7876f7101..b6d3bf3357 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/CoreQueueConfiguration.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/CoreQueueConfiguration.java @@ -19,8 +19,10 @@ package org.apache.activemq.artemis.core.config; import java.io.Serializable; import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.RoutingType; +@Deprecated public class CoreQueueConfiguration implements Serializable { private static final long serialVersionUID = 650404974977490254L; @@ -124,6 +126,49 @@ public class CoreQueueConfiguration implements Serializable { return ringSize; } + public QueueConfiguration toQueueConfiguration() { + return new QueueConfiguration(this.getName()) + .setAddress(this.getAddress()) + .setDurable(this.isDurable()) + .setRoutingType(this.getRoutingType()) + .setExclusive(this.isExclusive()) + .setRingSize(this.getRingSize()) + .setGroupRebalance(this.isGroupRebalance()) + .setNonDestructive(this.isNonDestructive()) + .setLastValue(this.isLastValue()) + .setFilterString(this.getFilterString()) + .setMaxConsumers(this.getMaxConsumers()) + .setPurgeOnNoConsumers(this.getPurgeOnNoConsumers()) + .setConsumersBeforeDispatch(this.getConsumersBeforeDispatch()) + .setDelayBeforeDispatch(this.getDelayBeforeDispatch()) + .setGroupBuckets(this.getGroupBuckets()) + .setGroupFirstKey(this.getGroupFirstKey()) + .setUser(this.getUser()) + .setLastValueKey(this.getLastValueKey()); + } + + public static CoreQueueConfiguration fromQueueConfiguration(QueueConfiguration queueConfiguration) { + return new CoreQueueConfiguration() + .setAddress(queueConfiguration.getAddress() != null ? queueConfiguration.getAddress().toString() : null) + .setName(queueConfiguration.getName() != null ? queueConfiguration.getName().toString() : null) + .setFilterString(queueConfiguration.getFilterString() != null ? queueConfiguration.getFilterString().toString() : null) + .setDurable(queueConfiguration.isDurable() != null ? queueConfiguration.isDurable() : true) + .setUser(queueConfiguration.getUser() != null ? queueConfiguration.getUser().toString() : null) + .setExclusive(queueConfiguration.isExclusive()) + .setGroupRebalance(queueConfiguration.isGroupRebalance()) + .setGroupBuckets(queueConfiguration.getGroupBuckets()) + .setGroupFirstKey(queueConfiguration.getGroupFirstKey() != null ? queueConfiguration.getGroupFirstKey().toString() : null) + .setLastValue(queueConfiguration.isLastValue()) + .setLastValueKey(queueConfiguration.getLastValueKey() != null ? queueConfiguration.getLastValueKey().toString() : null) + .setNonDestructive(queueConfiguration.isNonDestructive()) + .setMaxConsumers(queueConfiguration.getMaxConsumers()) + .setConsumersBeforeDispatch(queueConfiguration.getConsumersBeforeDispatch()) + .setDelayBeforeDispatch(queueConfiguration.getDelayBeforeDispatch()) + .setRingSize(queueConfiguration.getRingSize() != null ? queueConfiguration.getRingSize() : ActiveMQDefaultConfiguration.getDefaultRingSize()) + .setPurgeOnNoConsumers(queueConfiguration.isPurgeOnNoConsumers() != null ? queueConfiguration.isPurgeOnNoConsumers() : ActiveMQDefaultConfiguration.getDefaultPurgeOnNoConsumers()) + .setRoutingType(queueConfiguration.getRoutingType() != null ? queueConfiguration.getRoutingType() : ActiveMQDefaultConfiguration.getDefaultRoutingType()); + } + /** * @param address the address to set */ diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java index dd3be11938..c6ed4e1521 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java @@ -43,6 +43,7 @@ import java.util.concurrent.CopyOnWriteArrayList; import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; import org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration; import org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.core.config.BridgeConfiguration; @@ -161,7 +162,9 @@ public class ConfigurationImpl implements Configuration, Serializable { protected List federationConfigurations = new ArrayList<>(); - private List queueConfigurations = new ArrayList<>(); + @Deprecated + // this can eventually be replaced with List, but to keep existing semantics it must stay as is for now + private List coreQueueConfigurations = new ArrayList<>(); private List addressConfigurations = new ArrayList<>(); @@ -716,20 +719,48 @@ public class ConfigurationImpl implements Configuration, Serializable { return this; } + @Deprecated @Override public List getQueueConfigurations() { - return queueConfigurations; + return coreQueueConfigurations; } @Override - public ConfigurationImpl setQueueConfigurations(final List configs) { - queueConfigurations = configs; + /** + * Note: modifying the returned {@code List} will not impact the underlying {@code List}. + */ + public List getQueueConfigs() { + List result = new ArrayList<>(); + for (CoreQueueConfiguration coreQueueConfiguration : coreQueueConfigurations) { + result.add(coreQueueConfiguration.toQueueConfiguration()); + } + return result; + } + + @Deprecated + @Override + public ConfigurationImpl setQueueConfigurations(final List coreQueueConfigurations) { + this.coreQueueConfigurations = coreQueueConfigurations; + return this; + } + + @Override + public ConfigurationImpl setQueueConfigs(final List configs) { + for (QueueConfiguration queueConfiguration : configs) { + coreQueueConfigurations.add(CoreQueueConfiguration.fromQueueConfiguration(queueConfiguration)); + } return this; } @Override public ConfigurationImpl addQueueConfiguration(final CoreQueueConfiguration config) { - queueConfigurations.add(config); + coreQueueConfigurations.add(config); + return this; + } + + @Override + public ConfigurationImpl addQueueConfiguration(final QueueConfiguration config) { + coreQueueConfigurations.add(CoreQueueConfiguration.fromQueueConfiguration(config)); return this; } @@ -1873,7 +1904,7 @@ public class ConfigurationImpl implements Configuration, Serializable { result = prime * result + (persistDeliveryCountBeforeDelivery ? 1231 : 1237); result = prime * result + (persistIDCache ? 1231 : 1237); result = prime * result + (persistenceEnabled ? 1231 : 1237); - result = prime * result + ((queueConfigurations == null) ? 0 : queueConfigurations.hashCode()); +// result = prime * result + ((queueConfigurations == null) ? 0 : queueConfigurations.hashCode()); result = prime * result + scheduledThreadPoolMaxSize; result = prime * result + (securityEnabled ? 1231 : 1237); result = prime * result + (populateValidatedUser ? 1231 : 1237); @@ -2087,11 +2118,11 @@ public class ConfigurationImpl implements Configuration, Serializable { return false; if (persistenceEnabled != other.persistenceEnabled) return false; - if (queueConfigurations == null) { - if (other.queueConfigurations != null) - return false; - } else if (!queueConfigurations.equals(other.queueConfigurations)) - return false; +// if (queueConfigurations == null) { +// if (other.queueConfigurations != null) +// return false; +// } else if (!queueConfigurations.equals(other.queueConfigurations)) +// return false; if (scheduledThreadPoolMaxSize != other.scheduledThreadPoolMaxSize) return false; if (securityEnabled != other.securityEnabled) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/LegacyJMSConfiguration.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/LegacyJMSConfiguration.java index 0a9b6e5b76..7b495dd355 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/LegacyJMSConfiguration.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/LegacyJMSConfiguration.java @@ -21,10 +21,10 @@ import java.io.InputStream; import java.net.URL; import java.util.Map; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.config.CoreAddressConfiguration; -import org.apache.activemq.artemis.core.config.CoreQueueConfiguration; import org.apache.activemq.artemis.core.deployers.Deployable; import org.apache.activemq.artemis.core.server.ActiveMQComponent; import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager; @@ -176,9 +176,7 @@ public class LegacyJMSConfiguration implements Deployable { configuration.addAddressConfiguration(new CoreAddressConfiguration() .setName(queueName) .addRoutingType(RoutingType.ANYCAST) - .addQueueConfiguration(new CoreQueueConfiguration() - .setAddress(queueName) - .setName(queueName) + .addQueueConfiguration(new QueueConfiguration(queueName) .setFilterString(selectorString) .setDurable(durable) .setRoutingType(RoutingType.ANYCAST))); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java index 10468130ad..20ede02a47 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java @@ -39,6 +39,7 @@ import org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration; import org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration; import org.apache.activemq.artemis.api.core.JGroupsFileBroadcastEndpointFactory; import org.apache.activemq.artemis.api.core.Pair; +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.api.core.TransportConfiguration; @@ -50,7 +51,6 @@ import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.config.ConfigurationUtils; import org.apache.activemq.artemis.core.config.ConnectorServiceConfiguration; import org.apache.activemq.artemis.core.config.CoreAddressConfiguration; -import org.apache.activemq.artemis.core.config.CoreQueueConfiguration; import org.apache.activemq.artemis.core.config.DivertConfiguration; import org.apache.activemq.artemis.core.config.FederationConfiguration; import org.apache.activemq.artemis.core.config.ScaleDownConfiguration; @@ -826,15 +826,15 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { NodeList elements = e.getElementsByTagName("queues"); if (elements.getLength() != 0) { Element node = (Element) elements.item(0); - config.setQueueConfigurations(parseQueueConfigurations(node, ActiveMQDefaultConfiguration.DEFAULT_ROUTING_TYPE)); + config.setQueueConfigs(parseQueueConfigurations(node, ActiveMQDefaultConfiguration.DEFAULT_ROUTING_TYPE)); } } - private List parseQueueConfigurations(final Element node, RoutingType routingType) { - List queueConfigurations = new ArrayList<>(); + private List parseQueueConfigurations(final Element node, RoutingType routingType) { + List queueConfigurations = new ArrayList<>(); NodeList list = node.getElementsByTagName("queue"); for (int i = 0; i < list.getLength(); i++) { - CoreQueueConfiguration queueConfig = parseQueueConfiguration(list.item(i)); + QueueConfiguration queueConfig = parseQueueConfiguration(list.item(i)); queueConfig.setRoutingType(routingType); queueConfigurations.add(queueConfig); } @@ -1235,7 +1235,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { return resourceLimitSettings; } - protected CoreQueueConfiguration parseQueueConfiguration(final Node node) { + protected QueueConfiguration parseQueueConfiguration(final Node node) { String name = getAttributeValue(node, "name"); String address = null; String filterString = null; @@ -1300,9 +1300,8 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { } } - return new CoreQueueConfiguration() + return new QueueConfiguration(name) .setAddress(address) - .setName(name) .setFilterString(filterString) .setDurable(durable) .setMaxConsumers(maxConsumers) @@ -1326,7 +1325,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { String name = getAttributeValue(node, "name"); addressConfiguration.setName(name); - List queueConfigurations = new ArrayList<>(); + List queueConfigurations = new ArrayList<>(); NodeList children = node.getChildNodes(); for (int j = 0; j < children.getLength(); j++) { Node child = children.item(j); @@ -1339,11 +1338,11 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { } } - for (CoreQueueConfiguration coreQueueConfiguration : queueConfigurations) { - coreQueueConfiguration.setAddress(name); + for (QueueConfiguration queueConfiguration : queueConfigurations) { + queueConfiguration.setAddress(name); } - addressConfiguration.setQueueConfigurations(queueConfigurations); + addressConfiguration.setQueueConfigs(queueConfigurations); return addressConfiguration; } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java index 4431d706b9..79737d268c 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java @@ -51,6 +51,7 @@ import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; import org.apache.activemq.artemis.api.core.ActiveMQAddressDoesNotExistException; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.JsonUtil; +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.api.core.TransportConfiguration; @@ -935,10 +936,12 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active } checkStarted(); - SimpleString filter = filterStr == null ? null : new SimpleString(filterStr); clearIO(); try { - server.createQueue(SimpleString.toSimpleString(address), server.getAddressSettingsRepository().getMatch(address).getDefaultQueueRoutingType(), new SimpleString(name), filter, durable, false); + server.createQueue(new QueueConfiguration(name) + .setName(name) + .setFilterString(filterStr) + .setDurable(durable)); } finally { blockOnIO(); } @@ -1179,7 +1182,27 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active filter = new SimpleString(filterStr); } - final Queue queue = server.createQueue(SimpleString.toSimpleString(address), RoutingType.valueOf(routingType.toUpperCase()), SimpleString.toSimpleString(name), filter, durable, false, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, SimpleString.toSimpleString(groupFirstKey), lastValue, SimpleString.toSimpleString(lastValueKey), nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, autoDelete, autoDeleteDelay, autoDeleteMessageCount, autoCreateAddress, ringSize); + final Queue queue = server.createQueue(new QueueConfiguration(name) + .setAddress(address) + .setRoutingType(RoutingType.valueOf(routingType.toUpperCase())) + .setFilterString(filter) + .setDurable(durable) + .setMaxConsumers(maxConsumers) + .setPurgeOnNoConsumers(purgeOnNoConsumers) + .setExclusive(exclusive) + .setGroupRebalance(groupRebalance) + .setGroupBuckets(groupBuckets) + .setGroupFirstKey(groupFirstKey) + .setLastValue(lastValue) + .setLastValueKey(lastValueKey) + .setNonDestructive(nonDestructive) + .setConsumersBeforeDispatch(consumersBeforeDispatch) + .setDelayBeforeDispatch(delayBeforeDispatch) + .setAutoDelete(autoDelete) + .setAutoDeleteDelay(autoDeleteDelay) + .setAutoDeleteMessageCount(autoDeleteMessageCount) + .setAutoCreateAddress(autoCreateAddress) + .setRingSize(ringSize)); return QueueTextFormatter.Long.format(queue, new StringBuilder()).toString(); } catch (ActiveMQException e) { throw new IllegalStateException(e.getMessage()); @@ -1188,6 +1211,60 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active } } + @Override + public String createQueue(String queueConfigurationAsJson) throws Exception { + return createQueue(queueConfigurationAsJson, false); + } + + @Override + public String createQueue(String queueConfigurationAsJson, boolean ignoreIfExists) throws Exception { + if (AuditLogger.isEnabled()) { + AuditLogger.createQueue(this.server, null, queueConfigurationAsJson, ignoreIfExists); + } + checkStarted(); + + clearIO(); + + try { + // when the QueueConfiguration is passed through createQueue all of its defaults get set which we return to the caller + QueueConfiguration queueConfiguration = QueueConfiguration.fromJSON(queueConfigurationAsJson); + if (queueConfiguration == null) { + throw ActiveMQMessageBundle.BUNDLE.failedToParseJson(queueConfigurationAsJson); + } + server.createQueue(queueConfiguration, ignoreIfExists); + return queueConfiguration.toJSON(); + } catch (ActiveMQException e) { + throw new IllegalStateException(e.getMessage()); + } finally { + blockOnIO(); + } + } + + @Override + public String updateQueue(String queueConfigurationAsJson) throws Exception { + + if (AuditLogger.isEnabled()) { + AuditLogger.updateQueue(this.server, queueConfigurationAsJson); + } + checkStarted(); + + clearIO(); + + try { + QueueConfiguration queueConfiguration = QueueConfiguration.fromJSON(queueConfigurationAsJson); + if (queueConfiguration == null) { + throw ActiveMQMessageBundle.BUNDLE.failedToParseJson(queueConfigurationAsJson); + } + final Queue queue = server.updateQueue(queueConfiguration); + if (queue == null) { + throw ActiveMQMessageBundle.BUNDLE.noSuchQueue(queueConfiguration.getName()); + } + return server.locateQueue(queueConfiguration.getName()).getQueueConfiguration().toJSON(); + } finally { + blockOnIO(); + } + } + @Deprecated @Override public String updateQueue(String name, 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 7cc7974fe3..2b31668e84 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 @@ -23,6 +23,7 @@ import java.util.Set; import org.apache.activemq.artemis.api.core.Message; import org.apache.activemq.artemis.api.core.Pair; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.core.filter.Filter; import org.apache.activemq.artemis.core.server.ActiveMQComponent; @@ -65,6 +66,7 @@ public interface PostOffice extends ActiveMQComponent { AddressInfo updateAddressInfo(SimpleString addressName, EnumSet routingTypes) throws Exception; + @Deprecated QueueBinding updateQueue(SimpleString name, RoutingType routingType, Filter filter, @@ -80,6 +82,7 @@ public interface PostOffice extends ActiveMQComponent { SimpleString user, Boolean configurationManaged) throws Exception; + @Deprecated QueueBinding updateQueue(SimpleString name, RoutingType routingType, Filter filter, @@ -96,6 +99,8 @@ public interface PostOffice extends ActiveMQComponent { Boolean configurationManaged, Long ringSize) throws Exception; + QueueBinding updateQueue(QueueConfiguration queueConfiguration) 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 7f43e98645..9bac9a80a7 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 @@ -37,6 +37,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQDuplicateIdException; import org.apache.activemq.artemis.api.core.ActiveMQNonExistentQueueException; import org.apache.activemq.artemis.api.core.Message; import org.apache.activemq.artemis.api.core.Pair; +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.api.core.management.CoreNotificationType; @@ -46,6 +47,7 @@ import org.apache.activemq.artemis.api.core.management.ResourceNames; import org.apache.activemq.artemis.core.config.DivertConfiguration; import org.apache.activemq.artemis.core.config.WildcardConfiguration; import org.apache.activemq.artemis.core.filter.Filter; +import org.apache.activemq.artemis.core.filter.impl.FilterImpl; import org.apache.activemq.artemis.core.io.IOCallback; import org.apache.activemq.artemis.core.message.impl.CoreMessage; import org.apache.activemq.artemis.core.paging.PagingManager; @@ -511,60 +513,19 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding .addRoutingType(RoutingType.ANYCAST) .setInternal(false); addAddressInfo(addressInfo); - AddressSettings addressSettings = addressSettingsRepository.getMatch(internalAddressName.toString()); - server.createQueue(internalAddressName, - RoutingType.MULTICAST, - internalMulticastQueueName, - null, - null, - true, - false, - false, - false, - false, - 0, - false, - false, - false, - addressSettings.getDefaultGroupBuckets(), - null, - addressSettings.isDefaultLastValueQueue(), - addressSettings.getDefaultLastValueKey(), - false, - 0, - 0L, - false, - 0L, - 0L, - false, - retroactiveMessageCount); - server.createQueue(internalAddressName, - RoutingType.ANYCAST, - internalAnycastQueueName, - null, - null, - true, - false, - false, - false, - false, - 0, - false, - false, - false, - addressSettings.getDefaultGroupBuckets(), - null, - addressSettings.isDefaultLastValueQueue(), - addressSettings.getDefaultLastValueKey(), - false, - 0, - 0L, - false, - 0L, - 0L, - false, - retroactiveMessageCount); + server.createQueue(new QueueConfiguration(internalMulticastQueueName) + .setAddress(internalAddressName) + .setRoutingType(RoutingType.MULTICAST) + .setMaxConsumers(0) + .setRingSize(retroactiveMessageCount)); + + server.createQueue(new QueueConfiguration(internalAnycastQueueName) + .setAddress(internalAddressName) + .setRoutingType(RoutingType.ANYCAST) + .setMaxConsumers(0) + .setRingSize(retroactiveMessageCount)); + } server.deployDivert(new DivertConfiguration() .setName(internalDivertName.toString()) @@ -600,6 +561,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding } @Override + @Deprecated public QueueBinding updateQueue(SimpleString name, RoutingType routingType, Filter filter, @@ -618,6 +580,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding } @Override + @Deprecated public QueueBinding updateQueue(SimpleString name, RoutingType routingType, Filter filter, @@ -633,8 +596,27 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding SimpleString user, Boolean configurationManaged, Long ringSize) throws Exception { + return updateQueue(new QueueConfiguration(name) + .setRoutingType(routingType) + .setFilterString(filter.getFilterString()) + .setMaxConsumers(maxConsumers) + .setPurgeOnNoConsumers(purgeOnNoConsumers) + .setExclusive(exclusive) + .setGroupRebalance(groupRebalance) + .setGroupBuckets(groupBuckets) + .setGroupFirstKey(groupFirstKey) + .setNonDestructive(nonDestructive) + .setConsumersBeforeDispatch(consumersBeforeDispatch) + .setDelayBeforeDispatch(delayBeforeDispatch) + .setUser(user) + .setConfigurationManaged(configurationManaged) + .setRingSize(ringSize)); + } + + @Override + public QueueBinding updateQueue(QueueConfiguration queueConfiguration) throws Exception { synchronized (this) { - final QueueBinding queueBinding = (QueueBinding) addressManager.getBinding(name); + final QueueBinding queueBinding = (QueueBinding) addressManager.getBinding(queueConfiguration.getName()); if (queueBinding == null) { return null; } @@ -648,82 +630,83 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding boolean changed = false; //validate update - if (maxConsumers != null && maxConsumers.intValue() != Queue.MAX_CONSUMERS_UNLIMITED) { + if (queueConfiguration.getMaxConsumers() != null && queueConfiguration.getMaxConsumers().intValue() != Queue.MAX_CONSUMERS_UNLIMITED) { final int consumerCount = queue.getConsumerCount(); - if (consumerCount > maxConsumers) { - throw ActiveMQMessageBundle.BUNDLE.invalidMaxConsumersUpdate(name.toString(), maxConsumers, consumerCount); + if (consumerCount > queueConfiguration.getMaxConsumers()) { + throw ActiveMQMessageBundle.BUNDLE.invalidMaxConsumersUpdate(queueConfiguration.getName().toString(), queueConfiguration.getMaxConsumers(), consumerCount); } } - if (routingType != null) { + if (queueConfiguration.getRoutingType() != null) { final SimpleString address = queue.getAddress(); final AddressInfo addressInfo = addressManager.getAddressInfo(address); final EnumSet addressRoutingTypes = addressInfo.getRoutingTypes(); - if (!addressRoutingTypes.contains(routingType)) { - throw ActiveMQMessageBundle.BUNDLE.invalidRoutingTypeUpdate(name.toString(), routingType, address.toString(), addressRoutingTypes); + if (!addressRoutingTypes.contains(queueConfiguration.getRoutingType())) { + throw ActiveMQMessageBundle.BUNDLE.invalidRoutingTypeUpdate(queueConfiguration.getName().toString(), queueConfiguration.getRoutingType(), address.toString(), addressRoutingTypes); } } //atomic update - if (maxConsumers != null && queue.getMaxConsumers() != maxConsumers.intValue()) { + if (queueConfiguration.getMaxConsumers() != null && queue.getMaxConsumers() != queueConfiguration.getMaxConsumers().intValue()) { changed = true; - queue.setMaxConsumer(maxConsumers); + queue.setMaxConsumer(queueConfiguration.getMaxConsumers()); } - if (routingType != null && queue.getRoutingType() != routingType) { + if (queueConfiguration.getRoutingType() != null && queue.getRoutingType() != queueConfiguration.getRoutingType()) { changed = true; - queue.setRoutingType(routingType); + queue.setRoutingType(queueConfiguration.getRoutingType()); } - if (purgeOnNoConsumers != null && queue.isPurgeOnNoConsumers() != purgeOnNoConsumers.booleanValue()) { + if (queueConfiguration.isPurgeOnNoConsumers() != null && queue.isPurgeOnNoConsumers() != queueConfiguration.isPurgeOnNoConsumers().booleanValue()) { changed = true; - queue.setPurgeOnNoConsumers(purgeOnNoConsumers); + queue.setPurgeOnNoConsumers(queueConfiguration.isPurgeOnNoConsumers()); } - if (exclusive != null && queue.isExclusive() != exclusive.booleanValue()) { + if (queueConfiguration.isExclusive() != null && queue.isExclusive() != queueConfiguration.isExclusive().booleanValue()) { changed = true; - queue.setExclusive(exclusive); + queue.setExclusive(queueConfiguration.isExclusive()); } - if (groupRebalance != null && queue.isGroupRebalance() != groupRebalance.booleanValue()) { + if (queueConfiguration.isGroupRebalance() != null && queue.isGroupRebalance() != queueConfiguration.isGroupRebalance().booleanValue()) { changed = true; - queue.setGroupRebalance(groupRebalance); + queue.setGroupRebalance(queueConfiguration.isGroupRebalance()); } - if (groupBuckets != null && queue.getGroupBuckets() != groupBuckets.intValue()) { + if (queueConfiguration.getGroupBuckets() != null && queue.getGroupBuckets() != queueConfiguration.getGroupBuckets().intValue()) { changed = true; - queue.setGroupBuckets(groupBuckets); + queue.setGroupBuckets(queueConfiguration.getGroupBuckets()); } - if (groupFirstKey != null && !groupFirstKey.equals(queue.getGroupFirstKey())) { + if (queueConfiguration.getGroupFirstKey() != null && !queueConfiguration.getGroupFirstKey().equals(queue.getGroupFirstKey())) { changed = true; - queue.setGroupFirstKey(groupFirstKey); + queue.setGroupFirstKey(queueConfiguration.getGroupFirstKey()); } - if (nonDestructive != null && queue.isNonDestructive() != nonDestructive.booleanValue()) { + if (queueConfiguration.isNonDestructive() != null && queue.isNonDestructive() != queueConfiguration.isNonDestructive().booleanValue()) { changed = true; - queue.setNonDestructive(nonDestructive); + queue.setNonDestructive(queueConfiguration.isNonDestructive()); } - if (consumersBeforeDispatch != null && !consumersBeforeDispatch.equals(queue.getConsumersBeforeDispatch())) { + if (queueConfiguration.getConsumersBeforeDispatch() != null && !queueConfiguration.getConsumersBeforeDispatch().equals(queue.getConsumersBeforeDispatch())) { changed = true; - queue.setConsumersBeforeDispatch(consumersBeforeDispatch.intValue()); + queue.setConsumersBeforeDispatch(queueConfiguration.getConsumersBeforeDispatch().intValue()); } - if (delayBeforeDispatch != null && !delayBeforeDispatch.equals(queue.getDelayBeforeDispatch())) { + if (queueConfiguration.getDelayBeforeDispatch() != null && !queueConfiguration.getDelayBeforeDispatch().equals(queue.getDelayBeforeDispatch())) { changed = true; - queue.setDelayBeforeDispatch(delayBeforeDispatch.longValue()); + queue.setDelayBeforeDispatch(queueConfiguration.getDelayBeforeDispatch().longValue()); } + Filter filter = FilterImpl.createFilter(queueConfiguration.getFilterString()); if (filter != null && !filter.equals(queue.getFilter())) { changed = true; queue.setFilter(filter); } - if (configurationManaged != null && !configurationManaged.equals(queue.isConfigurationManaged())) { + if (queueConfiguration.isConfigurationManaged() != null && !queueConfiguration.isConfigurationManaged().equals(queue.isConfigurationManaged())) { changed = true; - queue.setConfigurationManaged(configurationManaged); + queue.setConfigurationManaged(queueConfiguration.isConfigurationManaged()); } if (logger.isDebugEnabled()) { - if (user == null && queue.getUser() != null) { + if (queueConfiguration.getUser() == null && queue.getUser() != null) { logger.debug("Ignoring updating Queue to a NULL user"); } } - if (user != null && !user.equals(queue.getUser())) { + if (queueConfiguration.getUser() != null && !queueConfiguration.getUser().equals(queue.getUser())) { changed = true; - queue.setUser(user); + queue.setUser(queueConfiguration.getUser()); } - if (ringSize != null && !ringSize.equals(queue.getRingSize())) { + if (queueConfiguration.getRingSize() != null && !queueConfiguration.getRingSize().equals(queue.getRingSize())) { changed = true; - queue.setRingSize(ringSize); + queue.setRingSize(queueConfiguration.getRingSize()); } if (changed) { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/ServerSessionPacketHandler.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/ServerSessionPacketHandler.java index 46702cf15f..4c583aabdd 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/ServerSessionPacketHandler.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/ServerSessionPacketHandler.java @@ -28,6 +28,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQInternalErrorException; import org.apache.activemq.artemis.api.core.ActiveMQQueueMaxConsumerLimitReached; import org.apache.activemq.artemis.api.core.ICoreMessage; import org.apache.activemq.artemis.api.core.Message; +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.api.core.client.ClientSession; @@ -348,7 +349,12 @@ public class ServerSessionPacketHandler implements ChannelHandler { case CREATE_QUEUE: { CreateQueueMessage request = (CreateQueueMessage) packet; requiresResponse = request.isRequiresResponse(); - session.createQueue(request.getAddress(), request.getQueueName(), getRoutingTypeFromAddress(request.getAddress()), request.getFilterString(), request.isTemporary(), request.isDurable()); + session.createQueue(new QueueConfiguration(request.getQueueName()) + .setAddress(request.getAddress()) + .setRoutingType(getRoutingTypeFromAddress(request.getAddress())) + .setFilterString(request.getFilterString()) + .setTemporary(request.isTemporary()) + .setDurable(request.isDurable())); if (requiresResponse) { response = createNullResponseMessage(packet); } @@ -357,9 +363,8 @@ public class ServerSessionPacketHandler implements ChannelHandler { case CREATE_QUEUE_V2: { CreateQueueMessage_V2 request = (CreateQueueMessage_V2) packet; requiresResponse = request.isRequiresResponse(); - session.createQueue(request.getAddress(), request.getQueueName(), request.getRoutingType(), request.getFilterString(), request.isTemporary(), request.isDurable(), request.getMaxConsumers(), request.isPurgeOnNoConsumers(), - request.isExclusive(), request.isGroupRebalance(), request.getGroupBuckets(), request.getGroupFirstKey(), request.isLastValue(), request.getLastValueKey(), request.isNonDestructive(), request.getConsumersBeforeDispatch(), request.getDelayBeforeDispatch(), - request.isAutoDelete(), request.getAutoDeleteDelay(), request.getAutoDeleteMessageCount(), request.isAutoCreated(), request.getRingSize()); + session.createQueue(request.toQueueConfiguration()); + if (requiresResponse) { response = createNullResponseMessage(packet); } @@ -370,7 +375,10 @@ public class ServerSessionPacketHandler implements ChannelHandler { requiresResponse = request.isRequiresResponse(); QueueQueryResult result = session.executeQueueQuery(request.getQueueName()); if (!(result.isExists() && Objects.equals(result.getAddress(), request.getAddress()) && Objects.equals(result.getFilterString(), request.getFilterString()))) { - session.createSharedQueue(request.getAddress(), request.getQueueName(), request.isDurable(), request.getFilterString()); + session.createSharedQueue(new QueueConfiguration(request.getQueueName()) + .setAddress(request.getAddress()) + .setFilterString(request.getFilterString()) + .setDurable(request.isDurable())); } if (requiresResponse) { response = createNullResponseMessage(packet); @@ -382,9 +390,7 @@ public class ServerSessionPacketHandler implements ChannelHandler { requiresResponse = request.isRequiresResponse(); QueueQueryResult result = session.executeQueueQuery(request.getQueueName()); if (!(result.isExists() && Objects.equals(result.getAddress(), request.getAddress()) && Objects.equals(result.getFilterString(), request.getFilterString()))) { - session.createSharedQueue(request.getAddress(), request.getQueueName(), request.getRoutingType(), request.getFilterString(), request.isDurable(), request.getMaxConsumers(), request.isPurgeOnNoConsumers(), - request.isExclusive(), request.isGroupRebalance(), request.getGroupBuckets(), request.getGroupFirstKey(), request.isLastValue(), request.getLastValueKey(), request.isNonDestructive(), request.getConsumersBeforeDispatch(), request.getDelayBeforeDispatch(), - request.isAutoDelete(), request.getAutoDeleteDelay(), request.getAutoDeleteMessageCount()); + session.createSharedQueue(request.toQueueConfiguration()); } if (requiresResponse) { response = createNullResponseMessage(packet); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQPacketHandler.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQPacketHandler.java index eecc18765f..733a472f5f 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQPacketHandler.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQPacketHandler.java @@ -23,6 +23,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQExceptionType; import org.apache.activemq.artemis.api.core.ActiveMQInternalErrorException; import org.apache.activemq.artemis.api.core.ActiveMQSecurityException; +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.persistence.OperationContext; @@ -247,7 +248,11 @@ public class ActiveMQPacketHandler implements ChannelHandler { private void handleCreateQueue(final CreateQueueMessage request) { try { - server.createQueue(request.getAddress(), null, request.getQueueName(), request.getFilterString(), request.isDurable(), request.isTemporary()); + server.createQueue(new QueueConfiguration(request.getQueueName()) + .setAddress(request.getAddress()) + .setFilterString(request.getFilterString()) + .setDurable(request.isDurable()) + .setTemporary(request.isTemporary())); } catch (Exception e) { ActiveMQServerLogger.LOGGER.failedToHandleCreateQueue(e); } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java index 2e1c7c2298..4d685047de 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java @@ -482,4 +482,7 @@ public interface ActiveMQMessageBundle { @Message(id = 229228, value = "{0} must be less than or equal to 1 (actual value: {1})", format = Message.Format.MESSAGE_FORMAT) IllegalArgumentException lessThanOrEqualToOne(String name, Number val); + + @Message(id = 229229, value = "Failed to parse JSON queue configuration: {0}", format = Message.Format.MESSAGE_FORMAT) + IllegalArgumentException failedToParseJson(String json); } 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 23d5c055b9..603adaf6f7 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 @@ -27,6 +27,7 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import org.apache.activemq.artemis.api.core.ActiveMQException; +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.config.BridgeConfiguration; @@ -402,91 +403,109 @@ public interface ActiveMQServer extends ServiceComponent { * @throws org.apache.activemq.artemis.api.core.ActiveMQInvalidTransientQueueUseException if the shared queue already exists with a different {@code address} or {@code filterString} * @throws NullPointerException if {@code address} is {@code null} */ + @Deprecated void createSharedQueue(SimpleString address, RoutingType routingType, SimpleString name, SimpleString filterString, SimpleString user, boolean durable) throws Exception; + @Deprecated void createSharedQueue(SimpleString address, RoutingType routingType, SimpleString name, SimpleString filterString, SimpleString user, boolean durable, int maxConsumers, boolean purgeOnNoConsumers, boolean exclusive, boolean lastValue) throws Exception; + @Deprecated void createSharedQueue(SimpleString address, RoutingType routingType, SimpleString name, SimpleString filterString, SimpleString user, boolean durable, int maxConsumers, boolean purgeOnNoConsumers, boolean exclusive, boolean groupRebalance, int groupBuckets, boolean lastValue, SimpleString lastValueKey, boolean nonDestructive, int consumersBeforeDispatch, long delayBeforeDispatch, boolean autoDelete, long autoDeleteTimeout, long autoDeleteMessageCount) throws Exception; + @Deprecated Queue createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, boolean durable, boolean temporary) throws Exception; + @Deprecated Queue createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString user, SimpleString filterString, boolean durable, boolean temporary) throws Exception; - Queue createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, - boolean durable, boolean temporary, int maxConsumers, boolean purgeOnNoConsumers, - boolean autoCreateAddress) throws Exception; + @Deprecated + Queue createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, boolean durable, boolean temporary, int maxConsumers, boolean purgeOnNoConsumers, boolean autoCreateAddress) throws Exception; + @Deprecated Queue createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, boolean durable, boolean temporary, int maxConsumers, boolean purgeOnNoConsumers, boolean exclusive, boolean groupRebalance, int groupBuckets, boolean lastValue, SimpleString lastValueKey, boolean nonDestructive, int consumersBeforeDispatch, long delayBeforeDispatch, boolean autoDelete, long autoDeleteDelay, long autoDeleteMessageCount, boolean autoCreateAddress) throws Exception; + @Deprecated Queue createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, boolean durable, boolean temporary, int maxConsumers, boolean purgeOnNoConsumers, boolean exclusive, boolean groupRebalance, int groupBuckets, SimpleString groupFirstKey, boolean lastValue, SimpleString lastValueKey, boolean nonDestructive, int consumersBeforeDispatch, long delayBeforeDispatch, boolean autoDelete, long autoDeleteDelay, long autoDeleteMessageCount, boolean autoCreateAddress) throws Exception; + @Deprecated Queue createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, boolean durable, boolean temporary, int maxConsumers, boolean purgeOnNoConsumers, boolean exclusive, boolean groupRebalance, int groupBuckets, SimpleString groupFirstKey, boolean lastValue, SimpleString lastValueKey, boolean nonDestructive, int consumersBeforeDispatch, long delayBeforeDispatch, boolean autoDelete, long autoDeleteDelay, long autoDeleteMessageCount, boolean autoCreateAddress, long ringSize) throws Exception; + @Deprecated Queue createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, SimpleString user, boolean durable, boolean temporary, boolean autoCreated, Integer maxConsumers, Boolean purgeOnNoConsumers, boolean autoCreateAddress) throws Exception; + @Deprecated Queue createQueue(AddressInfo addressInfo, SimpleString queueName, SimpleString filter, SimpleString user, boolean durable, boolean temporary, boolean autoCreated, Integer maxConsumers, Boolean purgeOnNoConsumers, boolean autoCreateAddress) throws Exception; + @Deprecated Queue createQueue(AddressInfo addressInfo, SimpleString queueName, SimpleString filter, SimpleString user, boolean durable, boolean temporary, boolean autoCreated, Integer maxConsumers, Boolean purgeOnNoConsumers, Boolean exclusive, Boolean lastValue, boolean autoCreateAddress) throws Exception; + @Deprecated Queue createQueue(AddressInfo addressInfo, SimpleString queueName, SimpleString filter, SimpleString user, boolean durable, boolean temporary, boolean autoCreated, Integer maxConsumers, Boolean purgeOnNoConsumers, Boolean exclusive, Boolean groupRebalance, Integer groupBuckets, Boolean lastValue, SimpleString lastValueKey, Boolean nonDestructive, Integer consumersBeforeDispatch, Long delayBeforeDispatch, Boolean autoDelete, Long autoDeleteDelay, Long autoDeleteMessageCount, boolean autoCreateAddress) throws Exception; + @Deprecated Queue createQueue(AddressInfo addressInfo, SimpleString queueName, SimpleString filter, SimpleString user, boolean durable, boolean temporary, boolean autoCreated, Integer maxConsumers, Boolean purgeOnNoConsumers, Boolean exclusive, Boolean groupRebalance, Integer groupBuckets, SimpleString groupFirstKey, Boolean lastValue, SimpleString lastValueKey, Boolean nonDestructive, Integer consumersBeforeDispatch, Long delayBeforeDispatch, Boolean autoDelete, Long autoDeleteDelay, Long autoDeleteMessageCount, boolean autoCreateAddress) throws Exception; + @Deprecated Queue createQueue(AddressInfo addressInfo, SimpleString queueName, SimpleString filter, SimpleString user, boolean durable, boolean temporary, boolean autoCreated, Integer maxConsumers, Boolean purgeOnNoConsumers, Boolean exclusive, Boolean groupRebalance, Integer groupBuckets, SimpleString groupFirstKey, Boolean lastValue, SimpleString lastValueKey, Boolean nonDestructive, Integer consumersBeforeDispatch, Long delayBeforeDispatch, Boolean autoDelete, Long autoDeleteDelay, Long autoDeleteMessageCount, boolean autoCreateAddress, Long ringSize) throws Exception; + @Deprecated Queue createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, SimpleString user, boolean durable, boolean temporary, boolean ignoreIfExists, boolean transientQueue, boolean autoCreated, int maxConsumers, boolean purgeOnNoConsumers, boolean autoCreateAddress) throws Exception; + @Deprecated Queue createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, SimpleString user, boolean durable, boolean temporary, boolean ignoreIfExists, boolean transientQueue, boolean autoCreated, int maxConsumers, boolean purgeOnNoConsumers, boolean exclusive, boolean lastValue, boolean autoCreateAddress) throws Exception; + @Deprecated Queue createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, SimpleString user, boolean durable, boolean temporary, boolean ignoreIfExists, boolean transientQueue, boolean autoCreated, int maxConsumers, boolean purgeOnNoConsumers, boolean exclusive, boolean groupRebalance, int groupBuckets, boolean lastValue, SimpleString lastValueKey, boolean nonDestructive, int consumersBeforeDispatch, long delayBeforeDispatch, boolean autoDelete, long autoDeleteDelay, long autoDeleteMessageCount, boolean autoCreateAddress) throws Exception; + @Deprecated Queue createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, SimpleString user, boolean durable, boolean temporary, boolean ignoreIfExists, boolean transientQueue, boolean autoCreated, int maxConsumers, boolean purgeOnNoConsumers, boolean exclusive, boolean groupRebalance, int groupBuckets, SimpleString groupFirstKey, boolean lastValue, SimpleString lastValueKey, boolean nonDestructive, int consumersBeforeDispatch, long delayBeforeDispatch, boolean autoDelete, long autoDeleteDelay, long autoDeleteMessageCount, boolean autoCreateAddress) throws Exception; + @Deprecated Queue createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, SimpleString user, boolean durable, boolean temporary, boolean ignoreIfExists, boolean transientQueue, boolean autoCreated, int maxConsumers, boolean purgeOnNoConsumers, boolean exclusive, boolean groupRebalance, @@ -502,6 +521,71 @@ public interface ActiveMQServer extends ServiceComponent { @Deprecated Queue deployQueue(SimpleString address, SimpleString queue, SimpleString filter, boolean durable, boolean temporary) throws Exception; + /** + * Overloaded version of {@link ActiveMQServer#createQueue(QueueConfiguration, boolean)} where the {@code boolean} + * parameter is always {@code false} (i.e. if the queue already exists then an exception will be thrown). + * + * @see ActiveMQServer#createQueue(QueueConfiguration, boolean) + */ + Queue createQueue(QueueConfiguration queueConfiguration) throws Exception; + + /** + * This method creates a queue based on the {@link QueueConfiguration} input. See {@link QueueConfiguration} for more + * details on configuration specifics. + *

+ * Some dynamic defaults will be enforced via address-settings for the corresponding unset properties: + *

+ * + * @param queueConfiguration the configuration to use when creating the queue + * @param ignoreIfExists whether or not to simply return without an exception if the queue exists + * @return the {@code Queue} instance that was created + * @throws Exception + */ + Queue createQueue(QueueConfiguration queueConfiguration, boolean ignoreIfExists) throws Exception; + + /** + * This method is essentially the same as {@link #createQueue(QueueConfiguration, boolean)} with a few key exceptions. + *

+ * If {@code durable} is {@code true} then: + *

+ * If {@code durable} is {@code false} then: + *

+ * In all instances {@code autoCreated} will be forced to {@code false} and {@code autoCreatedAddress} will be forced + * to {@code true}. + * + * The {@code boolean} passed to {@link #createQueue(QueueConfiguration, boolean)} will always be true; + * + * @see #createQueue(QueueConfiguration, boolean) + * + * @throws org.apache.activemq.artemis.api.core.ActiveMQInvalidTransientQueueUseException if the shared queue already exists with a different {@code address} or {@code filterString} + */ + void createSharedQueue(QueueConfiguration queueConfiguration) throws Exception; + + @Deprecated void createSharedQueue(SimpleString address, RoutingType routingType, SimpleString name, @@ -605,17 +689,20 @@ public interface ActiveMQServer extends ServiceComponent { void stop(boolean failoverOnServerShutdown, boolean isExit) throws Exception; + @Deprecated Queue updateQueue(String name, RoutingType routingType, Integer maxConsumers, Boolean purgeOnNoConsumers) throws Exception; + @Deprecated Queue updateQueue(String name, RoutingType routingType, Integer maxConsumers, Boolean purgeOnNoConsumers, Boolean exclusive) throws Exception; + @Deprecated Queue updateQueue(String name, RoutingType routingType, Integer maxConsumers, @@ -623,6 +710,7 @@ public interface ActiveMQServer extends ServiceComponent { Boolean exclusive, String user) throws Exception; + @Deprecated Queue updateQueue(String name, RoutingType routingType, String filterString, @@ -636,6 +724,7 @@ public interface ActiveMQServer extends ServiceComponent { Long delayBeforeDispatch, String user) throws Exception; + @Deprecated Queue updateQueue(String name, RoutingType routingType, String filterString, @@ -650,6 +739,7 @@ public interface ActiveMQServer extends ServiceComponent { Long delayBeforeDispatch, String user) throws Exception; + @Deprecated Queue updateQueue(String name, RoutingType routingType, String filterString, @@ -665,6 +755,34 @@ public interface ActiveMQServer extends ServiceComponent { String user, Long ringSize) throws Exception; + /** + * Update the queue named in the {@code QueueConfiguration} with the corresponding properties. Set only the + * properties that you wish to change from their existing values. Only the following properties can actually be + * updated: + *

+ * The other configuration attributes are immutable and will be ignored if set. + * + * @param queueConfiguration the {@code QueueConfiguration} to use + * @return the updated {@code Queue} instance + * @throws Exception + */ + Queue updateQueue(QueueConfiguration queueConfiguration) 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/Queue.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/Queue.java index ee370246b3..5e8e94d19a 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/Queue.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/Queue.java @@ -24,6 +24,7 @@ import java.util.concurrent.Executor; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.Message; import org.apache.activemq.artemis.api.core.Pair; +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.filter.Filter; @@ -469,4 +470,7 @@ public interface Queue extends Bindable,CriticalComponent { } + default QueueConfiguration getQueueConfiguration() { + return null; + } } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/QueueConfig.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/QueueConfig.java index 74aa5d42bf..69cbe9d9bd 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/QueueConfig.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/QueueConfig.java @@ -17,14 +17,18 @@ package org.apache.activemq.artemis.core.server; import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; +import org.apache.activemq.artemis.api.core.ActiveMQException; +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.filter.Filter; import org.apache.activemq.artemis.core.filter.FilterUtils; +import org.apache.activemq.artemis.core.filter.impl.FilterImpl; import org.apache.activemq.artemis.core.paging.PagingManager; import org.apache.activemq.artemis.core.paging.PagingStore; import org.apache.activemq.artemis.core.paging.cursor.PageSubscription; +@Deprecated public final class QueueConfig { private final long id; @@ -55,6 +59,7 @@ public final class QueueConfig { private final long autoDeleteMessageCount; private final long ringSize; + @Deprecated public static final class Builder { private final long id; @@ -366,6 +371,36 @@ public final class QueueConfig { this.configurationManaged = configurationManaged; } + public static QueueConfig fromQueueConfiguration(QueueConfiguration queueConfiguration) throws ActiveMQException { + return new QueueConfig(queueConfiguration.getId() == null ? 0 : queueConfiguration.getId(), + queueConfiguration.getAddress(), + queueConfiguration.getName(), + queueConfiguration.getFilterString() == null ? null : FilterImpl.createFilter(queueConfiguration.getFilterString()), + null, + null, + queueConfiguration.getUser(), + queueConfiguration.isDurable(), + queueConfiguration.isTemporary(), + queueConfiguration.isAutoCreated(), + queueConfiguration.getRoutingType(), + queueConfiguration.getMaxConsumers(), + queueConfiguration.isExclusive(), + queueConfiguration.isLastValue(), + queueConfiguration.getLastValueKey(), + queueConfiguration.isNonDestructive(), + queueConfiguration.getConsumersBeforeDispatch(), + queueConfiguration.getDelayBeforeDispatch(), + queueConfiguration.isPurgeOnNoConsumers(), + queueConfiguration.isGroupRebalance(), + queueConfiguration.getGroupBuckets(), + queueConfiguration.getGroupFirstKey(), + queueConfiguration.isAutoDelete(), + queueConfiguration.getAutoDeleteDelay(), + queueConfiguration.getAutoDeleteMessageCount(), + queueConfiguration.getRingSize(), + queueConfiguration.isConfigurationManaged()); + } + public long id() { return id; } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/QueueFactory.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/QueueFactory.java index 0f57b1391b..0dce140f46 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/QueueFactory.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/QueueFactory.java @@ -16,8 +16,10 @@ */ package org.apache.activemq.artemis.core.server; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.core.filter.Filter; +import org.apache.activemq.artemis.core.paging.PagingManager; import org.apache.activemq.artemis.core.paging.cursor.PageSubscription; import org.apache.activemq.artemis.core.postoffice.PostOffice; @@ -29,8 +31,11 @@ import org.apache.activemq.artemis.core.postoffice.PostOffice; */ public interface QueueFactory { + @Deprecated Queue createQueueWith(QueueConfig config) throws Exception; + Queue createQueueWith(QueueConfiguration config, PagingManager pagingManager) throws Exception; + /** * @deprecated Replaced by {@link #createQueueWith} */ diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerSession.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerSession.java index f940ec254a..514f458897 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerSession.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerSession.java @@ -27,6 +27,7 @@ import java.util.concurrent.Executor; import org.apache.activemq.artemis.Closeable; import org.apache.activemq.artemis.api.core.Message; import org.apache.activemq.artemis.api.core.Pair; +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.persistence.OperationContext; @@ -120,6 +121,7 @@ public interface ServerSession extends SecurityAuth { */ void resetTX(Transaction transaction); + @Deprecated Queue createQueue(SimpleString address, SimpleString name, RoutingType routingType, @@ -127,6 +129,7 @@ public interface ServerSession extends SecurityAuth { boolean temporary, boolean durable) throws Exception; + @Deprecated Queue createQueue(AddressInfo address, SimpleString name, SimpleString filterString, @@ -144,12 +147,14 @@ public interface ServerSession extends SecurityAuth { * @return * @throws Exception */ + @Deprecated Queue createQueue(SimpleString address, SimpleString name, SimpleString filterString, boolean temporary, boolean durable) throws Exception; + @Deprecated Queue createQueue(SimpleString address, SimpleString name, RoutingType routingType, @@ -160,6 +165,7 @@ public interface ServerSession extends SecurityAuth { boolean purgeOnNoConsumers, boolean autoCreated) throws Exception; + @Deprecated Queue createQueue(SimpleString address, SimpleString name, RoutingType routingType, @@ -172,6 +178,7 @@ public interface ServerSession extends SecurityAuth { Boolean lastValue, boolean autoCreated) throws Exception; + @Deprecated Queue createQueue(SimpleString address, SimpleString name, RoutingType routingType, @@ -193,6 +200,7 @@ public interface ServerSession extends SecurityAuth { Long autoDeleteMessageCount, boolean autoCreated) throws Exception; + @Deprecated Queue createQueue(SimpleString address, SimpleString name, RoutingType routingType, @@ -215,6 +223,7 @@ public interface ServerSession extends SecurityAuth { Long autoDeleteMessageCount, boolean autoCreated) throws Exception; + @Deprecated Queue createQueue(SimpleString address, SimpleString name, RoutingType routingType, @@ -238,6 +247,7 @@ public interface ServerSession extends SecurityAuth { boolean autoCreated, Long ringSize) throws Exception; + @Deprecated Queue createQueue(SimpleString address, SimpleString name, RoutingType routingType, @@ -246,6 +256,7 @@ public interface ServerSession extends SecurityAuth { boolean durable, boolean autoCreated) throws Exception; + @Deprecated Queue createQueue(AddressInfo addressInfo, SimpleString name, SimpleString filterString, @@ -253,6 +264,7 @@ public interface ServerSession extends SecurityAuth { boolean durable, boolean autoCreated) throws Exception; + @Deprecated Queue createQueue(AddressInfo addressInfo, SimpleString name, SimpleString filterString, @@ -262,6 +274,22 @@ public interface ServerSession extends SecurityAuth { Boolean lastValue, boolean autoCreated) throws Exception; + /** + * This method invokes {@link ActiveMQServer#createQueue(QueueConfiguration)} with a few client-specific additions: + *

+ * + * @param queueConfiguration the configuration to use when creating the queue + * @return the {@code Queue} instance that was created + * @throws Exception + */ + Queue createQueue(QueueConfiguration queueConfiguration) throws Exception; + AddressInfo createAddress(SimpleString address, EnumSet routingTypes, boolean autoCreated) throws Exception; @@ -367,6 +395,7 @@ public interface ServerSession extends SecurityAuth { boolean isClosed(); + @Deprecated void createSharedQueue(SimpleString address, SimpleString name, RoutingType routingType, @@ -377,6 +406,7 @@ public interface ServerSession extends SecurityAuth { Boolean exclusive, Boolean lastValue) throws Exception; + @Deprecated void createSharedQueue(SimpleString address, SimpleString name, RoutingType routingType, @@ -396,6 +426,7 @@ public interface ServerSession extends SecurityAuth { Long autoDeleteDelay, Long autoDeleteMessageCount) throws Exception; + @Deprecated void createSharedQueue(SimpleString address, SimpleString name, RoutingType routingType, @@ -416,17 +447,21 @@ public interface ServerSession extends SecurityAuth { Long autoDeleteDelay, Long autoDeleteMessageCount) throws Exception; + @Deprecated void createSharedQueue(SimpleString address, SimpleString name, RoutingType routingType, boolean durable, SimpleString filterString) throws Exception; + @Deprecated void createSharedQueue(SimpleString address, SimpleString name, boolean durable, SimpleString filterString) throws Exception; + void createSharedQueue(QueueConfiguration queueConfiguration) throws Exception; + List getInTXMessagesForConsumer(long consumerId); List getInTxLingerMessages(); @@ -468,6 +503,8 @@ public interface ServerSession extends SecurityAuth { */ AddressInfo getAddressAndRoutingType(AddressInfo addressInfo); + RoutingType getRoutingTypeFromPrefix(SimpleString address, RoutingType defaultRoutingType); + /** * Get the canonical (i.e. non-prefixed) address and the corresponding routing-type. * diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionBridge.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionBridge.java index 77bc936fd8..da161ac1f1 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionBridge.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionBridge.java @@ -27,6 +27,7 @@ import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQExceptionType; import org.apache.activemq.artemis.api.core.Message; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; @@ -264,7 +265,7 @@ public class ClusterConnectionBridge extends BridgeImpl { createPermissiveManagementNotificationToFilter() + ")"); - sessionConsumer.createTemporaryQueue(managementNotificationAddress, notifQueueName, filter); + sessionConsumer.createQueue(new QueueConfiguration(notifQueueName).setAddress(managementNotificationAddress).setFilterString(filter).setDurable(false).setTemporary(true)); notifConsumer = sessionConsumer.createConsumer(notifQueueName); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionImpl.java index b223fc133c..3febe4a97e 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionImpl.java @@ -32,6 +32,7 @@ import java.util.concurrent.TimeUnit; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration; import org.apache.activemq.artemis.api.core.Pair; +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.api.core.TransportConfiguration; @@ -721,7 +722,7 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn } else { // Add binding in storage so the queue will get reloaded on startup and we can find it - it's never // actually routed to at that address though - queue = server.createQueue(queueName, RoutingType.MULTICAST, queueName, null, true, false, -1, false, true); + queue = server.createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.MULTICAST).setAutoCreateAddress(true).setMaxConsumers(-1).setPurgeOnNoConsumers(false)); } // There are a few things that will behave differently when it's an internal queue diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/federation/address/FederatedAddress.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/federation/address/FederatedAddress.java index 2a3d7e510c..21e6490fb3 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/federation/address/FederatedAddress.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/federation/address/FederatedAddress.java @@ -30,7 +30,7 @@ import java.util.function.Predicate; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.Message; -import org.apache.activemq.artemis.api.core.QueueAttributes; +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.api.core.client.ClientSession; @@ -290,16 +290,17 @@ public class FederatedAddress extends FederatedAbstract implements ActiveMQServe private void createRemoteQueue(ClientSession clientSession, FederatedConsumerKey key) throws ActiveMQException { if (!clientSession.queueQuery(key.getQueueName()).isExists()) { - QueueAttributes queueAttributes = new QueueAttributes() - .setRoutingType(key.getRoutingType()) - .setFilterString(key.getQueueFilterString()) - .setDurable(true) - .setAutoDelete(config.getAutoDelete() == null ? true : config.getAutoDelete()) - .setAutoDeleteDelay(config.getAutoDeleteDelay() == null ? TimeUnit.HOURS.toMillis(1) : config.getAutoDeleteDelay()) - .setAutoDeleteMessageCount(config.getAutoDeleteMessageCount() == null ? -1 : config.getAutoDeleteMessageCount()) - .setMaxConsumers(-1) - .setPurgeOnNoConsumers(false); - clientSession.createQueue(key.getAddress(), key.getQueueName(), false, queueAttributes); + clientSession.createQueue(new QueueConfiguration(key.getQueueName()) + .setAddress(key.getAddress()) + .setRoutingType(key.getRoutingType()) + .setFilterString(key.getQueueFilterString()) + .setDurable(true) + .setAutoDelete(config.getAutoDelete() == null ? true : config.getAutoDelete()) + .setAutoDeleteDelay(config.getAutoDeleteDelay() == null ? TimeUnit.HOURS.toMillis(1) : config.getAutoDeleteDelay()) + .setAutoDeleteMessageCount(config.getAutoDeleteMessageCount() == null ? -1 : config.getAutoDeleteMessageCount()) + .setMaxConsumers(-1) + .setPurgeOnNoConsumers(false) + .setAutoCreated(false)); } } 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 b436bdc607..8e5af5b65e 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 @@ -55,6 +55,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQDeleteAddressException; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException; import org.apache.activemq.artemis.api.core.Pair; +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.api.core.management.ActiveMQServerControl; @@ -64,7 +65,6 @@ import org.apache.activemq.artemis.core.config.BridgeConfiguration; import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.config.ConfigurationUtils; import org.apache.activemq.artemis.core.config.CoreAddressConfiguration; -import org.apache.activemq.artemis.core.config.CoreQueueConfiguration; import org.apache.activemq.artemis.core.config.DivertConfiguration; import org.apache.activemq.artemis.core.config.FederationConfiguration; import org.apache.activemq.artemis.core.config.HAPolicyConfiguration; @@ -82,7 +82,6 @@ import org.apache.activemq.artemis.core.journal.JournalLoadInformation; import org.apache.activemq.artemis.core.management.impl.ActiveMQServerControlImpl; import org.apache.activemq.artemis.core.paging.PagingManager; import org.apache.activemq.artemis.core.paging.PagingStoreFactory; -import org.apache.activemq.artemis.core.paging.cursor.PageSubscription; import org.apache.activemq.artemis.core.paging.impl.PagingManagerImpl; import org.apache.activemq.artemis.core.paging.impl.PagingStoreFactoryDatabase; import org.apache.activemq.artemis.core.paging.impl.PagingStoreFactoryNIO; @@ -134,7 +133,6 @@ import org.apache.activemq.artemis.core.server.NodeManager; import org.apache.activemq.artemis.core.server.PostQueueCreationCallback; import org.apache.activemq.artemis.core.server.PostQueueDeletionCallback; import org.apache.activemq.artemis.core.server.Queue; -import org.apache.activemq.artemis.core.server.QueueConfig; import org.apache.activemq.artemis.core.server.QueueFactory; import org.apache.activemq.artemis.core.server.QueueQueryResult; import org.apache.activemq.artemis.core.server.SecuritySettingPlugin; @@ -1753,6 +1751,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { return nodeManager == null ? null : nodeManager.getNodeId(); } + @Deprecated @Override public Queue createQueue(final SimpleString address, final RoutingType routingType, @@ -1764,6 +1763,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { return createQueue(address, routingType, queueName, filterString, durable, temporary, as.getDefaultMaxConsumers(), as.isDefaultPurgeOnNoConsumers(), as.isAutoCreateAddresses()); } + @Deprecated @Override public Queue createQueue(final SimpleString address, final RoutingType routingType, @@ -1776,6 +1776,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { return createQueue(address, routingType, queueName, filterString, user, durable, temporary, false, as.getDefaultMaxConsumers(), as.isDefaultPurgeOnNoConsumers(), as.isAutoCreateAddresses()); } + @Deprecated @Override public Queue createQueue(final SimpleString address, final RoutingType routingType, @@ -1789,6 +1790,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { return createQueue(address, routingType, queueName, filter, null, durable, temporary, false, maxConsumers, purgeOnNoConsumers, autoCreateAddress); } + @Deprecated @Override public Queue createQueue(final SimpleString address, final RoutingType routingType, @@ -1813,6 +1815,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { return createQueue(address, routingType, queueName, filter, null, durable, temporary, false, false, false, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, lastValue, lastValueKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, autoDelete, autoDeleteDelay, autoDeleteMessageCount, autoCreateAddress); } + @Deprecated @Override public Queue createQueue(final SimpleString address, final RoutingType routingType, @@ -1838,6 +1841,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { return createQueue(address, routingType, queueName, filter, null, durable, temporary, false, false, false, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, groupFirstKey, lastValue, lastValueKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, autoDelete, autoDeleteDelay, autoDeleteMessageCount, autoCreateAddress); } + @Deprecated @Override public Queue createQueue(final SimpleString address, final RoutingType routingType, @@ -1864,8 +1868,8 @@ public class ActiveMQServerImpl implements ActiveMQServer { return createQueue(address, routingType, queueName, filter, null, durable, temporary, false, false, false, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, groupFirstKey, lastValue, lastValueKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, autoDelete, autoDeleteDelay, autoDeleteMessageCount, autoCreateAddress, ringSize); } - @Override @Deprecated + @Override public Queue createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, @@ -1880,30 +1884,35 @@ public class ActiveMQServerImpl implements ActiveMQServer { return createQueue(address, routingType, queueName, filter, user, durable, temporary, false, false, autoCreated, maxConsumers, purgeOnNoConsumers, autoCreateAddress); } + @Deprecated @Override public Queue createQueue(AddressInfo addressInfo, SimpleString queueName, SimpleString filter, SimpleString user, boolean durable, boolean temporary, boolean autoCreated, Integer maxConsumers, Boolean purgeOnNoConsumers, boolean autoCreateAddress) throws Exception { AddressSettings as = getAddressSettingsRepository().getMatch(addressInfo == null ? queueName.toString() : addressInfo.getName().toString()); return createQueue(addressInfo, queueName, filter, user, durable, temporary, false, false, autoCreated, maxConsumers, purgeOnNoConsumers, as.isDefaultExclusiveQueue(), as.isDefaultGroupRebalance(), as.getDefaultGroupBuckets(), as.getDefaultGroupFirstKey(), as.isDefaultLastValueQueue(), as.getDefaultLastValueKey(), as.isDefaultNonDestructive(), as.getDefaultConsumersBeforeDispatch(), as.getDefaultDelayBeforeDispatch(), isAutoDelete(autoCreated, as), as.getAutoDeleteQueuesDelay(), as.getAutoDeleteQueuesMessageCount(), autoCreateAddress, false, as.getDefaultRingSize()); } + @Deprecated @Override public Queue createQueue(AddressInfo addressInfo, SimpleString queueName, SimpleString filter, SimpleString user, boolean durable, boolean temporary, boolean autoCreated, Integer maxConsumers, Boolean purgeOnNoConsumers, Boolean exclusive, Boolean lastValue, boolean autoCreateAddress) throws Exception { AddressSettings as = getAddressSettingsRepository().getMatch(addressInfo == null ? queueName.toString() : addressInfo.getName().toString()); return createQueue(addressInfo, queueName, filter, user, durable, temporary, false, false, autoCreated, maxConsumers, purgeOnNoConsumers, exclusive, as.isDefaultGroupRebalance(), as.getDefaultGroupBuckets(), as.getDefaultGroupFirstKey(), lastValue, as.getDefaultLastValueKey(), as.isDefaultNonDestructive(), as.getDefaultConsumersBeforeDispatch(), as.getDefaultDelayBeforeDispatch(), isAutoDelete(autoCreated, as), as.getAutoDeleteQueuesDelay(), as.getAutoDeleteQueuesMessageCount(), autoCreateAddress, false, as.getDefaultRingSize()); } + @Deprecated @Override public Queue createQueue(AddressInfo addressInfo, SimpleString queueName, SimpleString filter, SimpleString user, boolean durable, boolean temporary, boolean autoCreated, Integer maxConsumers, Boolean purgeOnNoConsumers, Boolean exclusive, Boolean groupRebalance, Integer groupBuckets, Boolean lastValue, SimpleString lastValueKey, Boolean nonDestructive, Integer consumersBeforeDispatch, Long delayBeforeDispatch, Boolean autoDelete, Long autoDeleteDelay, Long autoDeleteMessageCount, boolean autoCreateAddress) throws Exception { AddressSettings as = getAddressSettingsRepository().getMatch(addressInfo == null ? queueName.toString() : addressInfo.getName().toString()); return createQueue(addressInfo, queueName, filter, user, durable, temporary, false, false, autoCreated, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, as.getDefaultGroupFirstKey(), lastValue, lastValueKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, autoDelete, autoDeleteDelay, autoDeleteMessageCount, autoCreateAddress, false, as.getDefaultRingSize()); } + @Deprecated @Override public Queue createQueue(AddressInfo addressInfo, SimpleString queueName, SimpleString filter, SimpleString user, boolean durable, boolean temporary, boolean autoCreated, Integer maxConsumers, Boolean purgeOnNoConsumers, Boolean exclusive, Boolean groupRebalance, Integer groupBuckets, SimpleString groupFirstKey, Boolean lastValue, SimpleString lastValueKey, Boolean nonDestructive, Integer consumersBeforeDispatch, Long delayBeforeDispatch, Boolean autoDelete, Long autoDeleteDelay, Long autoDeleteMessageCount, boolean autoCreateAddress) throws Exception { AddressSettings as = getAddressSettingsRepository().getMatch(addressInfo == null ? queueName.toString() : addressInfo.getName().toString()); return createQueue(addressInfo, queueName, filter, user, durable, temporary, false, false, autoCreated, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, groupFirstKey, lastValue, lastValueKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, autoDelete, autoDeleteDelay, autoDeleteMessageCount, autoCreateAddress, false, as.getDefaultRingSize()); } + @Deprecated @Override public Queue createQueue(AddressInfo addressInfo, SimpleString queueName, SimpleString filter, SimpleString user, boolean durable, boolean temporary, boolean autoCreated, Integer maxConsumers, Boolean purgeOnNoConsumers, Boolean exclusive, Boolean groupRebalance, Integer groupBuckets, SimpleString groupFirstKey, Boolean lastValue, SimpleString lastValueKey, Boolean nonDestructive, Integer consumersBeforeDispatch, Long delayBeforeDispatch, Boolean autoDelete, Long autoDeleteDelay, Long autoDeleteMessageCount, boolean autoCreateAddress, Long ringSize) throws Exception { return createQueue(addressInfo, queueName, filter, user, durable, temporary, false, false, autoCreated, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, groupFirstKey, lastValue, lastValueKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, autoDelete, autoDeleteDelay, autoDeleteMessageCount, autoCreateAddress, false, ringSize); @@ -1913,6 +1922,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { return autoCreated ? addressSettings.isAutoDeleteQueues() : addressSettings.isAutoDeleteCreatedQueues(); } + @Deprecated @Override public Queue createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, SimpleString user, boolean durable, boolean temporary, boolean ignoreIfExists, boolean transientQueue, @@ -1921,6 +1931,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { return createQueue(address, routingType, queueName, filter, user, durable, temporary, ignoreIfExists, transientQueue, autoCreated, maxConsumers, purgeOnNoConsumers, as.isDefaultExclusiveQueue(), as.isDefaultGroupRebalance(), as.getDefaultGroupBuckets(), as.isDefaultLastValueQueue(), as.getDefaultLastValueKey(), as.isDefaultNonDestructive(), as.getDefaultConsumersBeforeDispatch(), as.getDefaultDelayBeforeDispatch(), isAutoDelete(autoCreated, as), as.getAutoDeleteQueuesDelay(), as.getAutoDeleteQueuesMessageCount(), autoCreateAddress); } + @Deprecated @Override public Queue createQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter, SimpleString user, boolean durable, boolean temporary, boolean ignoreIfExists, boolean transientQueue, @@ -1940,6 +1951,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { return createQueue(address, getAddressSettingsRepository().getMatch(address == null ? queueName.toString() : address.toString()).getDefaultQueueRoutingType(), queueName, filterString, durable, temporary); } + @Deprecated @Override public void createSharedQueue(final SimpleString address, RoutingType routingType, @@ -1951,6 +1963,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { createSharedQueue(address, routingType, name, filterString, user, durable, as.getDefaultMaxConsumers(), as.isDefaultPurgeOnNoConsumers(), as.isDefaultExclusiveQueue(), as.isDefaultLastValueQueue()); } + @Deprecated @Override public void createSharedQueue(final SimpleString address, RoutingType routingType, @@ -1966,6 +1979,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { createSharedQueue(address, routingType, name, filterString, user, durable, maxConsumers, purgeOnNoConsumers, exclusive, as.isDefaultGroupRebalance(), as.getDefaultGroupBuckets(), lastValue, as.getDefaultLastValueKey(), as.isDefaultNonDestructive(), as.getDefaultConsumersBeforeDispatch(), as.getDefaultDelayBeforeDispatch(), isAutoDelete(false, as), as.getAutoDeleteQueuesDelay(), as.getAutoDeleteQueuesMessageCount()); } + @Deprecated @Override public void createSharedQueue(final SimpleString address, RoutingType routingType, @@ -1990,6 +2004,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { createSharedQueue(address, routingType, name, filterString, user, durable, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, as.getDefaultGroupFirstKey(), lastValue, lastValueKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, autoDelete, autoDeleteDelay, autoDeleteMessageCount); } + @Deprecated @Override public void createSharedQueue(final SimpleString address, RoutingType routingType, @@ -2011,31 +2026,47 @@ public class ActiveMQServerImpl implements ActiveMQServer { boolean autoDelete, long autoDeleteDelay, long autoDeleteMessageCount) throws Exception { - //force the old contract about address - if (address == null) { - throw new NullPointerException("address can't be null!"); + createSharedQueue(new QueueConfiguration(name) + .setAddress(address) + .setRoutingType(routingType) + .setFilterString(filterString) + .setUser(user) + .setDurable(durable) + .setMaxConsumers(maxConsumers) + .setPurgeOnNoConsumers(purgeOnNoConsumers) + .setExclusive(exclusive) + .setGroupRebalance(groupRebalance) + .setGroupBuckets(groupBuckets) + .setGroupFirstKey(groupFirstKey) + .setLastValue(lastValue) + .setLastValueKey(lastValueKey) + .setNonDestructive(nonDestructive) + .setConsumersBeforeDispatch(consumersBeforeDispatch) + .setDelayBeforeDispatch(delayBeforeDispatch) + .setAutoDelete(autoDelete) + .setAutoDeleteDelay(autoDeleteDelay) + .setAutoDeleteMessageCount(autoDeleteMessageCount)); + + } + + @Override + public void createSharedQueue(final QueueConfiguration queueConfiguration) throws Exception { + final Queue queue = createQueue(queueConfiguration + .setTemporary(!queueConfiguration.isDurable()) + .setTransient(!queueConfiguration.isDurable()) + .setAutoCreated(false) + .setAutoCreateAddress(true), true); + + if (!queue.getAddress().equals(queueConfiguration.getAddress())) { + throw ActiveMQMessageBundle.BUNDLE.queueSubscriptionBelongsToDifferentAddress(queueConfiguration.getName()); } - if (routingType == null) { - AddressInfo addressInfo = getAddressInfo(address); - routingType = addressInfo.getRoutingTypes().size() == 1 ? addressInfo.getRoutingType() : getAddressSettingsRepository().getMatch(address.toString()).getDefaultQueueRoutingType(); - if (routingType == null) { - // TODO (mtaylor) throw exception Can not determine routing type info from address - } - } - - final Queue queue = createQueue(address, routingType, name, filterString, user, durable, !durable, true, !durable, false, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, groupFirstKey, lastValue, lastValueKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, autoDelete, autoDeleteDelay, autoDeleteMessageCount, true); - - if (!queue.getAddress().equals(address)) { - throw ActiveMQMessageBundle.BUNDLE.queueSubscriptionBelongsToDifferentAddress(name); - } - - if (filterString != null && (queue.getFilter() == null || !queue.getFilter().getFilterString().equals(filterString)) || filterString == null && queue.getFilter() != null) { - throw ActiveMQMessageBundle.BUNDLE.queueSubscriptionBelongsToDifferentFilter(name); + if (queueConfiguration.getFilterString() != null && (queue.getFilter() == null || !queue.getFilter().getFilterString().equals(queueConfiguration.getFilterString())) || queueConfiguration.getFilterString() == null && queue.getFilter() != null) { + throw ActiveMQMessageBundle.BUNDLE.queueSubscriptionBelongsToDifferentFilter(queueConfiguration.getName()); } if (logger.isDebugEnabled()) { - logger.debug("Transient Queue " + name + " created on address " + name + " with filter=" + filterString); + logger.debug("Transient Queue " + queueConfiguration.getName() + " created on address " + queueConfiguration.getName() + " with filter=" + queueConfiguration.getFilterString()); } } @@ -3035,9 +3066,9 @@ public class ActiveMQServerImpl implements ActiveMQServer { .map(CoreAddressConfiguration::getName) .collect(Collectors.toSet()); - Set queuesInConfig = configuration.getAddressConfigurations().stream() - .map(CoreAddressConfiguration::getQueueConfigurations) - .flatMap(List::stream).map(CoreQueueConfiguration::getName) + Set queuesInConfig = configuration.getAddressConfigurations().stream() + .map(CoreAddressConfiguration::getQueueConfigs) + .flatMap(List::stream).map(QueueConfiguration::getName) .collect(Collectors.toSet()); for (SimpleString addressName : listAddressNames()) { @@ -3062,7 +3093,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { } } else if (addressSettings.getConfigDeleteQueues() == DeletionPolicy.FORCE) { for (Queue queue : listConfiguredQueues(addressName)) { - if (!queuesInConfig.contains(queue.getName().toString())) { + if (!queuesInConfig.contains(queue.getName())) { ActiveMQServerLogger.LOGGER.undeployQueue(queue.getName()); try { queue.deleteQueue(true); @@ -3107,7 +3138,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { } addOrUpdateAddressInfo(merged); - deployQueuesFromListCoreQueueConfiguration(config.getQueueConfigurations()); + deployQueuesFromListQueueConfiguration(config.getQueueConfigs()); //Now all queues updated we apply the actual address info expected tobe. addOrUpdateAddressInfo(tobe); @@ -3127,44 +3158,36 @@ public class ActiveMQServerImpl implements ActiveMQServer { return new AddressInfo(address, mergedRoutingTypes); } - private void deployQueuesFromListCoreQueueConfiguration(List queues) throws Exception { - for (CoreQueueConfiguration config : queues) { + private void deployQueuesFromListQueueConfiguration(List queues) throws Exception { + for (QueueConfiguration config : queues) { try { - SimpleString queueName = SimpleString.toSimpleString(config.getName()); - ActiveMQServerLogger.LOGGER.deployQueue(config.getName(), config.getAddress(), config.getRoutingType().toString()); - AddressSettings as = addressSettingsRepository.getMatch(config.getAddress()); - // determine if there is an address::queue match; update it if so - int maxConsumers = config.getMaxConsumers() == null ? as.getDefaultMaxConsumers() : config.getMaxConsumers(); - boolean isExclusive = config.isExclusive() == null ? as.isDefaultExclusiveQueue() : config.isExclusive(); - boolean groupRebalance = config.isGroupRebalance() == null ? as.isDefaultGroupRebalance() : config.isGroupRebalance(); - int groupBuckets = config.getGroupBuckets() == null ? as.getDefaultGroupBuckets() : config.getGroupBuckets(); - SimpleString groupFirstKey = config.getGroupFirstKey() == null ? as.getDefaultGroupFirstKey() : SimpleString.toSimpleString(config.getGroupFirstKey()); - boolean isLastValue = config.isLastValue() == null ? as.isDefaultLastValueQueue() : config.isLastValue(); - SimpleString lastValueKey = config.getLastValueKey() == null ? as.getDefaultLastValueKey() : SimpleString.toSimpleString(config.getLastValueKey()); - boolean isNonDestructive = config.isNonDestructive() == null ? as.isDefaultNonDestructive() : config.isNonDestructive(); - int consumersBeforeDispatch = config.getConsumersBeforeDispatch() == null ? as.getDefaultConsumersBeforeDispatch() : config.getConsumersBeforeDispatch(); - long delayBeforeDispatch = config.getDelayBeforeDispatch() == null ? as.getDefaultDelayBeforeDispatch() : config.getDelayBeforeDispatch(); - long ringSize = config.getRingSize() == null ? as.getDefaultRingSize() : config.getRingSize(); + QueueConfigurationUtils.applyDynamicQueueDefaults(config, addressSettingsRepository.getMatch(config.getAddress().toString())); - if (locateQueue(queueName) != null && locateQueue(queueName).getAddress().toString().equals(config.getAddress())) { - updateQueue(config.getName(), config.getRoutingType(), config.getFilterString(), maxConsumers, config.getPurgeOnNoConsumers(), isExclusive, groupRebalance, groupBuckets, groupFirstKey != null ? groupFirstKey.toString() : null, isNonDestructive, consumersBeforeDispatch, delayBeforeDispatch, config.getUser(), true, ringSize); + config.setAutoCreateAddress(true); + + ActiveMQServerLogger.LOGGER.deployQueue(config.getName().toString(), config.getAddress().toString(), config.getRoutingType().toString()); + + // 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)); } else { // if the address::queue doesn't exist then create it try { - createQueue(new AddressInfo(SimpleString.toSimpleString(config.getAddress())).addRoutingType(config.getRoutingType()), queueName, SimpleString.toSimpleString(config.getFilterString()), SimpleString.toSimpleString(config.getUser()), config.isDurable(), false, false, false, false, maxConsumers, config.getPurgeOnNoConsumers(), isExclusive, groupRebalance, groupBuckets, groupFirstKey, isLastValue, lastValueKey, isNonDestructive, consumersBeforeDispatch, delayBeforeDispatch, isAutoDelete(false, as), as.getAutoDeleteQueuesDelay(), as.getAutoDeleteQueuesMessageCount(), true, true, ringSize); + // handful of hard-coded config values for the static configuration use-case + createQueue(config.setTemporary(false).setTransient(false).setAutoCreated(false).setConfigurationManaged(true).setAutoCreateAddress(true), false); } catch (ActiveMQQueueExistsException e) { // the queue may exist on a *different* address ActiveMQServerLogger.LOGGER.warn(e.getMessage()); } } } catch (Exception e) { - ActiveMQServerLogger.LOGGER.problemDeployingQueue(config.getName(), e.getMessage()); + ActiveMQServerLogger.LOGGER.problemDeployingQueue(config.getName().toString(), e.getMessage()); } } } private void deployQueuesFromConfiguration() throws Exception { - deployQueuesFromListCoreQueueConfiguration(configuration.getQueueConfigurations()); + deployQueuesFromListQueueConfiguration(configuration.getQueueConfigs()); } private void checkForPotentialOOMEInAddressConfiguration() { @@ -3333,6 +3356,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { return postOffice.getAddressInfo(address); } + @Deprecated public Queue createQueue(final AddressInfo addrInfo, final SimpleString queueName, final SimpleString filterString, @@ -3359,87 +3383,87 @@ public class ActiveMQServerImpl implements ActiveMQServer { final boolean autoCreateAddress, final boolean configurationManaged, final long ringSize) throws Exception { - SimpleString realQueueName = CompositeAddress.extractQueueName(queueName); + return createQueue(new QueueConfiguration(queueName) + .setAddress(addrInfo == null ? null : addrInfo.getName()) + .setRoutingType(addrInfo == null ? null : addrInfo.getRoutingType()) + .setFilterString(filterString) + .setUser(user) + .setDurable(durable) + .setTemporary(temporary) + .setTransient(transientQueue) + .setAutoCreated(autoCreated) + .setMaxConsumers(maxConsumers) + .setPurgeOnNoConsumers(purgeOnNoConsumers) + .setExclusive(exclusive) + .setGroupRebalance(groupRebalance) + .setGroupBuckets(groupBuckets) + .setGroupFirstKey(groupFirstKey) + .setLastValue(lastValue) + .setLastValueKey(lastValueKey) + .setNonDestructive(nonDestructive) + .setConsumersBeforeDispatch(consumersBeforeDispatch) + .setDelayBeforeDispatch(delayBeforeDispatch) + .setAutoDelete(autoDelete) + .setAutoDeleteDelay(autoDeleteDelay) + .setAutoDeleteMessageCount(autoDeleteMessageCount) + .setAutoCreateAddress(autoCreateAddress) + .setConfigurationManaged(configurationManaged) + .setRingSize(ringSize), + ignoreIfExists); + } - if (realQueueName == null || realQueueName.length() == 0) { - throw ActiveMQMessageBundle.BUNDLE.invalidQueueName(queueName); + @Override + public Queue createQueue(final QueueConfiguration queueConfiguration) throws Exception { + return createQueue(queueConfiguration, false); + } + + @Override + public Queue createQueue(final QueueConfiguration queueConfiguration, boolean ignoreIfExists) throws Exception { + if (queueConfiguration.getName() == null || queueConfiguration.getName().length() == 0) { + throw ActiveMQMessageBundle.BUNDLE.invalidQueueName(queueConfiguration.getName()); } - final QueueBinding binding = (QueueBinding) postOffice.getBinding(realQueueName); + final QueueBinding binding = (QueueBinding) postOffice.getBinding(queueConfiguration.getName()); if (binding != null) { if (ignoreIfExists) { return binding.getQueue(); } else { - throw ActiveMQMessageBundle.BUNDLE.queueAlreadyExists(realQueueName, binding.getAddress()); + throw ActiveMQMessageBundle.BUNDLE.queueAlreadyExists(queueConfiguration.getName(), binding.getAddress()); } } - final Filter filter = FilterImpl.createFilter(filterString); + QueueConfigurationUtils.applyDynamicQueueDefaults(queueConfiguration, addressSettingsRepository.getMatch(queueConfiguration.getAddress().toString())); - final long txID = storageManager.generateID(); - final long queueID = storageManager.generateID(); - - final QueueConfig.Builder queueConfigBuilder; - - final SimpleString addressToUse = (addrInfo == null || addrInfo.getName() == null) ? realQueueName : addrInfo.getName(); - - queueConfigBuilder = QueueConfig.builderWith(queueID, realQueueName, addressToUse); - - AddressInfo info = postOffice.getAddressInfo(addressToUse); - - RoutingType routingType = addrInfo == null ? null : addrInfo.getRoutingType(); - RoutingType rt = (routingType == null ? ActiveMQDefaultConfiguration.getDefaultRoutingType() : routingType); - if (autoCreateAddress || temporary) { + AddressInfo info = postOffice.getAddressInfo(queueConfiguration.getAddress()); + if (queueConfiguration.isAutoCreateAddress() || queueConfiguration.isTemporary()) { if (info == null) { - final AddressInfo addressInfo = new AddressInfo(addressToUse, rt) - .setAutoCreated(true) - .setTemporary(temporary) - .setInternal(addrInfo == null ? false : addrInfo.isInternal()); - addAddressInfo(addressInfo); - } else if (!info.getRoutingTypes().contains(rt)) { + addAddressInfo(new AddressInfo(queueConfiguration.getAddress(), queueConfiguration.getRoutingType()) + .setAutoCreated(true) + .setTemporary(queueConfiguration.isTemporary()) + .setInternal(queueConfiguration.isInternal())); + } else if (!info.getRoutingTypes().contains(queueConfiguration.getRoutingType())) { EnumSet routingTypes = EnumSet.copyOf(info.getRoutingTypes()); - routingTypes.add(rt); + routingTypes.add(queueConfiguration.getRoutingType()); updateAddressInfo(info.getName(), routingTypes); } } else if (info == null) { - throw ActiveMQMessageBundle.BUNDLE.addressDoesNotExist(addressToUse); - } else if (!info.getRoutingTypes().contains(rt)) { - throw ActiveMQMessageBundle.BUNDLE.invalidRoutingTypeForAddress(rt, info.getName().toString(), info.getRoutingTypes()); + throw ActiveMQMessageBundle.BUNDLE.addressDoesNotExist(queueConfiguration.getAddress()); + } else if (!info.getRoutingTypes().contains(queueConfiguration.getRoutingType())) { + throw ActiveMQMessageBundle.BUNDLE.invalidRoutingTypeForAddress(queueConfiguration.getRoutingType(), info.getName().toString(), info.getRoutingTypes()); } - final QueueConfig queueConfig = queueConfigBuilder - .filter(filter) - .pagingManager(pagingManager) - .user(user) - .durable(durable) - .temporary(temporary) - .autoCreated(autoCreated) - .routingType(rt) - .maxConsumers(maxConsumers) - .purgeOnNoConsumers(purgeOnNoConsumers) - .exclusive(exclusive) - .groupRebalance(groupRebalance) - .groupBuckets(groupBuckets) - .groupFirstKey(groupFirstKey) - .lastValue(lastValue) - .lastValueKey(lastValueKey) - .nonDestructive(nonDestructive) - .consumersBeforeDispatch(consumersBeforeDispatch) - .delayBeforeDispatch(delayBeforeDispatch) - .autoDelete(autoDelete) - .autoDeleteDelay(autoDeleteDelay) - .autoDeleteMessageCount(autoDeleteMessageCount) - .configurationManaged(configurationManaged) - .ringSize(ringSize) - .build(); - if (hasBrokerQueuePlugins()) { - callBrokerQueuePlugins(plugin -> plugin.beforeCreateQueue(queueConfig)); + callBrokerQueuePlugins(plugin -> plugin.beforeCreateQueue(queueConfiguration)); } - final Queue queue = queueFactory.createQueueWith(queueConfig); + queueConfiguration.setId(storageManager.generateID()); - if (transientQueue) { + // preemptive check to ensure the filterString is good + FilterImpl.createFilter(queueConfiguration.getFilterString()); + + final Queue queue = queueFactory.createQueueWith(queueConfiguration, pagingManager); + + if (queueConfiguration.isTransient()) { queue.setConsumersRefCount(new TransientQueueManagerImpl(this, queue.getName())); } else { queue.setConsumersRefCount(new QueueManagerImpl(this, queue.getName())); @@ -3447,7 +3471,9 @@ public class ActiveMQServerImpl implements ActiveMQServer { final QueueBinding localQueueBinding = new LocalQueueBinding(queue.getAddress(), queue, nodeManager.getNodeId()); + long txID = 0; if (queue.isDurable()) { + txID = storageManager.generateID(); storageManager.addQueueBinding(txID, localQueueBinding); } @@ -3458,15 +3484,14 @@ public class ActiveMQServerImpl implements ActiveMQServer { } } catch (Exception e) { try { - if (durable) { + if (queueConfiguration.isDurable()) { storageManager.rollbackBindings(txID); } - final PageSubscription pageSubscription = queue.getPageSubscription(); try { queue.close(); } finally { - if (pageSubscription != null) { - pageSubscription.destroy(); + if (queue.getPageSubscription() != null) { + queue.getPageSubscription().destroy(); } } } catch (Throwable ignored) { @@ -3475,7 +3500,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { throw e; } - if (addrInfo == null || !addrInfo.isInternal()) { + if (!queueConfiguration.isInternal()) { managementService.registerQueue(queue, queue.getAddress(), storageManager); } @@ -3499,6 +3524,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { } } + @Deprecated @Override public Queue createQueue(final SimpleString address, final RoutingType routingType, @@ -3528,6 +3554,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { return createQueue(new AddressInfo(address).addRoutingType(routingType), queueName, filterString, user, durable, temporary, ignoreIfExists, transientQueue, autoCreated, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, as.getDefaultGroupFirstKey(), lastValue, lastValueKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, autoDelete, autoDeleteDelay, autoDeleteMessageCount, autoCreateAddress, false, as.getDefaultRingSize()); } + @Deprecated @Override public Queue createQueue(final SimpleString address, final RoutingType routingType, @@ -3558,6 +3585,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { return createQueue(new AddressInfo(address).addRoutingType(routingType), queueName, filterString, user, durable, temporary, ignoreIfExists, transientQueue, autoCreated, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, groupFirstKey, lastValue, lastValueKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, autoDelete, autoDeleteDelay, autoDeleteMessageCount, autoCreateAddress, false, as.getDefaultRingSize()); } + @Deprecated @Override public Queue createQueue(final SimpleString address, final RoutingType routingType, @@ -3618,6 +3646,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { return updateQueue(name, routingType, null, maxConsumers, purgeOnNoConsumers, exclusive, null, null, null, null, null, user); } + @Deprecated @Override public Queue updateQueue(String name, RoutingType routingType, @@ -3634,6 +3663,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { return updateQueue(name, routingType, filterString, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, null, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, user, null); } + @Deprecated @Override public Queue updateQueue(String name, RoutingType routingType, @@ -3651,6 +3681,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { return updateQueue(name, routingType, filterString, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, groupFirstKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, user, null); } + @Deprecated @Override public Queue updateQueue(String name, RoutingType routingType, @@ -3666,29 +3697,27 @@ public class ActiveMQServerImpl implements ActiveMQServer { Long delayBeforeDispatch, String user, Long ringSize) throws Exception { - return updateQueue(name, routingType, filterString, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, groupFirstKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, user, null, ringSize); + return updateQueue(new QueueConfiguration(name) + .setRoutingType(routingType) + .setFilterString(filterString) + .setMaxConsumers(maxConsumers) + .setPurgeOnNoConsumers(purgeOnNoConsumers) + .setExclusive(exclusive) + .setGroupRebalance(groupRebalance) + .setGroupBuckets(groupBuckets) + .setGroupFirstKey(groupFirstKey) + .setNonDestructive(nonDestructive) + .setConsumersBeforeDispatch(consumersBeforeDispatch) + .setDelayBeforeDispatch(delayBeforeDispatch) + .setUser(user) + .setRingSize(ringSize)); } - private Queue updateQueue(String name, - RoutingType routingType, - String filterString, - Integer maxConsumers, - Boolean purgeOnNoConsumers, - Boolean exclusive, - Boolean groupRebalance, - Integer groupBuckets, - String groupFirstKey, - Boolean nonDestructive, - Integer consumersBeforeDispatch, - Long delayBeforeDispatch, - String user, - Boolean configurationManaged, - Long ringSize) throws Exception { - final Filter filter = FilterImpl.createFilter(filterString); - final QueueBinding queueBinding = this.postOffice.updateQueue(new SimpleString(name), routingType, filter, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, SimpleString.toSimpleString(groupFirstKey), nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, SimpleString.toSimpleString(user), configurationManaged, ringSize); + @Override + public Queue updateQueue(QueueConfiguration queueConfiguration) throws Exception { + final QueueBinding queueBinding = this.postOffice.updateQueue(queueConfiguration); if (queueBinding != null) { - final Queue queue = queueBinding.getQueue(); - return queue; + return queueBinding.getQueue(); } else { return null; } @@ -3889,7 +3918,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { configuration.setAddressesSettings(config.getAddressesSettings()); configuration.setDivertConfigurations(config.getDivertConfigurations()); configuration.setAddressConfigurations(config.getAddressConfigurations()); - configuration.setQueueConfigurations(config.getQueueConfigurations()); + configuration.setQueueConfigs(config.getQueueConfigs()); configurationReloadDeployed.set(false); if (isActive()) { deployReloadableConfigFromConfiguration(); @@ -3915,7 +3944,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { ActiveMQServerLogger.LOGGER.reloadingConfiguration("addresses"); undeployAddressesAndQueueNotInConfiguration(configuration); deployAddressesFromConfiguration(configuration); - deployQueuesFromListCoreQueueConfiguration(configuration.getQueueConfigurations()); + deployQueuesFromListQueueConfiguration(configuration.getQueueConfigs()); } } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/LastValueQueue.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/LastValueQueue.java index 5a269ab513..90cd1482c2 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/LastValueQueue.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/LastValueQueue.java @@ -25,6 +25,7 @@ import java.util.function.Consumer; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.Message; +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.filter.Filter; @@ -57,6 +58,7 @@ public class LastValueQueue extends QueueImpl { private final Map map = new ConcurrentHashMap<>(); private final SimpleString lastValueKey; + @Deprecated public LastValueQueue(final long persistenceID, final SimpleString address, final SimpleString name, @@ -89,8 +91,52 @@ public class LastValueQueue extends QueueImpl { final ArtemisExecutor executor, final ActiveMQServer server, final QueueFactory factory) { - super(persistenceID, address, name, filter, pagingStore, pageSubscription, user, durable, temporary, autoCreated, routingType, maxConsumers, exclusive, groupRebalance, groupBuckets, groupFirstKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, purgeOnNoConsumers, autoDelete, autoDeleteDelay, autoDeleteMessageCount, configurationManaged, scheduledExecutor, postOffice, storageManager, addressSettingsRepository, executor, server, factory); - this.lastValueKey = lastValueKey; + this(new QueueConfiguration(name) + .setId(persistenceID) + .setAddress(address) + .setFilterString(filter.getFilterString()) + .setUser(user) + .setDurable(durable) + .setTemporary(temporary) + .setAutoCreated(autoCreated) + .setRoutingType(routingType) + .setMaxConsumers(maxConsumers) + .setExclusive(exclusive) + .setGroupRebalance(groupRebalance) + .setGroupBuckets(groupBuckets) + .setGroupFirstKey(groupFirstKey) + .setNonDestructive(nonDestructive) + .setConsumersBeforeDispatch(consumersBeforeDispatch) + .setDelayBeforeDispatch(delayBeforeDispatch) + .setPurgeOnNoConsumers(purgeOnNoConsumers) + .setAutoDelete(autoDelete) + .setAutoDeleteDelay(autoDeleteDelay) + .setAutoDeleteMessageCount(autoDeleteMessageCount) + .setConfigurationManaged(configurationManaged) + .setLastValueKey(lastValueKey), + pagingStore, + pageSubscription, + scheduledExecutor, + postOffice, + storageManager, + addressSettingsRepository, + executor, + server, + factory); + } + + public LastValueQueue(final QueueConfiguration queueConfiguration, + final PagingStore pagingStore, + final PageSubscription pageSubscription, + final ScheduledExecutorService scheduledExecutor, + final PostOffice postOffice, + final StorageManager storageManager, + final HierarchicalRepository addressSettingsRepository, + final ArtemisExecutor executor, + final ActiveMQServer server, + final QueueFactory factory) { + super(queueConfiguration, pagingStore, pageSubscription, scheduledExecutor, postOffice, storageManager, addressSettingsRepository, executor, server, factory); + this.lastValueKey = queueConfiguration.getLastValueKey(); } @Override @@ -165,6 +211,11 @@ public class LastValueQueue extends QueueImpl { return false; } + @Override + public QueueConfiguration getQueueConfiguration() { + return super.getQueueConfiguration().setLastValue(true); + } + private void replaceLVQMessage(MessageReference ref, HolderReference hr) { MessageReference oldRef = hr.getReference(); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/PostOfficeJournalLoader.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/PostOfficeJournalLoader.java index 26be7dce8e..db6a55a107 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/PostOfficeJournalLoader.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/PostOfficeJournalLoader.java @@ -27,9 +27,10 @@ import java.util.concurrent.atomic.AtomicLong; import org.apache.activemq.artemis.api.core.Message; import org.apache.activemq.artemis.api.core.Pair; +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.config.Configuration; -import org.apache.activemq.artemis.core.filter.Filter; import org.apache.activemq.artemis.core.filter.FilterUtils; import org.apache.activemq.artemis.core.filter.impl.FilterImpl; import org.apache.activemq.artemis.core.journal.Journal; @@ -39,9 +40,9 @@ import org.apache.activemq.artemis.core.paging.PagingStore; import org.apache.activemq.artemis.core.paging.cursor.PageSubscriptionCounter; import org.apache.activemq.artemis.core.paging.impl.Page; import org.apache.activemq.artemis.core.persistence.AddressBindingInfo; +import org.apache.activemq.artemis.core.persistence.AddressQueueStatus; import org.apache.activemq.artemis.core.persistence.GroupingInfo; import org.apache.activemq.artemis.core.persistence.QueueBindingInfo; -import org.apache.activemq.artemis.core.persistence.AddressQueueStatus; import org.apache.activemq.artemis.core.persistence.StorageManager; import org.apache.activemq.artemis.core.persistence.impl.PageCountPending; import org.apache.activemq.artemis.core.persistence.impl.journal.AddMessageRecord; @@ -55,9 +56,7 @@ import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; import org.apache.activemq.artemis.core.server.MessageReference; import org.apache.activemq.artemis.core.server.NodeManager; import org.apache.activemq.artemis.core.server.Queue; -import org.apache.activemq.artemis.core.server.QueueConfig; import org.apache.activemq.artemis.core.server.QueueFactory; -import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.core.server.group.GroupingHandler; import org.apache.activemq.artemis.core.server.group.impl.GroupBinding; import org.apache.activemq.artemis.core.server.management.ManagementService; @@ -121,13 +120,9 @@ public class PostOfficeJournalLoader implements JournalLoader { for (final QueueBindingInfo queueBindingInfo : queueBindingInfos) { queueBindingInfosMap.put(queueBindingInfo.getId(), queueBindingInfo); - final Filter filter = FilterImpl.createFilter(queueBindingInfo.getFilterString()); - - final boolean isTopicIdentification = FilterUtils.isTopicIdentification(filter); - if (postOffice.getBinding(queueBindingInfo.getQueueName()) != null) { - if (isTopicIdentification) { + if (FilterUtils.isTopicIdentification(FilterImpl.createFilter(queueBindingInfo.getFilterString()))) { final long tx = storageManager.generateID(); storageManager.deleteQueueBinding(tx, queueBindingInfo.getId()); storageManager.commitBindings(tx); @@ -138,35 +133,34 @@ public class PostOfficeJournalLoader implements JournalLoader { queueBindingInfo.replaceQueueName(newName); } } - final QueueConfig.Builder queueConfigBuilder; - if (queueBindingInfo.getAddress() == null) { - queueConfigBuilder = QueueConfig.builderWith(queueBindingInfo.getId(), queueBindingInfo.getQueueName()); - } else { - queueConfigBuilder = QueueConfig.builderWith(queueBindingInfo.getId(), queueBindingInfo.getQueueName(), queueBindingInfo.getAddress()); - } - queueConfigBuilder.filter(filter).pagingManager(pagingManager) - .user(queueBindingInfo.getUser()) - .durable(true) - .temporary(false) - .autoCreated(queueBindingInfo.isAutoCreated()) - .purgeOnNoConsumers(queueBindingInfo.isPurgeOnNoConsumers()) - .maxConsumers(queueBindingInfo.getMaxConsumers()) - .exclusive(queueBindingInfo.isExclusive()) - .groupRebalance(queueBindingInfo.isGroupRebalance()) - .groupBuckets(queueBindingInfo.getGroupBuckets()) - .groupFirstKey(queueBindingInfo.getGroupFirstKey()) - .lastValue(queueBindingInfo.isLastValue()) - .lastValueKey(queueBindingInfo.getLastValueKey()) - .nonDestructive(queueBindingInfo.isNonDestructive()) - .consumersBeforeDispatch(queueBindingInfo.getConsumersBeforeDispatch()) - .delayBeforeDispatch(queueBindingInfo.getDelayBeforeDispatch()) - .autoDelete(queueBindingInfo.isAutoDelete()) - .autoDeleteDelay(queueBindingInfo.getAutoDeleteDelay()) - .autoDeleteMessageCount(queueBindingInfo.getAutoDeleteMessageCount()) - .routingType(RoutingType.getType(queueBindingInfo.getRoutingType())) - .configurationManaged((queueBindingInfo.isConfigurationManaged())) - .ringSize(queueBindingInfo.getRingSize()); - final Queue queue = queueFactory.createQueueWith(queueConfigBuilder.build()); + + final Queue queue = queueFactory.createQueueWith(new QueueConfiguration(queueBindingInfo.getQueueName()) + .setId(queueBindingInfo.getId()) + .setAddress(queueBindingInfo.getAddress()) + .setFilterString(queueBindingInfo.getFilterString()) + .setUser(queueBindingInfo.getUser()) + .setDurable(true) + .setTemporary(false) + .setAutoCreated(queueBindingInfo.isAutoCreated()) + .setPurgeOnNoConsumers(queueBindingInfo.isPurgeOnNoConsumers()) + .setMaxConsumers(queueBindingInfo.getMaxConsumers()) + .setExclusive(queueBindingInfo.isExclusive()) + .setGroupRebalance(queueBindingInfo.isGroupRebalance()) + .setGroupBuckets(queueBindingInfo.getGroupBuckets()) + .setGroupFirstKey(queueBindingInfo.getGroupFirstKey()) + .setLastValue(queueBindingInfo.isLastValue()) + .setLastValueKey(queueBindingInfo.getLastValueKey()) + .setNonDestructive(queueBindingInfo.isNonDestructive()) + .setConsumersBeforeDispatch(queueBindingInfo.getConsumersBeforeDispatch()) + .setDelayBeforeDispatch(queueBindingInfo.getDelayBeforeDispatch()) + .setAutoDelete(queueBindingInfo.isAutoDelete()) + .setAutoDeleteDelay(queueBindingInfo.getAutoDeleteDelay()) + .setAutoDeleteMessageCount(queueBindingInfo.getAutoDeleteMessageCount()) + .setRoutingType(RoutingType.getType(queueBindingInfo.getRoutingType())) + .setConfigurationManaged(queueBindingInfo.isConfigurationManaged()) + .setRingSize(queueBindingInfo.getRingSize()), + pagingManager); + queue.setConsumersRefCount(new QueueManagerImpl(((PostOfficeImpl)postOffice).getServer(), queueBindingInfo.getQueueName())); if (queueBindingInfo.getQueueStatusEncodings() != null) { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueConfigurationUtils.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueConfigurationUtils.java new file mode 100644 index 0000000000..c4d9cb02ac --- /dev/null +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueConfigurationUtils.java @@ -0,0 +1,47 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.activemq.artemis.core.server.impl; + +import org.apache.activemq.artemis.api.core.QueueConfiguration; +import org.apache.activemq.artemis.core.settings.impl.AddressSettings; + +public class QueueConfigurationUtils { + + public static void applyDynamicQueueDefaults(QueueConfiguration config, AddressSettings as) { + config.setMaxConsumers(config.getMaxConsumers() == null ? as.getDefaultMaxConsumers() : config.getMaxConsumers()); + config.setExclusive(config.isExclusive() == null ? as.isDefaultExclusiveQueue() : config.isExclusive()); + config.setGroupRebalance(config.isGroupRebalance() == null ? as.isDefaultGroupRebalance() : config.isGroupRebalance()); + config.setGroupBuckets(config.getGroupBuckets() == null ? as.getDefaultGroupBuckets() : config.getGroupBuckets()); + config.setGroupFirstKey(config.getGroupFirstKey() == null ? as.getDefaultGroupFirstKey() : config.getGroupFirstKey()); + config.setLastValue(config.isLastValue() == null ? as.isDefaultLastValueQueue() : config.isLastValue()); + config.setLastValueKey(config.getLastValueKey() == null ? as.getDefaultLastValueKey() : config.getLastValueKey()); + config.setNonDestructive(config.isNonDestructive() == null ? as.isDefaultNonDestructive() : config.isNonDestructive()); + config.setConsumersBeforeDispatch(config.getConsumersBeforeDispatch() == null ? as.getDefaultConsumersBeforeDispatch() : config.getConsumersBeforeDispatch()); + config.setDelayBeforeDispatch(config.getDelayBeforeDispatch() == null ? as.getDefaultDelayBeforeDispatch() : config.getDelayBeforeDispatch()); + config.setRingSize(config.getRingSize() == null ? as.getDefaultRingSize() : config.getRingSize()); + config.setRoutingType(config.getRoutingType() == null ? as.getDefaultQueueRoutingType() : config.getRoutingType()); + config.setPurgeOnNoConsumers(config.isPurgeOnNoConsumers() == null ? as.isDefaultPurgeOnNoConsumers() : config.isPurgeOnNoConsumers()); + config.setAutoCreateAddress(config.isAutoCreateAddress() == null ? as.isAutoCreateAddresses() : config.isAutoCreateAddress()); + + // only set the default auto-delete on auto-created queues + config.setAutoDelete(config.isAutoDelete() == null ? config.isAutoCreated() && as.isAutoDeleteQueues() : config.isAutoDelete()); + + config.setAutoDeleteDelay(config.getAutoDeleteDelay() == null ? as.getAutoDeleteQueuesDelay() : config.getAutoDeleteDelay()); + config.setAutoDeleteMessageCount(config.getAutoDeleteMessageCount() == null ? as.getAutoDeleteQueuesMessageCount() : config.getAutoDeleteMessageCount()); + } +} diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueFactoryImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueFactoryImpl.java index ecfc86d29f..13e3c313b3 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueFactoryImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueFactoryImpl.java @@ -20,8 +20,12 @@ import java.util.concurrent.ScheduledExecutorService; import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; import org.apache.activemq.artemis.api.core.Message; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.core.filter.Filter; +import org.apache.activemq.artemis.core.filter.impl.FilterImpl; +import org.apache.activemq.artemis.core.paging.PagingManager; +import org.apache.activemq.artemis.core.paging.PagingStore; import org.apache.activemq.artemis.core.paging.cursor.PageSubscription; import org.apache.activemq.artemis.core.persistence.StorageManager; import org.apache.activemq.artemis.core.postoffice.PostOffice; @@ -71,6 +75,7 @@ public class QueueFactoryImpl implements QueueFactory { this.postOffice = postOffice; } + @Deprecated @Override public Queue createQueueWith(final QueueConfig config) { final Queue queue; @@ -83,6 +88,20 @@ public class QueueFactoryImpl implements QueueFactory { return queue; } + @Override + public Queue createQueueWith(final QueueConfiguration config, PagingManager pagingManager) { + validateState(config); + final Queue queue; + PageSubscription pageSubscription = getPageSubscription(config, pagingManager); + if (lastValueKey(config) != null) { + queue = new LastValueQueue(config.setLastValueKey(lastValueKey(config)), pageSubscription != null ? pageSubscription.getPagingStore() : null, pageSubscription, scheduledExecutor, postOffice, storageManager, addressSettingsRepository, executorFactory.getExecutor(), server, this); + } else { + queue = new QueueImpl(config, pageSubscription != null ? pageSubscription.getPagingStore() : null, pageSubscription, scheduledExecutor, postOffice, storageManager, addressSettingsRepository, executorFactory.getExecutor(), server, this); + } + server.getCriticalAnalyzer().add(queue); + return queue; + } + @Deprecated @Override public Queue createQueue(final long persistenceID, @@ -112,6 +131,28 @@ public class QueueFactoryImpl implements QueueFactory { return queue; } + @Override + public void queueRemoved(Queue queue) { + server.getCriticalAnalyzer().remove(queue); + } + + public static PageSubscription getPageSubscription(QueueConfiguration queueConfiguration, PagingManager pagingManager) { + PageSubscription pageSubscription; + + try { + PagingStore pageStore = pagingManager.getPageStore(queueConfiguration.getAddress()); + if (pageStore != null) { + pageSubscription = pageStore.getCursorProvider().createSubscription(queueConfiguration.getId(), FilterImpl.createFilter(queueConfiguration.getFilterString()), queueConfiguration.isDurable()); + } else { + pageSubscription = null; + } + } catch (Exception e) { + throw new IllegalStateException(e); + } + + return pageSubscription; + } + private static SimpleString lastValueKey(final QueueConfig config) { if (config.lastValueKey() != null && !config.lastValueKey().isEmpty()) { return config.lastValueKey(); @@ -122,6 +163,16 @@ public class QueueFactoryImpl implements QueueFactory { } } + private static SimpleString lastValueKey(final QueueConfiguration config) { + if (config.getLastValueKey() != null && !config.getLastValueKey().isEmpty()) { + return config.getLastValueKey(); + } else if (config.isLastValue()) { + return Message.HDR_LAST_VALUE_NAME; + } else { + return null; + } + } + private static SimpleString lastValueKey(final AddressSettings addressSettings) { if (addressSettings.getDefaultLastValueKey() != null && !addressSettings.getDefaultLastValueKey().isEmpty()) { return addressSettings.getDefaultLastValueKey(); @@ -132,8 +183,16 @@ public class QueueFactoryImpl implements QueueFactory { } } - @Override - public void queueRemoved(Queue queue) { - server.getCriticalAnalyzer().remove(queue); + private void validateState(QueueConfiguration config) { + if (isEmptyOrNull(config.getName())) { + throw new IllegalStateException("name can't be null or empty!"); + } + if (isEmptyOrNull(config.getAddress())) { + throw new IllegalStateException("address can't be null or empty!"); + } + } + + private static boolean isEmptyOrNull(SimpleString value) { + return (value == null || value.length() == 0); } } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java index d7c93adbfa..344daaee0a 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java @@ -47,6 +47,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQNullRefException; import org.apache.activemq.artemis.api.core.Message; import org.apache.activemq.artemis.api.core.Pair; +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.api.core.management.CoreNotificationType; @@ -55,6 +56,7 @@ import org.apache.activemq.artemis.api.core.management.QueueControl; import org.apache.activemq.artemis.api.core.management.ResourceNames; import org.apache.activemq.artemis.core.PriorityAware; import org.apache.activemq.artemis.core.filter.Filter; +import org.apache.activemq.artemis.core.filter.impl.FilterImpl; import org.apache.activemq.artemis.core.io.IOCallback; import org.apache.activemq.artemis.core.paging.PagingStore; import org.apache.activemq.artemis.core.paging.cursor.PageIterator; @@ -358,6 +360,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { return str.toString(); } + @Deprecated public QueueImpl(final long id, final SimpleString address, final SimpleString name, @@ -376,6 +379,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { this(id, address, name, filter, null, null, user, durable, temporary, autoCreated, scheduledExecutor, postOffice, storageManager, addressSettingsRepository, executor, server, factory); } + @Deprecated public QueueImpl(final long id, final SimpleString address, final SimpleString name, @@ -396,6 +400,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { this(id, address, name, filter, pagingStore, pageSubscription, user, durable, temporary, autoCreated, RoutingType.MULTICAST, null, null, scheduledExecutor, postOffice, storageManager, addressSettingsRepository, executor, server, factory); } + @Deprecated public QueueImpl(final long id, final SimpleString address, final SimpleString name, @@ -419,6 +424,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { this(id, address, name, filter, pagingStore, pageSubscription, user, durable, temporary, autoCreated, routingType, maxConsumers, null, purgeOnNoConsumers, scheduledExecutor, postOffice, storageManager, addressSettingsRepository, executor, server, factory); } + @Deprecated public QueueImpl(final long id, final SimpleString address, final SimpleString name, @@ -443,6 +449,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { this(id, address, name, filter, pagingStore, pageSubscription, user, durable, temporary, autoCreated, routingType, maxConsumers, exclusive, null, null, false, null, null, purgeOnNoConsumers, null, null, null, false, scheduledExecutor, postOffice, storageManager, addressSettingsRepository, executor, server, factory); } + @Deprecated public QueueImpl(final long id, final SimpleString address, final SimpleString name, @@ -476,6 +483,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { this(id, address, name, filter, pagingStore, pageSubscription, user, durable, temporary, autoCreated, routingType, maxConsumers, exclusive, groupRebalance, groupBuckets, null, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, purgeOnNoConsumers, autoDelete, autoDeleteDelay, autoDeleteMessageCount, configurationManaged, scheduledExecutor, postOffice, storageManager, addressSettingsRepository, executor, server, factory); } + @Deprecated public QueueImpl(final long id, final SimpleString address, final SimpleString name, @@ -510,6 +518,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { this(id, address, name, filter, pagingStore, pageSubscription, user, durable, temporary, autoCreated, routingType, maxConsumers, exclusive, groupRebalance, groupBuckets, groupFirstKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, purgeOnNoConsumers, autoDelete, autoDeleteDelay, autoDeleteMessageCount, configurationManaged, null, scheduledExecutor, postOffice, storageManager, addressSettingsRepository, executor, server, factory); } + @Deprecated public QueueImpl(final long id, final SimpleString address, final SimpleString name, @@ -542,57 +551,106 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { final ArtemisExecutor executor, final ActiveMQServer server, final QueueFactory factory) { + this(new QueueConfiguration(name) + .setId(id) + .setAddress(address) + .setFilterString(filter == null ? null : filter.getFilterString()) + .setUser(user) + .setDurable(durable) + .setTemporary(temporary) + .setAutoCreated(autoCreated) + .setRoutingType(routingType) + .setMaxConsumers(maxConsumers) + .setExclusive(exclusive) + .setGroupRebalance(groupRebalance) + .setGroupBuckets(groupBuckets) + .setGroupFirstKey(groupFirstKey) + .setNonDestructive(nonDestructive) + .setConsumersBeforeDispatch(consumersBeforeDispatch) + .setDelayBeforeDispatch(delayBeforeDispatch) + .setPurgeOnNoConsumers(purgeOnNoConsumers) + .setAutoDelete(autoDelete) + .setAutoDeleteDelay(autoDeleteDelay) + .setAutoDeleteMessageCount(autoDeleteMessageCount) + .setConfigurationManaged(configurationManaged) + .setRingSize(ringSize), + pagingStore, + pageSubscription, + scheduledExecutor, + postOffice, + storageManager, + addressSettingsRepository, + executor, + server, + factory); + this.filter = filter; + } + + public QueueImpl(final QueueConfiguration queueConfiguration, + final PagingStore pagingStore, + final PageSubscription pageSubscription, + final ScheduledExecutorService scheduledExecutor, + final PostOffice postOffice, + final StorageManager storageManager, + final HierarchicalRepository addressSettingsRepository, + final ArtemisExecutor executor, + final ActiveMQServer server, + final QueueFactory factory) { super(server == null ? EmptyCriticalAnalyzer.getInstance() : server.getCriticalAnalyzer(), CRITICAL_PATHS); - this.id = id; + this.id = queueConfiguration.getId(); - this.address = address; + this.address = queueConfiguration.getAddress(); this.addressInfo = postOffice == null ? null : postOffice.getAddressInfo(address); - this.routingType = routingType; + this.routingType = queueConfiguration.getRoutingType(); - this.name = name; + this.name = queueConfiguration.getName(); - this.filter = filter; + try { + this.filter = filter == null ? FilterImpl.createFilter(queueConfiguration.getFilterString()) : filter; + } catch (ActiveMQException e) { + throw new RuntimeException(e); + } this.pagingStore = pagingStore; this.pageSubscription = pageSubscription; - this.propertyDurable = durable; + this.propertyDurable = queueConfiguration.isDurable(); - this.temporary = temporary; + this.temporary = queueConfiguration.isTemporary(); - this.autoCreated = autoCreated; + this.autoCreated = queueConfiguration.isAutoCreated(); - this.maxConsumers = maxConsumers == null ? ActiveMQDefaultConfiguration.getDefaultMaxQueueConsumers() : maxConsumers; + this.maxConsumers = queueConfiguration.getMaxConsumers() == null ? ActiveMQDefaultConfiguration.getDefaultMaxQueueConsumers() : queueConfiguration.getMaxConsumers(); - this.exclusive = exclusive == null ? ActiveMQDefaultConfiguration.getDefaultExclusive() : exclusive; + this.exclusive = queueConfiguration.isExclusive() == null ? ActiveMQDefaultConfiguration.getDefaultExclusive() : queueConfiguration.isExclusive(); - this.nonDestructive = nonDestructive == null ? ActiveMQDefaultConfiguration.getDefaultNonDestructive() : nonDestructive; + this.nonDestructive = queueConfiguration.isNonDestructive() == null ? ActiveMQDefaultConfiguration.getDefaultNonDestructive() : queueConfiguration.isNonDestructive(); - this.purgeOnNoConsumers = purgeOnNoConsumers == null ? ActiveMQDefaultConfiguration.getDefaultPurgeOnNoConsumers() : purgeOnNoConsumers; + this.purgeOnNoConsumers = queueConfiguration.isPurgeOnNoConsumers() == null ? ActiveMQDefaultConfiguration.getDefaultPurgeOnNoConsumers() : queueConfiguration.isPurgeOnNoConsumers(); - this.consumersBeforeDispatch = consumersBeforeDispatch == null ? ActiveMQDefaultConfiguration.getDefaultConsumersBeforeDispatch() : consumersBeforeDispatch; + this.consumersBeforeDispatch = queueConfiguration.getConsumersBeforeDispatch() == null ? ActiveMQDefaultConfiguration.getDefaultConsumersBeforeDispatch() : queueConfiguration.getConsumersBeforeDispatch(); - this.delayBeforeDispatch = delayBeforeDispatch == null ? ActiveMQDefaultConfiguration.getDefaultDelayBeforeDispatch() : delayBeforeDispatch; + this.delayBeforeDispatch = queueConfiguration.getDelayBeforeDispatch() == null ? ActiveMQDefaultConfiguration.getDefaultDelayBeforeDispatch() : queueConfiguration.getDelayBeforeDispatch(); - this.groupRebalance = groupRebalance == null ? ActiveMQDefaultConfiguration.getDefaultGroupRebalance() : groupRebalance; + this.groupRebalance = queueConfiguration.isGroupRebalance() == null ? ActiveMQDefaultConfiguration.getDefaultGroupRebalance() : queueConfiguration.isGroupRebalance(); - this.groupBuckets = groupBuckets == null ? ActiveMQDefaultConfiguration.getDefaultGroupBuckets() : groupBuckets; + this.groupBuckets = queueConfiguration.getGroupBuckets() == null ? ActiveMQDefaultConfiguration.getDefaultGroupBuckets() : queueConfiguration.getGroupBuckets(); this.groups = groupMap(this.groupBuckets); - this.groupFirstKey = groupFirstKey == null ? ActiveMQDefaultConfiguration.getDefaultGroupFirstKey() : groupFirstKey; + this.groupFirstKey = queueConfiguration.getGroupFirstKey() == null ? ActiveMQDefaultConfiguration.getDefaultGroupFirstKey() : queueConfiguration.getGroupFirstKey(); - this.autoDelete = autoDelete == null ? ActiveMQDefaultConfiguration.getDefaultQueueAutoDelete(autoCreated) : autoDelete; + this.autoDelete = queueConfiguration.isAutoDelete() == null ? ActiveMQDefaultConfiguration.getDefaultQueueAutoDelete(autoCreated) : queueConfiguration.isAutoDelete(); - this.autoDeleteDelay = autoDeleteDelay == null ? ActiveMQDefaultConfiguration.getDefaultQueueAutoDeleteDelay() : autoDeleteDelay; + this.autoDeleteDelay = queueConfiguration.getAutoDeleteDelay() == null ? ActiveMQDefaultConfiguration.getDefaultQueueAutoDeleteDelay() : queueConfiguration.getAutoDeleteDelay(); - this.autoDeleteMessageCount = autoDeleteMessageCount == null ? ActiveMQDefaultConfiguration.getDefaultQueueAutoDeleteMessageCount() : autoDeleteMessageCount; + this.autoDeleteMessageCount = queueConfiguration.getAutoDeleteMessageCount() == null ? ActiveMQDefaultConfiguration.getDefaultQueueAutoDeleteMessageCount() : queueConfiguration.getAutoDeleteMessageCount(); - this.configurationManaged = configurationManaged; + this.configurationManaged = queueConfiguration.isConfigurationManaged(); this.postOffice = postOffice; @@ -622,7 +680,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { this.executor = executor; - this.user = user; + this.user = queueConfiguration.getUser(); this.factory = factory; @@ -631,7 +689,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { this.pause(false); } - this.ringSize = ringSize == null ? ActiveMQDefaultConfiguration.getDefaultRingSize() : ringSize; + this.ringSize = queueConfiguration.getRingSize() == null ? ActiveMQDefaultConfiguration.getDefaultRingSize() : queueConfiguration.getRingSize(); } // Bindable implementation ------------------------------------------------------------------------------------- @@ -3437,7 +3495,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { if (addressSettings.getDeadLetterAddress() != null && addressSettings.getDeadLetterAddress().length() != 0) { SimpleString dlqName = addressSettings.getDeadLetterQueuePrefix().concat(getAddress()).concat(addressSettings.getDeadLetterQueueSuffix()); SimpleString dlqFilter = new SimpleString(String.format("%s = '%s'", Message.HDR_ORIGINAL_ADDRESS, getAddress())); - server.createQueue(addressSettings.getDeadLetterAddress(), RoutingType.MULTICAST, dlqName, dlqFilter, null, true, false, true, false, true, addressSettings.getDefaultMaxConsumers(), addressSettings.isDefaultPurgeOnNoConsumers(), addressSettings.isDefaultExclusiveQueue(), addressSettings.isDefaultLastValueQueue(), true); + server.createQueue(new QueueConfiguration(dlqName).setAddress(addressSettings.getDeadLetterAddress()).setFilterString(dlqFilter).setAutoCreated(true).setAutoCreateAddress(true), true); } } } @@ -3448,7 +3506,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { if (addressSettings.getExpiryAddress() != null && addressSettings.getExpiryAddress().length() != 0) { SimpleString expiryQueueName = addressSettings.getExpiryQueuePrefix().concat(getAddress()).concat(addressSettings.getExpiryQueueSuffix()); SimpleString expiryFilter = new SimpleString(String.format("%s = '%s'", Message.HDR_ORIGINAL_ADDRESS, getAddress())); - server.createQueue(addressSettings.getExpiryAddress(), RoutingType.MULTICAST, expiryQueueName, expiryFilter, null, true, false, true, false, true, addressSettings.getDefaultMaxConsumers(), addressSettings.isDefaultPurgeOnNoConsumers(), addressSettings.isDefaultExclusiveQueue(), addressSettings.isDefaultLastValueQueue(), true); + server.createQueue(new QueueConfiguration(expiryQueueName).setAddress(addressSettings.getExpiryAddress()).setFilterString(expiryFilter).setAutoCreated(true).setAutoCreateAddress(true), true); } } } @@ -3864,6 +3922,37 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { } } + @Override + public QueueConfiguration getQueueConfiguration() { + return new QueueConfiguration(name) + .setAddress(address) + .setId(id) + .setRoutingType(routingType) + .setFilterString(filter.getFilterString()) + .setDurable(isDurable()) + .setUser(user) + .setMaxConsumers(maxConsumers) + .setExclusive(exclusive) + .setGroupRebalance(groupRebalance) + .setGroupBuckets(groupBuckets) + .setGroupFirstKey(groupFirstKey) + .setLastValue(false) + .setLastValue(null) + .setNonDestructive(nonDestructive) + .setPurgeOnNoConsumers(purgeOnNoConsumers) + .setConsumersBeforeDispatch(consumersBeforeDispatch) + .setDelayBeforeDispatch(delayBeforeDispatch) + .setAutoDelete(autoDelete) + .setAutoDeleteDelay(autoDeleteDelay) + .setAutoDeleteMessageCount(autoDeleteMessageCount) + .setRingSize(ringSize) + .setConfigurationManaged(configurationManaged) + .setTemporary(temporary) + .setInternal(internalQueue) + .setTransient(refCountForConsumers instanceof TransientQueueManagerImpl) + .setAutoCreated(autoCreated); + } + // Inner classes // -------------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java index db51dcc42a..fe3b4624c3 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java @@ -31,6 +31,7 @@ import java.util.TreeSet; import org.apache.activemq.artemis.api.core.Message; import org.apache.activemq.artemis.api.core.Pair; +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.api.core.client.ClientMessage; @@ -453,7 +454,7 @@ public class ScaleDownHandler { RoutingType routingType) throws Exception { long queueID = getQueueID(session, queue.getName()); if (queueID == -1) { - session.createQueue(addressName, routingType, queue.getName(), queue.getFilter() == null ? null : queue.getFilter().getFilterString(), queue.isDurable()); + session.createQueue(new QueueConfiguration(queue.getName()).setAddress(addressName).setRoutingType(routingType).setFilterString(queue.getFilter() == null ? null : queue.getFilter().getFilterString()).setDurable(queue.isDurable())); logger.debug("Failed to get queue ID, creating queue [addressName=" + addressName + ", queueName=" + queue.getName() + ", routingType=" + queue.getRoutingType() + ", filter=" + (queue.getFilter() == null ? "" : queue.getFilter().getFilterString()) + ", durable=" + queue.isDurable() + "]"); queueID = getQueueID(session, queue.getName()); } 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 d32a8efa61..6f7d9b91a5 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 @@ -42,6 +42,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQIllegalStateException; import org.apache.activemq.artemis.api.core.ActiveMQNonExistentQueueException; import org.apache.activemq.artemis.api.core.Message; import org.apache.activemq.artemis.api.core.Pair; +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.api.core.management.CoreNotificationType; @@ -623,6 +624,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener { this.autoCommitSends = transaction == null; } + @Deprecated @Override public Queue createQueue(final SimpleString address, final SimpleString name, @@ -633,6 +635,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener { return createQueue(address, name, as.getDefaultQueueRoutingType(), filterString, temporary, durable, as.getDefaultMaxConsumers(), as.isDefaultPurgeOnNoConsumers(), false); } + @Deprecated @Override public Queue createQueue(final SimpleString address, final SimpleString name, @@ -644,12 +647,14 @@ public class ServerSessionImpl implements ServerSession, FailureListener { return createQueue(address, name, routingType, filterString, temporary, durable, as.getDefaultMaxConsumers(), as.isDefaultPurgeOnNoConsumers(), false); } + @Deprecated @Override public Queue createQueue(AddressInfo addressInfo, SimpleString name, SimpleString filterString, boolean temporary, boolean durable) throws Exception { AddressSettings as = server.getAddressSettingsRepository().getMatch(addressInfo.getName().toString()); return createQueue(addressInfo, name, filterString, temporary, durable, as.getDefaultMaxConsumers(), as.isDefaultPurgeOnNoConsumers(), as.isDefaultExclusiveQueue(), as.isDefaultGroupRebalance(), as.getDefaultGroupBuckets(), as.getDefaultGroupFirstKey(), as.isDefaultLastValueQueue(), as.getDefaultLastValueKey(), as.isDefaultNonDestructive(), as.getDefaultConsumersBeforeDispatch(), as.getDefaultDelayBeforeDispatch(), ActiveMQServerImpl.isAutoDelete(false, as), as.getAutoDeleteQueuesDelay(), as.getAutoDeleteQueuesMessageCount(), false, ActiveMQDefaultConfiguration.getDefaultRingSize()); } + @Deprecated public Queue createQueue(final AddressInfo addressInfo, final SimpleString name, final SimpleString filterString, @@ -671,40 +676,67 @@ public class ServerSessionImpl implements ServerSession, FailureListener { final long autoDeleteMessageCount, final boolean autoCreated, final long ringSize) throws Exception { + return createQueue(new QueueConfiguration(name) + .setAddress(addressInfo.getName()) + .setRoutingType(addressInfo.getRoutingType()) + .setFilterString(filterString) + .setUser(getUsername()) + .setDurable(durable) + .setTemporary(temporary) + .setAutoCreated(autoCreated) + .setMaxConsumers(maxConsumers) + .setPurgeOnNoConsumers(purgeOnNoConsumers) + .setExclusive(exclusive) + .setGroupRebalance(groupRebalance) + .setGroupBuckets(groupBuckets) + .setGroupFirstKey(groupFirstKey) + .setLastValue(lastValue) + .setLastValueKey(lastValueKey) + .setNonDestructive(nonDestructive) + .setConsumersBeforeDispatch(consumersBeforeDispatch) + .setDelayBeforeDispatch(delayBeforeDispatch) + .setAutoDelete(autoDelete) + .setAutoDeleteDelay(autoDeleteDelay) + .setAutoDeleteMessageCount(autoDeleteMessageCount) + .setRingSize(ringSize)); + } + + @Override + public Queue createQueue(QueueConfiguration queueConfiguration) throws Exception { if (AuditLogger.isEnabled()) { - AuditLogger.createQueue(this, getUsername(), addressInfo, name, filterString, temporary, durable, maxConsumers, purgeOnNoConsumers, - exclusive, groupRebalance, groupBuckets, groupFirstKey, lastValue, lastValueKey, nonDestructive, consumersBeforeDispatch, - delayBeforeDispatch, autoDelete, autoDeleteDelay, autoDeleteMessageCount, autoCreated); + AuditLogger.createQueue(this, getUsername(), queueConfiguration); } - final SimpleString unPrefixedName = removePrefix(name); - AddressInfo art = getAddressAndRoutingType(addressInfo); + queueConfiguration + .setRoutingType(getRoutingTypeFromPrefix(queueConfiguration.getAddress(), queueConfiguration.getRoutingType())) + .setAddress(removePrefix(queueConfiguration.getAddress())) + .setName(removePrefix(queueConfiguration.getName())); - if (durable) { + if (queueConfiguration.isDurable()) { // make sure the user has privileges to create this queue - securityCheck(art.getName(), unPrefixedName, CheckType.CREATE_DURABLE_QUEUE, this); + securityCheck(queueConfiguration.getAddress(), queueConfiguration.getName(), CheckType.CREATE_DURABLE_QUEUE, this); } else { - securityCheck(art.getName(), unPrefixedName, CheckType.CREATE_NON_DURABLE_QUEUE, this); + securityCheck(queueConfiguration.getAddress(), queueConfiguration.getName(), CheckType.CREATE_NON_DURABLE_QUEUE, this); } - AddressSettings as = server.getAddressSettingsRepository().getMatch(art.getName().toString()); + AddressSettings as = server.getAddressSettingsRepository().getMatch(queueConfiguration.getAddress().toString()); - if (as.isAutoCreateAddresses() && server.getAddressInfo(art.getName()) == null) { - securityCheck(art.getName(), unPrefixedName, CheckType.CREATE_ADDRESS, this); + if (as.isAutoCreateAddresses() && server.getAddressInfo(queueConfiguration.getAddress()) == null) { + securityCheck(queueConfiguration.getAddress(), queueConfiguration.getName(), CheckType.CREATE_ADDRESS, this); } server.checkQueueCreationLimit(getUsername()); - Queue queue = server.createQueue(art, unPrefixedName, filterString, SimpleString.toSimpleString(getUsername()), durable, temporary, autoCreated, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, groupFirstKey, lastValue, lastValueKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, autoDelete, autoDeleteDelay, autoDeleteMessageCount, as.isAutoCreateAddresses(), ringSize); + Queue queue = server.createQueue(queueConfiguration.setUser(getUsername())); - if (temporary) { + if (queueConfiguration.isTemporary()) { // Temporary queue in core simply means the queue will be deleted if // the remoting connection // dies. It does not mean it will get deleted automatically when the // session is closed. // It is up to the user to delete the queue when finished with it - TempQueueCleanerUpper cleaner = new TempQueueCleanerUpper(server, unPrefixedName); + TempQueueCleanerUpper cleaner = new TempQueueCleanerUpper(server, queueConfiguration.getName()); if (remotingConnection instanceof TempQueueObserver) { cleaner.setObserver((TempQueueObserver) remotingConnection); } @@ -712,18 +744,19 @@ public class ServerSessionImpl implements ServerSession, FailureListener { remotingConnection.addCloseListener(cleaner); remotingConnection.addFailureListener(cleaner); - tempQueueCleannerUppers.put(unPrefixedName, cleaner); + tempQueueCleannerUppers.put(queueConfiguration.getName(), cleaner); } if (logger.isDebugEnabled()) { - logger.debug("Queue " + unPrefixedName + " created on address " + addressInfo.getName() + - " with filter=" + filterString + " temporary = " + - temporary + " durable=" + durable + " on session user=" + this.username + ", connection=" + this.remotingConnection); + logger.debug("Queue " + queueConfiguration.getName() + " created on address " + queueConfiguration.getAddress() + + " with filter=" + queueConfiguration.getFilterString() + " temporary = " + + queueConfiguration.isTemporary() + " durable=" + queueConfiguration.isDurable() + " on session user=" + this.username + ", connection=" + this.remotingConnection); } return queue; } + @Deprecated @Override public Queue createQueue(final SimpleString address, final SimpleString name, @@ -738,6 +771,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener { return createQueue(new AddressInfo(address, routingType), name, filterString, temporary, durable, maxConsumers, purgeOnNoConsumers, as.isDefaultExclusiveQueue(), as.isDefaultGroupRebalance(), as.getDefaultGroupBuckets(), as.getDefaultGroupFirstKey(), as.isDefaultLastValueQueue(), as.getDefaultLastValueKey(), as.isDefaultNonDestructive(), as.getDefaultConsumersBeforeDispatch(), as.getDefaultDelayBeforeDispatch(), ActiveMQServerImpl.isAutoDelete(autoCreated, as), as.getAutoDeleteQueuesDelay(), as.getAutoDeleteQueuesMessageCount(), autoCreated, as.getDefaultRingSize()); } + @Deprecated @Override public Queue createQueue(final SimpleString address, final SimpleString name, @@ -753,6 +787,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener { return createQueue(address, name, routingType, filterString, temporary, durable, maxConsumers, purgeOnNoConsumers, exclusive, null, null, lastValue, null, null, null, null, null, null, null, autoCreated); } + @Deprecated @Override public Queue createQueue(final SimpleString address, final SimpleString name, @@ -777,6 +812,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener { return createQueue(address, name, routingType, filterString, temporary, durable, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, null, lastValue, lastValueKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, autoDelete, autoDeleteDelay, autoDeleteMessageCount, autoCreated); } + @Deprecated @Override public Queue createQueue(final SimpleString address, final SimpleString name, @@ -802,6 +838,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener { return createQueue(address, name, routingType, filterString, temporary, durable, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, null, lastValue, lastValueKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, autoDelete, autoDeleteDelay, autoDeleteMessageCount, autoCreated, null); } + @Deprecated @Override public Queue createQueue(final SimpleString address, final SimpleString name, @@ -848,6 +885,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener { } } + @Deprecated @Override public Queue createQueue(SimpleString address, SimpleString name, @@ -860,12 +898,14 @@ public class ServerSessionImpl implements ServerSession, FailureListener { return createQueue(address, name, routingType, filterString, temporary, durable, as.getDefaultMaxConsumers(), as.isDefaultPurgeOnNoConsumers(), autoCreated); } + @Deprecated @Override public Queue createQueue(AddressInfo addressInfo, SimpleString name, SimpleString filterString, boolean temporary, boolean durable, boolean autoCreated) throws Exception { AddressSettings as = server.getAddressSettingsRepository().getMatch(addressInfo.getName().toString()); return createQueue(addressInfo, name, filterString, temporary, durable, as.getDefaultMaxConsumers(), as.isDefaultPurgeOnNoConsumers(), as.isDefaultExclusiveQueue(), as.isDefaultGroupRebalance(), as.getDefaultGroupBuckets(), as.getDefaultGroupFirstKey(), as.isDefaultLastValueQueue(), as.getDefaultLastValueKey(), as.isDefaultNonDestructive(), as.getDefaultConsumersBeforeDispatch(), as.getDefaultDelayBeforeDispatch(), ActiveMQServerImpl.isAutoDelete(autoCreated, as), as.getAutoDeleteQueuesDelay(), as.getAutoDeleteQueuesMessageCount(), autoCreated, as.getDefaultRingSize()); } + @Deprecated @Override public Queue createQueue(AddressInfo addressInfo, SimpleString name, SimpleString filterString, boolean temporary, boolean durable, Boolean exclusive, Boolean lastValue, boolean autoCreated) throws Exception { AddressSettings as = server.getAddressSettingsRepository().getMatch(addressInfo.getName().toString()); @@ -907,6 +947,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener { return server.getAddressInfo(art.getName()); } + @Deprecated @Override public void createSharedQueue(SimpleString address, SimpleString name, @@ -920,6 +961,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener { createSharedQueue(address, name, routingType, filterString, durable, maxConsumers, purgeOnNoConsumers, exclusive, null, null, lastValue, null, null, null, null, null, null, null); } + @Deprecated @Override public void createSharedQueue(SimpleString address, SimpleString name, @@ -942,6 +984,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener { createSharedQueue(address, name, routingType, filterString, durable, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, null, lastValue, lastValueKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, autoDelete, autoDeleteDelay, autoDeleteMessageCount); } + @Deprecated @Override public void createSharedQueue(SimpleString address, SimpleString name, @@ -962,35 +1005,41 @@ public class ServerSessionImpl implements ServerSession, FailureListener { Boolean autoDelete, Long autoDeleteDelay, Long autoDeleteMessageCount) throws Exception { - if (AuditLogger.isEnabled()) { - AuditLogger.createSharedQueue(this, getUsername(), address, name, routingType, filterString, durable, maxConsumers, purgeOnNoConsumers, - exclusive, groupRebalance, groupBuckets, lastValue, lastValueKey, nonDestructive, consumersBeforeDispatch, - delayBeforeDispatch, autoDelete, autoDeleteDelay, autoDeleteMessageCount); - } - address = removePrefix(address); + createSharedQueue(new QueueConfiguration(name) + .setAddress(address) + .setFilterString(filterString) + .setUser(getUsername()) + .setDurable(durable) + .setMaxConsumers(maxConsumers) + .setPurgeOnNoConsumers(purgeOnNoConsumers) + .setExclusive(exclusive) + .setGroupRebalance(groupRebalance) + .setGroupBuckets(groupBuckets) + .setLastValue(lastValue) + .setLastValueKey(lastValueKey) + .setNonDestructive(nonDestructive) + .setConsumersBeforeDispatch(consumersBeforeDispatch) + .setDelayBeforeDispatch(delayBeforeDispatch) + .setAutoDelete(autoDelete) + .setAutoDeleteDelay(autoDeleteDelay) + .setAutoDeleteMessageCount(autoDeleteMessageCount)); + } - securityCheck(address, name, durable ? CheckType.CREATE_DURABLE_QUEUE : CheckType.CREATE_NON_DURABLE_QUEUE, this); + @Override + public void createSharedQueue(QueueConfiguration queueConfiguration) throws Exception { + if (AuditLogger.isEnabled()) { + AuditLogger.createSharedQueue(this, getUsername(), queueConfiguration); + } + queueConfiguration.setAddress(removePrefix(queueConfiguration.getAddress())); + + securityCheck(queueConfiguration.getAddress(), queueConfiguration.getName(), queueConfiguration.isDurable() == null || queueConfiguration.isDurable() ? CheckType.CREATE_DURABLE_QUEUE : CheckType.CREATE_NON_DURABLE_QUEUE, this); server.checkQueueCreationLimit(getUsername()); - AddressSettings as = server.getAddressSettingsRepository().getMatch(address.toString()); - - server.createSharedQueue(address, routingType, name, filterString, SimpleString.toSimpleString(getUsername()), durable, - maxConsumers == null ? as.getDefaultMaxConsumers() : maxConsumers, - purgeOnNoConsumers == null ? as.isDefaultPurgeOnNoConsumers() : purgeOnNoConsumers, - exclusive == null ? as.isDefaultExclusiveQueue() : exclusive, - groupRebalance == null ? as.isDefaultGroupRebalance() : groupRebalance, - groupBuckets == null ? as.getDefaultGroupBuckets() : groupBuckets, - lastValue == null ? as.isDefaultLastValueQueue() : lastValue, - lastValueKey == null ? as.getDefaultLastValueKey() : lastValueKey, - nonDestructive == null ? as.isDefaultNonDestructive() : nonDestructive, - consumersBeforeDispatch == null ? as.getDefaultConsumersBeforeDispatch() : consumersBeforeDispatch, - delayBeforeDispatch == null ? as.getDefaultDelayBeforeDispatch() : delayBeforeDispatch, - autoDelete == null ? as.isAutoDeleteCreatedQueues() : autoDelete, - autoDeleteDelay == null ? as.getAutoDeleteQueuesDelay() : autoDeleteDelay, - autoDeleteMessageCount == null ? as.getAutoDeleteQueuesMessageCount() : autoDeleteMessageCount); + server.createSharedQueue(queueConfiguration); } + @Deprecated @Override public void createSharedQueue(SimpleString address, final SimpleString name, @@ -1001,6 +1050,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener { createSharedQueue(address, name, routingType, filterString, durable, null, null, null, null); } + @Deprecated @Override public void createSharedQueue(final SimpleString address, final SimpleString name, @@ -2205,6 +2255,18 @@ public class ServerSessionImpl implements ServerSession, FailureListener { return addressInfo; } + @Override + public RoutingType getRoutingTypeFromPrefix(SimpleString address, RoutingType defaultRoutingType) { + if (prefixEnabled) { + for (Map.Entry entry : prefixes.entrySet()) { + if (address.startsWith(entry.getKey())) { + return entry.getValue(); + } + } + } + return defaultRoutingType; + } + @Override public Pair> getAddressAndRoutingTypes(SimpleString address, EnumSet defaultRoutingTypes) { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/plugin/ActiveMQServerQueuePlugin.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/plugin/ActiveMQServerQueuePlugin.java index 6c76472535..0852bd148d 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/plugin/ActiveMQServerQueuePlugin.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/plugin/ActiveMQServerQueuePlugin.java @@ -18,6 +18,7 @@ package org.apache.activemq.artemis.core.server.plugin; import org.apache.activemq.artemis.api.core.ActiveMQException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.core.security.SecurityAuth; import org.apache.activemq.artemis.core.server.Queue; @@ -38,6 +39,17 @@ public interface ActiveMQServerQueuePlugin extends ActiveMQServerBasePlugin { } + /** + * Before a queue is created + * + * @param queueConfig + * @throws ActiveMQException + */ + default void beforeCreateQueue(QueueConfiguration queueConfig) throws ActiveMQException { + //by default call the old method for backwards compatibility + beforeCreateQueue(QueueConfig.fromQueueConfiguration(queueConfig)); + } + /** * After a queue has been created * diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/plugin/impl/LoggingActiveMQServerPlugin.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/plugin/impl/LoggingActiveMQServerPlugin.java index 3483472ce0..6455368f47 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/plugin/impl/LoggingActiveMQServerPlugin.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/plugin/impl/LoggingActiveMQServerPlugin.java @@ -22,6 +22,7 @@ import java.util.Map; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.Message; +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.config.BridgeConfiguration; @@ -31,7 +32,6 @@ import org.apache.activemq.artemis.core.postoffice.RoutingStatus; import org.apache.activemq.artemis.core.security.SecurityAuth; import org.apache.activemq.artemis.core.server.MessageReference; import org.apache.activemq.artemis.core.server.Queue; -import org.apache.activemq.artemis.core.server.QueueConfig; import org.apache.activemq.artemis.core.server.RoutingContext; import org.apache.activemq.artemis.core.server.ServerConsumer; import org.apache.activemq.artemis.core.server.ServerSession; @@ -362,11 +362,10 @@ public class LoggingActiveMQServerPlugin implements ActiveMQServerPlugin, Serial * @throws ActiveMQException */ @Override - public void beforeCreateQueue(QueueConfig queueConfig) throws ActiveMQException { + public void beforeCreateQueue(QueueConfiguration queueConfig) throws ActiveMQException { if (logAll || logInternalEvents) { LoggingActiveMQServerPluginLogger.LOGGER.beforeCreateQueue(queueConfig); } - } /** diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/plugin/impl/LoggingActiveMQServerPluginLogger.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/plugin/impl/LoggingActiveMQServerPluginLogger.java index fa697ba624..40b521fc1e 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/plugin/impl/LoggingActiveMQServerPluginLogger.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/plugin/impl/LoggingActiveMQServerPluginLogger.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.core.server.plugin.impl; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.core.config.BridgeConfiguration; import org.apache.activemq.artemis.core.persistence.OperationContext; @@ -24,7 +25,6 @@ import org.apache.activemq.artemis.core.postoffice.RoutingStatus; import org.apache.activemq.artemis.core.security.SecurityAuth; import org.apache.activemq.artemis.core.server.MessageReference; import org.apache.activemq.artemis.core.server.Queue; -import org.apache.activemq.artemis.core.server.QueueConfig; import org.apache.activemq.artemis.core.server.RoutingContext; import org.apache.activemq.artemis.core.server.ServerConsumer; import org.apache.activemq.artemis.core.server.ServerSession; @@ -197,7 +197,7 @@ public interface LoggingActiveMQServerPluginLogger extends BasicLogger { @LogMessage(level = Logger.Level.DEBUG) @Message(id = 843006, value = "beforeCreateQueue called with queueConfig: {0}", format = Message.Format.MESSAGE_FORMAT) - void beforeCreateQueue(QueueConfig queueConfig); + void beforeCreateQueue(QueueConfiguration queueConfig); @LogMessage(level = Logger.Level.DEBUG) @Message(id = 843007, value = "beforeDestroyQueue called with queueName: {0}, session: {1}, checkConsumerCount: {2}," + diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/DefaultsFileConfigurationTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/DefaultsFileConfigurationTest.java index fca5304b66..c50f0d1fd8 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/DefaultsFileConfigurationTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/DefaultsFileConfigurationTest.java @@ -62,7 +62,7 @@ public class DefaultsFileConfigurationTest extends ConfigurationImplTest { Assert.assertEquals(Collections.emptyList(), conf.getClusterConfigurations()); - Assert.assertEquals(Collections.emptyList(), conf.getQueueConfigurations()); + Assert.assertEquals(Collections.emptyList(), conf.getQueueConfigs()); Assert.assertEquals(Collections.emptyList(), conf.getAddressConfigurations()); diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java index ba156717f8..475ec622ee 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java @@ -31,6 +31,7 @@ import java.util.Set; import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; import org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration; import org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration; +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.api.core.TransportConfiguration; @@ -39,7 +40,6 @@ import org.apache.activemq.artemis.core.config.BridgeConfiguration; import org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration; import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.config.CoreAddressConfiguration; -import org.apache.activemq.artemis.core.config.CoreQueueConfiguration; import org.apache.activemq.artemis.core.config.DivertConfiguration; import org.apache.activemq.artemis.core.config.FileDeploymentManager; import org.apache.activemq.artemis.core.config.HAPolicyConfiguration; @@ -405,17 +405,17 @@ public class FileConfigurationTest extends ConfigurationImplTest { assertEquals(104, conf.getResourceLimitSettings().get("myUser").getMaxConnections()); assertEquals(13, conf.getResourceLimitSettings().get("myUser").getMaxQueues()); - assertEquals(2, conf.getQueueConfigurations().size()); + assertEquals(2, conf.getQueueConfigs().size()); - assertEquals("queue1", conf.getQueueConfigurations().get(0).getName()); - assertEquals("address1", conf.getQueueConfigurations().get(0).getAddress()); - assertEquals("color='red'", conf.getQueueConfigurations().get(0).getFilterString()); - assertEquals(false, conf.getQueueConfigurations().get(0).isDurable()); + assertEquals("queue1", conf.getQueueConfigs().get(0).getName().toString()); + assertEquals("address1", conf.getQueueConfigs().get(0).getAddress().toString()); + assertEquals("color='red'", conf.getQueueConfigs().get(0).getFilterString().toString()); + assertEquals(false, conf.getQueueConfigs().get(0).isDurable()); - assertEquals("queue2", conf.getQueueConfigurations().get(1).getName()); - assertEquals("address2", conf.getQueueConfigurations().get(1).getAddress()); - assertEquals("color='blue'", conf.getQueueConfigurations().get(1).getFilterString()); - assertEquals(false, conf.getQueueConfigurations().get(1).isDurable()); + assertEquals("queue2", conf.getQueueConfigs().get(1).getName().toString()); + assertEquals("address2", conf.getQueueConfigs().get(1).getAddress().toString()); + assertEquals("color='blue'", conf.getQueueConfigs().get(1).getFilterString().toString()); + assertEquals(false, conf.getQueueConfigs().get(1).isDurable()); verifyAddresses(); @@ -474,30 +474,30 @@ public class FileConfigurationTest extends ConfigurationImplTest { Set routingTypes = new HashSet<>(); routingTypes.add(RoutingType.ANYCAST); assertEquals(routingTypes, addressConfiguration.getRoutingTypes()); - assertEquals(2, addressConfiguration.getQueueConfigurations().size()); + assertEquals(2, addressConfiguration.getQueueConfigs().size()); // Addr 1 Queue 1 - CoreQueueConfiguration queueConfiguration = addressConfiguration.getQueueConfigurations().get(0); + QueueConfiguration queueConfiguration = addressConfiguration.getQueueConfigs().get(0); - assertEquals("q1", queueConfiguration.getName()); + assertEquals("q1", queueConfiguration.getName().toString()); assertEquals(3L, queueConfiguration.getRingSize().longValue()); assertFalse(queueConfiguration.isDurable()); - assertEquals("color='blue'", queueConfiguration.getFilterString()); - assertEquals(ActiveMQDefaultConfiguration.getDefaultPurgeOnNoConsumers(), queueConfiguration.getPurgeOnNoConsumers()); - assertEquals("addr1", queueConfiguration.getAddress()); + assertEquals("color='blue'", queueConfiguration.getFilterString().toString()); + assertEquals(ActiveMQDefaultConfiguration.getDefaultPurgeOnNoConsumers(), queueConfiguration.isPurgeOnNoConsumers()); + assertEquals("addr1", queueConfiguration.getAddress().toString()); // If null, then default will be taken from address-settings (which defaults to ActiveMQDefaultConfiguration.getDefaultMaxQueueConsumers()) assertEquals(null, queueConfiguration.getMaxConsumers()); // Addr 1 Queue 2 - queueConfiguration = addressConfiguration.getQueueConfigurations().get(1); + queueConfiguration = addressConfiguration.getQueueConfigs().get(1); - assertEquals("q2", queueConfiguration.getName()); + assertEquals("q2", queueConfiguration.getName().toString()); assertEquals(-1, queueConfiguration.getRingSize().longValue()); assertTrue(queueConfiguration.isDurable()); - assertEquals("color='green'", queueConfiguration.getFilterString()); + assertEquals("color='green'", queueConfiguration.getFilterString().toString()); assertEquals(Queue.MAX_CONSUMERS_UNLIMITED, queueConfiguration.getMaxConsumers().intValue()); - assertFalse(queueConfiguration.getPurgeOnNoConsumers()); - assertEquals("addr1", queueConfiguration.getAddress()); + assertFalse(queueConfiguration.isPurgeOnNoConsumers()); + assertEquals("addr1", queueConfiguration.getAddress().toString()); // Addr 2 addressConfiguration = conf.getAddressConfigurations().get(1); @@ -505,28 +505,28 @@ public class FileConfigurationTest extends ConfigurationImplTest { routingTypes = new HashSet<>(); routingTypes.add(RoutingType.MULTICAST); assertEquals(routingTypes, addressConfiguration.getRoutingTypes()); - assertEquals(2, addressConfiguration.getQueueConfigurations().size()); + assertEquals(2, addressConfiguration.getQueueConfigs().size()); // Addr 2 Queue 1 - queueConfiguration = addressConfiguration.getQueueConfigurations().get(0); + queueConfiguration = addressConfiguration.getQueueConfigs().get(0); - assertEquals("q3", queueConfiguration.getName()); + assertEquals("q3", queueConfiguration.getName().toString()); assertTrue(queueConfiguration.isDurable()); - assertEquals("color='red'", queueConfiguration.getFilterString()); + assertEquals("color='red'", queueConfiguration.getFilterString().toString()); assertEquals(10, queueConfiguration.getMaxConsumers().intValue()); - assertEquals(ActiveMQDefaultConfiguration.getDefaultPurgeOnNoConsumers(), queueConfiguration.getPurgeOnNoConsumers()); - assertEquals("addr2", queueConfiguration.getAddress()); + assertEquals(ActiveMQDefaultConfiguration.getDefaultPurgeOnNoConsumers(), queueConfiguration.isPurgeOnNoConsumers()); + assertEquals("addr2", queueConfiguration.getAddress().toString()); // Addr 2 Queue 2 - queueConfiguration = addressConfiguration.getQueueConfigurations().get(1); + queueConfiguration = addressConfiguration.getQueueConfigs().get(1); - assertEquals("q4", queueConfiguration.getName()); + assertEquals("q4", queueConfiguration.getName().toString()); assertTrue(queueConfiguration.isDurable()); assertNull(queueConfiguration.getFilterString()); // If null, then default will be taken from address-settings (which defaults to ActiveMQDefaultConfiguration.getDefaultMaxQueueConsumers()) assertEquals(null, queueConfiguration.getMaxConsumers()); - assertTrue(queueConfiguration.getPurgeOnNoConsumers()); - assertEquals("addr2", queueConfiguration.getAddress()); + assertTrue(queueConfiguration.isPurgeOnNoConsumers()); + assertEquals("addr2", queueConfiguration.getAddress().toString()); // Addr 3 addressConfiguration = conf.getAddressConfigurations().get(2); diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/message/impl/MessagePropertyTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/message/impl/MessagePropertyTest.java index 1a69c0e86a..a31e09f254 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/message/impl/MessagePropertyTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/message/impl/MessagePropertyTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.core.message.impl; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -54,7 +55,7 @@ public class MessagePropertyTest extends ActiveMQTestBase { String filter = null; session.createAddress(SimpleString.toSimpleString(ADDRESS), RoutingType.MULTICAST, false); - session.createQueue(ADDRESS, RoutingType.MULTICAST, ADDRESS, filter, true); + session.createQueue(new QueueConfiguration(ADDRESS).setRoutingType(RoutingType.MULTICAST).setFilterString(filter)); ClientProducer producer = session.createProducer(ADDRESS); for (int i = 0; i < numMessages; i++) { diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java index 1af3400eca..91128a0904 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java @@ -66,6 +66,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQExceptionType; import org.apache.activemq.artemis.api.core.ICoreMessage; import org.apache.activemq.artemis.api.core.Message; import org.apache.activemq.artemis.api.core.Pair; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; @@ -1580,7 +1581,7 @@ public abstract class ActiveMQTestBase extends Assert { ClientSessionFactory sf = locator.createSessionFactory(); ClientSession session = sf.createSession(); try { - session.createQueue(address, queue); + session.createQueue(new QueueConfiguration(queue).setAddress(address)); } finally { session.close(); closeSessionFactory(sf); diff --git a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java index 22a8e44956..00c0d1bfb3 100644 --- a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java +++ b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java @@ -27,6 +27,7 @@ import java.util.Map; import java.util.Set; import org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException; +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.api.core.TransportConfiguration; @@ -254,7 +255,7 @@ public class ArtemisBrokerWrapper extends ArtemisBrokerBase { if (coreQ == null) { coreQ = new SimpleString(qname); try { - this.server.createQueue(coreQ, RoutingType.MULTICAST, coreQ, null, false, false); + this.server.createQueue(new QueueConfiguration(coreQ).setDurable(false)); testQueues.put(qname, coreQ); } catch (ActiveMQQueueExistsException e) { //ignore diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ActiveMQServerControlMultiThreadTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ActiveMQServerControlMultiThreadTest.java index 609103a60d..7ac0949f36 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ActiveMQServerControlMultiThreadTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ActiveMQServerControlMultiThreadTest.java @@ -26,6 +26,7 @@ import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import org.apache.activemq.artemis.api.core.JsonUtil; +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.api.core.client.ClientConsumer; @@ -139,7 +140,7 @@ public class ActiveMQServerControlMultiThreadTest extends ManagementTestBase { ActiveMQServerControl serverControl = createManagementControl(); server.addAddressInfo(new AddressInfo(addressName1, RoutingType.ANYCAST)); - server.createQueue(addressName1, RoutingType.ANYCAST, queueName1, null, false, false); + server.createQueue(new QueueConfiguration(queueName1).setAddress(addressName1).setRoutingType(RoutingType.ANYCAST).setDurable(false)); // create a consumer try (ServerLocator locator = createInVMNonHALocator(); ClientSessionFactory csf = createSessionFactory(locator); diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/BMFailoverTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/BMFailoverTest.java index 6e6509f82f..e6d29c646f 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/BMFailoverTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/BMFailoverTest.java @@ -23,6 +23,7 @@ import javax.transaction.xa.Xid; import org.apache.activemq.artemis.api.core.ActiveMQTransactionOutcomeUnknownException; import org.apache.activemq.artemis.api.core.ActiveMQTransactionRolledBackException; import org.apache.activemq.artemis.api.core.ActiveMQUnBlockedException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; @@ -101,7 +102,7 @@ public class BMFailoverTest extends FailoverTestBase { ClientSession session = createSession(sf, true, false, false); - session.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS)); ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS); @@ -175,8 +176,8 @@ public class BMFailoverTest extends FailoverTestBase { // closeable will take care of closing it try (ClientSession session = sf.createSession(false, true, true); ClientProducer sendInitialProducer = session.createProducer();) { - session.createQueue(inQueue, inQueue, null, true); - session.createQueue(outQueue, outQueue, null, true); + session.createQueue(new QueueConfiguration(inQueue)); + session.createQueue(new QueueConfiguration(outQueue)); sendInitialProducer.send(inQueue, createMessage(session, 0, true)); } @@ -325,14 +326,14 @@ public class BMFailoverTest extends FailoverTestBase { private ClientSession createSessionAndQueue() throws Exception { ClientSession session = createSession(sf, false, false); - session.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS)); return session; } private ClientSession createXASessionAndQueue() throws Exception { ClientSession session = addClientSession(sf.createSession(true, true, true)); - session.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS)); return session; } diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/BridgeServerLocatorConfigurationTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/BridgeServerLocatorConfigurationTest.java index 5e6a497200..fa40256cd4 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/BridgeServerLocatorConfigurationTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/BridgeServerLocatorConfigurationTest.java @@ -21,9 +21,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.core.config.BridgeConfiguration; -import org.apache.activemq.artemis.core.config.CoreQueueConfiguration; import org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.cluster.impl.BridgeImpl; @@ -94,15 +94,9 @@ public class BridgeServerLocatorConfigurationTest extends ActiveMQTestBase { bridgeConfigs.add(bridgeConfiguration); serverWithBridge.getConfiguration().setBridgeConfigurations(bridgeConfigs); - CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0); - List queueConfigs0 = new ArrayList<>(); - queueConfigs0.add(queueConfig0); - serverWithBridge.getConfiguration().setQueueConfigurations(queueConfigs0); + serverWithBridge.getConfiguration().addQueueConfiguration(new QueueConfiguration(queueName0).setAddress(testAddress)); - CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName1); - List queueConfigs1 = new ArrayList<>(); - queueConfigs1.add(queueConfig1); - server1.getConfiguration().setQueueConfigurations(queueConfigs1); + server1.getConfiguration().addQueueConfiguration(new QueueConfiguration(queueName1).setAddress(forwardAddress)); server1.start(); waitForServerToStart(server1); diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/CriticalAnalyzerFaultInjectionTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/CriticalAnalyzerFaultInjectionTest.java index 785b9eb96d..77bfe02172 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/CriticalAnalyzerFaultInjectionTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/CriticalAnalyzerFaultInjectionTest.java @@ -22,6 +22,7 @@ import javax.jms.MessageProducer; import javax.jms.Queue; import javax.jms.Session; +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.config.Configuration; @@ -52,7 +53,7 @@ public class CriticalAnalyzerFaultInjectionTest extends JMSTestBase { public void setUp() throws Exception { super.setUp(); server.addAddressInfo(new AddressInfo(address, RoutingType.ANYCAST)); - server.createQueue(address, RoutingType.ANYCAST, address, null, true, false); + server.createQueue(new QueueConfiguration(address).setRoutingType(RoutingType.ANYCAST)); conn = nettyCf.createConnection(); } diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/LargeMessageOnShutdownTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/LargeMessageOnShutdownTest.java index 9b01223424..d21e070cfb 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/LargeMessageOnShutdownTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/LargeMessageOnShutdownTest.java @@ -20,7 +20,7 @@ import java.io.ByteArrayInputStream; import java.util.concurrent.TimeUnit; import org.apache.activemq.artemis.api.core.ActiveMQBuffers; -import org.apache.activemq.artemis.api.core.RoutingType; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; import org.apache.activemq.artemis.api.core.client.ClientConsumer; @@ -52,7 +52,7 @@ public class LargeMessageOnShutdownTest extends ActiveMQTestBase { server = createServer(true, createDefaultNettyConfig()); startServer(); - server.createQueue(queueName, RoutingType.MULTICAST, queueName, null, true, false); + server.createQueue(new QueueConfiguration(queueName)); } @After diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/LargeMessageReplicationTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/LargeMessageReplicationTest.java index 9429ab0c02..9af81b841b 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/LargeMessageReplicationTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/LargeMessageReplicationTest.java @@ -16,7 +16,15 @@ */ package org.apache.activemq.artemis.tests.extras.byteman; +import java.nio.ByteBuffer; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicLong; + import org.apache.activemq.artemis.api.core.ActiveMQBuffer; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; @@ -28,7 +36,6 @@ import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryInternal; import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.config.CoreAddressConfiguration; -import org.apache.activemq.artemis.core.config.CoreQueueConfiguration; import org.apache.activemq.artemis.core.config.DivertConfiguration; import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants; import org.apache.activemq.artemis.tests.integration.cluster.failover.FailoverTestBase; @@ -39,13 +46,6 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import java.nio.ByteBuffer; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.atomic.AtomicLong; - @RunWith(BMUnitRunner.class) public class LargeMessageReplicationTest extends FailoverTestBase { @@ -94,10 +94,7 @@ public class LargeMessageReplicationTest extends FailoverTestBase { CoreAddressConfiguration addrCfg = new CoreAddressConfiguration(); addrCfg.setName(address); addrCfg.addRoutingType(RoutingType.ANYCAST); - CoreQueueConfiguration qConfig = new CoreQueueConfiguration(); - qConfig.setName(name); - qConfig.setAddress(address); - addrCfg.addQueueConfiguration(qConfig); + addrCfg.addQueueConfiguration(new QueueConfiguration(name).setAddress(address)); addrConfigs.add(addrCfg); } diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ManagementExceptionHandlingTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ManagementExceptionHandlingTest.java index 8c79bf687b..fe1d9d3652 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ManagementExceptionHandlingTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ManagementExceptionHandlingTest.java @@ -16,7 +16,15 @@ */ package org.apache.activemq.artemis.tests.extras.byteman; +import javax.management.MBeanServer; +import javax.management.ObjectName; +import javax.management.RuntimeMBeanException; +import java.lang.management.ManagementFactory; +import java.util.HashMap; + import org.apache.activemq.artemis.api.core.ActiveMQException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; +import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.jboss.byteman.contrib.bmunit.BMRule; @@ -27,12 +35,6 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import javax.management.MBeanServer; -import javax.management.ObjectName; -import javax.management.RuntimeMBeanException; -import java.lang.management.ManagementFactory; -import java.util.HashMap; - @RunWith(BMUnitRunner.class) public class ManagementExceptionHandlingTest extends ActiveMQTestBase { @@ -67,7 +69,7 @@ public class ManagementExceptionHandlingTest extends ActiveMQTestBase { action = "throw new org.apache.activemq.artemis.api.core.ActiveMQException(\"gotcha\")")}) public void testActiveMQServerControl() throws Exception { try { - server.getActiveMQServerControl().createQueue("some.address", "ANYCAST", "some.queue", "filter", true, -1, false, true); + server.getActiveMQServerControl().createQueue(new QueueConfiguration("some.queue").setAddress("some.address").setRoutingType(RoutingType.ANYCAST).toJSON()); fail("test should have gotten an exception!"); } catch (ActiveMQException e) { fail("Wrong exception got!"); diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/OrphanedConsumerTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/OrphanedConsumerTest.java index 72a4a2d4d7..a162570e22 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/OrphanedConsumerTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/OrphanedConsumerTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.extras.byteman; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -165,8 +166,8 @@ public class OrphanedConsumerTest extends ActiveMQTestBase { ClientSession session = sf.createSession(true, true, 0); - session.createQueue("queue", "queue1", true); - session.createQueue("queue", "queue2", true); + session.createQueue(new QueueConfiguration("queue1").setAddress("queue")); + session.createQueue(new QueueConfiguration("queue2").setAddress("queue")); ClientProducer prod = session.createProducer("queue"); diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/PagingLeakTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/PagingLeakTest.java index 8bf1645046..834b88a941 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/PagingLeakTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/PagingLeakTest.java @@ -20,6 +20,7 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -31,7 +32,6 @@ import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.paging.cursor.impl.PagePositionImpl; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServers; -import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy; import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; @@ -132,7 +132,7 @@ public class PagingLeakTest extends ActiveMQTestBase { final int maxConsumed; Consumer(int sleepTime, String suffix, int maxConsumed) throws Exception { - server.createQueue(address, RoutingType.MULTICAST, address.concat(suffix), null, true, false); + server.createQueue(new QueueConfiguration(address.concat(suffix)).setAddress(address)); this.sleepTime = sleepTime; locator = createInVMLocator(0); diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/PagingOMETest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/PagingOMETest.java index 4f3b7223b8..bc94f855ab 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/PagingOMETest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/PagingOMETest.java @@ -21,6 +21,7 @@ import java.nio.ByteBuffer; import java.util.HashMap; import org.apache.activemq.artemis.api.core.ActiveMQBuffer; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -109,7 +110,7 @@ public class PagingOMETest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, false, false); - session.createQueue(ADDRESS, ADDRESS, null, true); + session.createQueue(new QueueConfiguration(ADDRESS)); Queue queue = server.locateQueue(ADDRESS); queue.getPageSubscription().getPagingStore().startPaging(); diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/QueueDeploymentFailedTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/QueueDeploymentFailedTest.java index d01215a563..d932c41cde 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/QueueDeploymentFailedTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/QueueDeploymentFailedTest.java @@ -18,9 +18,9 @@ package org.apache.activemq.artemis.tests.extras.byteman; import java.util.UUID; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.core.config.CoreAddressConfiguration; -import org.apache.activemq.artemis.core.config.CoreQueueConfiguration; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.jboss.byteman.contrib.bmunit.BMRule; @@ -40,7 +40,7 @@ public class QueueDeploymentFailedTest extends ActiveMQTestBase { public void testQueueDeploymentFailure() throws Exception { ActiveMQServer server = createServer(false, createDefaultNettyConfig()); String address = UUID.randomUUID().toString(); - server.getConfiguration().addAddressConfiguration(new CoreAddressConfiguration().setName(address).addRoutingType(RoutingType.ANYCAST).addQueueConfiguration(new CoreQueueConfiguration().setName(UUID.randomUUID().toString()).setRoutingType(RoutingType.ANYCAST).setAddress(address))); + server.getConfiguration().addAddressConfiguration(new CoreAddressConfiguration().setName(address).addRoutingType(RoutingType.ANYCAST).addQueueConfiguration(new QueueConfiguration(UUID.randomUUID().toString()).setRoutingType(RoutingType.ANYCAST).setAddress(address))); server.start(); assertTrue(server.getRemotingService().isStarted()); } diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/RaceOnClosingConsumerWhileReconnecting.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/RaceOnClosingConsumerWhileReconnecting.java index db27c0a5c7..a7a6e39f7a 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/RaceOnClosingConsumerWhileReconnecting.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/RaceOnClosingConsumerWhileReconnecting.java @@ -20,6 +20,7 @@ package org.apache.activemq.artemis.tests.extras.byteman; import java.util.Set; import org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException; +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.api.core.client.ClientConsumer; @@ -66,7 +67,7 @@ public class RaceOnClosingConsumerWhileReconnecting extends ActiveMQTestBase { SimpleString addressName1 = new SimpleString("my_address_one"); server.addAddressInfo(new AddressInfo(addressName1, RoutingType.ANYCAST)); - server.createQueue(addressName1, RoutingType.ANYCAST, queueName1, null, true, false); + server.createQueue(new QueueConfiguration(queueName1).setAddress(addressName1).setRoutingType(RoutingType.ANYCAST)); final long retryInterval = 500; final double retryMultiplier = 1d; diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/RaceOnCursorIteratorTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/RaceOnCursorIteratorTest.java index b7e29f1f8c..7196923417 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/RaceOnCursorIteratorTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/RaceOnCursorIteratorTest.java @@ -21,6 +21,7 @@ import java.util.HashMap; import java.util.concurrent.locks.ReentrantReadWriteLock; import org.apache.activemq.artemis.api.core.ActiveMQBuffer; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientSession; import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; @@ -103,7 +104,7 @@ public class RaceOnCursorIteratorTest extends ActiveMQTestBase { session = sf.createSession(false, true, true); - session.createQueue(ADDRESS, ADDRESS, null, true); + session.createQueue(new QueueConfiguration(ADDRESS)); queue = server.locateQueue(ADDRESS); queue.getPageSubscription().getPagingStore().startPaging(); diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/StompInternalStateTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/StompInternalStateTest.java index a4dd033c28..a336cd8622 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/StompInternalStateTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/StompInternalStateTest.java @@ -20,6 +20,7 @@ import java.util.HashMap; import java.util.Map; import java.util.Set; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ClientSession; import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; @@ -64,7 +65,7 @@ public class StompInternalStateTest extends ActiveMQTestBase { ServerLocator locator = createNettyNonHALocator(); ClientSessionFactory factory = createSessionFactory(locator); session = factory.createSession(); - session.createTemporaryQueue(STOMP_QUEUE_NAME, STOMP_QUEUE_NAME); + session.createQueue(new QueueConfiguration(STOMP_QUEUE_NAME).setDurable(false).setTemporary(true)); session.deleteQueue(STOMP_QUEUE_NAME); assertNull(resultTestStompProtocolManagerLeak); diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/TimeoutXATest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/TimeoutXATest.java index c75c7e1415..6afccd8c83 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/TimeoutXATest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/TimeoutXATest.java @@ -29,9 +29,10 @@ import javax.transaction.xa.Xid; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +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.server.ActiveMQServer; -import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.jboss.byteman.contrib.bmunit.BMRule; @@ -56,7 +57,7 @@ public class TimeoutXATest extends ActiveMQTestBase { server.getConfiguration().setTransactionTimeoutScanPeriod(1100); server.getConfiguration().setJournalSyncNonTransactional(false); server.start(); - server.createQueue(SimpleString.toSimpleString("Queue1"), RoutingType.ANYCAST, SimpleString.toSimpleString("Queue1"), null, true, false); + server.createQueue(new QueueConfiguration("Queue1").setRoutingType(RoutingType.ANYCAST)); removingTXEntered0 = new CountDownLatch(1); removingTXAwait0 = new CountDownLatch(1); diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/critical/analyzer/CriticalAnalyzerFaultInjectionTestBase.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/critical/analyzer/CriticalAnalyzerFaultInjectionTestBase.java index d96cb3cd9f..6b3549ad9c 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/critical/analyzer/CriticalAnalyzerFaultInjectionTestBase.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/critical/analyzer/CriticalAnalyzerFaultInjectionTestBase.java @@ -21,6 +21,7 @@ import javax.jms.MessageProducer; import javax.jms.Queue; import javax.jms.Session; +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.config.Configuration; @@ -46,7 +47,7 @@ public abstract class CriticalAnalyzerFaultInjectionTestBase extends JMSTestBase public void setUp() throws Exception { super.setUp(); server.addAddressInfo(new AddressInfo(address, RoutingType.ANYCAST)); - server.createQueue(address, RoutingType.ANYCAST, address, null, true, false); + server.createQueue(new QueueConfiguration(address).setRoutingType(RoutingType.ANYCAST)); conn = nettyCf.createConnection(); } diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/BridgeTestBase.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/BridgeTestBase.java index e76643c1a7..6b02791ff5 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/BridgeTestBase.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/BridgeTestBase.java @@ -37,8 +37,8 @@ import java.util.Set; import com.arjuna.ats.arjuna.coordinator.TransactionReaper; import com.arjuna.ats.arjuna.coordinator.TxControl; import com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple; +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.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.management.AddressControl; import org.apache.activemq.artemis.api.core.management.QueueControl; @@ -125,7 +125,7 @@ public abstract class BridgeTestBase extends ActiveMQTestBase { if (index == 1) { server = server1; } - assertTrue("queue '/queue/" + queueName + "' created", server.createQueue(SimpleString.toSimpleString(queueName), RoutingType.ANYCAST, SimpleString.toSimpleString(queueName), null, true, false) != null); + assertTrue("queue '/queue/" + queueName + "' created", server.createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST)) != null); } @Override diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/ClusteredBridgeTestBase.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/ClusteredBridgeTestBase.java index 6fae34e77c..cf22f292d7 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/ClusteredBridgeTestBase.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/ClusteredBridgeTestBase.java @@ -27,8 +27,8 @@ import java.util.concurrent.TimeUnit; import com.arjuna.ats.arjuna.coordinator.TransactionReaper; import com.arjuna.ats.arjuna.coordinator.TxControl; import org.apache.activemq.artemis.api.core.ActiveMQException; +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.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; import org.apache.activemq.artemis.api.core.client.ClientConsumer; @@ -173,7 +173,7 @@ public abstract class ClusteredBridgeTestBase extends ActiveMQTestBase { } public void createQueue(String queueName) throws Exception { - liveNode.createQueue(SimpleString.toSimpleString(queueName), RoutingType.ANYCAST, SimpleString.toSimpleString(queueName), null, true, false); + liveNode.createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST)); } public ConnectionFactoryFactory getConnectionFactoryFactory() { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/DuplicateDetectionTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/DuplicateDetectionTest.java index 235497b959..5a8c23e2dc 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/DuplicateDetectionTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/DuplicateDetectionTest.java @@ -23,6 +23,7 @@ import javax.transaction.xa.Xid; import org.apache.activemq.artemis.api.core.ActiveMQDuplicateIdException; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.Message; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; @@ -61,7 +62,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); - session.createQueue(queueName, queueName, null, false); + session.createQueue(new QueueConfiguration(queueName).setDurable(false)); ClientProducer producer = session.createProducer(queueName); @@ -167,11 +168,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { for (int i = 0; i < TEST_SIZE; i++) { final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue_" + i); - if (temporary) { - session.createTemporaryQueue(addressName, queueName, (SimpleString) null); - } else { - session.createQueue(addressName, queueName, null, true); - } + session.createQueue(new QueueConfiguration(queueName).setAddress(addressName).setDurable(!temporary).setTemporary(temporary)); ClientProducer producer = session.createProducer(addressName); @@ -236,7 +233,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { session.start(); final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); - session.createQueue(queueName, queueName, null, true); + session.createQueue(new QueueConfiguration(queueName)); ClientProducer producer = session.createProducer(queueName); @@ -290,7 +287,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); - session.createQueue(queueName, queueName, null, false); + session.createQueue(new QueueConfiguration(queueName).setDurable(false)); ClientProducer producer = session.createProducer(queueName); @@ -354,11 +351,11 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { final SimpleString queueName3 = new SimpleString("DuplicateDetectionTestQueue3"); - session.createQueue(queueName1, queueName1, null, false); + session.createQueue(new QueueConfiguration(queueName1).setDurable(false)); - session.createQueue(queueName2, queueName2, null, false); + session.createQueue(new QueueConfiguration(queueName2).setDurable(false)); - session.createQueue(queueName3, queueName3, null, false); + session.createQueue(new QueueConfiguration(queueName3).setDurable(false)); ClientProducer producer1 = session.createProducer(queueName1); ClientConsumer consumer1 = session.createConsumer(queueName1); @@ -491,7 +488,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); - session.createQueue(queueName, queueName, null, false); + session.createQueue(new QueueConfiguration(queueName).setDurable(false)); ClientProducer producer = session.createProducer(queueName); @@ -533,7 +530,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); - session.createQueue(queueName, queueName, null, false); + session.createQueue(new QueueConfiguration(queueName).setDurable(false)); ClientProducer producer = session.createProducer(queueName); @@ -569,7 +566,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); - session.createQueue(queueName, queueName, null, false); + session.createQueue(new QueueConfiguration(queueName).setDurable(false)); ClientProducer producer = session.createProducer(queueName); @@ -621,7 +618,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); - session.createQueue(queueName, queueName, null, false); + session.createQueue(new QueueConfiguration(queueName).setDurable(false)); ClientProducer producer = session.createProducer(queueName); @@ -661,9 +658,9 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { final SimpleString queue2 = new SimpleString("queue2"); - session.createQueue(queueName, queueName, null, false); + session.createQueue(new QueueConfiguration(queueName).setDurable(false)); - session.createQueue(queue2, queue2, null, false); + session.createQueue(new QueueConfiguration(queue2).setDurable(false)); ClientProducer producer = session.createProducer(queueName); @@ -741,7 +738,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); - session.createQueue(queueName, queueName, null, false); + session.createQueue(new QueueConfiguration(queueName).setDurable(false)); ClientProducer producer = session.createProducer(queueName); @@ -810,7 +807,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); - session.createQueue(queueName, queueName, null, false); + session.createQueue(new QueueConfiguration(queueName).setDurable(false)); ClientProducer producer = session.createProducer(queueName); @@ -881,7 +878,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); - session.createQueue(queueName, queueName, null, false); + session.createQueue(new QueueConfiguration(queueName).setDurable(false)); ClientProducer producer = session.createProducer(queueName); @@ -951,7 +948,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); - session.createQueue(queueName, queueName, null, false); + session.createQueue(new QueueConfiguration(queueName).setDurable(false)); ClientProducer producer = session.createProducer(queueName); @@ -1013,7 +1010,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); - session.createQueue(queueName, queueName, null, true); + session.createQueue(new QueueConfiguration(queueName)); ClientProducer producer = session.createProducer(queueName); @@ -1091,7 +1088,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); - session.createQueue(queueName, queueName, null, false); + session.createQueue(new QueueConfiguration(queueName).setDurable(false)); ClientProducer producer = session.createProducer(queueName); @@ -1182,7 +1179,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); - session.createQueue(queueName, queueName, null, false); + session.createQueue(new QueueConfiguration(queueName).setDurable(false)); ClientProducer producer = session.createProducer(queueName); @@ -1218,7 +1215,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { session.start(); - session.createQueue(queueName, queueName, null, false); + session.createQueue(new QueueConfiguration(queueName).setDurable(false)); producer = session.createProducer(queueName); @@ -1257,7 +1254,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); - session.createQueue(queueName, queueName, null, false); + session.createQueue(new QueueConfiguration(queueName).setDurable(false)); ClientProducer producer = session.createProducer(queueName); @@ -1288,7 +1285,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { session.start(); - session.createQueue(queueName, queueName, null, false); + session.createQueue(new QueueConfiguration(queueName).setDurable(false)); producer = session.createProducer(queueName); @@ -1322,7 +1319,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); - session.createQueue(queueName, queueName, null, false); + session.createQueue(new QueueConfiguration(queueName).setDurable(false)); ClientProducer producer = session.createProducer(queueName); @@ -1358,7 +1355,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { session.start(); - session.createQueue(queueName, queueName, null, false); + session.createQueue(new QueueConfiguration(queueName).setDurable(false)); producer = session.createProducer(queueName); @@ -1395,7 +1392,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); - session.createQueue(queueName, queueName, null, false); + session.createQueue(new QueueConfiguration(queueName).setDurable(false)); ClientProducer producer = session.createProducer(queueName); @@ -1433,7 +1430,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { session.start(); - session.createQueue(queueName, queueName, null, false); + session.createQueue(new QueueConfiguration(queueName).setDurable(false)); producer = session.createProducer(queueName); @@ -1462,7 +1459,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); - session.createQueue(queueName, queueName, null, false); + session.createQueue(new QueueConfiguration(queueName).setDurable(false)); ClientProducer producer = session.createProducer(queueName); @@ -1504,7 +1501,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { session.start(); - session.createQueue(queueName, queueName, null, false); + session.createQueue(new QueueConfiguration(queueName).setDurable(false)); producer = session.createProducer(queueName); @@ -1563,7 +1560,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); - session.createQueue(queueName, queueName, null, false); + session.createQueue(new QueueConfiguration(queueName).setDurable(false)); ClientProducer producer = session.createProducer(queueName); @@ -1603,7 +1600,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { session.start(); - session.createQueue(queueName, queueName, null, false); + session.createQueue(new QueueConfiguration(queueName).setDurable(false)); producer = session.createProducer(queueName); @@ -1644,7 +1641,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); - session.createQueue(queueName, queueName, null, false); + session.createQueue(new QueueConfiguration(queueName).setDurable(false)); ClientProducer producer = session.createProducer(queueName); @@ -1680,7 +1677,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { session.start(); - session.createQueue(queueName, queueName, null, false); + session.createQueue(new QueueConfiguration(queueName).setDurable(false)); producer = session.createProducer(queueName); @@ -1721,7 +1718,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); - session.createQueue(queueName, queueName, null, false); + session.createQueue(new QueueConfiguration(queueName).setDurable(false)); ClientProducer producer = session.createProducer(queueName); @@ -1761,7 +1758,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { session.start(); - session.createQueue(queueName, queueName, null, false); + session.createQueue(new QueueConfiguration(queueName).setDurable(false)); producer = session.createProducer(queueName); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/SimpleTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/SimpleTest.java index 7bf2ce0eb4..55be4d2635 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/SimpleTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/SimpleTest.java @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.integration; import java.util.UUID; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientProducer; @@ -87,7 +88,7 @@ public class SimpleTest extends ActiveMQTestBase { final String addressName = "simpleAddress"; // Create a queue bound to a particular address where the test will send to & consume from. - session.createQueue(addressName, RoutingType.ANYCAST, queueName); + session.createQueue(new QueueConfiguration(queueName).setAddress(addressName).setRoutingType(RoutingType.ANYCAST)); // Create a producer to send a message to the previously created address. ClientProducer producer = session.createProducer(addressName); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/SingleServerSimpleTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/SingleServerSimpleTest.java index b89726baa3..1cb7c8e3a9 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/SingleServerSimpleTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/SingleServerSimpleTest.java @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.integration; import java.util.UUID; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientProducer; @@ -44,7 +45,7 @@ public class SingleServerSimpleTest extends SingleServerTestBase { final String addressName = "simpleAddress"; // Create a queue bound to a particular address where the test will send to & consume from. - session.createQueue(addressName, RoutingType.ANYCAST, queueName); + session.createQueue(new QueueConfiguration(queueName).setAddress(addressName).setRoutingType(RoutingType.ANYCAST)); // Create a producer to send a message to the previously created address. ClientProducer producer = session.createProducer(addressName); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/String64KLimitTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/String64KLimitTest.java index 585717348d..588ef11d80 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/String64KLimitTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/String64KLimitTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; @@ -69,7 +70,7 @@ public class String64KLimitTest extends ActiveMQTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, queue, false); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false)); ClientProducer producer = session.createProducer(address); ClientConsumer consumer = session.createConsumer(queue); @@ -133,7 +134,7 @@ public class String64KLimitTest extends ActiveMQTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, queue, false); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false)); ClientProducer producer = session.createProducer(address); ClientConsumer consumer = session.createConsumer(queue); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/addressing/AddressConfigTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/addressing/AddressConfigTest.java index 859c613717..47a91604cd 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/addressing/AddressConfigTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/addressing/AddressConfigTest.java @@ -20,6 +20,7 @@ package org.apache.activemq.artemis.tests.integration.addressing; import java.util.HashSet; import java.util.Set; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.server.ActiveMQServer; @@ -44,7 +45,7 @@ public class AddressConfigTest extends ActiveMQTestBase { @Test public void persistAddressConfigTest() throws Exception { - server.createQueue(SimpleString.toSimpleString("myAddress"), RoutingType.MULTICAST, SimpleString.toSimpleString("myQueue"), null, true, false); + server.createQueue(new QueueConfiguration("myQueue").setAddress("myAddress")); server.stop(); server.start(); AddressInfo addressInfo = server.getAddressInfo(SimpleString.toSimpleString("myAddress")); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/addressing/AddressingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/addressing/AddressingTest.java index 5a905b823a..aed19c6782 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/addressing/AddressingTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/addressing/AddressingTest.java @@ -23,6 +23,7 @@ import java.util.UUID; import java.util.concurrent.TimeUnit; import org.apache.activemq.artemis.api.core.ActiveMQQueueMaxConsumerLimitReached; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; @@ -75,8 +76,8 @@ public class AddressingTest extends ActiveMQTestBase { addressInfo.addRoutingType(RoutingType.MULTICAST); server.addOrUpdateAddressInfo(addressInfo); - Queue q1 = server.createQueue(new SimpleString(consumeAddress), RoutingType.MULTICAST, new SimpleString(consumeAddress + ".1"), null, true, false); - Queue q2 = server.createQueue(new SimpleString(consumeAddress), RoutingType.MULTICAST, new SimpleString(consumeAddress + ".2"), null, true, false); + Queue q1 = server.createQueue(new QueueConfiguration(new SimpleString(consumeAddress + ".1")).setAddress(new SimpleString(consumeAddress)).setRoutingType(RoutingType.MULTICAST)); + Queue q2 = server.createQueue(new QueueConfiguration(new SimpleString(consumeAddress + ".2")).setAddress(new SimpleString(consumeAddress)).setRoutingType(RoutingType.MULTICAST)); ClientSession session = sessionFactory.createSession(); session.start(); @@ -113,8 +114,8 @@ public class AddressingTest extends ActiveMQTestBase { addressInfo.addRoutingType(RoutingType.ANYCAST); server.addOrUpdateAddressInfo(addressInfo); - Queue q1 = server.createQueue(new SimpleString(consumeAddress), RoutingType.ANYCAST, new SimpleString(consumeAddress + ".1"), null, true, false, Queue.MAX_CONSUMERS_UNLIMITED, false, true); - Queue q2 = server.createQueue(new SimpleString(consumeAddress), RoutingType.ANYCAST, new SimpleString(consumeAddress + ".2"), null, true, false, Queue.MAX_CONSUMERS_UNLIMITED, false, true); + Queue q1 = server.createQueue(new QueueConfiguration(new SimpleString(consumeAddress + ".1")).setAddress(new SimpleString(consumeAddress)).setRoutingType(RoutingType.ANYCAST).setMaxConsumers(Queue.MAX_CONSUMERS_UNLIMITED)); + Queue q2 = server.createQueue(new QueueConfiguration(new SimpleString(consumeAddress + ".2")).setAddress(new SimpleString(consumeAddress)).setRoutingType(RoutingType.ANYCAST).setMaxConsumers(Queue.MAX_CONSUMERS_UNLIMITED)); ClientSession session = sessionFactory.createSession(); session.start(); @@ -147,9 +148,9 @@ public class AddressingTest extends ActiveMQTestBase { addressInfo.addRoutingType(RoutingType.ANYCAST); server.addOrUpdateAddressInfo(addressInfo); - Queue q1 = server.createQueue(address, RoutingType.ANYCAST, address.concat(".1"), null, true, false, Queue.MAX_CONSUMERS_UNLIMITED, false, true); - Queue q2 = server.createQueue(address, RoutingType.ANYCAST, address.concat(".2"), null, true, false, Queue.MAX_CONSUMERS_UNLIMITED, false, true); - Queue q3 = server.createQueue(address, RoutingType.ANYCAST, address.concat(".3"), null, true, false, Queue.MAX_CONSUMERS_UNLIMITED, false, true); + Queue q1 = server.createQueue(new QueueConfiguration(address.concat(".1")).setAddress(address).setRoutingType(RoutingType.ANYCAST).setMaxConsumers(Queue.MAX_CONSUMERS_UNLIMITED)); + Queue q2 = server.createQueue(new QueueConfiguration(address.concat(".2")).setAddress(address).setRoutingType(RoutingType.ANYCAST).setMaxConsumers(Queue.MAX_CONSUMERS_UNLIMITED)); + Queue q3 = server.createQueue(new QueueConfiguration(address.concat(".3")).setAddress(address).setRoutingType(RoutingType.ANYCAST).setMaxConsumers(Queue.MAX_CONSUMERS_UNLIMITED)); ClientSession session = sessionFactory.createSession(); session.start(); @@ -200,8 +201,8 @@ public class AddressingTest extends ActiveMQTestBase { for (String consumeAddress : testAddresses) { // For each address, create 2 Queues with the same address, assert both queues receive message - Queue q1 = server.createQueue(new SimpleString(consumeAddress), RoutingType.MULTICAST, new SimpleString(consumeAddress + ".1"), null, true, false); - Queue q2 = server.createQueue(new SimpleString(consumeAddress), RoutingType.MULTICAST, new SimpleString(consumeAddress + ".2"), null, true, false); + Queue q1 = server.createQueue(new QueueConfiguration(new SimpleString(consumeAddress + ".1")).setAddress(new SimpleString(consumeAddress)).setRoutingType(RoutingType.MULTICAST)); + Queue q2 = server.createQueue(new QueueConfiguration(new SimpleString(consumeAddress + ".2")).setAddress(new SimpleString(consumeAddress)).setRoutingType(RoutingType.MULTICAST)); ClientSession session = sessionFactory.createSession(); session.start(); @@ -227,7 +228,7 @@ public class AddressingTest extends ActiveMQTestBase { public void testPurgeOnNoConsumersTrue() throws Exception { SimpleString address = new SimpleString("test.address"); SimpleString queueName = SimpleString.toSimpleString(UUID.randomUUID().toString()); - server.createQueue(address, RoutingType.ANYCAST, queueName, null, null, true, false, false, false, false, 1, true, true); + server.createQueue(new QueueConfiguration(queueName).setAddress(address).setRoutingType(RoutingType.ANYCAST).setMaxConsumers(1).setPurgeOnNoConsumers(true)); Queue queue = server.locateQueue(queueName); assertNotNull(queue); ClientSession session = sessionFactory.createSession(); @@ -257,7 +258,7 @@ public class AddressingTest extends ActiveMQTestBase { public void testPurgeOnNoConsumersFalse() throws Exception { SimpleString address = new SimpleString("test.address"); SimpleString queueName = SimpleString.toSimpleString(UUID.randomUUID().toString()); - server.createQueue(address, RoutingType.ANYCAST, queueName, null, null, true, false, false, false, false, 1, false, true); + server.createQueue(new QueueConfiguration(queueName).setAddress(address).setRoutingType(RoutingType.ANYCAST).setMaxConsumers(1)); assertNotNull(server.locateQueue(queueName)); ClientSession session = sessionFactory.createSession(); ClientProducer producer = session.createProducer(address); @@ -273,7 +274,7 @@ public class AddressingTest extends ActiveMQTestBase { SimpleString queueName = SimpleString.toSimpleString(UUID.randomUUID().toString()); // For each address, create 2 Queues with the same address, assert both queues receive message boolean purgeOnNoConsumers = false; - Queue q1 = server.createQueue(address, RoutingType.MULTICAST, queueName, null, true, false, 0, purgeOnNoConsumers, true); + Queue q1 = server.createQueue(new QueueConfiguration(queueName).setAddress(address).setMaxConsumers(0).setPurgeOnNoConsumers(purgeOnNoConsumers)); Exception expectedException = null; String expectedMessage = "Maximum Consumer Limit Reached on Queue"; @@ -299,7 +300,7 @@ public class AddressingTest extends ActiveMQTestBase { SimpleString queueName = SimpleString.toSimpleString(UUID.randomUUID().toString()); // For each address, create 2 Queues with the same address, assert both queues receive message boolean purgeOnNoConsumers = false; - Queue q1 = server.createQueue(address, RoutingType.MULTICAST, queueName, null, true, false, Queue.MAX_CONSUMERS_UNLIMITED, purgeOnNoConsumers, true); + Queue q1 = server.createQueue(new QueueConfiguration(queueName).setAddress(address).setMaxConsumers(Queue.MAX_CONSUMERS_UNLIMITED).setPurgeOnNoConsumers(purgeOnNoConsumers)); ClientSession session = sessionFactory.createSession(); session.start(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/addressing/AnycastTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/addressing/AnycastTest.java index 05747aae40..89246a586a 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/addressing/AnycastTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/addressing/AnycastTest.java @@ -18,6 +18,7 @@ package org.apache.activemq.artemis.tests.integration.addressing; import java.util.concurrent.TimeUnit; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; @@ -66,8 +67,8 @@ public class AnycastTest extends ActiveMQTestBase { @Test public void testTxCommitReceive() throws Exception { - Queue q1 = server.createQueue(baseAddress, RoutingType.ANYCAST, baseAddress.concat(".1"), null, true, false, Queue.MAX_CONSUMERS_UNLIMITED, false, true); - Queue q2 = server.createQueue(baseAddress, RoutingType.ANYCAST, baseAddress.concat(".2"), null, true, false, Queue.MAX_CONSUMERS_UNLIMITED, false, true); + Queue q1 = server.createQueue(new QueueConfiguration(baseAddress.concat(".1")).setAddress(baseAddress).setRoutingType(RoutingType.ANYCAST).setMaxConsumers(Queue.MAX_CONSUMERS_UNLIMITED)); + Queue q2 = server.createQueue(new QueueConfiguration(baseAddress.concat(".2")).setAddress(baseAddress).setRoutingType(RoutingType.ANYCAST).setMaxConsumers(Queue.MAX_CONSUMERS_UNLIMITED)); ClientSession session = sessionFactory.createSession(false, false); session.start(); @@ -113,8 +114,8 @@ public class AnycastTest extends ActiveMQTestBase { @Test public void testTxRollbackReceive() throws Exception { - Queue q1 = server.createQueue(baseAddress, RoutingType.ANYCAST, baseAddress.concat(".1"), null, true, false, Queue.MAX_CONSUMERS_UNLIMITED, false, true); - Queue q2 = server.createQueue(baseAddress, RoutingType.ANYCAST, baseAddress.concat(".2"), null, true, false, Queue.MAX_CONSUMERS_UNLIMITED, false, true); + Queue q1 = server.createQueue(new QueueConfiguration(baseAddress.concat(".1")).setAddress(baseAddress).setRoutingType(RoutingType.ANYCAST).setMaxConsumers(Queue.MAX_CONSUMERS_UNLIMITED)); + Queue q2 = server.createQueue(new QueueConfiguration(baseAddress.concat(".2")).setAddress(baseAddress).setRoutingType(RoutingType.ANYCAST).setMaxConsumers(Queue.MAX_CONSUMERS_UNLIMITED)); ClientSession session = sessionFactory.createSession(false, false); session.start(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/addressing/MulticastTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/addressing/MulticastTest.java index dac2b9a83b..e5e5187f9e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/addressing/MulticastTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/addressing/MulticastTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.addressing; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; @@ -66,8 +67,8 @@ public class MulticastTest extends ActiveMQTestBase { @Test public void testTxCommitReceive() throws Exception { - Queue q1 = server.createQueue(baseAddress, RoutingType.MULTICAST, baseAddress.concat(".1"), null, true, false, Queue.MAX_CONSUMERS_UNLIMITED, false, true); - Queue q2 = server.createQueue(baseAddress, RoutingType.MULTICAST, baseAddress.concat(".2"), null, true, false, Queue.MAX_CONSUMERS_UNLIMITED, false, true); + Queue q1 = server.createQueue(new QueueConfiguration(baseAddress.concat(".1")).setAddress(baseAddress).setMaxConsumers(Queue.MAX_CONSUMERS_UNLIMITED)); + Queue q2 = server.createQueue(new QueueConfiguration(baseAddress.concat(".2")).setAddress(baseAddress).setMaxConsumers(Queue.MAX_CONSUMERS_UNLIMITED)); ClientSession session = sessionFactory.createSession(false, false); session.start(); @@ -113,8 +114,8 @@ public class MulticastTest extends ActiveMQTestBase { @Test public void testTxRollbackReceive() throws Exception { - Queue q1 = server.createQueue(baseAddress, RoutingType.MULTICAST, baseAddress.concat(".1"), null, true, false, Queue.MAX_CONSUMERS_UNLIMITED, false, true); - Queue q2 = server.createQueue(baseAddress, RoutingType.MULTICAST, baseAddress.concat(".2"), null, true, false, Queue.MAX_CONSUMERS_UNLIMITED, false, true); + Queue q1 = server.createQueue(new QueueConfiguration(baseAddress.concat(".1")).setAddress(baseAddress).setMaxConsumers(Queue.MAX_CONSUMERS_UNLIMITED)); + Queue q2 = server.createQueue(new QueueConfiguration(baseAddress.concat(".2")).setAddress(baseAddress).setMaxConsumers(Queue.MAX_CONSUMERS_UNLIMITED)); ClientSession session = sessionFactory.createSession(false, false); session.start(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/addressing/TwoWaysRemoveAddressTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/addressing/TwoWaysRemoveAddressTest.java index 5ffe42ea28..b3dd24cf0b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/addressing/TwoWaysRemoveAddressTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/addressing/TwoWaysRemoveAddressTest.java @@ -21,6 +21,7 @@ import java.util.concurrent.CyclicBarrier; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; +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.server.ActiveMQServer; @@ -55,7 +56,7 @@ public class TwoWaysRemoveAddressTest extends ActiveMQTestBase { for (int i = 0; i < retries; i++) { logger.debug("Removed queue on thread 1 ::" + i); - server.createQueue(SimpleString.toSimpleString("address_1_" + i), RoutingType.ANYCAST, SimpleString.toSimpleString("queueName_1_" + i), null, true, false); + server.createQueue(new QueueConfiguration("queueName_1_" + i).setAddress("address_1_" + i).setRoutingType(RoutingType.ANYCAST)); server.destroyQueue(SimpleString.toSimpleString("queueName_1_" + i)); } } catch (Throwable e) { @@ -74,7 +75,7 @@ public class TwoWaysRemoveAddressTest extends ActiveMQTestBase { for (int i = 0; i < retries; i++) { logger.debug("Removed queue on thread 2 ::" + i); - server.createQueue(SimpleString.toSimpleString("address_2_" + i), RoutingType.ANYCAST, SimpleString.toSimpleString("queueName_2_" + i), null, true, false); + server.createQueue(new QueueConfiguration("queueName_2_" + i).setAddress("address_2_" + i).setRoutingType(RoutingType.ANYCAST)); server.removeAddressInfo(SimpleString.toSimpleString("address_2_" + i), null, true); } } catch (Throwable e) { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpBridgeApplicationPropertiesTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpBridgeApplicationPropertiesTest.java index 43aea33a99..7b33de1748 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpBridgeApplicationPropertiesTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpBridgeApplicationPropertiesTest.java @@ -23,6 +23,7 @@ import java.util.HashMap; import java.util.Map; import org.apache.activemq.artemis.api.core.Message; +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.api.core.client.ActiveMQClient; @@ -118,10 +119,10 @@ public class AmqpBridgeApplicationPropertiesTest extends AmqpClientTestSupport { server0.start(); server1.start(); - server0.createQueue(customNotificationQueue, RoutingType.ANYCAST, customNotificationQueue, null, true, false); - server0.createQueue(frameworkNotificationsQueue, RoutingType.ANYCAST, frameworkNotificationsQueue, null, true, false); - server1.createQueue(bridgeNotificationsQueue, RoutingType.ANYCAST, bridgeNotificationsQueue, null, true, false); - server1.createQueue(notificationsQueue, RoutingType.MULTICAST, notificationsQueue, null, true, false); + server0.createQueue(new QueueConfiguration(customNotificationQueue).setRoutingType(RoutingType.ANYCAST)); + server0.createQueue(new QueueConfiguration(frameworkNotificationsQueue).setRoutingType(RoutingType.ANYCAST)); + server1.createQueue(new QueueConfiguration(bridgeNotificationsQueue).setRoutingType(RoutingType.ANYCAST)); + server1.createQueue(new QueueConfiguration(notificationsQueue)); server0.deployBridge(new BridgeConfiguration().setName("notifications-bridge").setQueueName(frameworkNotificationsQueue.toString()).setForwardingAddress(bridgeNotificationsQueue.toString()).setConfirmationWindowSize(10).setStaticConnectors(Arrays.asList("notification-broker")).setTransformerConfiguration(new TransformerConfiguration(BridgeApplicationPropertiesTransformer.class.getName()))); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpBridgeClusterRedistributionTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpBridgeClusterRedistributionTest.java index 328f7f9de2..91f6a2485b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpBridgeClusterRedistributionTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpBridgeClusterRedistributionTest.java @@ -17,6 +17,7 @@ package org.apache.activemq.artemis.tests.integration.amqp; +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.api.core.TransportConfiguration; @@ -143,14 +144,14 @@ public class AmqpBridgeClusterRedistributionTest extends AmqpClientTestSupport { server1.start(); server2.start(); - server0.createQueue(customNotificationQueue, RoutingType.ANYCAST, customNotificationQueue, null, true, false); - server0.createQueue(frameworkNotificationsQueue, RoutingType.ANYCAST, frameworkNotificationsQueue, null, true, false); + server0.createQueue(new QueueConfiguration(customNotificationQueue).setRoutingType(RoutingType.ANYCAST)); + server0.createQueue(new QueueConfiguration(frameworkNotificationsQueue).setRoutingType(RoutingType.ANYCAST)); - server1.createQueue(bridgeNotificationsQueue, RoutingType.ANYCAST, bridgeNotificationsQueue, null, true, false); - server1.createQueue(notificationsQueue, RoutingType.MULTICAST, notificationsQueue, null, true, false); + server1.createQueue(new QueueConfiguration(bridgeNotificationsQueue).setRoutingType(RoutingType.ANYCAST)); + server1.createQueue(new QueueConfiguration(notificationsQueue)); - server2.createQueue(bridgeNotificationsQueue, RoutingType.ANYCAST, bridgeNotificationsQueue, null, true, false); - server2.createQueue(notificationsQueue, RoutingType.MULTICAST, notificationsQueue, null, true, false); + server2.createQueue(new QueueConfiguration(bridgeNotificationsQueue).setRoutingType(RoutingType.ANYCAST)); + server2.createQueue(new QueueConfiguration(notificationsQueue)); server0.deployBridge(new BridgeConfiguration().setName("notifications-bridge").setQueueName(frameworkNotificationsQueue.toString()).setForwardingAddress(bridgeNotificationsQueue.toString()).setConfirmationWindowSize(10).setStaticConnectors(Arrays.asList("notification-broker"))); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpClientTestSupport.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpClientTestSupport.java index a4b63a3917..b94e1f704f 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpClientTestSupport.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpClientTestSupport.java @@ -25,6 +25,7 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; +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.api.core.TransportConfiguration; @@ -227,20 +228,20 @@ public class AmqpClientTestSupport extends AmqpTestSupport { protected void createAddressAndQueues(ActiveMQServer server) throws Exception { // Default Queue server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(getQueueName()), RoutingType.ANYCAST)); - server.createQueue(SimpleString.toSimpleString(getQueueName()), RoutingType.ANYCAST, SimpleString.toSimpleString(getQueueName()), null, true, false, -1, false, true); + server.createQueue(new QueueConfiguration(getQueueName()).setRoutingType(RoutingType.ANYCAST)); // Default DLQ server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(getDeadLetterAddress()), RoutingType.ANYCAST)); - server.createQueue(SimpleString.toSimpleString(getDeadLetterAddress()), RoutingType.ANYCAST, SimpleString.toSimpleString(getDeadLetterAddress()), null, true, false, -1, false, true); + server.createQueue(new QueueConfiguration(getDeadLetterAddress()).setRoutingType(RoutingType.ANYCAST)); // Default Topic server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(getTopicName()), RoutingType.MULTICAST)); - server.createQueue(SimpleString.toSimpleString(getTopicName()), RoutingType.MULTICAST, SimpleString.toSimpleString(getTopicName()), null, true, false, -1, false, true); + server.createQueue(new QueueConfiguration(getTopicName())); // Additional Test Queues for (int i = 0; i < getPrecreatedQueueSize(); ++i) { server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(getQueueName(i)), RoutingType.ANYCAST)); - server.createQueue(SimpleString.toSimpleString(getQueueName(i)), RoutingType.ANYCAST, SimpleString.toSimpleString(getQueueName(i)), null, true, false, -1, false, true); + server.createQueue(new QueueConfiguration(getQueueName(i)).setRoutingType(RoutingType.ANYCAST)); } } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpFullyQualifiedNameTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpFullyQualifiedNameTest.java index ba9ff23dca..95c99f1da6 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpFullyQualifiedNameTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpFullyQualifiedNameTest.java @@ -26,6 +26,7 @@ import javax.jms.MessageProducer; import javax.jms.Session; import javax.jms.Topic; +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.api.core.TransportConfiguration; @@ -95,8 +96,8 @@ public class AmqpFullyQualifiedNameTest extends JMSClientTestSupport { String queue1 = "q1"; String queue2 = "q2"; - server.createQueue(SimpleString.toSimpleString(address1), RoutingType.ANYCAST, SimpleString.toSimpleString(queue1), null, true, false, -1, false, true); - server.createQueue(SimpleString.toSimpleString(address2), RoutingType.ANYCAST, SimpleString.toSimpleString(queue2), null, true, false, -1, false, true); + server.createQueue(new QueueConfiguration(queue1).setAddress(address1).setRoutingType(RoutingType.ANYCAST)); + server.createQueue(new QueueConfiguration(queue2).setAddress(address2).setRoutingType(RoutingType.ANYCAST)); Exception e = null; @@ -127,8 +128,8 @@ public class AmqpFullyQualifiedNameTest extends JMSClientTestSupport { String queue1 = "q1"; String queue2 = "q2"; - server.createQueue(SimpleString.toSimpleString(address1), RoutingType.MULTICAST, SimpleString.toSimpleString(queue1), null, true, false, -1, false, true); - server.createQueue(SimpleString.toSimpleString(address2), RoutingType.MULTICAST, SimpleString.toSimpleString(queue2), null, true, false, -1, false, true); + server.createQueue(new QueueConfiguration(queue1).setAddress(address1)); + server.createQueue(new QueueConfiguration(queue2).setAddress(address2)); Exception e = null; @@ -156,7 +157,7 @@ public class AmqpFullyQualifiedNameTest extends JMSClientTestSupport { public void testTopic() throws Exception { SimpleString queueName = new SimpleString("someAddress"); - server.createQueue(multicastAddress, RoutingType.MULTICAST, queueName, null, false, false); + server.createQueue(new QueueConfiguration(queueName).setAddress(multicastAddress).setDurable(false)); Connection connection = createConnection(false); try { @@ -204,8 +205,8 @@ public class AmqpFullyQualifiedNameTest extends JMSClientTestSupport { SimpleString queueName1 = new SimpleString("sub.queue1"); SimpleString queueName2 = new SimpleString("sub.queue2"); - server.createQueue(multicastAddress, RoutingType.MULTICAST, queueName1, null, false, false); - server.createQueue(multicastAddress, RoutingType.MULTICAST, queueName2, null, false, false); + server.createQueue(new QueueConfiguration(queueName1).setAddress(multicastAddress).setDurable(false)); + server.createQueue(new QueueConfiguration(queueName2).setAddress(multicastAddress).setDurable(false)); Connection connection = createConnection(false); try { @@ -313,7 +314,7 @@ public class AmqpFullyQualifiedNameTest extends JMSClientTestSupport { */ @Test public void testQueueSpecial() throws Exception { - server.createQueue(anycastAddress, RoutingType.ANYCAST, anycastQ1, null, true, false, -1, false, true); + server.createQueue(new QueueConfiguration(anycastQ1).setAddress(anycastAddress).setRoutingType(RoutingType.ANYCAST)); Connection connection = createConnection(); Exception expectedException = null; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpMessageDivertsTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpMessageDivertsTest.java index 0613801489..483d557fcc 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpMessageDivertsTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpMessageDivertsTest.java @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.integration.amqp; import java.util.concurrent.TimeUnit; 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.server.ComponentConfigurationRoutingType; @@ -44,7 +45,7 @@ public class AmqpMessageDivertsTest extends AmqpClientTestSupport { public void runQueueReceiverReadMessageWithDivert(String routingType) throws Exception { final String forwardingAddress = getQueueName() + "Divert"; final SimpleString simpleForwardingAddress = SimpleString.toSimpleString(forwardingAddress); - server.createQueue(simpleForwardingAddress, RoutingType.ANYCAST, simpleForwardingAddress, null, true, false); + server.createQueue(new QueueConfiguration(simpleForwardingAddress).setRoutingType(RoutingType.ANYCAST)); server.getActiveMQServerControl().createDivert("name", "routingName", getQueueName(), forwardingAddress, true, null, null, routingType); sendMessages(getQueueName(), 1); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpMessageRoutingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpMessageRoutingTest.java index 774b3a2642..89f3ebce79 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpMessageRoutingTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpMessageRoutingTest.java @@ -23,6 +23,7 @@ import javax.jms.MessageProducer; import javax.jms.Session; import javax.jms.Topic; +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.api.core.management.ActiveMQServerControl; @@ -57,9 +58,9 @@ public class AmqpMessageRoutingTest extends JMSClientTestSupport { ActiveMQServerControl serverControl = server.getActiveMQServerControl(); serverControl.createAddress(addressA, RoutingType.ANYCAST.toString() + "," + RoutingType.MULTICAST.toString()); - serverControl.createQueue(addressA, queueA, RoutingType.ANYCAST.toString()); - serverControl.createQueue(addressA, queueB, RoutingType.ANYCAST.toString()); - serverControl.createQueue(addressA, queueC, RoutingType.MULTICAST.toString()); + serverControl.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setRoutingType(RoutingType.ANYCAST).toJSON()); + serverControl.createQueue(new QueueConfiguration(queueB).setAddress(addressA).setRoutingType(RoutingType.ANYCAST).toJSON()); + serverControl.createQueue(new QueueConfiguration(queueC).setAddress(addressA).setRoutingType(RoutingType.MULTICAST).toJSON()); sendMessages("anycast://" + addressA, 1); @@ -76,9 +77,9 @@ public class AmqpMessageRoutingTest extends JMSClientTestSupport { ActiveMQServerControl serverControl = server.getActiveMQServerControl(); serverControl.createAddress(addressA, RoutingType.ANYCAST.toString() + "," + RoutingType.MULTICAST.toString()); - serverControl.createQueue(addressA, queueA, RoutingType.ANYCAST.toString()); - serverControl.createQueue(addressA, queueB, RoutingType.ANYCAST.toString()); - serverControl.createQueue(addressA, queueC, RoutingType.MULTICAST.toString()); + serverControl.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setRoutingType(RoutingType.ANYCAST).toJSON()); + serverControl.createQueue(new QueueConfiguration(queueB).setAddress(addressA).setRoutingType(RoutingType.ANYCAST).toJSON()); + serverControl.createQueue(new QueueConfiguration(queueC).setAddress(addressA).setRoutingType(RoutingType.MULTICAST).toJSON()); sendMessages(addressA, 1, RoutingType.ANYCAST); @@ -95,9 +96,9 @@ public class AmqpMessageRoutingTest extends JMSClientTestSupport { ActiveMQServerControl serverControl = server.getActiveMQServerControl(); serverControl.createAddress(addressA, RoutingType.ANYCAST.toString() + "," + RoutingType.MULTICAST.toString()); - serverControl.createQueue(addressA, queueA, RoutingType.ANYCAST.toString()); - serverControl.createQueue(addressA, queueB, RoutingType.MULTICAST.toString()); - serverControl.createQueue(addressA, queueC, RoutingType.MULTICAST.toString()); + serverControl.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setRoutingType(RoutingType.ANYCAST).toJSON()); + serverControl.createQueue(new QueueConfiguration(queueB).setAddress(addressA).setRoutingType(RoutingType.MULTICAST).toJSON()); + serverControl.createQueue(new QueueConfiguration(queueC).setAddress(addressA).setRoutingType(RoutingType.MULTICAST).toJSON()); sendMessages("multicast://" + addressA, 1); @@ -114,9 +115,9 @@ public class AmqpMessageRoutingTest extends JMSClientTestSupport { ActiveMQServerControl serverControl = server.getActiveMQServerControl(); serverControl.createAddress(addressA, RoutingType.ANYCAST.toString() + "," + RoutingType.MULTICAST.toString()); - serverControl.createQueue(addressA, queueA, RoutingType.ANYCAST.toString()); - serverControl.createQueue(addressA, queueB, RoutingType.MULTICAST.toString()); - serverControl.createQueue(addressA, queueC, RoutingType.MULTICAST.toString()); + serverControl.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setRoutingType(RoutingType.ANYCAST).toJSON()); + serverControl.createQueue(new QueueConfiguration(queueB).setAddress(addressA).setRoutingType(RoutingType.MULTICAST).toJSON()); + serverControl.createQueue(new QueueConfiguration(queueC).setAddress(addressA).setRoutingType(RoutingType.MULTICAST).toJSON()); sendMessages(addressA, 1, RoutingType.MULTICAST); @@ -143,7 +144,7 @@ public class AmqpMessageRoutingTest extends JMSClientTestSupport { addressInfo.addRoutingType(RoutingType.ANYCAST); server.addAddressInfo(addressInfo); - server.createQueue(ssTestAddress, RoutingType.ANYCAST, ssTestAddress, null, true, false); + server.createQueue(new QueueConfiguration(ssTestAddress).setRoutingType(RoutingType.ANYCAST)); Connection connection = createConnection(UUIDGenerator.getInstance().generateStringUUID()); @@ -188,7 +189,7 @@ public class AmqpMessageRoutingTest extends JMSClientTestSupport { ActiveMQServerControl serverControl = server.getActiveMQServerControl(); serverControl.createAddress(addressA, RoutingType.ANYCAST.toString() + "," + RoutingType.MULTICAST.toString()); - serverControl.createQueue(addressA, addressA, RoutingType.ANYCAST.toString()); + serverControl.createQueue(new QueueConfiguration(addressA).setRoutingType(RoutingType.ANYCAST).toJSON()); try { Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpPurgeOnNoConsumersTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpPurgeOnNoConsumersTest.java index ae4849b960..04097f4fcd 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpPurgeOnNoConsumersTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpPurgeOnNoConsumersTest.java @@ -25,6 +25,7 @@ import javax.jms.TextMessage; import java.io.IOException; import java.util.concurrent.TimeUnit; +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.server.impl.AddressInfo; @@ -52,7 +53,7 @@ public class AmqpPurgeOnNoConsumersTest extends AmqpClientTestSupport { SimpleString ssQueue = new SimpleString(queue); server.addAddressInfo(new AddressInfo(ssQueue, RoutingType.ANYCAST)); - server.createQueue(ssQueue, RoutingType.ANYCAST, ssQueue, null, true, false, 1, true, false); + server.createQueue(new QueueConfiguration(ssQueue).setRoutingType(RoutingType.ANYCAST).setMaxConsumers(1).setPurgeOnNoConsumers(true).setAutoCreateAddress(false)); AmqpClient client = createAmqpClient(); connection = addConnection(client.connect()); @@ -107,7 +108,7 @@ public class AmqpPurgeOnNoConsumersTest extends AmqpClientTestSupport { String queue = "purgeQueue"; SimpleString ssQueue = new SimpleString(queue); server.addAddressInfo(new AddressInfo(ssQueue, RoutingType.ANYCAST)); - server.createQueue(ssQueue, RoutingType.ANYCAST, ssQueue, null, true, false, 1, true, false); + server.createQueue(new QueueConfiguration(ssQueue).setRoutingType(RoutingType.ANYCAST).setMaxConsumers(1).setPurgeOnNoConsumers(true).setAutoCreateAddress(false)); ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("tcp://localhost:5672"); Connection connection = cf.createConnection(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpSendReceiveTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpSendReceiveTest.java index dda89ec948..d11faad5e3 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpSendReceiveTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpSendReceiveTest.java @@ -30,6 +30,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import javax.jms.Topic; +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.config.BridgeConfiguration; @@ -1084,7 +1085,7 @@ public class AmqpSendReceiveTest extends AmqpClientTestSupport { String queueName = "TestQueueName"; String address = "TestAddress"; server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(address), RoutingType.ANYCAST)); - server.createQueue(new SimpleString(address), RoutingType.ANYCAST, new SimpleString(queueName), null, true, false); + server.createQueue(new QueueConfiguration(new SimpleString(queueName)).setAddress(new SimpleString(address)).setRoutingType(RoutingType.ANYCAST)); AmqpClient client = createAmqpClient(); AmqpConnection connection = addConnection(client.connect()); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpTransactionTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpTransactionTest.java index 84a4927ed9..b6e04ec03a 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpTransactionTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpTransactionTest.java @@ -16,11 +16,6 @@ */ package org.apache.activemq.artemis.tests.integration.amqp; -import java.io.IOException; -import java.util.ArrayList; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.DeliveryMode; @@ -28,9 +23,13 @@ import javax.jms.Message; import javax.jms.MessageConsumer; import javax.jms.MessageProducer; import javax.jms.Session; +import java.io.IOException; +import java.util.ArrayList; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +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.server.Queue; import org.apache.activemq.artemis.tests.util.Wait; import org.apache.activemq.transport.amqp.client.AmqpClient; @@ -856,7 +855,7 @@ public class AmqpTransactionTest extends AmqpClientTestSupport { public void testSendPersistentTX() throws Exception { int MESSAGE_COUNT = 2000; AtomicInteger errors = new AtomicInteger(0); - server.createQueue(SimpleString.toSimpleString("q1"), RoutingType.ANYCAST, SimpleString.toSimpleString("q1"), null, true, false, 1, false, true); + server.createQueue(new QueueConfiguration("q1").setRoutingType(RoutingType.ANYCAST).setMaxConsumers(1)); ConnectionFactory factory = new JmsConnectionFactory("amqp://localhost:" + AMQP_PORT); Connection sendConnection = factory.createConnection(); Connection consumerConnection = factory.createConnection(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/BrokerDefinedAnycastConsumerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/BrokerDefinedAnycastConsumerTest.java index 7f0fdd8dd8..00b48a19f4 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/BrokerDefinedAnycastConsumerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/BrokerDefinedAnycastConsumerTest.java @@ -21,6 +21,7 @@ import static org.apache.qpid.jms.provider.amqp.message.AmqpDestinationHelper.TO import java.util.concurrent.TimeUnit; +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.server.impl.AddressInfo; @@ -48,7 +49,7 @@ public class BrokerDefinedAnycastConsumerTest extends AmqpClientTestSupport { @Test(timeout = 60000) public void testConsumeFromSingleQueueOnAddressSameName() throws Exception { server.addAddressInfo(new AddressInfo(address, RoutingType.ANYCAST)); - server.createQueue(address, RoutingType.ANYCAST, address, null, true, false); + server.createQueue(new QueueConfiguration(address).setRoutingType(RoutingType.ANYCAST)); sendMessages(address.toString(), 1); @@ -69,8 +70,8 @@ public class BrokerDefinedAnycastConsumerTest extends AmqpClientTestSupport { @Test(timeout = 60000) public void testConsumeFromSingleQueueOnAddressSameNameMultipleQueues() throws Exception { server.addAddressInfo(new AddressInfo(address, RoutingType.ANYCAST)); - server.createQueue(address, RoutingType.ANYCAST, queue1, null, true, false); - server.createQueue(address, RoutingType.ANYCAST, address, null, true, false); + server.createQueue(new QueueConfiguration(queue1).setAddress(address).setRoutingType(RoutingType.ANYCAST)); + server.createQueue(new QueueConfiguration(address).setRoutingType(RoutingType.ANYCAST)); sendMessages(address.toString(), 2); @@ -91,7 +92,7 @@ public class BrokerDefinedAnycastConsumerTest extends AmqpClientTestSupport { @Test(timeout = 60000) public void testConsumeFromSingleQueueOnAddressDifferentName() throws Exception { server.addAddressInfo(new AddressInfo(address, RoutingType.ANYCAST)); - server.createQueue(address, RoutingType.ANYCAST, queue1, null, true, false); + server.createQueue(new QueueConfiguration(queue1).setAddress(address).setRoutingType(RoutingType.ANYCAST)); sendMessages(address.toString(), 1); @@ -112,8 +113,8 @@ public class BrokerDefinedAnycastConsumerTest extends AmqpClientTestSupport { @Test(timeout = 60000) public void testConsumeFromSingleQueueOnAddressDifferentNameMultipleQueues() throws Exception { server.addAddressInfo(new AddressInfo(address, RoutingType.ANYCAST)); - server.createQueue(address, RoutingType.ANYCAST, queue1, null, true, false); - server.createQueue(address, RoutingType.ANYCAST, queue2, null, true, false); + server.createQueue(new QueueConfiguration(queue1).setAddress(address).setRoutingType(RoutingType.ANYCAST)); + server.createQueue(new QueueConfiguration(queue2).setAddress(address).setRoutingType(RoutingType.ANYCAST)); sendMessages(address.toString(), 1); @@ -134,7 +135,7 @@ public class BrokerDefinedAnycastConsumerTest extends AmqpClientTestSupport { @Test(timeout = 60000) public void testConsumeFromSingleQualifiedQueueOnAddressSameName() throws Exception { server.addAddressInfo(new AddressInfo(address, RoutingType.ANYCAST)); - server.createQueue(address, RoutingType.ANYCAST, queue1, null, true, false); + server.createQueue(new QueueConfiguration(queue1).setAddress(address).setRoutingType(RoutingType.ANYCAST)); sendMessages(address.toString(), 1); @@ -215,7 +216,7 @@ public class BrokerDefinedAnycastConsumerTest extends AmqpClientTestSupport { addressInfo.getRoutingTypes().add(RoutingType.ANYCAST); addressInfo.getRoutingTypes().add(RoutingType.MULTICAST); server.addAddressInfo(addressInfo); - server.createQueue(address, RoutingType.MULTICAST, address, null, true, false); + server.createQueue(new QueueConfiguration(address)); AmqpClient client = createAmqpClient(); AmqpConnection connection = addConnection(client.connect()); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/BrokerDefinedMulticastConsumerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/BrokerDefinedMulticastConsumerTest.java index bdf6258e26..53004477f6 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/BrokerDefinedMulticastConsumerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/BrokerDefinedMulticastConsumerTest.java @@ -21,6 +21,7 @@ import static org.apache.qpid.jms.provider.amqp.message.AmqpDestinationHelper.TO import java.util.concurrent.TimeUnit; +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.server.impl.AddressInfo; @@ -42,7 +43,7 @@ public class BrokerDefinedMulticastConsumerTest extends AmqpClientTestSupport { @Test(timeout = 60000) public void testConsumeFromSingleQueueOnAddressSameName() throws Exception { server.addAddressInfo(new AddressInfo(address, RoutingType.MULTICAST)); - server.createQueue(address, RoutingType.MULTICAST, address, null, true, false); + server.createQueue(new QueueConfiguration(address)); sendMessages(address.toString(), 1); @@ -87,7 +88,7 @@ public class BrokerDefinedMulticastConsumerTest extends AmqpClientTestSupport { addressInfo.getRoutingTypes().add(RoutingType.MULTICAST); addressInfo.getRoutingTypes().add(RoutingType.ANYCAST); server.addAddressInfo(addressInfo); - server.createQueue(address, RoutingType.MULTICAST, address, null, true, false); + server.createQueue(new QueueConfiguration(address)); AmqpClient client = createAmqpClient(); AmqpConnection connection = addConnection(client.connect()); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/ClientDefinedMultiConsumerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/ClientDefinedMultiConsumerTest.java index 51c70ee47c..e2085a445b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/ClientDefinedMultiConsumerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/ClientDefinedMultiConsumerTest.java @@ -20,6 +20,7 @@ import static org.apache.qpid.jms.provider.amqp.message.AmqpDestinationHelper.TO import java.util.concurrent.TimeUnit; +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.server.impl.AddressInfo; @@ -76,7 +77,7 @@ public class ClientDefinedMultiConsumerTest extends AmqpClientTestSupport { AddressInfo addressInfo = new AddressInfo(address); addressInfo.getRoutingTypes().add(RoutingType.MULTICAST); server.addAddressInfo(addressInfo); - server.createQueue(address, RoutingType.MULTICAST, SimpleString.toSimpleString("myClientId.mySub:shared-volatile"), null, true, false, -1, false, false); + server.createQueue(new QueueConfiguration("myClientId.mySub:shared-volatile").setAddress(address).setAutoCreateAddress(false)); AmqpClient client = createAmqpClient(); AmqpConnection connection = addConnection(client.connect("myClientId")); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/ExtremeCancelsTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/ExtremeCancelsTest.java index f3ef6a484c..83b4cbeb35 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/ExtremeCancelsTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/ExtremeCancelsTest.java @@ -29,6 +29,7 @@ import java.util.Collection; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; +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.jms.client.ActiveMQConnectionFactory; @@ -67,7 +68,7 @@ public class ExtremeCancelsTest extends JMSClientTestSupport { @Test(timeout = 120000) public void testLotsOfCloseOpenConsumer() throws Exception { - server.createQueue(anycastAddress, RoutingType.ANYCAST, anycastAddress, null, true, false); + server.createQueue(new QueueConfiguration(anycastAddress).setRoutingType(RoutingType.ANYCAST)); AtomicInteger errors = new AtomicInteger(0); AtomicBoolean runnning = new AtomicBoolean(true); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSLVQTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSLVQTest.java index 9eef3e93f5..844e735bac 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSLVQTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSLVQTest.java @@ -25,6 +25,7 @@ import javax.jms.Queue; import javax.jms.Session; import javax.jms.TextMessage; import org.apache.activemq.artemis.api.core.Message; +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.server.ActiveMQServer; @@ -55,7 +56,6 @@ public class JMSLVQTest extends JMSClientTestSupport { server.getAddressSettingsRepository().addMatch(NORMAL_QUEUE_NAME, new AddressSettings()); server.getAddressSettingsRepository().addMatch(LVQ_QUEUE_NAME, new AddressSettings().setDefaultLastValueQueue(true)); server.getAddressSettingsRepository().addMatch(LVQ_CUSTOM_KEY_QUEUE_NAME, new AddressSettings().setDefaultLastValueQueue(true).setDefaultLastValueKey(SimpleString.toSimpleString(CUSTOM_KEY))); - } @Override @@ -64,16 +64,16 @@ public class JMSLVQTest extends JMSClientTestSupport { //Add Standard Queue server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(NORMAL_QUEUE_NAME), RoutingType.ANYCAST)); - server.createQueue(SimpleString.toSimpleString(NORMAL_QUEUE_NAME), RoutingType.ANYCAST, SimpleString.toSimpleString(NORMAL_QUEUE_NAME), null, true, false, -1, false, true); + server.createQueue(new QueueConfiguration(NORMAL_QUEUE_NAME).setRoutingType(RoutingType.ANYCAST)); //Add LVQ using Default Message.HDR_LAST_VALUE_NAME server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(LVQ_QUEUE_NAME), RoutingType.ANYCAST)); - server.createQueue(SimpleString.toSimpleString(LVQ_QUEUE_NAME), RoutingType.ANYCAST, SimpleString.toSimpleString(LVQ_QUEUE_NAME), null, true, false, -1, false, true); + server.createQueue(new QueueConfiguration(LVQ_QUEUE_NAME).setRoutingType(RoutingType.ANYCAST)); //Add LVQ using Custom Key server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(LVQ_CUSTOM_KEY_QUEUE_NAME), RoutingType.ANYCAST)); - server.createQueue(SimpleString.toSimpleString(LVQ_CUSTOM_KEY_QUEUE_NAME), RoutingType.ANYCAST, SimpleString.toSimpleString(LVQ_CUSTOM_KEY_QUEUE_NAME), null, true, false, -1, false, true); + server.createQueue(new QueueConfiguration(LVQ_CUSTOM_KEY_QUEUE_NAME).setRoutingType(RoutingType.ANYCAST)); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSMessageTypesTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSMessageTypesTest.java index 2a62f05d0a..4a1e29652e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSMessageTypesTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSMessageTypesTest.java @@ -31,6 +31,7 @@ import javax.jms.Session; import javax.jms.StreamMessage; import javax.jms.TextMessage; +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.api.core.management.AddressControl; @@ -57,7 +58,7 @@ public class JMSMessageTypesTest extends JMSClientTestSupport { @Test(timeout = 60000) public void testAddressControlSendMessage() throws Exception { SimpleString address = RandomUtil.randomSimpleString(); - server.createQueue(address, RoutingType.ANYCAST, address, null, true, false); + server.createQueue(new QueueConfiguration(address).setRoutingType(RoutingType.ANYCAST)); AddressControl addressControl = ManagementControlHelper.createAddressControl(address, mBeanServer); Assert.assertEquals(1, addressControl.getQueueNames().length); @@ -87,7 +88,7 @@ public class JMSMessageTypesTest extends JMSClientTestSupport { @Test(timeout = 60000) public void testAddressControlSendMessageWithText() throws Exception { SimpleString address = RandomUtil.randomSimpleString(); - server.createQueue(address, RoutingType.ANYCAST, address, null, true, false); + server.createQueue(new QueueConfiguration(address).setRoutingType(RoutingType.ANYCAST)); AddressControl addressControl = ManagementControlHelper.createAddressControl(address, mBeanServer); Assert.assertEquals(1, addressControl.getQueueNames().length); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSNonDestructiveTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSNonDestructiveTest.java index 9b31b792a1..4fa5706f82 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSNonDestructiveTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSNonDestructiveTest.java @@ -28,6 +28,7 @@ import java.util.Arrays; import java.util.Collection; import org.apache.activemq.artemis.api.core.Message; +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.api.core.management.QueueControl; @@ -86,19 +87,19 @@ public class JMSNonDestructiveTest extends JMSClientTestSupport { //Add Non Destructive Queue server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(NON_DESTRUCTIVE_QUEUE_NAME), RoutingType.ANYCAST)); - server.createQueue(SimpleString.toSimpleString(NON_DESTRUCTIVE_QUEUE_NAME), RoutingType.ANYCAST, SimpleString.toSimpleString(NON_DESTRUCTIVE_QUEUE_NAME), null, true, false, -1, false, true); + server.createQueue(new QueueConfiguration(NON_DESTRUCTIVE_QUEUE_NAME).setRoutingType(RoutingType.ANYCAST)); //Add Non Destructive Expiry Queue server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(NON_DESTRUCTIVE_EXPIRY_QUEUE_NAME), RoutingType.ANYCAST)); - server.createQueue(SimpleString.toSimpleString(NON_DESTRUCTIVE_EXPIRY_QUEUE_NAME), RoutingType.ANYCAST, SimpleString.toSimpleString(NON_DESTRUCTIVE_EXPIRY_QUEUE_NAME), null, true, false, -1, false, true); + server.createQueue(new QueueConfiguration(NON_DESTRUCTIVE_EXPIRY_QUEUE_NAME).setRoutingType(RoutingType.ANYCAST)); //Add Non Destructive Last Value Queue server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(NON_DESTRUCTIVE_LVQ_QUEUE_NAME), RoutingType.ANYCAST)); - server.createQueue(SimpleString.toSimpleString(NON_DESTRUCTIVE_LVQ_QUEUE_NAME), RoutingType.ANYCAST, SimpleString.toSimpleString(NON_DESTRUCTIVE_LVQ_QUEUE_NAME), null, true, false, -1, false, true); + server.createQueue(new QueueConfiguration(NON_DESTRUCTIVE_LVQ_QUEUE_NAME).setRoutingType(RoutingType.ANYCAST)); //Add Non Destructive Last Value Queue for Tombstone Test server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(NON_DESTRUCTIVE_TOMBSTONE_LVQ_QUEUE_NAME), RoutingType.ANYCAST)); - server.createQueue(SimpleString.toSimpleString(NON_DESTRUCTIVE_TOMBSTONE_LVQ_QUEUE_NAME), RoutingType.ANYCAST, SimpleString.toSimpleString(NON_DESTRUCTIVE_TOMBSTONE_LVQ_QUEUE_NAME), null, true, false, -1, false, true); + server.createQueue(new QueueConfiguration(NON_DESTRUCTIVE_TOMBSTONE_LVQ_QUEUE_NAME).setRoutingType(RoutingType.ANYCAST)); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSSelectorTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSSelectorTest.java index 56c83d234d..7c7630a3e4 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSSelectorTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSSelectorTest.java @@ -24,6 +24,8 @@ import javax.jms.MessageProducer; import javax.jms.Queue; import javax.jms.Session; import javax.jms.TextMessage; + +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.server.ActiveMQServer; @@ -56,7 +58,7 @@ public class JMSSelectorTest extends JMSClientTestSupport { //Add Standard Queue server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(NORMAL_QUEUE_NAME), RoutingType.ANYCAST)); - server.createQueue(SimpleString.toSimpleString(NORMAL_QUEUE_NAME), RoutingType.ANYCAST, SimpleString.toSimpleString(NORMAL_QUEUE_NAME), null, true, false, -1, false, true); + server.createQueue(new QueueConfiguration(NORMAL_QUEUE_NAME).setRoutingType(RoutingType.ANYCAST)); } @Test diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSTransactedRedeliveryBugTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSTransactedRedeliveryBugTest.java index 9bbb62dc9f..5ac39a7247 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSTransactedRedeliveryBugTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSTransactedRedeliveryBugTest.java @@ -25,6 +25,7 @@ import javax.jms.Queue; import javax.jms.Session; import javax.jms.TextMessage; +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.server.ActiveMQServer; @@ -50,9 +51,9 @@ public class JMSTransactedRedeliveryBugTest extends JMSClientTestSupport { protected void createAddressAndQueues(ActiveMQServer server) throws Exception { super.createAddressAndQueues(server); server.addAddressInfo(new AddressInfo(INITIAL_QUEUE_SS, RoutingType.ANYCAST)); - server.createQueue(INITIAL_QUEUE_SS, RoutingType.ANYCAST, INITIAL_QUEUE_SS, null, true, false, -1, false, true); + server.createQueue(new QueueConfiguration(INITIAL_QUEUE_SS).setRoutingType(RoutingType.ANYCAST)); server.addAddressInfo(new AddressInfo(FINAL_QUEUE_SS, RoutingType.ANYCAST)); - server.createQueue(FINAL_QUEUE_SS, RoutingType.ANYCAST, FINAL_QUEUE_SS, null, true, false, -1, false, true); + server.createQueue(new QueueConfiguration(FINAL_QUEUE_SS).setRoutingType(RoutingType.ANYCAST)); } @Override diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/interop/AmqpCoreTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/interop/AmqpCoreTest.java index ef203845bc..be79b0f217 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/interop/AmqpCoreTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/interop/AmqpCoreTest.java @@ -16,23 +16,23 @@ */ package org.apache.activemq.artemis.tests.integration.amqp.interop; -import org.apache.activemq.artemis.api.core.RoutingType; +import javax.jms.Connection; +import javax.jms.ConnectionFactory; +import javax.jms.MessageProducer; +import javax.jms.Session; + +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientSession; import org.apache.activemq.artemis.api.core.client.MessageHandler; import org.apache.activemq.artemis.jms.client.ActiveMQSession; -import org.apache.activemq.artemis.tests.util.Wait; import org.apache.activemq.artemis.tests.integration.amqp.JMSClientTestSupport; +import org.apache.activemq.artemis.tests.util.Wait; import org.apache.qpid.jms.JmsConnectionFactory; import org.apache.qpid.jms.JmsTopic; import org.junit.Test; -import javax.jms.Connection; -import javax.jms.ConnectionFactory; -import javax.jms.MessageProducer; -import javax.jms.Session; - public class AmqpCoreTest extends JMSClientTestSupport { @Override @@ -55,9 +55,9 @@ public class AmqpCoreTest extends JMSClientTestSupport { try { Session session = coreJmsConn.createSession(false, Session.AUTO_ACKNOWLEDGE); ClientSession coreSession = ((ActiveMQSession) session).getCoreSession(); - coreSession.createQueue("exampleQueueAddress", RoutingType.MULTICAST, "exampleQueue1"); - coreSession.createQueue("exampleQueueAddress", RoutingType.MULTICAST, "exampleQueue2"); - coreSession.createQueue("exampleQueueAddress", RoutingType.MULTICAST, "exampleQueue3"); + coreSession.createQueue(new QueueConfiguration("exampleQueue1").setAddress("exampleQueueAddress")); + coreSession.createQueue(new QueueConfiguration("exampleQueue2").setAddress("exampleQueueAddress")); + coreSession.createQueue(new QueueConfiguration("exampleQueue3").setAddress("exampleQueueAddress")); ClientConsumer consumer1 = coreSession.createConsumer("exampleQueue1"); CoreMessageHandler handler1 = new CoreMessageHandler(1); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/largemessages/AmqpReplicatedLargeMessageTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/largemessages/AmqpReplicatedLargeMessageTest.java index a87a82e35a..53263d3772 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/largemessages/AmqpReplicatedLargeMessageTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/largemessages/AmqpReplicatedLargeMessageTest.java @@ -20,6 +20,7 @@ package org.apache.activemq.artemis.tests.integration.amqp.largemessages; import java.net.URI; import java.util.concurrent.TimeUnit; +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.api.core.TransportConfiguration; @@ -64,7 +65,7 @@ public class AmqpReplicatedLargeMessageTest extends AmqpReplicatedTestSupport { backupServer.start(); liveServer.getServer().addAddressInfo(new AddressInfo(getQueueName(), RoutingType.ANYCAST)); - liveServer.getServer().createQueue(getQueueName(), RoutingType.ANYCAST, getQueueName(), null, true, false, -1, false, true); + liveServer.getServer().createQueue(new QueueConfiguration(getQueueName()).setRoutingType(RoutingType.ANYCAST)); waitForRemoteBackupSynchronization(backupServer.getServer()); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/bridge/BridgeRoutingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/bridge/BridgeRoutingTest.java index 394dc3680d..3cdfb5ab04 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/bridge/BridgeRoutingTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/bridge/BridgeRoutingTest.java @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.integration.bridge; import java.util.Arrays; import java.util.Collection; +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.api.core.client.ActiveMQClient; @@ -131,8 +132,8 @@ public class BridgeRoutingTest extends ActiveMQTestBase { SimpleString source = SimpleString.toSimpleString("source"); SimpleString destination = SimpleString.toSimpleString("destination"); - server0.createQueue(source, sourceRoutingType, source, null, true, false); - server1.createQueue(destination, destinationRoutingType, destination, null, true, false); + server0.createQueue(new QueueConfiguration(source).setRoutingType(sourceRoutingType)); + server1.createQueue(new QueueConfiguration(destination).setRoutingType(destinationRoutingType)); server0.deployBridge(new BridgeConfiguration() .setRoutingType(bridgeRoutingType) diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cli/AddressCommandTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cli/AddressCommandTest.java index 0bd686f1f1..0dcb468fa9 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cli/AddressCommandTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cli/AddressCommandTest.java @@ -21,6 +21,7 @@ import java.io.PrintStream; import java.text.MessageFormat; import java.util.EnumSet; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.cli.commands.AbstractAction; import org.apache.activemq.artemis.cli.commands.ActionContext; @@ -107,7 +108,7 @@ public class AddressCommandTest extends JMSTestBase { final SimpleString addressSimpleString = new SimpleString(addressName); final AddressInfo addressInfo = new AddressInfo(addressSimpleString, EnumSet.of(RoutingType.ANYCAST, RoutingType.MULTICAST)); server.addAddressInfo(addressInfo); - server.createQueue(addressSimpleString, RoutingType.MULTICAST, new SimpleString("queue1"), null, true, false); + server.createQueue(new QueueConfiguration(new SimpleString("queue1")).setAddress(addressSimpleString).setRoutingType(RoutingType.MULTICAST)); final DeleteAddress deleteAddress = new DeleteAddress(); deleteAddress.setName(addressName); @@ -144,9 +145,9 @@ public class AddressCommandTest extends JMSTestBase { // Create bindings SimpleString address = new SimpleString("address"); server.addAddressInfo(new AddressInfo(address, RoutingType.MULTICAST)); - server.createQueue(address, RoutingType.MULTICAST, new SimpleString("queue1"), null, true, false); - server.createQueue(address, RoutingType.MULTICAST, new SimpleString("queue2"), null, true, false); - server.createQueue(address, RoutingType.MULTICAST, new SimpleString("queue3"), null, true, false); + server.createQueue(new QueueConfiguration(new SimpleString("queue1")).setAddress(address).setRoutingType(RoutingType.MULTICAST)); + server.createQueue(new QueueConfiguration(new SimpleString("queue2")).setAddress(address).setRoutingType(RoutingType.MULTICAST)); + server.createQueue(new QueueConfiguration(new SimpleString("queue3")).setAddress(address).setRoutingType(RoutingType.MULTICAST)); DivertConfiguration divertConfiguration = new DivertConfiguration(); divertConfiguration.setName(address.toString()); @@ -193,7 +194,7 @@ public class AddressCommandTest extends JMSTestBase { final SimpleString addressSimpleString = new SimpleString(addressName); final AddressInfo addressInfo = new AddressInfo(addressSimpleString, EnumSet.of(RoutingType.ANYCAST, RoutingType.MULTICAST)); server.addAddressInfo(addressInfo); - server.createQueue(addressSimpleString, RoutingType.MULTICAST, new SimpleString("queue1"), null, true, false); + server.createQueue(new QueueConfiguration(new SimpleString("queue1")).setAddress(addressSimpleString).setRoutingType(RoutingType.MULTICAST)); final UpdateAddress updateAddress = new UpdateAddress(); updateAddress.setName(addressName); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cli/QueueCommandTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cli/QueueCommandTest.java index f45c1914a1..7ea05ac626 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cli/QueueCommandTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cli/QueueCommandTest.java @@ -22,6 +22,7 @@ import java.util.EnumSet; import java.util.Set; import java.util.UUID; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.cli.commands.AbstractAction; import org.apache.activemq.artemis.cli.commands.ActionContext; @@ -249,7 +250,7 @@ public class QueueCommandTest extends JMSTestBase { final boolean oldPurgeOnNoConsumers = false; final AddressInfo addressInfo = new AddressInfo(addressSimpleString, EnumSet.of(RoutingType.ANYCAST, RoutingType.MULTICAST)); server.addAddressInfo(addressInfo); - server.createQueue(addressSimpleString, oldRoutingType, queueNameString, null, true, false, oldMaxConsumers, oldPurgeOnNoConsumers, false); + server.createQueue(new QueueConfiguration(queueNameString).setAddress(addressSimpleString).setRoutingType(oldRoutingType).setMaxConsumers(oldMaxConsumers).setPurgeOnNoConsumers(oldPurgeOnNoConsumers).setAutoCreateAddress(false)); final int newMaxConsumers = 1; final RoutingType newRoutingType = RoutingType.ANYCAST; @@ -282,7 +283,7 @@ public class QueueCommandTest extends JMSTestBase { final Set supportedRoutingTypes = EnumSet.of(oldRoutingType); final AddressInfo addressInfo = new AddressInfo(addressSimpleString, EnumSet.copyOf(supportedRoutingTypes)); server.addAddressInfo(addressInfo); - server.createQueue(addressSimpleString, oldRoutingType, queueNameString, null, true, false, oldMaxConsumers, oldPurgeOnNoConsumers, false); + server.createQueue(new QueueConfiguration(queueNameString).setAddress(addressSimpleString).setRoutingType(oldRoutingType).setMaxConsumers(oldMaxConsumers).setPurgeOnNoConsumers(oldPurgeOnNoConsumers).setAutoCreateAddress(false)); final RoutingType newRoutingType = RoutingType.ANYCAST; final UpdateQueue updateQueue = new UpdateQueue(); @@ -311,7 +312,7 @@ public class QueueCommandTest extends JMSTestBase { final boolean oldPurgeOnNoConsumers = false; final AddressInfo addressInfo = new AddressInfo(addressSimpleString, oldRoutingType); server.addAddressInfo(addressInfo); - server.createQueue(addressSimpleString, oldRoutingType, queueNameString, null, true, false, oldMaxConsumers, oldPurgeOnNoConsumers, false); + server.createQueue(new QueueConfiguration(queueNameString).setAddress(addressSimpleString).setRoutingType(oldRoutingType).setMaxConsumers(oldMaxConsumers).setPurgeOnNoConsumers(oldPurgeOnNoConsumers).setAutoCreateAddress(false)); server.locateQueue(queueNameString).addConsumer(new DummyServerConsumer()); server.locateQueue(queueNameString).addConsumer(new DummyServerConsumer()); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AckBatchSizeTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AckBatchSizeTest.java index 847b69e29a..452398cfdb 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AckBatchSizeTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AckBatchSizeTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.client; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -69,7 +70,7 @@ public class AckBatchSizeTest extends ActiveMQTestBase { ClientSession sendSession = cf.createSession(false, true, true); ClientSession session = cf.createSession(false, true, true); - session.createQueue(addressA, queueA, false); + session.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setDurable(false)); ClientProducer cp = sendSession.createProducer(addressA); for (int i = 0; i < numMessages; i++) { ClientMessage message = (ClientMessage)sendSession.createMessage(false).setAddress(addressA); @@ -111,7 +112,7 @@ public class AckBatchSizeTest extends ActiveMQTestBase { int numMessages = 100; ClientSession session = cf.createSession(false, true, true); - session.createQueue(addressA, queueA, false); + session.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setDurable(false)); ClientProducer cp = sendSession.createProducer(addressA); for (int i = 0; i < numMessages; i++) { cp.send(sendSession.createMessage(false)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AcknowledgeTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AcknowledgeTest.java index ce6a2290ef..a6bec7aa88 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AcknowledgeTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AcknowledgeTest.java @@ -27,6 +27,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException; import org.apache.activemq.artemis.api.core.ICoreMessage; import org.apache.activemq.artemis.api.core.Message; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -68,7 +69,7 @@ public class AcknowledgeTest extends ActiveMQTestBase { ClientSessionFactory cf = createSessionFactory(locator); ClientSession sendSession = cf.createSession(false, true, true); ClientSession session = cf.createSession(false, true, true); - sendSession.createQueue(addressA, queueA, false); + sendSession.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setDurable(false)); ClientProducer cp = sendSession.createProducer(addressA); ClientConsumer cc = session.createConsumer(queueA); int numMessages = 100; @@ -98,7 +99,7 @@ public class AcknowledgeTest extends ActiveMQTestBase { ClientSessionFactory cf = createSessionFactory(locator); ClientSession sendSession = cf.createSession(false, true, true); ClientSession session = cf.createSession(false, true, true); - sendSession.createQueue(addressA, queueA, false); + sendSession.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setDurable(false)); ClientProducer cp = sendSession.createProducer(addressA); ClientConsumer cc = session.createConsumer(queueA); int numMessages = 3; @@ -135,7 +136,7 @@ public class AcknowledgeTest extends ActiveMQTestBase { ClientSessionFactory cf = createSessionFactory(locator); ClientSession sendSession = cf.createSession(false, true, true); final ClientSession session = cf.createSession(false, true, true); - sendSession.createQueue(addressA, queueA, false); + sendSession.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setDurable(false)); ClientProducer cp = sendSession.createProducer(addressA); ClientConsumer cc = session.createConsumer(queueA); int numMessages = 100; @@ -186,7 +187,7 @@ public class AcknowledgeTest extends ActiveMQTestBase { sessionConsumer.start(); - sessionConsumer.createQueue(addressA, queueA, true); + sessionConsumer.createQueue(new QueueConfiguration(queueA).setAddress(addressA)); ClientConsumer consumer = sessionConsumer.createConsumer(queueA); @@ -249,7 +250,7 @@ public class AcknowledgeTest extends ActiveMQTestBase { ClientSessionFactory cf = createSessionFactory(locator); ClientSession sendSession = cf.createSession(false, true, true); final ClientSession session = cf.createSession(false, true, true); - sendSession.createQueue(addressA, queueA, false); + sendSession.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setDurable(false)); ClientProducer cp = sendSession.createProducer(addressA); ClientConsumer cc = session.createConsumer(queueA); int numMessages = 100; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AddressSettingsTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AddressSettingsTest.java index d684a6774b..b27d1ff8e7 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AddressSettingsTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AddressSettingsTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.client; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -73,10 +74,10 @@ public class AddressSettingsTest extends ActiveMQTestBase { ServerLocator locator = createInVMNonHALocator(); ClientSessionFactory sf = createSessionFactory(locator); ClientSession session = sf.createSession(false, true, false); - session.createQueue(addressA, queueA, false); - session.createQueue(addressB, queueB, false); - session.createQueue(dlaA, dlqA, false); - session.createQueue(dlaB, dlqB, false); + session.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setDurable(false)); + session.createQueue(new QueueConfiguration(queueB).setAddress(addressB).setDurable(false)); + session.createQueue(new QueueConfiguration(dlqA).setAddress(dlaA).setDurable(false)); + session.createQueue(new QueueConfiguration(dlqB).setAddress(dlaB).setDurable(false)); ClientSession sendSession = sf.createSession(false, true, true); ClientMessage cm = sendSession.createMessage(true); cm.getBodyBuffer().writeString("A"); @@ -125,10 +126,10 @@ public class AddressSettingsTest extends ActiveMQTestBase { ServerLocator locator = createInVMNonHALocator(); ClientSessionFactory sf = createSessionFactory(locator); ClientSession session = sf.createSession(false, true, false); - session.createQueue(addressA, queueA, false); - session.createQueue(addressB, queueB, false); - session.createQueue(dlaA, dlqA, false); - session.createQueue(dlaB, dlqB, false); + session.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setDurable(false)); + session.createQueue(new QueueConfiguration(queueB).setAddress(addressB).setDurable(false)); + session.createQueue(new QueueConfiguration(dlqA).setAddress(dlaA).setDurable(false)); + session.createQueue(new QueueConfiguration(dlqB).setAddress(dlaB).setDurable(false)); ClientSession sendSession = sf.createSession(false, true, true); ClientMessage cm = sendSession.createMessage(true); cm.getBodyBuffer().writeString("A"); @@ -176,10 +177,10 @@ public class AddressSettingsTest extends ActiveMQTestBase { ServerLocator locator = createInVMNonHALocator(); ClientSessionFactory sf = createSessionFactory(locator); ClientSession session = sf.createSession(false, true, false); - session.createQueue(addressA, queueA, false); - session.createQueue(addressB, queueB, false); - session.createQueue(dlaA, dlqA, false); - session.createQueue(dlaB, dlqB, false); + session.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setDurable(false)); + session.createQueue(new QueueConfiguration(queueB).setAddress(addressB).setDurable(false)); + session.createQueue(new QueueConfiguration(dlqA).setAddress(dlaA).setDurable(false)); + session.createQueue(new QueueConfiguration(dlqB).setAddress(dlaB).setDurable(false)); ClientSession sendSession = sf.createSession(false, true, true); ClientMessage cm = sendSession.createMessage(true); cm.getBodyBuffer().writeString("A"); @@ -229,12 +230,12 @@ public class AddressSettingsTest extends ActiveMQTestBase { ServerLocator locator = createInVMNonHALocator(); ClientSessionFactory sf = createSessionFactory(locator); ClientSession session = sf.createSession(false, true, false); - session.createQueue(addressA2, queueA, false); - session.createQueue(addressB2, queueB, false); - session.createQueue(addressC, queueC, false); - session.createQueue(dlaA, dlqA, false); - session.createQueue(dlaB, dlqB, false); - session.createQueue(dlaC, dlqC, false); + session.createQueue(new QueueConfiguration(queueA).setAddress(addressA2).setDurable(false)); + session.createQueue(new QueueConfiguration(queueB).setAddress(addressB2).setDurable(false)); + session.createQueue(new QueueConfiguration(queueC).setAddress(addressC).setDurable(false)); + session.createQueue(new QueueConfiguration(dlqA).setAddress(dlaA).setDurable(false)); + session.createQueue(new QueueConfiguration(dlqB).setAddress(dlaB).setDurable(false)); + session.createQueue(new QueueConfiguration(dlqC).setAddress(dlaC).setDurable(false)); ClientSession sendSession = sf.createSession(false, true, true); ClientMessage cm = sendSession.createMessage(true); cm.getBodyBuffer().writeString("A"); @@ -298,12 +299,12 @@ public class AddressSettingsTest extends ActiveMQTestBase { ServerLocator locator = createInVMNonHALocator(); ClientSessionFactory sf = createSessionFactory(locator); ClientSession session = sf.createSession(false, true, false); - session.createQueue(addressA2, queueA, false); - session.createQueue(addressB2, queueB, false); - session.createQueue(addressC, queueC, false); - session.createQueue(dlaA, dlqA, false); - session.createQueue(dlaB, dlqB, false); - session.createQueue(dlaC, dlqC, false); + session.createQueue(new QueueConfiguration(queueA).setAddress(addressA2).setDurable(false)); + session.createQueue(new QueueConfiguration(queueB).setAddress(addressB2).setDurable(false)); + session.createQueue(new QueueConfiguration(queueC).setAddress(addressC).setDurable(false)); + session.createQueue(new QueueConfiguration(dlqA).setAddress(dlaA).setDurable(false)); + session.createQueue(new QueueConfiguration(dlqB).setAddress(dlaB).setDurable(false)); + session.createQueue(new QueueConfiguration(dlqC).setAddress(dlaC).setDurable(false)); ClientSession sendSession = sf.createSession(false, true, true); ClientMessage cm = sendSession.createMessage(true); ClientMessage cm2 = sendSession.createMessage(true); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoDeleteAddressTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoDeleteAddressTest.java index ee78bda2ad..6b82935b7b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoDeleteAddressTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoDeleteAddressTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.client; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; import org.apache.activemq.artemis.api.core.client.ServerLocator; @@ -50,7 +51,7 @@ public class AutoDeleteAddressTest extends ActiveMQTestBase { @Test public void testAutoDeleteAutoCreatedAddress() throws Exception { // auto-delete-addresses defaults to true - server.createQueue(addressA, RoutingType.ANYCAST, queueA, null, null, true, false, false, false, true, 1, false, true); + server.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setRoutingType(RoutingType.ANYCAST).setAutoCreated(true)); assertNotNull(server.getAddressInfo(addressA)); cf.createSession().createConsumer(queueA).close(); Wait.assertTrue(() -> server.getAddressInfo(addressA) == null); @@ -59,7 +60,7 @@ public class AutoDeleteAddressTest extends ActiveMQTestBase { @Test public void testNegativeAutoDeleteAutoCreatedAddress() throws Exception { server.getAddressSettingsRepository().addMatch(addressA.toString(), new AddressSettings().setAutoDeleteAddresses(false)); - server.createQueue(addressA, RoutingType.ANYCAST, queueA, null, null, true, false, false, false, true, 1, false, true); + server.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setRoutingType(RoutingType.ANYCAST).setAutoCreated(true)); assertNotNull(server.getAddressInfo(addressA)); cf.createSession().createConsumer(queueA).close(); assertNotNull(server.getAddressInfo(addressA)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoDeleteQueueTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoDeleteQueueTest.java index 5bce2cf885..87c75b844b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoDeleteQueueTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoDeleteQueueTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.client; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientProducer; import org.apache.activemq.artemis.api.core.client.ClientSession; @@ -54,7 +55,7 @@ public class AutoDeleteQueueTest extends ActiveMQTestBase { @Test public void testAutoDeleteAutoCreatedQueueOnLastConsumerClose() throws Exception { // auto-delete-queues defaults to true - server.createQueue(addressA, RoutingType.ANYCAST, queueA, null, null, true, false, false, false, true, 1, false, true); + server.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setRoutingType(RoutingType.ANYCAST).setAutoCreated(true)); assertNotNull(server.locateQueue(queueA)); cf.createSession().createConsumer(queueA).close(); Wait.assertTrue(() -> server.locateQueue(queueA) == null); @@ -63,7 +64,7 @@ public class AutoDeleteQueueTest extends ActiveMQTestBase { @Test public void testAutoDeleteAutoCreatedQueueOnLastMessageRemovedWithoutConsumer() throws Exception { // auto-delete-queues defaults to true - server.createQueue(addressA, RoutingType.ANYCAST, queueA, null, null, true, false, false, false, true, 1, false, true); + server.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setRoutingType(RoutingType.ANYCAST).setAutoCreated(true)); assertNotNull(server.locateQueue(queueA)); ClientSession session = cf.createSession(); ClientProducer producer = session.createProducer(addressA); @@ -76,7 +77,7 @@ public class AutoDeleteQueueTest extends ActiveMQTestBase { @Test public void testAutoDeleteAutoCreatedQueueOnLastMessageExpired() throws Exception { // auto-delete-queues defaults to true - server.createQueue(addressA, RoutingType.ANYCAST, queueA, null, null, true, false, false, false, true, 1, false, true); + server.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setRoutingType(RoutingType.ANYCAST).setAutoCreated(true)); assertNotNull(server.locateQueue(queueA)); ClientSession session = cf.createSession(); ClientProducer producer = session.createProducer(addressA); @@ -87,7 +88,7 @@ public class AutoDeleteQueueTest extends ActiveMQTestBase { @Test public void testNegativeAutoDeleteAutoCreatedQueue() throws Exception { server.getAddressSettingsRepository().addMatch(addressA.toString(), new AddressSettings().setAutoDeleteQueues(false)); - server.createQueue(addressA, RoutingType.ANYCAST, queueA, null, null, true, false, false, false, true, 1, false, true); + server.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setRoutingType(RoutingType.ANYCAST).setAutoCreated(true)); assertNotNull(server.locateQueue(queueA)); cf.createSession().createConsumer(queueA).close(); assertNotNull(server.locateQueue(queueA)); @@ -96,7 +97,7 @@ public class AutoDeleteQueueTest extends ActiveMQTestBase { @Test public void testNegativeAutoDeleteAutoCreatedQueue2() throws Exception { server.getAddressSettingsRepository().addMatch(addressA.toString(), new AddressSettings()); - server.createQueue(addressA, RoutingType.ANYCAST, queueA, null, null, true, false, false, false, true, 1, false, true); + server.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setRoutingType(RoutingType.ANYCAST).setAutoCreated(true)); assertNotNull(server.locateQueue(queueA)); assertFalse(Wait.waitFor(() -> server.locateQueue(queueA) == null, 5000, 100)); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutogroupIdTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutogroupIdTest.java index da86e97bd2..7ed58f5bb4 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutogroupIdTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutogroupIdTest.java @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.integration.client; import java.util.concurrent.CountDownLatch; import org.apache.activemq.artemis.api.core.ActiveMQException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -78,7 +79,7 @@ public class AutogroupIdTest extends ActiveMQTestBase { ClientSessionFactory sf = createSessionFactory(locator); ClientSession session = sf.createSession(false, true, true); - session.createQueue(groupTestQ, groupTestQ, null, false); + session.createQueue(new QueueConfiguration(groupTestQ).setDurable(false)); ClientProducer producer = session.createProducer(groupTestQ); @@ -121,7 +122,7 @@ public class AutogroupIdTest extends ActiveMQTestBase { ClientSessionFactory sf = createSessionFactory(locator); ClientSession session = sf.createSession(false, true, true); - session.createQueue(groupTestQ, groupTestQ, null, false); + session.createQueue(new QueueConfiguration(groupTestQ).setDurable(false)); ClientProducer producer = session.createProducer(groupTestQ); ClientProducer producer2 = session.createProducer(groupTestQ); @@ -167,7 +168,7 @@ public class AutogroupIdTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - session.createQueue(groupTestQ, groupTestQ, null, false); + session.createQueue(new QueueConfiguration(groupTestQ).setDurable(false)); ClientProducer producer = session.createProducer(groupTestQ); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/BlockingSendTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/BlockingSendTest.java index a34eb56bb6..896989fa58 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/BlockingSendTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/BlockingSendTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.client; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientProducer; @@ -59,7 +60,7 @@ public class BlockingSendTest extends ActiveMQTestBase { session = factory.createSession(); - session.createQueue("address", RoutingType.ANYCAST, "queue"); + session.createQueue(new QueueConfiguration("queue").setAddress("address").setRoutingType(RoutingType.ANYCAST)); ClientProducer prod = session.createProducer("address"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/CommitRollbackTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/CommitRollbackTest.java index 1bb29a391d..f70e408716 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/CommitRollbackTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/CommitRollbackTest.java @@ -20,6 +20,7 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import org.apache.activemq.artemis.api.core.ActiveMQException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -55,7 +56,7 @@ public class CommitRollbackTest extends ActiveMQTestBase { ClientSessionFactory cf = createSessionFactory(locator); ClientSession sendSession = cf.createSession(false, true, true); ClientSession session = cf.createSession(false, false, false); - sendSession.createQueue(addressA, queueA, false); + sendSession.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setDurable(false)); ClientProducer cp = sendSession.createProducer(addressA); ClientConsumer cc = session.createConsumer(queueA); int numMessages = 100; @@ -85,7 +86,7 @@ public class CommitRollbackTest extends ActiveMQTestBase { ClientSessionFactory cf = createSessionFactory(locator); ClientSession sendSession = cf.createSession(false, true, true); ClientSession session = cf.createSession(false, false, false); - sendSession.createQueue(addressA, queueA, false); + sendSession.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setDurable(false)); ClientProducer cp = sendSession.createProducer(addressA); ClientConsumer cc = session.createConsumer(queueA); int numMessages = 100; @@ -120,8 +121,8 @@ public class CommitRollbackTest extends ActiveMQTestBase { ClientSessionFactory cf = createSessionFactory(locator); ClientSession sendSession = cf.createSession(false, true, true); ClientSession session = cf.createSession(false, false, false); - sendSession.createQueue(addressA, queueA, false); - sendSession.createQueue(addressB, queueB, false); + sendSession.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setDurable(false)); + sendSession.createQueue(new QueueConfiguration(queueB).setAddress(addressB).setDurable(false)); ClientProducer cp = sendSession.createProducer(addressA); ClientProducer cp2 = sendSession.createProducer(addressB); ClientConsumer cc = session.createConsumer(queueA); @@ -162,7 +163,7 @@ public class CommitRollbackTest extends ActiveMQTestBase { ClientSessionFactory cf = createSessionFactory(locator); ClientSession sendSession = cf.createSession(false, true, true); final ClientSession session = cf.createSession(false, true, false); - sendSession.createQueue(addressA, queueA, false); + sendSession.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setDurable(false)); ClientProducer cp = sendSession.createProducer(addressA); ClientConsumer cc = session.createConsumer(queueA); int numMessages = 100; @@ -206,7 +207,7 @@ public class CommitRollbackTest extends ActiveMQTestBase { ClientSessionFactory cf = createSessionFactory(locator); ClientSession sendSession = cf.createSession(false, true, true); final ClientSession session = cf.createSession(false, true, false); - sendSession.createQueue(addressA, queueA, false); + sendSession.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setDurable(false)); ClientProducer cp = sendSession.createProducer(addressA); ClientConsumer cc = session.createConsumer(queueA); int numMessages = 100; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConcurrentCreateDeleteProduceTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConcurrentCreateDeleteProduceTest.java index 12a7af4d98..546e55b745 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConcurrentCreateDeleteProduceTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConcurrentCreateDeleteProduceTest.java @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.integration.client; import java.util.HashMap; import java.util.concurrent.atomic.AtomicInteger; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -75,7 +76,7 @@ public class ConcurrentCreateDeleteProduceTest extends ActiveMQTestBase { ClientProducer producer = session.createProducer(ADDRESS); // just to make it page forever - Queue serverQueue = server.createQueue(ADDRESS, RoutingType.ANYCAST, SimpleString.toSimpleString("everPage"), null, true, false); + Queue serverQueue = server.createQueue(new QueueConfiguration("everPage").setAddress(ADDRESS).setRoutingType(RoutingType.ANYCAST)); serverQueue.getPageSubscription().getPagingStore().startPaging(); Consumer[] consumers = new Consumer[10]; @@ -120,7 +121,7 @@ public class ConcurrentCreateDeleteProduceTest extends ActiveMQTestBase { for (int i = 0; i < 100 && running; i++) { SimpleString queueName = ADDRESS.concat("_" + sequence.incrementAndGet()); - session.createQueue(ADDRESS, queueName, true); + session.createQueue(new QueueConfiguration(queueName).setAddress(ADDRESS)); ClientConsumer consumer = session.createConsumer(queueName); while (running) { ClientMessage msg = consumer.receive(500); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerCloseTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerCloseTest.java index d942269e13..45b95e8985 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerCloseTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerCloseTest.java @@ -21,6 +21,7 @@ import java.util.concurrent.TimeUnit; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQExceptionType; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -284,7 +285,7 @@ public class ConsumerCloseTest extends ActiveMQTestBase { sf = createSessionFactory(locator); session = addClientSession(sf.createSession(false, true, true)); - session.createQueue(address, queue, false); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false)); } } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerFilterTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerFilterTest.java index 283b1c76a9..1eee70d717 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerFilterTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerFilterTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.client; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientProducer; @@ -54,7 +55,7 @@ public class ConsumerFilterTest extends ActiveMQTestBase { session = sf.createSession(); session.start(); - session.createQueue("foo", RoutingType.ANYCAST, "foo"); + session.createQueue(new QueueConfiguration("foo").setRoutingType(RoutingType.ANYCAST)); producer = session.createProducer("foo"); consumer = session.createConsumer("foo", "animal='giraffe'"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerRoundRobinTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerRoundRobinTest.java index 8350ddcb4d..0de5f3dce4 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerRoundRobinTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerRoundRobinTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.client; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -44,7 +45,7 @@ public class ConsumerRoundRobinTest extends ActiveMQTestBase { ServerLocator locator = createInVMNonHALocator(); ClientSessionFactory cf = createSessionFactory(locator); ClientSession session = addClientSession(cf.createSession(false, true, true)); - session.createQueue(addressA, queueA, false); + session.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setDurable(false)); ClientConsumer[] consumers = new ClientConsumer[5]; // start the session before we create the consumers, this is because start is non blocking and we have to diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerStuckTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerStuckTest.java index d6557538ed..be72733ee2 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerStuckTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerStuckTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.client; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -61,7 +62,7 @@ public class ConsumerStuckTest extends ActiveMQTestBase { RemotingConnectionImpl remotingConnection = (RemotingConnectionImpl) sf.getConnection(); ClientSession session = sf.createSession(false, true, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); @@ -151,7 +152,7 @@ public class ConsumerStuckTest extends ActiveMQTestBase { RemotingConnectionImpl remotingConnection = (RemotingConnectionImpl) sf.getConnection(); ClientSession session = sf.createSession(false, true, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); final int numMessages = 10000; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerTest.java index 9cdf38a37c..5a73116911 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerTest.java @@ -46,6 +46,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQIllegalStateException; import org.apache.activemq.artemis.api.core.Interceptor; import org.apache.activemq.artemis.api.core.Message; +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.api.core.client.ClientConsumer; @@ -126,7 +127,7 @@ public class ConsumerTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true, true); - server.createQueue(QUEUE, RoutingType.ANYCAST, QUEUE, null, true, false); + server.createQueue(new QueueConfiguration(QUEUE).setRoutingType(RoutingType.ANYCAST)); session.close(); @@ -940,10 +941,10 @@ public class ConsumerTest extends ActiveMQTestBase { sessions.add(session); - session.createQueue(QUEUE, QUEUE.concat("" + i), null, true); + session.createQueue(new QueueConfiguration(QUEUE.concat("" + i)).setAddress(QUEUE).setDurable(true)); if (i == 0) { - session.createQueue(QUEUE_RESPONSE, QUEUE_RESPONSE); + session.createQueue(new QueueConfiguration(QUEUE_RESPONSE)); } ClientConsumer consumer = session.createConsumer(QUEUE.concat("" + i)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerWindowSizeTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerWindowSizeTest.java index 2fb737c553..843aee1be4 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerWindowSizeTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerWindowSizeTest.java @@ -24,6 +24,7 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; +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.api.core.client.ActiveMQClient; @@ -104,7 +105,7 @@ public class ConsumerWindowSizeTest extends ActiveMQTestBase { ClientSessionFactory sf = createSessionFactory(locator); ClientSession session = sf.createSession(false, false, false); - session.createQueue("testWindow", "testWindow", true); + session.createQueue(new QueueConfiguration("testWindow")); session.close(); int numConsumers = 5; @@ -156,7 +157,7 @@ public class ConsumerWindowSizeTest extends ActiveMQTestBase { ClientSessionFactory sf = createSessionFactory(locator); ClientSession session = sf.createSession(false, false, false); - session.createQueue("testReceive", "testReceive", true); + session.createQueue(new QueueConfiguration("testReceive")); session.close(); ClientSession sessionProd = sf.createSession(false, false); @@ -203,7 +204,7 @@ public class ConsumerWindowSizeTest extends ActiveMQTestBase { ClientSessionFactory sf = createSessionFactory(locator); ClientSession session = sf.createSession(false, false, false); - session.createQueue("testWindow", "testWindow", true); + session.createQueue(new QueueConfiguration("testWindow")); session.close(); int numConsumers = 5; @@ -255,7 +256,7 @@ public class ConsumerWindowSizeTest extends ActiveMQTestBase { ClientSessionFactory sf = createSessionFactory(locator); ClientSession session = sf.createSession(false, false, false); - session.createQueue("testWindow", "testWindow", true); + session.createQueue(new QueueConfiguration("testWindow")); session.close(); int numConsumers = 5; @@ -310,7 +311,7 @@ public class ConsumerWindowSizeTest extends ActiveMQTestBase { { ClientSession session = sf.createSession(false, false, false); - session.createQueue("testWindow", "testWindow", true); + session.createQueue(new QueueConfiguration("testWindow")); session.close(); } @@ -389,7 +390,7 @@ public class ConsumerWindowSizeTest extends ActiveMQTestBase { { ClientSession session = sf.createSession(false, false, false); - session.createQueue("testWindow", "testWindow", true); + session.createQueue(new QueueConfiguration("testWindow")); session.close(); } @@ -445,7 +446,7 @@ public class ConsumerWindowSizeTest extends ActiveMQTestBase { ClientSessionFactory cf = createSessionFactory(locator); ClientSession sendSession = cf.createSession(false, true, true); ClientSession receiveSession = cf.createSession(false, true, true); - sendSession.createQueue(addressA, queueA, false); + sendSession.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setDurable(false)); ClientConsumer receivingConsumer = receiveSession.createConsumer(queueA); ClientSession session = cf.createSession(false, true, true); @@ -496,7 +497,7 @@ public class ConsumerWindowSizeTest extends ActiveMQTestBase { SimpleString ADDRESS = addressA; - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); sessionB = sf.createSession(false, true, true); sessionB.start(); @@ -577,7 +578,7 @@ public class ConsumerWindowSizeTest extends ActiveMQTestBase { SimpleString ADDRESS = addressA; - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); sessionB = sf.createSession(false, true, true); sessionB.start(); @@ -695,7 +696,7 @@ public class ConsumerWindowSizeTest extends ActiveMQTestBase { SimpleString ADDRESS = new SimpleString("some-queue"); - session1.createQueue(ADDRESS, ADDRESS, true); + session1.createQueue(new QueueConfiguration(ADDRESS)); ClientConsumerInternal cons1 = (ClientConsumerInternal) session1.createConsumer(ADDRESS); @@ -842,7 +843,7 @@ public class ConsumerWindowSizeTest extends ActiveMQTestBase { SimpleString ADDRESS = new SimpleString("some-queue"); - session1.createQueue(ADDRESS, ADDRESS, true); + session1.createQueue(new QueueConfiguration(ADDRESS)); ClientConsumerInternal cons1 = (ClientConsumerInternal) session1.createConsumer(ADDRESS); @@ -943,7 +944,7 @@ public class ConsumerWindowSizeTest extends ActiveMQTestBase { SimpleString ADDRESS = new SimpleString("some-queue"); - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); ClientProducer producer = session.createProducer(ADDRESS); @@ -1016,7 +1017,7 @@ public class ConsumerWindowSizeTest extends ActiveMQTestBase { SimpleString ADDRESS = new SimpleString("some-queue"); - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); sessionB = sf.createSession(false, true, true); sessionB.start(); @@ -1158,7 +1159,7 @@ public class ConsumerWindowSizeTest extends ActiveMQTestBase { SimpleString ADDRESS = new SimpleString("some-queue"); - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); sessionB = sf.createSession(false, true, true); sessionB.start(); @@ -1305,7 +1306,7 @@ public class ConsumerWindowSizeTest extends ActiveMQTestBase { SimpleString ADDRESS = new SimpleString("some-queue"); - sessionA.createQueue(ADDRESS, ADDRESS, true); + sessionA.createQueue(new QueueConfiguration(ADDRESS)); sessionB = sf.createSession(false, true, true); @@ -1397,7 +1398,7 @@ public class ConsumerWindowSizeTest extends ActiveMQTestBase { ActiveMQServer messagingService = createServer(false, isNetty()); messagingService.start(); - messagingService.createQueue(queueA, RoutingType.ANYCAST, queueA, null, true, false); + messagingService.createQueue(new QueueConfiguration(queueA).setRoutingType(RoutingType.ANYCAST)); ClientSessionFactory cf = createSessionFactory(locator); ClientSession session = cf.createSession(false, true, true); @@ -1419,7 +1420,7 @@ public class ConsumerWindowSizeTest extends ActiveMQTestBase { .getAddressesSettings().put(queueA.toString(), settings); messagingService.start(); - messagingService.createQueue(queueA, RoutingType.ANYCAST, queueA, null, true, false); + messagingService.createQueue(new QueueConfiguration(queueA).setRoutingType(RoutingType.ANYCAST)); ClientSessionFactory cf = createSessionFactory(locator); ClientSession session = cf.createSession(false, true, true); @@ -1441,7 +1442,7 @@ public class ConsumerWindowSizeTest extends ActiveMQTestBase { .getAddressesSettings().put(addressA.toString(), settings); messagingService.start(); - messagingService.createQueue(addressA, RoutingType.ANYCAST, queueA, null, true, false); + messagingService.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setRoutingType(RoutingType.ANYCAST)); ClientSessionFactory cf = createSessionFactory(locator); ClientSession session = cf.createSession(false, true, true); @@ -1468,7 +1469,7 @@ public class ConsumerWindowSizeTest extends ActiveMQTestBase { .getAddressesSettings().put("#", settings); messagingService.start(); - messagingService.createQueue(queueA, RoutingType.ANYCAST, queueA, null, true, false); + messagingService.createQueue(new QueueConfiguration(queueA).setRoutingType(RoutingType.ANYCAST)); ClientSessionFactory cf = createSessionFactory(locator); ClientSession session = cf.createSession(false, true, true); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/CoreClientTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/CoreClientTest.java index 6090b42051..4c3ad12aad 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/CoreClientTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/CoreClientTest.java @@ -28,6 +28,7 @@ import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.TimeUnit; import org.apache.activemq.artemis.api.core.ActiveMQBuffer; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; import org.apache.activemq.artemis.api.core.client.ClientConsumer; @@ -118,7 +119,7 @@ public class CoreClientTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); @@ -231,7 +232,7 @@ public class CoreClientTest extends ActiveMQTestBase { String queueName = UUIDGenerator.getInstance().generateSimpleStringUUID().toString(); String address = prefix + baseAddress; - session.createQueue(prefix + baseAddress, null, queueName, null, false); + session.createQueue(new QueueConfiguration(queueName).setAddress(prefix + baseAddress).setDurable(false)); consumerMap.put(address, session.createConsumer(queueName)); } @@ -239,7 +240,7 @@ public class CoreClientTest extends ActiveMQTestBase { String queueName = UUIDGenerator.getInstance().generateSimpleStringUUID().toString(); String address = prefix + baseAddress; - session.createQueue(prefix + baseAddress, null, queueName, null, false); + session.createQueue(new QueueConfiguration(queueName).setAddress(prefix + baseAddress).setDurable(false)); consumerMap.put(address, session.createConsumer(queueName)); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/CreateQueueIdempotentTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/CreateQueueIdempotentTest.java index 2b57f06605..cd69c367f6 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/CreateQueueIdempotentTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/CreateQueueIdempotentTest.java @@ -20,6 +20,7 @@ import java.util.concurrent.atomic.AtomicInteger; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientSession; import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; @@ -53,10 +54,10 @@ public class CreateQueueIdempotentTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - session.createQueue(QUEUE, QUEUE, null, true); + session.createQueue(new QueueConfiguration(QUEUE)); try { - session.createQueue(QUEUE, QUEUE, null, true); + session.createQueue(new QueueConfiguration(QUEUE)); fail("Expected exception, queue already exists"); } catch (ActiveMQQueueExistsException qee) { //ok @@ -127,7 +128,7 @@ public class CreateQueueIdempotentTest extends ActiveMQTestBase { ClientSessionFactory sf = createSessionFactory(locator); session = sf.createSession(false, true, true); final SimpleString QUEUE = new SimpleString(queueName); - session.createQueue(QUEUE, QUEUE, null, true); + session.createQueue(new QueueConfiguration(QUEUE)); queuesCreated.incrementAndGet(); } catch (ActiveMQQueueExistsException qne) { failedAttempts.incrementAndGet(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/CreateQueueTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/CreateQueueTest.java index 754405bb60..2fbe62a1f3 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/CreateQueueTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/CreateQueueTest.java @@ -16,12 +16,15 @@ */ package org.apache.activemq.artemis.tests.integration.client; +import java.util.Arrays; +import java.util.Collection; import java.util.EnumSet; import java.util.HashSet; import java.util.Set; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQExceptionType; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientSession; import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; @@ -32,9 +35,14 @@ import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +@RunWith(Parameterized.class) public class CreateQueueTest extends ActiveMQTestBase { + private boolean legacyCreateQueue; + public final SimpleString addressA = new SimpleString("addressA"); public final SimpleString addressB = new SimpleString("addressB"); public final SimpleString queueA = new SimpleString("queueA"); @@ -46,6 +54,15 @@ public class CreateQueueTest extends ActiveMQTestBase { private ActiveMQServer server; private ClientSessionFactory cf; + @Parameterized.Parameters(name = "legacyCreateQueue={0}") + public static Collection getParams() { + return Arrays.asList(new Object[][]{{true}, {false}}); + } + + public CreateQueueTest(boolean legacyCreateQueue) { + this.legacyCreateQueue = legacyCreateQueue; + } + @Override @Before public void setUp() throws Exception { @@ -66,7 +83,11 @@ public class CreateQueueTest extends ActiveMQTestBase { EnumSet routingTypes = EnumSet.of(RoutingType.ANYCAST); sendSession.createAddress(addressA, routingTypes, false); try { - sendSession.createQueue(addressA, RoutingType.MULTICAST, queueA); + if (legacyCreateQueue) { + sendSession.createQueue(addressA, RoutingType.MULTICAST, queueA); + } else { + sendSession.createQueue(new QueueConfiguration(queueA).setAddress(addressA)); + } fail("Creating a queue here should fail since the queue routing type differs from what is supported on the address."); } catch (Exception e) { assertTrue(e instanceof ActiveMQException); @@ -77,7 +98,11 @@ public class CreateQueueTest extends ActiveMQTestBase { routingTypes = EnumSet.of(RoutingType.MULTICAST); sendSession.createAddress(addressB, routingTypes, false); try { - sendSession.createQueue(addressB, RoutingType.ANYCAST, queueB); + if (legacyCreateQueue) { + sendSession.createQueue(addressB, RoutingType.ANYCAST, queueB); + } else { + sendSession.createQueue(new QueueConfiguration(queueB).setAddress(addressB).setRoutingType(RoutingType.ANYCAST)); + } fail("Creating a queue here should fail since the queue routing type differs from what is supported on the address."); } catch (Exception e) { assertTrue(e instanceof ActiveMQException); @@ -94,7 +119,11 @@ public class CreateQueueTest extends ActiveMQTestBase { Set routingTypes = new HashSet<>(); routingTypes.add(RoutingType.ANYCAST); try { - sendSession.createQueue(addressA, RoutingType.MULTICAST, queueA); + if (legacyCreateQueue) { + sendSession.createQueue(addressA, RoutingType.MULTICAST, queueA); + } else { + sendSession.createQueue(new QueueConfiguration(queueA).setAddress(addressA)); + } fail("Creating a queue here should fail since the queue's address doesn't exist and auto-create-addresses = false."); } catch (Exception e) { assertTrue(e instanceof ActiveMQException); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/DeadLetterAddressTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/DeadLetterAddressTest.java index 8c9b8099b7..c921ff4274 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/DeadLetterAddressTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/DeadLetterAddressTest.java @@ -26,6 +26,7 @@ import java.util.concurrent.TimeUnit; import com.sun.management.UnixOperatingSystemMXBean; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.Message; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -63,8 +64,8 @@ public class DeadLetterAddressTest extends ActiveMQTestBase { AddressSettings addressSettings = new AddressSettings().setMaxDeliveryAttempts(1).setDeadLetterAddress(dla); server.getAddressSettingsRepository().addMatch(adName.toString(), addressSettings); SimpleString dlq = new SimpleString("DLQ1"); - clientSession.createQueue(dla, dlq, null, false); - clientSession.createQueue(adName, qName, null, false); + clientSession.createQueue(new QueueConfiguration(dlq).setAddress(dla).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(qName).setAddress(adName).setDurable(false)); ClientProducer producer = clientSession.createProducer(adName); producer.send(createTextMessage(clientSession, "heyho!")); clientSession.start(); @@ -102,8 +103,8 @@ public class DeadLetterAddressTest extends ActiveMQTestBase { AddressSettings addressSettings = new AddressSettings().setMaxDeliveryAttempts(1).setDeadLetterAddress(dla); server.getAddressSettingsRepository().addMatch(adName.toString(), addressSettings); SimpleString dlq = new SimpleString("DLQ1"); - clientSession.createQueue(dla, dlq, null, false); - clientSession.createQueue(adName, qName, null, false); + clientSession.createQueue(new QueueConfiguration(dlq).setAddress(dla).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(qName).setAddress(adName).setDurable(false)); for (int i = 0; i < 10; i++) { ClientProducer producer = clientSession.createProducer(adName); ClientMessage clientFile = clientSession.createMessage(true); @@ -132,8 +133,8 @@ public class DeadLetterAddressTest extends ActiveMQTestBase { AddressSettings addressSettings = new AddressSettings().setMaxDeliveryAttempts(1).setDeadLetterAddress(dla); server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings); //SimpleString dlq = new SimpleString("DLQ1"); - //clientSession.createQueue(dla, dlq, null, false); - clientSession.createQueue(qName, qName, null, false); + //clientSession.createQueue(new QueueConfiguration(dlq).setAddress(dla).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(qName).setDurable(false)); ClientProducer producer = clientSession.createProducer(qName); producer.send(createTextMessage(clientSession, "heyho!")); clientSession.start(); @@ -158,8 +159,8 @@ public class DeadLetterAddressTest extends ActiveMQTestBase { AddressSettings addressSettings = new AddressSettings().setMaxDeliveryAttempts(2).setDeadLetterAddress(dla); server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings); SimpleString dlq = new SimpleString("DLQ1"); - clientSession.createQueue(dla, dlq, null, false); - clientSession.createQueue(qName, qName, null, false); + clientSession.createQueue(new QueueConfiguration(dlq).setAddress(dla).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(qName).setDurable(false)); ClientProducer producer = clientSession.createProducer(qName); producer.send(createTextMessage(clientSession, "heyho!")); clientSession.start(); @@ -193,8 +194,8 @@ public class DeadLetterAddressTest extends ActiveMQTestBase { AddressSettings addressSettings = new AddressSettings().setMaxDeliveryAttempts(2).setDeadLetterAddress(dla); server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings); SimpleString dlq = new SimpleString("DLQ1"); - clientSession.createQueue(dla, dlq, null, false); - clientSession.createQueue(qName, qName, null, false); + clientSession.createQueue(new QueueConfiguration(dlq).setAddress(dla).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(qName).setDurable(false)); ClientProducer producer = clientSession.createProducer(qName); producer.send(createTextMessage(clientSession, "heyho!")); ClientConsumer clientConsumer = clientSession.createConsumer(qName); @@ -243,9 +244,9 @@ public class DeadLetterAddressTest extends ActiveMQTestBase { server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings); SimpleString dlq = new SimpleString("DLQ1"); SimpleString dlq2 = new SimpleString("DLQ2"); - clientSession.createQueue(dla, dlq, null, false); - clientSession.createQueue(dla, dlq2, null, false); - clientSession.createQueue(qName, qName, null, false); + clientSession.createQueue(new QueueConfiguration(dlq).setAddress(dla).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(dlq2).setAddress(dla).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(qName).setDurable(false)); ClientProducer producer = clientSession.createProducer(qName); producer.send(createTextMessage(clientSession, "heyho!")); clientSession.start(); @@ -278,7 +279,7 @@ public class DeadLetterAddressTest extends ActiveMQTestBase { SimpleString qName = new SimpleString("q1"); AddressSettings addressSettings = new AddressSettings().setMaxDeliveryAttempts(1); server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings); - clientSession.createQueue(qName, qName, null, false); + clientSession.createQueue(new QueueConfiguration(qName).setDurable(false)); ClientProducer producer = clientSession.createProducer(qName); producer.send(createTextMessage(clientSession, "heyho!")); clientSession.start(); @@ -303,8 +304,8 @@ public class DeadLetterAddressTest extends ActiveMQTestBase { AddressSettings addressSettings = new AddressSettings().setMaxDeliveryAttempts(MAX_DELIVERIES).setDeadLetterAddress(dla); server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings); SimpleString dlq = new SimpleString("DLQ1"); - clientSession.createQueue(dla, dlq, null, false); - clientSession.createQueue(qName, qName, null, false); + clientSession.createQueue(new QueueConfiguration(dlq).setAddress(dla).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(qName).setDurable(false)); ServerLocator locator = createInVMNonHALocator(); ClientSessionFactory sessionFactory = createSessionFactory(locator); ClientSession sendSession = sessionFactory.createSession(false, true, true); @@ -382,8 +383,8 @@ public class DeadLetterAddressTest extends ActiveMQTestBase { AddressSettings addressSettings = new AddressSettings().setMaxDeliveryAttempts(deliveryAttempt).setDeadLetterAddress(deadLetterAddress); server.getAddressSettingsRepository().setDefault(addressSettings); - clientSession.createQueue(address, queue, false); - clientSession.createQueue(deadLetterAddress, deadLetterQueue, false); + clientSession.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(deadLetterQueue).setAddress(deadLetterAddress).setDurable(false)); ClientProducer producer = clientSession.createProducer(address); ClientMessage clientMessage = createTextMessage(clientSession, "heyho!"); @@ -421,8 +422,8 @@ public class DeadLetterAddressTest extends ActiveMQTestBase { AddressSettings addressSettings = new AddressSettings().setMaxDeliveryAttempts(deliveryAttempt).setDeadLetterAddress(deadLetterAddress); server.getAddressSettingsRepository().addMatch("*", addressSettings); - clientSession.createQueue(address, queue, false); - clientSession.createQueue(deadLetterAddress, deadLetterQueue, false); + clientSession.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(deadLetterQueue).setAddress(deadLetterAddress).setDurable(false)); ClientProducer producer = clientSession.createProducer(address); ClientMessage clientMessage = createTextMessage(clientSession, "heyho!"); @@ -464,9 +465,9 @@ public class DeadLetterAddressTest extends ActiveMQTestBase { AddressSettings specificAddressSettings = new AddressSettings().setMaxDeliveryAttempts(specificeDeliveryAttempt).setDeadLetterAddress(specificDeadLetterAddress); server.getAddressSettingsRepository().addMatch(address.toString(), specificAddressSettings); - clientSession.createQueue(address, queue, false); - clientSession.createQueue(defaultDeadLetterAddress, defaultDeadLetterQueue, false); - clientSession.createQueue(specificDeadLetterAddress, specificDeadLetterQueue, false); + clientSession.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(defaultDeadLetterQueue).setAddress(defaultDeadLetterAddress).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(specificDeadLetterQueue).setAddress(specificDeadLetterAddress).setDurable(false)); ClientProducer producer = clientSession.createProducer(address); ClientMessage clientMessage = createTextMessage(clientSession, "heyho!"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/DeliveryOrderTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/DeliveryOrderTest.java index f93c27174f..c9e7bb701b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/DeliveryOrderTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/DeliveryOrderTest.java @@ -21,6 +21,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import org.apache.activemq.artemis.api.core.ActiveMQException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -66,7 +67,7 @@ public class DeliveryOrderTest extends ActiveMQTestBase { ClientSession sendSession = cf.createSession(false, false, true); ClientProducer cp = sendSession.createProducer(addressA); int numMessages = 1000; - sendSession.createQueue(addressA, queueA, false); + sendSession.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setDurable(false)); for (int i = 0; i < numMessages; i++) { ClientMessage cm = sendSession.createMessage(false); cm.getBodyBuffer().writeInt(i); @@ -91,7 +92,7 @@ public class DeliveryOrderTest extends ActiveMQTestBase { ClientSession sendSession = cf.createSession(false, true, false); ClientProducer cp = sendSession.createProducer(addressA); int numMessages = 1000; - sendSession.createQueue(addressA, queueA, false); + sendSession.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setDurable(false)); for (int i = 0; i < numMessages; i++) { ClientMessage cm = sendSession.createMessage(false); cm.getBodyBuffer().writeInt(i); @@ -119,7 +120,7 @@ public class DeliveryOrderTest extends ActiveMQTestBase { public void testMultipleConsumersMessageOrder() throws Exception { ClientSession sendSession = cf.createSession(false, true, true); ClientSession recSession = cf.createSession(false, true, true); - sendSession.createQueue(addressA, queueA, false); + sendSession.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setDurable(false)); int numReceivers = 100; AtomicInteger count = new AtomicInteger(0); int numMessage = 10000; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/DurableQueueTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/DurableQueueTest.java index 85b3dd5f52..53384f5949 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/DurableQueueTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/DurableQueueTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.client; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -56,7 +57,7 @@ public class DurableQueueTest extends ActiveMQTestBase { SimpleString queue = RandomUtil.randomSimpleString(); SimpleString address = RandomUtil.randomSimpleString(); - session.createQueue(address, queue, true); + session.createQueue(new QueueConfiguration(queue).setAddress(address)); ClientProducer producer = session.createProducer(address); producer.send(session.createMessage(false)); @@ -76,7 +77,7 @@ public class DurableQueueTest extends ActiveMQTestBase { SimpleString queue = RandomUtil.randomSimpleString(); SimpleString address = RandomUtil.randomSimpleString(); - session.createQueue(address, queue, true); + session.createQueue(new QueueConfiguration(queue).setAddress(address)); ClientProducer producer = session.createProducer(address); producer.send(session.createMessage(true)); @@ -108,7 +109,7 @@ public class DurableQueueTest extends ActiveMQTestBase { SimpleString queue = RandomUtil.randomSimpleString(); SimpleString address = RandomUtil.randomSimpleString(); - session.createQueue(address, queue, true); + session.createQueue(new QueueConfiguration(queue).setAddress(address)); session.close(); @@ -123,7 +124,7 @@ public class DurableQueueTest extends ActiveMQTestBase { SimpleString queue = RandomUtil.randomSimpleString(); SimpleString address = RandomUtil.randomSimpleString(); - session.createQueue(address, queue, true); + session.createQueue(new QueueConfiguration(queue).setAddress(address)); session.close(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ExpireTestOnRestartTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ExpireTestOnRestartTest.java index 2be9db152f..84d0515479 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ExpireTestOnRestartTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ExpireTestOnRestartTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.client; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -57,8 +58,8 @@ public class ExpireTestOnRestartTest extends ActiveMQTestBase { ClientSessionFactory factory = locator.createSessionFactory(); ClientSession session = factory.createSession(true, true); - session.createQueue("test", "test", true); - session.createQueue("exp", "exp", true); + session.createQueue(new QueueConfiguration("test")); + session.createQueue(new QueueConfiguration("exp")); ClientProducer prod = session.createProducer("test"); for (int i = 0; i < 10; i++) { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ExpiryAddressTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ExpiryAddressTest.java index fc4dec2efd..c0ebef65c7 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ExpiryAddressTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ExpiryAddressTest.java @@ -17,6 +17,7 @@ package org.apache.activemq.artemis.tests.integration.client; import org.apache.activemq.artemis.api.core.Message; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -51,8 +52,8 @@ public class ExpiryAddressTest extends ActiveMQTestBase { SimpleString eq = new SimpleString("EA1"); AddressSettings addressSettings = new AddressSettings().setExpiryAddress(ea); server.getAddressSettingsRepository().addMatch("#", addressSettings); - clientSession.createQueue(ea, eq, null, false); - clientSession.createQueue(adSend, qName, null, false); + clientSession.createQueue(new QueueConfiguration(eq).setAddress(ea).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(qName).setAddress(adSend).setDurable(false)); ClientProducer producer = clientSession.createProducer(adSend); ClientMessage clientMessage = createTextMessage(clientSession, "heyho!"); @@ -84,15 +85,15 @@ public class ExpiryAddressTest extends ActiveMQTestBase { SimpleString expiryQueue1 = new SimpleString("expiryQueue1"); AddressSettings addressSettings = new AddressSettings().setExpiryAddress(expiryAddress1); server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings); - clientSession.createQueue(expiryAddress1, expiryQueue1, null, false); - clientSession.createQueue(qName, qName, null, false); + clientSession.createQueue(new QueueConfiguration(expiryQueue1).setAddress(expiryAddress1).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(qName).setDurable(false)); // override "original" address settings SimpleString expiryAddress2 = new SimpleString("expiryAddress2"); SimpleString expiryQueue2 = new SimpleString("expiryQueue2"); addressSettings = new AddressSettings().setExpiryAddress(expiryAddress2); server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings); - clientSession.createQueue(expiryAddress2, expiryQueue2, null, false); + clientSession.createQueue(new QueueConfiguration(expiryQueue2).setAddress(expiryAddress2).setDurable(false)); // send message that will expire ASAP ClientProducer producer = clientSession.createProducer(qName); @@ -134,9 +135,9 @@ public class ExpiryAddressTest extends ActiveMQTestBase { SimpleString eq2 = new SimpleString("EQ2"); AddressSettings addressSettings = new AddressSettings().setExpiryAddress(ea); server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings); - clientSession.createQueue(ea, eq, null, false); - clientSession.createQueue(ea, eq2, null, false); - clientSession.createQueue(qName, qName, null, false); + clientSession.createQueue(new QueueConfiguration(eq).setAddress(ea).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(eq2).setAddress(ea).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(qName).setDurable(false)); ClientProducer producer = clientSession.createProducer(qName); ClientMessage clientMessage = createTextMessage(clientSession, "heyho!"); clientMessage.setExpiration(System.currentTimeMillis()); @@ -192,9 +193,9 @@ public class ExpiryAddressTest extends ActiveMQTestBase { SimpleString qName = new SimpleString("q1"); SimpleString eq = new SimpleString("EQ1"); SimpleString eq2 = new SimpleString("EQ2"); - clientSession.createQueue(ea, eq, null, false); - clientSession.createQueue(ea, eq2, null, false); - clientSession.createQueue(qName, qName, null, false); + clientSession.createQueue(new QueueConfiguration(eq).setAddress(ea).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(eq2).setAddress(ea).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(qName).setDurable(false)); ClientProducer producer = clientSession.createProducer(qName); ClientMessage clientMessage = createTextMessage(clientSession, "heyho!"); clientMessage.setExpiration(System.currentTimeMillis()); @@ -215,8 +216,8 @@ public class ExpiryAddressTest extends ActiveMQTestBase { AddressSettings addressSettings = new AddressSettings().setExpiryAddress(ea); server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings); SimpleString eq = new SimpleString("EA1"); - clientSession.createQueue(ea, eq, null, false); - clientSession.createQueue(qName, qName, null, false); + clientSession.createQueue(new QueueConfiguration(eq).setAddress(ea).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(qName).setDurable(false)); ServerLocator locator1 = createInVMNonHALocator(); ClientSessionFactory sessionFactory = createSessionFactory(locator1); @@ -265,8 +266,8 @@ public class ExpiryAddressTest extends ActiveMQTestBase { SimpleString eq = new SimpleString("EA1"); AddressSettings addressSettings = new AddressSettings().setExpiryAddress(ea); server.getAddressSettingsRepository().setDefault(addressSettings); - clientSession.createQueue(ea, eq, null, false); - clientSession.createQueue(qName, qName, null, false); + clientSession.createQueue(new QueueConfiguration(eq).setAddress(ea).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(qName).setDurable(false)); ClientProducer producer = clientSession.createProducer(qName); ClientMessage clientMessage = createTextMessage(clientSession, "heyho!"); @@ -293,8 +294,8 @@ public class ExpiryAddressTest extends ActiveMQTestBase { SimpleString eq = new SimpleString("EA1"); AddressSettings addressSettings = new AddressSettings().setExpiryAddress(ea); server.getAddressSettingsRepository().addMatch("*", addressSettings); - clientSession.createQueue(ea, eq, null, false); - clientSession.createQueue(qName, qName, null, false); + clientSession.createQueue(new QueueConfiguration(eq).setAddress(ea).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(qName).setDurable(false)); ClientProducer producer = clientSession.createProducer(qName); ClientMessage clientMessage = createTextMessage(clientSession, "heyho!"); @@ -328,9 +329,9 @@ public class ExpiryAddressTest extends ActiveMQTestBase { AddressSettings specificAddressSettings = new AddressSettings().setExpiryAddress(specificExpiryAddress); server.getAddressSettingsRepository().addMatch("prefix.address", specificAddressSettings); - clientSession.createQueue(address, queue, false); - clientSession.createQueue(defaultExpiryAddress, defaultExpiryQueue, false); - clientSession.createQueue(specificExpiryAddress, specificExpiryQueue, false); + clientSession.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(defaultExpiryQueue).setAddress(defaultExpiryAddress).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(specificExpiryQueue).setAddress(specificExpiryAddress).setDurable(false)); ClientProducer producer = clientSession.createProducer(address); ClientMessage clientMessage = createTextMessage(clientSession, "heyho!"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ExpiryLargeMessageTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ExpiryLargeMessageTest.java index 84885d3804..1f0a3ad1fd 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ExpiryLargeMessageTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ExpiryLargeMessageTest.java @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.integration.client; import java.io.File; import org.apache.activemq.artemis.api.core.Message; +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.api.core.client.ClientConsumer; @@ -75,11 +76,11 @@ public class ExpiryLargeMessageTest extends ActiveMQTestBase { server.start(); - server.createQueue(EXPIRY, RoutingType.ANYCAST, EXPIRY, null, true, false); + server.createQueue(new QueueConfiguration(EXPIRY).setRoutingType(RoutingType.ANYCAST)); - server.createQueue(DLQ, RoutingType.ANYCAST, DLQ, null, true, false); + server.createQueue(new QueueConfiguration(DLQ).setRoutingType(RoutingType.ANYCAST)); - server.createQueue(MY_QUEUE, RoutingType.ANYCAST, MY_QUEUE, null, true, false); + server.createQueue(new QueueConfiguration(MY_QUEUE).setRoutingType(RoutingType.ANYCAST)); ServerLocator locator = createInVMNonHALocator(); @@ -253,11 +254,11 @@ public class ExpiryLargeMessageTest extends ActiveMQTestBase { server.start(); - server.createQueue(EXPIRY, RoutingType.ANYCAST, EXPIRY, null, true, false); + server.createQueue(new QueueConfiguration(EXPIRY).setRoutingType(RoutingType.ANYCAST)); - server.createQueue(DLQ, RoutingType.ANYCAST, DLQ, null, true, false); + server.createQueue(new QueueConfiguration(DLQ).setRoutingType(RoutingType.ANYCAST)); - server.createQueue(MY_QUEUE, RoutingType.ANYCAST, MY_QUEUE, null, true, false); + server.createQueue(new QueueConfiguration(MY_QUEUE).setRoutingType(RoutingType.ANYCAST)); ServerLocator locator = createInVMNonHALocator(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/FullQualifiedQueueTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/FullQualifiedQueueTest.java index 5cbfea7471..daaf9e538a 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/FullQualifiedQueueTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/FullQualifiedQueueTest.java @@ -17,6 +17,7 @@ package org.apache.activemq.artemis.tests.integration.client; import org.apache.activemq.artemis.api.core.ActiveMQNonExistentQueueException; +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.api.core.client.ClientConsumer; @@ -62,12 +63,12 @@ public class FullQualifiedQueueTest extends ActiveMQTestBase { @Test public void testMixedQueues() throws Exception { - server.createQueue(mixedAddress, RoutingType.MULTICAST, multicastQ1, null, true, false, -1, false, true); - server.createQueue(mixedAddress, RoutingType.MULTICAST, multicastQ2, null, true, false, -1, false, true); - server.createQueue(mixedAddress, RoutingType.MULTICAST, multicastQ3, null, true, false, -1, false, true); - server.createQueue(mixedAddress, RoutingType.ANYCAST, anycastQ1, null, true, false, -1, false, true); - server.createQueue(mixedAddress, RoutingType.ANYCAST, anycastQ2, null, true, false, -1, false, true); - server.createQueue(mixedAddress, RoutingType.ANYCAST, anycastQ3, null, true, false, -1, false, true); + server.createQueue(new QueueConfiguration(multicastQ1).setAddress(mixedAddress)); + server.createQueue(new QueueConfiguration(multicastQ2).setAddress(mixedAddress)); + server.createQueue(new QueueConfiguration(multicastQ3).setAddress(mixedAddress)); + server.createQueue(new QueueConfiguration(anycastQ1).setAddress(mixedAddress).setRoutingType(RoutingType.ANYCAST)); + server.createQueue(new QueueConfiguration(anycastQ2).setAddress(mixedAddress).setRoutingType(RoutingType.ANYCAST)); + server.createQueue(new QueueConfiguration(anycastQ3).setAddress(mixedAddress).setRoutingType(RoutingType.ANYCAST)); ClientSessionFactory cf = createSessionFactory(locator); ClientSession session = cf.createSession(); @@ -132,9 +133,9 @@ public class FullQualifiedQueueTest extends ActiveMQTestBase { @Test public void testMulticastQueues() throws Exception { - server.createQueue(multicastAddress, RoutingType.MULTICAST, multicastQ1, null, true, false, -1, false, true); - server.createQueue(multicastAddress, RoutingType.MULTICAST, multicastQ2, null, true, false, -1, false, true); - server.createQueue(multicastAddress, RoutingType.MULTICAST, multicastQ3, null, true, false, -1, false, true); + server.createQueue(new QueueConfiguration(multicastQ1).setAddress(multicastAddress)); + server.createQueue(new QueueConfiguration(multicastQ2).setAddress(multicastAddress)); + server.createQueue(new QueueConfiguration(multicastQ3).setAddress(multicastAddress)); ClientSessionFactory cf = createSessionFactory(locator); ClientSession session = cf.createSession(); @@ -173,9 +174,9 @@ public class FullQualifiedQueueTest extends ActiveMQTestBase { @Test public void testAnycastQueues() throws Exception { - server.createQueue(anycastAddress, RoutingType.ANYCAST, anycastQ1, null, true, false, -1, false, true); - server.createQueue(anycastAddress, RoutingType.ANYCAST, anycastQ2, null, true, false, -1, false, true); - server.createQueue(anycastAddress, RoutingType.ANYCAST, anycastQ3, null, true, false, -1, false, true); + server.createQueue(new QueueConfiguration(anycastQ1).setAddress(anycastAddress).setRoutingType(RoutingType.ANYCAST)); + server.createQueue(new QueueConfiguration(anycastQ2).setAddress(anycastAddress).setRoutingType(RoutingType.ANYCAST)); + server.createQueue(new QueueConfiguration(anycastQ3).setAddress(anycastAddress).setRoutingType(RoutingType.ANYCAST)); ClientSessionFactory cf = createSessionFactory(locator); ClientSession session = cf.createSession(); @@ -234,7 +235,7 @@ public class FullQualifiedQueueTest extends ActiveMQTestBase { @Test public void testSpecialCase() throws Exception { - server.createQueue(anycastAddress, RoutingType.ANYCAST, anycastQ1, null, true, false, -1, false, true); + server.createQueue(new QueueConfiguration(anycastQ1).setAddress(anycastAddress).setRoutingType(RoutingType.ANYCAST)); ClientSessionFactory cf = createSessionFactory(locator); ClientSession session = cf.createSession(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/HangConsumerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/HangConsumerTest.java index a8e36ba6ae..d900247674 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/HangConsumerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/HangConsumerTest.java @@ -28,6 +28,7 @@ import java.util.concurrent.TimeUnit; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.Interceptor; import org.apache.activemq.artemis.api.core.Message; +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.api.core.client.ClientConsumer; @@ -43,6 +44,8 @@ import org.apache.activemq.artemis.core.io.SequentialFileFactory; import org.apache.activemq.artemis.core.io.nio.NIOSequentialFileFactory; import org.apache.activemq.artemis.core.journal.RecordInfo; import org.apache.activemq.artemis.core.journal.impl.JournalImpl; +import org.apache.activemq.artemis.core.paging.PagingManager; +import org.apache.activemq.artemis.core.paging.PagingStore; import org.apache.activemq.artemis.core.paging.cursor.PageSubscription; import org.apache.activemq.artemis.core.persistence.OperationContext; import org.apache.activemq.artemis.core.persistence.StorageManager; @@ -54,7 +57,6 @@ import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionRec import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.MessageReference; import org.apache.activemq.artemis.core.server.Queue; -import org.apache.activemq.artemis.core.server.QueueConfig; import org.apache.activemq.artemis.core.server.ServerConsumer; import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl; import org.apache.activemq.artemis.core.server.impl.QueueFactoryImpl; @@ -110,7 +112,7 @@ public class HangConsumerTest extends ActiveMQTestBase { @Test public void testHangOnDelivery() throws Exception { - queue = server.createQueue(QUEUE, RoutingType.ANYCAST, QUEUE, null, true, false); + queue = server.createQueue(new QueueConfiguration(QUEUE).setRoutingType(RoutingType.ANYCAST)); try { ClientSessionFactory factory = locator.createSessionFactory(); @@ -206,39 +208,32 @@ public class HangConsumerTest extends ActiveMQTestBase { class MyQueueWithBlocking extends QueueImpl { /** - * @param id - * @param address - * @param name - * @param filter + * @param queueConfiguration * @param pageSubscription - * @param durable - * @param temporary * @param scheduledExecutor * @param postOffice * @param storageManager * @param addressSettingsRepository * @param executor */ - MyQueueWithBlocking(final long id, - final SimpleString address, - final SimpleString name, - final Filter filter, - final SimpleString user, + MyQueueWithBlocking(final QueueConfiguration queueConfiguration, + final PagingStore pagingStore, final PageSubscription pageSubscription, - final boolean durable, - final boolean temporary, - final boolean autoCreated, - final RoutingType deliveryMode, - final Integer maxConsumers, - final Boolean purgeOnNoConsumers, final ScheduledExecutorService scheduledExecutor, final PostOffice postOffice, final StorageManager storageManager, final HierarchicalRepository addressSettingsRepository, final ArtemisExecutor executor, final ActiveMQServer server) { - super(id, address, name, filter, pageSubscription != null ? pageSubscription.getPagingStore() : null, pageSubscription, user, durable, temporary, autoCreated, deliveryMode, - maxConsumers, purgeOnNoConsumers, scheduledExecutor, postOffice, storageManager, - addressSettingsRepository, executor, server, null); + super(queueConfiguration, + pagingStore, + pageSubscription, + scheduledExecutor, + postOffice, + storageManager, + addressSettingsRepository, + executor, + server, + null); } @Override @@ -269,45 +264,22 @@ public class HangConsumerTest extends ActiveMQTestBase { } @Override - public Queue createQueueWith(final QueueConfig config) { - queue = new MyQueueWithBlocking(config.id(), config.address(), config.name(), config.filter(), - config.user(), config.pageSubscription(), config.isDurable(), - config.isTemporary(), config.isAutoCreated(), config.deliveryMode(), - config.maxConsumers(), config.isPurgeOnNoConsumers(), scheduledExecutor, + public Queue createQueueWith(final QueueConfiguration config, PagingManager pagingManager) { + PageSubscription pageSubscription = getPageSubscription(config, pagingManager); + queue = new MyQueueWithBlocking(config, pageSubscription != null ? pageSubscription.getPagingStore() : null, pageSubscription, scheduledExecutor, postOffice, storageManager, addressSettingsRepository, executorFactory.getExecutor(), server); return queue; } - - @Deprecated - @Override - public Queue createQueue(final long persistenceID, - final SimpleString address, - final SimpleString name, - final Filter filter, - final PageSubscription pageSubscription, - final SimpleString user, - final boolean durable, - final boolean temporary, - final boolean autoCreated) { - queue = new MyQueueWithBlocking(persistenceID, address, name, filter, user, pageSubscription, durable, - temporary, autoCreated, RoutingType.MULTICAST, null, null, - scheduledExecutor, postOffice, storageManager, addressSettingsRepository, - executorFactory.getExecutor(), server); - return queue; - } - } - LocalFactory queueFactory = - new LocalFactory(server.getExecutorFactory(), server.getScheduledPool(), - server.getAddressSettingsRepository(), server.getStorageManager(), server); + LocalFactory queueFactory = new LocalFactory(server.getExecutorFactory(), server.getScheduledPool(), server.getAddressSettingsRepository(), server.getStorageManager(), server); queueFactory.setPostOffice(server.getPostOffice()); ((ActiveMQServerImpl) server).replaceQueueFactory(queueFactory); - queue = server.createQueue(QUEUE, RoutingType.ANYCAST, QUEUE, null, true, false); + queue = server.createQueue(new QueueConfiguration(QUEUE).setRoutingType(RoutingType.ANYCAST)); blocked.acquire(); @@ -335,7 +307,7 @@ public class HangConsumerTest extends ActiveMQTestBase { Assert.assertTrue(latchDelete.await(10, TimeUnit.SECONDS)); try { - server.createQueue(QUEUE, RoutingType.ANYCAST, QUEUE, null, true, false); + server.createQueue(new QueueConfiguration(QUEUE).setRoutingType(RoutingType.ANYCAST)); } catch (Exception expected) { } @@ -363,7 +335,7 @@ public class HangConsumerTest extends ActiveMQTestBase { */ @Test public void testForceDuplicationOnBindings() throws Exception { - queue = server.createQueue(QUEUE, RoutingType.ANYCAST, QUEUE, null, true, false); + queue = server.createQueue(new QueueConfiguration(QUEUE).setRoutingType(RoutingType.ANYCAST)); ClientSessionFactory factory = locator.createSessionFactory(); ClientSession session = factory.createSession(false, false, false); @@ -397,7 +369,7 @@ public class HangConsumerTest extends ActiveMQTestBase { // An exception during delivery shouldn't make the message disappear @Test public void testExceptionWhileDelivering() throws Exception { - queue = server.createQueue(QUEUE, RoutingType.ANYCAST, QUEUE, null, true, false); + queue = server.createQueue(new QueueConfiguration(QUEUE).setRoutingType(RoutingType.ANYCAST)); HangInterceptor hangInt = new HangInterceptor(); try { @@ -451,7 +423,7 @@ public class HangConsumerTest extends ActiveMQTestBase { try { for (int i = 0; i < 5; i++) { if (server.locateQueue(SimpleString.toSimpleString("tt")) == null) { - server.createQueue(SimpleString.toSimpleString("tt"), RoutingType.ANYCAST, SimpleString.toSimpleString("tt"), SimpleString.toSimpleString(Filter.GENERIC_IGNORED_FILTER), true, false); + server.createQueue(new QueueConfiguration("tt").setRoutingType(RoutingType.ANYCAST).setFilterString(Filter.GENERIC_IGNORED_FILTER)); } server.stop(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/HeuristicXATest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/HeuristicXATest.java index e32c014221..c44a7a0b44 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/HeuristicXATest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/HeuristicXATest.java @@ -21,6 +21,7 @@ import javax.management.MBeanServerFactory; import javax.transaction.xa.XAResource; import javax.transaction.xa.Xid; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -94,7 +95,7 @@ public class HeuristicXATest extends ActiveMQTestBase { ClientSession session = sf.createSession(true, false, false); - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); session.start(xid, XAResource.TMNOFLAGS); @@ -167,7 +168,7 @@ public class HeuristicXATest extends ActiveMQTestBase { ClientSession session = sf.createSession(true, false, false); - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); session.start(xid, XAResource.TMNOFLAGS); @@ -245,7 +246,7 @@ public class HeuristicXATest extends ActiveMQTestBase { ClientSession session = sf.createSession(true, false, false); - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); session.start(xid, XAResource.TMNOFLAGS); @@ -348,7 +349,7 @@ public class HeuristicXATest extends ActiveMQTestBase { ClientSession session = sf.createSession(true, false, false); - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); session.start(xid, XAResource.TMNOFLAGS); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/InVMNonPersistentMessageBufferTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/InVMNonPersistentMessageBufferTest.java index d35f436373..c6d6fd6b36 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/InVMNonPersistentMessageBufferTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/InVMNonPersistentMessageBufferTest.java @@ -17,6 +17,7 @@ package org.apache.activemq.artemis.tests.integration.client; import org.apache.activemq.artemis.api.core.ActiveMQBuffer; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientProducer; @@ -252,7 +253,7 @@ public class InVMNonPersistentMessageBufferTest extends ActiveMQTestBase { session = cf.createSession(); - session.createQueue(InVMNonPersistentMessageBufferTest.address, RoutingType.ANYCAST, InVMNonPersistentMessageBufferTest.queueName); + session.createQueue(new QueueConfiguration(InVMNonPersistentMessageBufferTest.queueName).setAddress(InVMNonPersistentMessageBufferTest.address).setRoutingType(RoutingType.ANYCAST)); producer = session.createProducer(InVMNonPersistentMessageBufferTest.address); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/InterruptedLargeMessageTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/InterruptedLargeMessageTest.java index 8ffaedab05..df4bc8c2ec 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/InterruptedLargeMessageTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/InterruptedLargeMessageTest.java @@ -31,6 +31,7 @@ import java.util.concurrent.atomic.AtomicInteger; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.Interceptor; import org.apache.activemq.artemis.api.core.Message; +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.api.core.client.ActiveMQClient; @@ -42,6 +43,8 @@ import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.core.config.StoreConfiguration; import org.apache.activemq.artemis.core.filter.Filter; +import org.apache.activemq.artemis.core.filter.impl.FilterImpl; +import org.apache.activemq.artemis.core.paging.PagingManager; import org.apache.activemq.artemis.core.paging.cursor.PageSubscription; import org.apache.activemq.artemis.core.persistence.StorageManager; import org.apache.activemq.artemis.core.postoffice.PostOffice; @@ -54,6 +57,7 @@ import org.apache.activemq.artemis.core.server.QueueConfig; import org.apache.activemq.artemis.core.server.QueueFactory; import org.apache.activemq.artemis.core.server.impl.AckReason; import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl; +import org.apache.activemq.artemis.core.server.impl.QueueFactoryImpl; import org.apache.activemq.artemis.core.server.impl.QueueImpl; import org.apache.activemq.artemis.core.settings.HierarchicalRepository; import org.apache.activemq.artemis.core.settings.impl.AddressSettings; @@ -113,7 +117,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase { session = sf.createSession(false, true, true); - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); ClientProducer producer = session.createProducer(ADDRESS); @@ -154,7 +158,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase { final ClientSession session = sf.createSession(false, true, true); - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); ClientProducer producer = session.createProducer(ADDRESS); @@ -216,7 +220,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase { SimpleString jmsAddress = new SimpleString("Test"); - server.createQueue(jmsAddress, RoutingType.ANYCAST, jmsAddress, null, true, false); + server.createQueue(new QueueConfiguration(jmsAddress).setRoutingType(RoutingType.ANYCAST)); final AtomicInteger unexpectedErrors = new AtomicInteger(0); final AtomicInteger expectedErrors = new AtomicInteger(0); @@ -276,7 +280,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase { session = sf.createSession(false, true, true); - session.createQueue(ADDRESS, ADDRESS, false); + session.createQueue(new QueueConfiguration(ADDRESS).setDurable(false)); ClientProducer producer = session.createProducer(ADDRESS); @@ -335,7 +339,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase { session = sf.createSession(false, true, true); - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); server.getPagingManager().getPageStore(ADDRESS).startPaging(); @@ -413,7 +417,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase { Xid xid1 = newXID(); Xid xid2 = newXID(); - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); ClientProducer producer = session.createProducer(ADDRESS); @@ -562,6 +566,11 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase { return new NoPostACKQueue(config.id(), config.address(), config.name(), config.filter(), config.user(), config.pageSubscription(), config.isDurable(), config.isTemporary(), config.isAutoCreated(), scheduledExecutor, postOffice, storageManager, addressSettingsRepository, execFactory.getExecutor()); } + @Override + public Queue createQueueWith(QueueConfiguration config, PagingManager pagingManager) throws Exception { + return new NoPostACKQueue(config.getId(), config.getAddress(), config.getName(), FilterImpl.createFilter(config.getFilterString()), config.getUser(), QueueFactoryImpl.getPageSubscription(config, pagingManager), config.isDurable(), config.isTemporary(), config.isAutoCreated(), scheduledExecutor, postOffice, storageManager, addressSettingsRepository, execFactory.getExecutor()); + } + @Deprecated @Override public Queue createQueue(long persistenceID, @@ -603,7 +612,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase { session = sf.createSession(false, true, true); - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); ClientProducer producer = session.createProducer(ADDRESS); @@ -660,7 +669,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase { session = sf.createSession(false, true, true); - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); ClientProducer producer = session.createProducer(ADDRESS); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JmsNettyNioStressTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JmsNettyNioStressTest.java index afc6420615..aa5a76be11 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JmsNettyNioStressTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JmsNettyNioStressTest.java @@ -26,6 +26,7 @@ import java.util.HashMap; import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ClientSession; @@ -147,8 +148,8 @@ public class JmsNettyNioStressTest extends ActiveMQTestBase { Assert.assertTrue(session.addressQuery(SimpleString.toSimpleString("queue")).isExists()); Assert.assertTrue(session.addressQuery(SimpleString.toSimpleString("queue2")).isExists()); - session.createQueue("queue", RoutingType.ANYCAST, "queue"); - session.createQueue("queue2", RoutingType.ANYCAST, "queue2"); + session.createQueue(new QueueConfiguration("queue").setRoutingType(RoutingType.ANYCAST)); + session.createQueue(new QueueConfiguration("queue2").setRoutingType(RoutingType.ANYCAST)); Assert.assertTrue(session.addressQuery(SimpleString.toSimpleString("queue")).isExists()); Assert.assertTrue(session.addressQuery(SimpleString.toSimpleString("queue2")).isExists()); session.commit(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JournalCrashTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JournalCrashTest.java index c10f2baa26..944fff8b28 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JournalCrashTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JournalCrashTest.java @@ -21,6 +21,7 @@ import java.util.ArrayList; import java.util.Arrays; import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -110,7 +111,7 @@ public class JournalCrashTest extends SpawnedTestBase { try (ClientSession session = factory.createSession(false, false)) { try { - session.createQueue(QUEUE, QUEUE, true); + session.createQueue(new QueueConfiguration(QUEUE)); } catch (Exception ignored) { } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/LargeMessageAvoidLargeMessagesTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/LargeMessageAvoidLargeMessagesTest.java index 70c1952b10..4b46cd1e6c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/LargeMessageAvoidLargeMessagesTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/LargeMessageAvoidLargeMessagesTest.java @@ -17,6 +17,7 @@ package org.apache.activemq.artemis.tests.integration.client; import org.apache.activemq.artemis.api.core.Message; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; import org.apache.activemq.artemis.api.core.client.ClientConsumer; @@ -62,7 +63,7 @@ public class LargeMessageAvoidLargeMessagesTest extends LargeMessageTest { ClientSession session = addClientSession(sf.createSession(false, true, true)); - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); ClientProducer producer = session.createProducer(ADDRESS); @@ -105,7 +106,7 @@ public class LargeMessageAvoidLargeMessagesTest extends LargeMessageTest { ClientSession session = addClientSession(sf.createSession(false, true, true)); - session.createTemporaryQueue(ADDRESS, ADDRESS); + session.createQueue(new QueueConfiguration(ADDRESS).setAddress(ADDRESS).setDurable(false).setTemporary(true)); ClientProducer producer = session.createProducer(ADDRESS); @@ -157,7 +158,7 @@ public class LargeMessageAvoidLargeMessagesTest extends LargeMessageTest { ClientSession session = addClientSession(sf.createSession(false, false, false)); - session.createTemporaryQueue(ADDRESS, ADDRESS); + session.createQueue(new QueueConfiguration(ADDRESS).setAddress(ADDRESS).setDurable(false).setTemporary(true)); ClientProducer producer = session.createProducer(ADDRESS); @@ -208,7 +209,7 @@ public class LargeMessageAvoidLargeMessagesTest extends LargeMessageTest { ClientSession session = addClientSession(sf.createSession(false, false, false)); - session.createTemporaryQueue(ADDRESS, ADDRESS); + session.createQueue(new QueueConfiguration(ADDRESS).setAddress(ADDRESS).setDurable(false).setTemporary(true)); ClientProducer producer = session.createProducer(ADDRESS); @@ -281,8 +282,8 @@ public class LargeMessageAvoidLargeMessagesTest extends LargeMessageTest { session = addClientSession(sf.createSession(false, false, false)); - session.createQueue(ADDRESS, ADDRESS, true); - session.createQueue(ADDRESS, ADDRESS.concat("-2"), true); + session.createQueue(new QueueConfiguration(ADDRESS)); + session.createQueue(new QueueConfiguration(ADDRESS.concat("-2")).setAddress(ADDRESS)); SimpleString ADDRESS_DLA = ADDRESS.concat("-dla"); @@ -290,7 +291,7 @@ public class LargeMessageAvoidLargeMessagesTest extends LargeMessageTest { server.getAddressSettingsRepository().addMatch("*", addressSettings); - session.createQueue(ADDRESS_DLA, ADDRESS_DLA, true); + session.createQueue(new QueueConfiguration(ADDRESS_DLA)); ClientProducer producer = session.createProducer(ADDRESS); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/LargeMessageCompressTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/LargeMessageCompressTest.java index 117ca75ae5..bce8375276 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/LargeMessageCompressTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/LargeMessageCompressTest.java @@ -25,6 +25,7 @@ import java.io.OutputStream; import java.util.concurrent.atomic.AtomicLong; import org.apache.activemq.artemis.api.core.Message; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -76,7 +77,7 @@ public class LargeMessageCompressTest extends LargeMessageTest { ClientSession session = addClientSession(sf.createSession(false, false, false)); - session.createTemporaryQueue(ADDRESS, ADDRESS); + session.createQueue(new QueueConfiguration(ADDRESS).setAddress(ADDRESS).setDurable(false).setTemporary(true)); ClientProducer producer = session.createProducer(ADDRESS); @@ -136,7 +137,7 @@ public class LargeMessageCompressTest extends LargeMessageTest { ClientSession session = addClientSession(sf.createSession(false, false, false)); - session.createTemporaryQueue(ADDRESS, ADDRESS); + session.createQueue(new QueueConfiguration(ADDRESS).setAddress(ADDRESS).setDurable(false).setTemporary(true)); ClientProducer producer = session.createProducer(ADDRESS); @@ -179,7 +180,7 @@ public class LargeMessageCompressTest extends LargeMessageTest { ClientSession session = addClientSession(sf.createSession(false, false, false)); - session.createTemporaryQueue(ADDRESS, ADDRESS); + session.createQueue(new QueueConfiguration(ADDRESS).setAddress(ADDRESS).setDurable(false).setTemporary(true)); ClientProducer producer = session.createProducer(ADDRESS); @@ -237,7 +238,7 @@ public class LargeMessageCompressTest extends LargeMessageTest { ClientSession session = addClientSession(sf.createSession(false, false, false)); - session.createTemporaryQueue(ADDRESS, ADDRESS); + session.createQueue(new QueueConfiguration(ADDRESS).setAddress(ADDRESS).setDurable(false).setTemporary(true)); ClientProducer producer = session.createProducer(ADDRESS); @@ -300,7 +301,7 @@ public class LargeMessageCompressTest extends LargeMessageTest { ClientSession session = addClientSession(sf.createSession(false, false, false)); - session.createQueue(ADDRESS, ADDRESS, null, true); + session.createQueue(new QueueConfiguration(ADDRESS)); ClientProducer producer = session.createProducer(ADDRESS); @@ -376,7 +377,7 @@ public class LargeMessageCompressTest extends LargeMessageTest { ClientSession session = addClientSession(sf.createSession(false, false, false)); - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); ClientProducer producer = session.createProducer(ADDRESS); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/LargeMessageTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/LargeMessageTest.java index f2ba6c5f8d..e5cc609920 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/LargeMessageTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/LargeMessageTest.java @@ -28,6 +28,7 @@ import java.util.concurrent.atomic.AtomicInteger; import org.apache.activemq.artemis.api.core.ActiveMQBuffer; import org.apache.activemq.artemis.api.core.Message; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; import org.apache.activemq.artemis.api.core.client.ClientConsumer; @@ -118,7 +119,7 @@ public class LargeMessageTest extends LargeMessageTestBase { session = sf.createSession(false, false, false); - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); ClientProducer producer = session.createProducer(ADDRESS); @@ -191,7 +192,7 @@ public class LargeMessageTest extends LargeMessageTestBase { session = addClientSession(sf.createSession(false, false, false)); - session.createTemporaryQueue(ADDRESS, ADDRESS); + session.createQueue(new QueueConfiguration(ADDRESS).setAddress(ADDRESS).setDurable(false).setTemporary(true)); ClientProducer producer = session.createProducer(ADDRESS); @@ -287,7 +288,7 @@ public class LargeMessageTest extends LargeMessageTestBase { ClientSession session = sf.createSession(false, false, false); - session.createQueue(ADDRESS, ADDRESS, null, true); + session.createQueue(new QueueConfiguration(ADDRESS)); ClientProducer producer = session.createProducer(ADDRESS); @@ -347,7 +348,7 @@ public class LargeMessageTest extends LargeMessageTestBase { session = addClientSession(sf.createSession(!transacted, !transacted, 0)); - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); ClientProducer producer = session.createProducer(ADDRESS); @@ -403,8 +404,8 @@ public class LargeMessageTest extends LargeMessageTestBase { session = addClientSession(sf.createSession(false, false, false)); - session.createQueue(ADDRESS, ADDRESS, true); - session.createQueue(ADDRESS, ADDRESS.concat("-2"), true); + session.createQueue(new QueueConfiguration(ADDRESS)); + session.createQueue(new QueueConfiguration(ADDRESS.concat("-2")).setAddress(ADDRESS)); SimpleString ADDRESS_DLA = ADDRESS.concat("-dla"); @@ -412,7 +413,7 @@ public class LargeMessageTest extends LargeMessageTestBase { server.getAddressSettingsRepository().addMatch("*", addressSettings); - session.createQueue(ADDRESS_DLA, ADDRESS_DLA, true); + session.createQueue(new QueueConfiguration(ADDRESS_DLA)); ClientProducer producer = session.createProducer(ADDRESS); @@ -507,7 +508,7 @@ public class LargeMessageTest extends LargeMessageTestBase { session = sf.createSession(false, false, false); - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); ClientProducer producer = session.createProducer(ADDRESS); @@ -575,10 +576,10 @@ public class LargeMessageTest extends LargeMessageTestBase { session = sf.createSession(false, false, false); - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); - session.createQueue(ADDRESS_DLA, ADDRESS_DLA, true); - session.createQueue(ADDRESS_EXPIRY, ADDRESS_EXPIRY, true); + session.createQueue(new QueueConfiguration(ADDRESS_DLA)); + session.createQueue(new QueueConfiguration(ADDRESS_EXPIRY)); ClientProducer producer = session.createProducer(ADDRESS); @@ -683,10 +684,10 @@ public class LargeMessageTest extends LargeMessageTestBase { session = sf.createSession(false, false, false); - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); - session.createQueue(ADDRESS_DLA, ADDRESS_DLA, true); - session.createQueue(ADDRESS_EXPIRY, ADDRESS_EXPIRY, true); + session.createQueue(new QueueConfiguration(ADDRESS_DLA)); + session.createQueue(new QueueConfiguration(ADDRESS_EXPIRY)); ClientProducer producer = session.createProducer(ADDRESS); @@ -789,9 +790,9 @@ public class LargeMessageTest extends LargeMessageTestBase { session = sf.createSession(false, false, false); - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); - session.createQueue(ADDRESS_EXPIRY, ADDRESS_EXPIRY, true); + session.createQueue(new QueueConfiguration(ADDRESS_EXPIRY)); ClientProducer producer = session.createProducer(ADDRESS); @@ -881,7 +882,7 @@ public class LargeMessageTest extends LargeMessageTestBase { session = sf.createSession(true, true, 0); - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); ClientProducer producer = session.createProducer(ADDRESS); @@ -950,11 +951,11 @@ public class LargeMessageTest extends LargeMessageTestBase { session = sf.createSession(false, false, false); - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); SimpleString ADDRESS2 = ADDRESS.concat("-2"); - session.createQueue(ADDRESS2, ADDRESS2, true); + session.createQueue(new QueueConfiguration(ADDRESS2)); ClientProducer producer = session.createProducer(ADDRESS); @@ -1025,7 +1026,7 @@ public class LargeMessageTest extends LargeMessageTestBase { session = sf.createSession(false, false, false); - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); ClientProducer producer = session.createProducer(ADDRESS); @@ -1347,8 +1348,8 @@ public class LargeMessageTest extends LargeMessageTestBase { ClientSession session = sf.createSession(null, null, false, true, true, false, 0); - session.createQueue(ADDRESS, queue[0], null, true); - session.createQueue(ADDRESS, queue[1], null, true); + session.createQueue(new QueueConfiguration(queue[0]).setAddress(ADDRESS)); + session.createQueue(new QueueConfiguration(queue[1]).setAddress(ADDRESS)); int numberOfBytes = 400000; @@ -1414,8 +1415,8 @@ public class LargeMessageTest extends LargeMessageTestBase { ClientSession session = sf.createSession(null, null, false, true, true, false, 0); - session.createQueue(ADDRESS, queue[0], null, true); - session.createQueue(ADDRESS, queue[1], null, true); + session.createQueue(new QueueConfiguration(queue[0]).setAddress(ADDRESS)); + session.createQueue(new QueueConfiguration(queue[1]).setAddress(ADDRESS)); int numberOfBytes = 400000; @@ -1480,7 +1481,7 @@ public class LargeMessageTest extends LargeMessageTestBase { session = sf.createSession(isXA, false, false); - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); Xid xid = null; @@ -1544,7 +1545,7 @@ public class LargeMessageTest extends LargeMessageTestBase { session.start(xid, XAResource.TMNOFLAGS); } - session.createQueue(ADDRESS, ADDRESS, null, true); + session.createQueue(new QueueConfiguration(ADDRESS)); int numberOfBytes = 200000; @@ -1642,7 +1643,7 @@ public class LargeMessageTest extends LargeMessageTestBase { session = sf.createSession(null, null, false, false, false, false, 0); - session.createQueue(ADDRESS, ADDRESS, null, true); + session.createQueue(new QueueConfiguration(ADDRESS)); ClientProducer producer = session.createProducer(ADDRESS); @@ -1720,7 +1721,7 @@ public class LargeMessageTest extends LargeMessageTestBase { session = sf.createSession(null, null, false, false, false, false, 0); - session.createQueue(ADDRESS, ADDRESS, null, true); + session.createQueue(new QueueConfiguration(ADDRESS)); ClientProducer producer = session.createProducer(ADDRESS); @@ -1807,8 +1808,8 @@ public class LargeMessageTest extends LargeMessageTestBase { ClientSession session = sf.createSession(null, null, false, true, true, false, 0); - session.createQueue(ADDRESS, ADDRESS.concat("-0"), null, true); - session.createQueue(ADDRESS, ADDRESS.concat("-1"), null, true); + session.createQueue(new QueueConfiguration(ADDRESS.concat("-0")).setAddress(ADDRESS)); + session.createQueue(new QueueConfiguration(ADDRESS.concat("-1")).setAddress(ADDRESS)); ClientProducer producer = session.createProducer(ADDRESS); @@ -1934,8 +1935,8 @@ public class LargeMessageTest extends LargeMessageTestBase { ClientSession session = sf.createSession(false, true, true); - session.createQueue(ADDRESS, ADDRESS.concat("-0"), null, true); - session.createQueue(ADDRESS, ADDRESS.concat("-1"), null, true); + session.createQueue(new QueueConfiguration(ADDRESS.concat("-0")).setAddress(ADDRESS)); + session.createQueue(new QueueConfiguration(ADDRESS.concat("-1")).setAddress(ADDRESS)); ClientProducer producer = session.createProducer(ADDRESS); int msgId = 0; @@ -2031,7 +2032,7 @@ public class LargeMessageTest extends LargeMessageTestBase { session = sf.createSession(null, null, false, true, true, false, 0); - session.createQueue(ADDRESS, ADDRESS, null, true); + session.createQueue(new QueueConfiguration(ADDRESS)); ClientMessage clientFile = session.createMessage(true); clientFile.setBodyInputStream(ActiveMQTestBase.createFakeLargeStream(SIZE)); @@ -2098,7 +2099,7 @@ public class LargeMessageTest extends LargeMessageTestBase { session = sf.createSession(null, null, false, true, true, false, 0); - session.createQueue(ADDRESS, ADDRESS, null, true); + session.createQueue(new QueueConfiguration(ADDRESS)); ClientMessage clientFile = session.createMessage(true); clientFile.setBodyInputStream(ActiveMQTestBase.createFakeLargeStream(SIZE)); @@ -2164,7 +2165,7 @@ public class LargeMessageTest extends LargeMessageTestBase { session = sf.createSession(null, null, false, true, true, false, 0); - session.createQueue(ADDRESS, ADDRESS, null, true); + session.createQueue(new QueueConfiguration(ADDRESS)); ClientProducer producer = session.createProducer(ADDRESS); @@ -2242,7 +2243,7 @@ public class LargeMessageTest extends LargeMessageTestBase { session = sf.createSession(null, null, false, true, true, false, 0); - session.createQueue(ADDRESS, ADDRESS, null, true); + session.createQueue(new QueueConfiguration(ADDRESS)); ClientProducer producer = session.createProducer(ADDRESS); @@ -2334,7 +2335,7 @@ public class LargeMessageTest extends LargeMessageTestBase { fileMessage.releaseResources(false); - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); ClientProducer prod = session.createProducer(ADDRESS); @@ -2401,7 +2402,7 @@ public class LargeMessageTest extends LargeMessageTestBase { ClientSession session = sf.createSession(null, null, false, true, true, false, 0); - session.createQueue(ADDRESS, ADDRESS, null, true); + session.createQueue(new QueueConfiguration(ADDRESS)); ClientProducer producer = session.createProducer(ADDRESS); @@ -2499,7 +2500,7 @@ public class LargeMessageTest extends LargeMessageTestBase { fileMessage.releaseResources(false); - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); PagingStore store = server.getPagingManager().getPageStore(ADDRESS); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageBufferTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageBufferTest.java index cb0b02bae3..41fdaadf72 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageBufferTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageBufferTest.java @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.integration.client; import java.util.UUID; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientProducer; import org.apache.activemq.artemis.api.core.client.ClientSession; @@ -56,7 +57,7 @@ public class MessageBufferTest extends ActiveMQTestBase { final String queueName = "simpleQueue"; final String addressName = "simpleAddress"; - session.createQueue(addressName, RoutingType.ANYCAST, queueName); + session.createQueue(new QueueConfiguration(queueName).setAddress(addressName).setRoutingType(RoutingType.ANYCAST)); ClientProducer producer = session.createProducer(addressName); ClientMessageImpl message = (ClientMessageImpl) session.createMessage(true); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageConcurrencyTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageConcurrencyTest.java index 6d67fca44f..2a1145d680 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageConcurrencyTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageConcurrencyTest.java @@ -21,6 +21,7 @@ import java.util.Set; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -125,7 +126,7 @@ public class MessageConcurrencyTest extends ActiveMQTestBase { final ClientProducer mainProducer = consumeSession.createProducer(ADDRESS); - consumeSession.createQueue(ADDRESS, QUEUE_NAME); + consumeSession.createQueue(new QueueConfiguration(QUEUE_NAME).setAddress(ADDRESS)); ClientConsumer consumer = consumeSession.createConsumer(QUEUE_NAME); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageConsumerRollbackTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageConsumerRollbackTest.java index 99c16ff6b2..dee29af8bf 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageConsumerRollbackTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageConsumerRollbackTest.java @@ -21,6 +21,7 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientProducer; @@ -65,9 +66,9 @@ public class MessageConsumerRollbackTest extends ActiveMQTestBase { ClientSession session = sf.createTransactedSession(); - session.createQueue(inQueue, inQueue, true); + session.createQueue(new QueueConfiguration(inQueue)); - session.createQueue(outQueue, outQueue, true); + session.createQueue(new QueueConfiguration(outQueue)); session.close(); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageCounterTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageCounterTest.java index 1e094c3b32..c3708fee45 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageCounterTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageCounterTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.client; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -55,7 +56,7 @@ public class MessageCounterTest extends ActiveMQTestBase { ClientSessionFactory sf = createSessionFactory(locator); ClientSession session = sf.createSession(null, null, false, false, false, false, 0); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageDurabilityTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageDurabilityTest.java index 5a557a36e1..8644088132 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageDurabilityTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageDurabilityTest.java @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.integration.client; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQExceptionType; import org.apache.activemq.artemis.api.core.ActiveMQNonExistentQueueException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientProducer; @@ -59,7 +60,7 @@ public class MessageDurabilityTest extends ActiveMQTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, queue, !durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(!durable)); ClientProducer producer = session.createProducer(address); producer.send(session.createMessage(!durable)); @@ -83,7 +84,7 @@ public class MessageDurabilityTest extends ActiveMQTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, queue, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); ClientProducer producer = session.createProducer(address); producer.send(session.createMessage(!durable)); @@ -105,7 +106,7 @@ public class MessageDurabilityTest extends ActiveMQTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, queue, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); ClientProducer producer = session.createProducer(address); producer.send(session.createMessage(durable)); @@ -130,7 +131,7 @@ public class MessageDurabilityTest extends ActiveMQTestBase { SimpleString address = RandomUtil.randomSimpleString(); final SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, queue, !durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(!durable)); ClientProducer producer = session.createProducer(address); producer.send(session.createMessage(durable)); @@ -157,7 +158,7 @@ public class MessageDurabilityTest extends ActiveMQTestBase { SimpleString address = RandomUtil.randomSimpleString(); final SimpleString queue = RandomUtil.randomSimpleString(); - session.createTemporaryQueue(address, queue); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false).setTemporary(true)); ClientProducer producer = session.createProducer(address); producer.send(session.createMessage(durable)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageExpirationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageExpirationTest.java index b60c293b85..f4b4a35b0a 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageExpirationTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageExpirationTest.java @@ -17,6 +17,7 @@ package org.apache.activemq.artemis.tests.integration.client; import org.apache.activemq.artemis.api.core.Message; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -50,7 +51,7 @@ public class MessageExpirationTest extends ActiveMQTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, queue, false); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false)); ClientProducer producer = session.createProducer(address); ClientMessage message = session.createMessage(false); @@ -77,7 +78,7 @@ public class MessageExpirationTest extends ActiveMQTestBase { session.close(); session = addClientSession(sf.createSession(false, false, false)); - session.createQueue(address, queue, false); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false)); ClientProducer producer = session.createProducer(address); ClientMessage message = session.createMessage(false); @@ -130,7 +131,7 @@ public class MessageExpirationTest extends ActiveMQTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, queue, false); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false)); ClientProducer producer = session.createProducer(address); ClientConsumer consumer = session.createConsumer(queue); @@ -159,7 +160,7 @@ public class MessageExpirationTest extends ActiveMQTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, queue, false); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false)); ClientProducer producer = session.createProducer(address); ClientMessage message = session.createMessage(false); @@ -197,8 +198,8 @@ public class MessageExpirationTest extends ActiveMQTestBase { } }); - session.createQueue(address, queue, false); - session.createQueue(expiryAddress, expiryQueue, false); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false)); + session.createQueue(new QueueConfiguration(expiryQueue).setAddress(expiryAddress).setDurable(false)); ClientProducer producer = session.createProducer(address); ClientMessage message = session.createMessage(false); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageGroupingConnectionFactoryTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageGroupingConnectionFactoryTest.java index 0f7e9f67ab..dc19d64c37 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageGroupingConnectionFactoryTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageGroupingConnectionFactoryTest.java @@ -21,6 +21,7 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import org.apache.activemq.artemis.api.core.ActiveMQException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -113,7 +114,7 @@ public class MessageGroupingConnectionFactoryTest extends ActiveMQTestBase { ServerLocator locator = createInVMNonHALocator().setGroupID("grp1"); ClientSessionFactory sessionFactory = createSessionFactory(locator); clientSession = addClientSession(sessionFactory.createSession(false, true, true)); - clientSession.createQueue(qName, qName, null, false); + clientSession.createQueue(new QueueConfiguration(qName).setDurable(false)); } private static class DummyMessageHandler implements MessageHandler { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageGroupingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageGroupingTest.java index 3d916b67e4..be7b48d11e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageGroupingTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageGroupingTest.java @@ -24,6 +24,7 @@ import java.util.concurrent.TimeUnit; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.Message; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -536,7 +537,7 @@ public class MessageGroupingTest extends ActiveMQTestBase { locator = createInVMNonHALocator(); clientSessionFactory = createSessionFactory(locator); clientSession = addClientSession(clientSessionFactory.createSession(false, true, true)); - clientSession.createQueue(qName, qName, null, false); + clientSession.createQueue(new QueueConfiguration(qName).setDurable(false)); } private static class DummyMessageHandler implements MessageHandler { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageHandlerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageHandlerTest.java index d3543212b2..a43d5aedfc 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageHandlerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageHandlerTest.java @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.integration.client; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -64,7 +65,7 @@ public class MessageHandlerTest extends ActiveMQTestBase { public void testSetMessageHandlerWithMessagesPending() throws Exception { ClientSession session = sf.createSession(false, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); @@ -119,7 +120,7 @@ public class MessageHandlerTest extends ActiveMQTestBase { public void testSetResetMessageHandler() throws Exception { final ClientSession session = sf.createSession(false, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); @@ -211,7 +212,7 @@ public class MessageHandlerTest extends ActiveMQTestBase { public void testSetUnsetMessageHandler() throws Exception { final ClientSession session = sf.createSession(false, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); @@ -290,7 +291,7 @@ public class MessageHandlerTest extends ActiveMQTestBase { public void testSetUnsetResetMessageHandler() throws Exception { final ClientSession session = sf.createSession(false, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessagePriorityTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessagePriorityTest.java index 55c83d1378..bd0b88dedc 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessagePriorityTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessagePriorityTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.client; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -59,7 +60,7 @@ public class MessagePriorityTest extends ActiveMQTestBase { SimpleString queue = RandomUtil.randomSimpleString(); SimpleString address = RandomUtil.randomSimpleString(); - session.createQueue(address, queue, false); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false)); ClientProducer producer = session.createProducer(address); @@ -95,7 +96,7 @@ public class MessagePriorityTest extends ActiveMQTestBase { SimpleString queue = RandomUtil.randomSimpleString(); SimpleString address = RandomUtil.randomSimpleString(); - session.createQueue(address, queue, false); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false)); session.start(); @@ -132,7 +133,7 @@ public class MessagePriorityTest extends ActiveMQTestBase { SimpleString queue = RandomUtil.randomSimpleString(); SimpleString address = RandomUtil.randomSimpleString(); - session.createQueue(address, queue, false); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false)); ClientProducer producer = session.createProducer(address); @@ -200,7 +201,7 @@ public class MessagePriorityTest extends ActiveMQTestBase { SimpleString queue = RandomUtil.randomSimpleString(); SimpleString address = RandomUtil.randomSimpleString(); - session.createQueue(address, queue, false); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false)); ClientProducer producer = session.createProducer(address); @@ -258,7 +259,7 @@ public class MessagePriorityTest extends ActiveMQTestBase { SimpleString queue = RandomUtil.randomSimpleString(); SimpleString address = RandomUtil.randomSimpleString(); - session.createQueue(address, queue, false); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false)); ClientProducer producer = session.createProducer(address); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageRateTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageRateTest.java index b42f9923f8..0ce4eda9d6 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageRateTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageRateTest.java @@ -20,6 +20,7 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -60,7 +61,7 @@ public class MessageRateTest extends ActiveMQTestBase { ClientSessionFactory sf = createSessionFactory(locator); ClientSession session = sf.createSession(false, true, true); - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); ClientProducer producer = session.createProducer(ADDRESS); long start = System.currentTimeMillis(); @@ -85,7 +86,7 @@ public class MessageRateTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); ClientProducer producer = session.createProducer(ADDRESS); @@ -120,7 +121,7 @@ public class MessageRateTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); ClientProducer producer = session.createProducer(ADDRESS); @@ -156,7 +157,7 @@ public class MessageRateTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); ClientProducer producer = session.createProducer(ADDRESS); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MixRoutingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MixRoutingTest.java index 8e12033c7c..7b3039dbe3 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MixRoutingTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MixRoutingTest.java @@ -25,6 +25,7 @@ import javax.jms.TemporaryQueue; import javax.jms.TextMessage; import javax.jms.Topic; +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.server.ActiveMQServer; @@ -58,7 +59,7 @@ public class MixRoutingTest extends SingleServerTestBase { @Test public void testMix() throws Exception { SimpleString queueName = SimpleString.toSimpleString(getName()); - server.createQueue(queueName, RoutingType.ANYCAST, queueName, null, true, false); + server.createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST)); ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(); Connection connection = factory.createConnection(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); @@ -104,7 +105,7 @@ public class MixRoutingTest extends SingleServerTestBase { @Test public void testMix2() throws Exception { SimpleString queueName = SimpleString.toSimpleString(getName()); - server.createQueue(queueName, RoutingType.ANYCAST, queueName, null, true, false); + server.createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST)); ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(); Connection connection = factory.createConnection(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); @@ -157,7 +158,7 @@ public class MixRoutingTest extends SingleServerTestBase { SimpleString topicName = SimpleString.toSimpleString("topic" + getName()); AddressInfo info = new AddressInfo(topicName, RoutingType.MULTICAST); server.addAddressInfo(info); - server.createQueue(queueName, RoutingType.ANYCAST, queueName, null, true, false); + server.createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST)); ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(); Connection connection = factory.createConnection(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MultipleThreadFilterOneTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MultipleThreadFilterOneTest.java index d74f16b9dd..2af110413c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MultipleThreadFilterOneTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MultipleThreadFilterOneTest.java @@ -20,6 +20,7 @@ import java.util.HashMap; import java.util.concurrent.atomic.AtomicInteger; import org.apache.activemq.artemis.api.core.ActiveMQException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -135,7 +136,7 @@ public class MultipleThreadFilterOneTest extends ActiveMQTestBase { locator = createNonHALocator(isNetty); factory = locator.createSessionFactory(); consumerSession = factory.createSession(false, false); - consumerSession.createQueue(ADDRESS, "Q" + nr, "prodNR=" + nr, true); + consumerSession.createQueue(new QueueConfiguration("Q" + nr).setAddress(ADDRESS).setFilterString("prodNR=" + nr)); consumer = consumerSession.createConsumer("Q" + nr); consumerSession.start(); this.nr = nr; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/NIOvsOIOTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/NIOvsOIOTest.java index 673c83ed22..0bd8145c98 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/NIOvsOIOTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/NIOvsOIOTest.java @@ -22,6 +22,7 @@ import java.util.List; import java.util.Map; import java.util.concurrent.CountDownLatch; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -249,7 +250,7 @@ public class NIOvsOIOTest extends ActiveMQTestBase { queueName = UUIDGenerator.getInstance().generateStringUUID(); - session.createQueue(dest, RoutingType.ANYCAST, queueName); + session.createQueue(new QueueConfiguration(queueName).setAddress(dest).setRoutingType(RoutingType.ANYCAST)); consumer = session.createConsumer(queueName); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/NewDeadLetterAddressTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/NewDeadLetterAddressTest.java index 869f25e30f..479e0f26a5 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/NewDeadLetterAddressTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/NewDeadLetterAddressTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.client; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -48,7 +49,7 @@ public class NewDeadLetterAddressTest extends ActiveMQTestBase { AddressSettings addressSettings = new AddressSettings().setDeadLetterAddress(dla).setSendToDLAOnNoRoute(true); server.getAddressSettingsRepository().addMatch(address.toString(), addressSettings); SimpleString dlq = new SimpleString("DLQ1"); - clientSession.createQueue(dla, dlq, null, false); + clientSession.createQueue(new QueueConfiguration(dlq).setAddress(dla).setDurable(false)); ClientProducer producer = clientSession.createProducer(address); producer.send(createTextMessage(clientSession, "heyho!")); clientSession.start(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/OrderTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/OrderTest.java index cf3f880572..16dd1dfec2 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/OrderTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/OrderTest.java @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.integration.client; import java.util.Arrays; import java.util.Collection; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientProducer; @@ -76,7 +77,7 @@ public class OrderTest extends ActiveMQTestBase { ClientSession session = sf.createSession(true, true, 0); - session.createQueue("queue", "queue", true); + session.createQueue(new QueueConfiguration("queue")); ClientProducer prod = session.createProducer("queue"); @@ -141,7 +142,7 @@ public class OrderTest extends ActiveMQTestBase { ClientSession session = sf.createSession(true, true, 0); int numberOfMessages = 500; - session.createQueue("queue", "queue", true); + session.createQueue(new QueueConfiguration("queue")); ClientProducer prod = session.createProducer("queue"); @@ -199,7 +200,7 @@ public class OrderTest extends ActiveMQTestBase { int numberOfMessages = 500; - session.createQueue("queue", "queue", true); + session.createQueue(new QueueConfiguration("queue")); ClientProducer prod = session.createProducer("queue"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ProducerFlowControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ProducerFlowControlTest.java index 9b9362951f..168475f2b7 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ProducerFlowControlTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ProducerFlowControlTest.java @@ -24,6 +24,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import org.apache.activemq.artemis.api.core.ActiveMQObjectClosedException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -213,7 +214,7 @@ public class ProducerFlowControlTest extends ActiveMQTestBase { final String queueName = "testqueue"; for (int i = 0; i < numConsumers; i++) { - session.createQueue(address, new SimpleString(queueName + i), null, false); + session.createQueue(new QueueConfiguration(new SimpleString(queueName + i)).setAddress(address).setDurable(false)); } final byte[] bytes = RandomUtil.randomBytes(messageSize); @@ -326,7 +327,7 @@ public class ProducerFlowControlTest extends ActiveMQTestBase { final SimpleString queueName = new SimpleString("testqueue"); - session.createQueue(address, queueName, null, false); + session.createQueue(new QueueConfiguration(queueName).setAddress(address).setDurable(false)); ClientProducer producer = session.createProducer(address); @@ -414,11 +415,11 @@ public class ProducerFlowControlTest extends ActiveMQTestBase { session = sf.createSession(false, true, true, true); - session.createQueue("address", "queue1", null, false); - session.createQueue("address", "queue2", null, false); - session.createQueue("address", "queue3", null, false); - session.createQueue("address", "queue4", null, false); - session.createQueue("address", "queue5", null, false); + session.createQueue(new QueueConfiguration("queue1").setAddress("address").setDurable(false)); + session.createQueue(new QueueConfiguration("queue2").setAddress("address").setDurable(false)); + session.createQueue(new QueueConfiguration("queue3").setAddress("address").setDurable(false)); + session.createQueue(new QueueConfiguration("queue4").setAddress("address").setDurable(false)); + session.createQueue(new QueueConfiguration("queue5").setAddress("address").setDurable(false)); ClientConsumer consumer1 = session.createConsumer("queue1"); ClientConsumer consumer2 = session.createConsumer("queue2"); @@ -476,7 +477,7 @@ public class ProducerFlowControlTest extends ActiveMQTestBase { session = sf.createSession(false, true, true, true); - session.createQueue("address", "queue1", null, false); + session.createQueue(new QueueConfiguration("queue1").setAddress("address").setDurable(false)); ClientProducerCredits credits = null; @@ -506,7 +507,7 @@ public class ProducerFlowControlTest extends ActiveMQTestBase { session = sf.createSession(false, true, true, true); - session.createQueue("address", "queue1", null, false); + session.createQueue(new QueueConfiguration("queue1").setAddress("address").setDurable(false)); ClientProducerCredits credits = null; @@ -539,7 +540,7 @@ public class ProducerFlowControlTest extends ActiveMQTestBase { session = sf.createSession(false, true, true, true); - session.createQueue("address", "queue1", null, false); + session.createQueue(new QueueConfiguration("queue1").setAddress("address").setDurable(false)); ClientProducerCredits credits = null; @@ -569,7 +570,7 @@ public class ProducerFlowControlTest extends ActiveMQTestBase { session = sf.createSession(false, true, true, true); - session.createQueue("address", "queue1", null, false); + session.createQueue(new QueueConfiguration("queue1").setAddress("address").setDurable(false)); ClientProducerCredits credits = null; @@ -602,7 +603,7 @@ public class ProducerFlowControlTest extends ActiveMQTestBase { session = sf.createSession(false, true, true, true); - session.createQueue("address", "queue1", null, false); + session.createQueue(new QueueConfiguration("queue1").setAddress("address").setDurable(false)); ClientProducerCredits credits = null; @@ -656,7 +657,7 @@ public class ProducerFlowControlTest extends ActiveMQTestBase { session = sf.createSession(false, true, true, true); - session.createQueue("address", "queue1", null, false); + session.createQueue(new QueueConfiguration("queue1").setAddress("address").setDurable(false)); for (int i = 0; i < ClientProducerCreditManagerImpl.MAX_UNREFERENCED_CREDITS_CACHE_SIZE; i++) { ClientProducer prod = session.createProducer((String) null); @@ -679,7 +680,7 @@ public class ProducerFlowControlTest extends ActiveMQTestBase { session = sf.createSession(false, true, true, true); - session.createQueue("address", "queue1", null, false); + session.createQueue(new QueueConfiguration("queue1").setAddress("address").setDurable(false)); for (int i = 0; i < ClientProducerCreditManagerImpl.MAX_UNREFERENCED_CREDITS_CACHE_SIZE; i++) { ClientProducer prod = session.createProducer((String) null); @@ -720,7 +721,7 @@ public class ProducerFlowControlTest extends ActiveMQTestBase { session = sf.createSession(false, true, true, true); - session.createQueue("address", "queue1", null, false); + session.createQueue(new QueueConfiguration("queue1").setAddress("address").setDurable(false)); ClientProducer prod1 = session.createProducer("address"); Assert.assertEquals(1, ((ClientSessionInternal) session).getProducerCreditManager().creditsMapSize()); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ProducerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ProducerTest.java index ba71e24262..ac66eecde3 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ProducerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ProducerTest.java @@ -21,6 +21,7 @@ import java.util.concurrent.TimeUnit; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.Interceptor; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -31,7 +32,6 @@ import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.core.protocol.core.Packet; import org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl; import org.apache.activemq.artemis.core.server.ActiveMQServer; -import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy; import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection; @@ -90,7 +90,7 @@ public class ProducerTest extends ActiveMQTestBase { server.getConfiguration().getAddressesSettings().put(QUEUE.toString(), setting); server.start(); - server.createQueue(QUEUE, RoutingType.MULTICAST, QUEUE, null, true, false); + server.createQueue(new QueueConfiguration(QUEUE)); for (int i = 0; i < 100; i++) { final CountDownLatch latch = new CountDownLatch(1); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/QueueBrowserTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/QueueBrowserTest.java index beabef9061..14cc4efa6b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/QueueBrowserTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/QueueBrowserTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.client; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -59,7 +60,7 @@ public class QueueBrowserTest extends ActiveMQTestBase { sf = createSessionFactory(locator); ClientSession session = sf.createSession(false, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); @@ -101,7 +102,7 @@ public class QueueBrowserTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); @@ -143,7 +144,7 @@ public class QueueBrowserTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); @@ -176,7 +177,7 @@ public class QueueBrowserTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); @@ -211,7 +212,7 @@ public class QueueBrowserTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); @@ -259,7 +260,7 @@ public class QueueBrowserTest extends ActiveMQTestBase { ClientSession session = sf.createSession(null, null, false, true, true, preACK, 0); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); @@ -291,7 +292,7 @@ public class QueueBrowserTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); @@ -327,7 +328,7 @@ public class QueueBrowserTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ReceiveImmediateTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ReceiveImmediateTest.java index 42b3549751..99c16764e9 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ReceiveImmediateTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ReceiveImmediateTest.java @@ -18,6 +18,7 @@ package org.apache.activemq.artemis.tests.integration.client; import java.util.concurrent.atomic.AtomicBoolean; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -83,7 +84,7 @@ public class ReceiveImmediateTest extends ActiveMQTestBase { sf = createSessionFactory(locator); ClientSession session = sf.createSession(false, true, true); - session.createQueue(ADDRESS, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setAddress(ADDRESS).setDurable(false)); ClientConsumer consumer = session.createConsumer(QUEUE, null, false); session.start(); @@ -112,7 +113,7 @@ public class ReceiveImmediateTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - session.createQueue(ADDRESS, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setAddress(ADDRESS).setDurable(false)); ClientProducer producer = session.createProducer(ADDRESS); @@ -146,7 +147,7 @@ public class ReceiveImmediateTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - session.createQueue(ADDRESS, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setAddress(ADDRESS).setDurable(false)); ClientProducer producer = session.createProducer(ADDRESS); @@ -187,7 +188,7 @@ public class ReceiveImmediateTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, false); - session.createQueue(ADDRESS, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setAddress(ADDRESS).setDurable(false)); ClientConsumer consumer = session.createConsumer(QUEUE, null, browser); session.start(); @@ -204,7 +205,7 @@ public class ReceiveImmediateTest extends ActiveMQTestBase { sf = createSessionFactory(locator); ClientSession session = sf.createSession(false, true, true); - session.createQueue(ADDRESS, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setAddress(ADDRESS).setDurable(false)); ClientProducer producer = session.createProducer(ADDRESS); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ReceiveTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ReceiveTest.java index cca8b1046d..9d039bb553 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ReceiveTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ReceiveTest.java @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.integration.client; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQIllegalStateException; import org.apache.activemq.artemis.api.core.ActiveMQObjectClosedException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -72,7 +73,7 @@ public class ReceiveTest extends ActiveMQTestBase { ClientSession sendSession = cf.createSession(false, true, true); ClientProducer cp = sendSession.createProducer(addressA); ClientSession session = cf.createSession(false, true, true); - session.createQueue(addressA, queueA, false); + session.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setDurable(false)); ClientConsumer cc = session.createConsumer(queueA); session.start(); cp.send(sendSession.createMessage(false)); @@ -86,7 +87,7 @@ public class ReceiveTest extends ActiveMQTestBase { ClientSessionFactory cf = createSessionFactory(locator); ClientSession session = cf.createSession(false, true, true); - session.createQueue(addressA, queueA, false); + session.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setDurable(false)); ClientConsumer cc = session.createConsumer(queueA); session.start(); long time = System.currentTimeMillis(); @@ -100,7 +101,7 @@ public class ReceiveTest extends ActiveMQTestBase { ClientSessionFactory cf = createSessionFactory(locator); ClientSession session = cf.createSession(false, true, true); - session.createQueue(addressA, queueA, false); + session.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setDurable(false)); ClientConsumer cc = session.createConsumer(queueA); session.start(); session.close(); @@ -120,7 +121,7 @@ public class ReceiveTest extends ActiveMQTestBase { ClientSessionFactory cf = createSessionFactory(locator); ClientSession session = cf.createSession(false, true, true); - session.createQueue(addressA, queueA, false); + session.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setDurable(false)); ClientConsumer cc = session.createConsumer(queueA); session.start(); cc.setMessageHandler(new MessageHandler() { @@ -147,7 +148,7 @@ public class ReceiveTest extends ActiveMQTestBase { ClientSession sendSession = cf.createSession(false, true, true); ClientProducer cp = sendSession.createProducer(addressA); ClientSession session = cf.createSession(false, true, true); - session.createQueue(addressA, RoutingType.ANYCAST, queueA, false); + session.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setRoutingType(RoutingType.ANYCAST).setDurable(false)); ClientConsumer cc = session.createConsumer(queueA); ClientConsumer cc2 = session.createConsumer(queueA); session.start(); @@ -177,8 +178,8 @@ public class ReceiveTest extends ActiveMQTestBase { ClientProducer cp2 = sendSession.createProducer(addressB); ClientSession session = cf.createSession(false, true, false); - session.createQueue(addressA, queueA, false); - session.createQueue(addressB, queueB, false); + session.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setDurable(false)); + session.createQueue(new QueueConfiguration(queueB).setAddress(addressB).setDurable(false)); ClientConsumer cc1 = session.createConsumer(queueA); ClientConsumer cc2 = session.createConsumer(queueB); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/RedeliveryConsumerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/RedeliveryConsumerTest.java index 69e516efc3..e78e34ad38 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/RedeliveryConsumerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/RedeliveryConsumerTest.java @@ -21,6 +21,7 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicInteger; import org.apache.activemq.artemis.api.core.ActiveMQException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -419,7 +420,7 @@ public class RedeliveryConsumerTest extends ActiveMQTestBase { ClientSession session = addClientSession(factory.createSession(false, false, false)); try { - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); } catch (ActiveMQException expected) { // in case of restart } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/RequestorTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/RequestorTest.java index 68e178465a..69ba87fbdf 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/RequestorTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/RequestorTest.java @@ -18,6 +18,7 @@ package org.apache.activemq.artemis.tests.integration.client; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQExceptionType; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -54,7 +55,7 @@ public class RequestorTest extends ActiveMQTestBase { session.start(); - session.createTemporaryQueue(requestAddress, requestQueue); + session.createQueue(new QueueConfiguration(requestQueue).setAddress(requestAddress).setDurable(false).setTemporary(true)); ClientConsumer requestConsumer = session.createConsumer(requestQueue); requestConsumer.setMessageHandler(new SimpleMessageHandler(key, session)); @@ -85,7 +86,7 @@ public class RequestorTest extends ActiveMQTestBase { final ClientSession sessionRequest = sf.createSession(false, true, true); - sessionRequest.createQueue(requestAddress, requestQueue); + sessionRequest.createQueue(new QueueConfiguration(requestQueue).setAddress(requestAddress)); sessionRequest.start(); @@ -128,7 +129,7 @@ public class RequestorTest extends ActiveMQTestBase { session.start(); - session.createTemporaryQueue(requestAddress, requestQueue); + session.createQueue(new QueueConfiguration(requestQueue).setAddress(requestAddress).setDurable(false).setTemporary(true)); ClientConsumer requestConsumer = session.createConsumer(requestQueue); requestConsumer.setMessageHandler(new SimpleMessageHandler(key, session)); @@ -161,7 +162,7 @@ public class RequestorTest extends ActiveMQTestBase { session.start(); - session.createTemporaryQueue(requestAddress, requestQueue); + session.createQueue(new QueueConfiguration(requestQueue).setAddress(requestAddress).setDurable(false).setTemporary(true)); ClientConsumer requestConsumer = session.createConsumer(requestQueue); requestConsumer.setMessageHandler(new MessageHandler() { @@ -212,7 +213,7 @@ public class RequestorTest extends ActiveMQTestBase { session.start(); - session.createTemporaryQueue(requestAddress, requestQueue); + session.createQueue(new QueueConfiguration(requestQueue).setAddress(requestAddress).setDurable(false).setTemporary(true)); ClientConsumer requestConsumer = session.createConsumer(requestQueue); requestConsumer.setMessageHandler(new SimpleMessageHandler(key, session)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/RoutingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/RoutingTest.java index 7e058d87f1..66e2d51692 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/RoutingTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/RoutingTest.java @@ -18,6 +18,7 @@ package org.apache.activemq.artemis.tests.integration.client; import java.util.EnumSet; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -60,9 +61,9 @@ public class RoutingTest extends ActiveMQTestBase { @Test public void testRouteToMultipleQueues() throws Exception { ClientSession sendSession = cf.createSession(false, true, true); - sendSession.createQueue(addressA, queueA, false); - sendSession.createQueue(addressA, queueB, false); - sendSession.createQueue(addressA, queueC, false); + sendSession.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setDurable(false)); + sendSession.createQueue(new QueueConfiguration(queueB).setAddress(addressA).setDurable(false)); + sendSession.createQueue(new QueueConfiguration(queueC).setAddress(addressA).setDurable(false)); int numMessages = 300; ClientProducer p = sendSession.createProducer(addressA); for (int i = 0; i < numMessages; i++) { @@ -94,7 +95,7 @@ public class RoutingTest extends ActiveMQTestBase { @Test public void testRouteToSingleNonDurableQueue() throws Exception { ClientSession sendSession = cf.createSession(false, true, true); - sendSession.createQueue(addressA, queueA, false); + sendSession.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setDurable(false)); int numMessages = 300; ClientProducer p = sendSession.createProducer(addressA); for (int i = 0; i < numMessages; i++) { @@ -116,7 +117,7 @@ public class RoutingTest extends ActiveMQTestBase { @Test public void testRouteToSingleDurableQueue() throws Exception { ClientSession sendSession = cf.createSession(false, true, true); - sendSession.createQueue(addressA, queueA, true); + sendSession.createQueue(new QueueConfiguration(queueA).setAddress(addressA)); int numMessages = 300; ClientProducer p = sendSession.createProducer(addressA); for (int i = 0; i < numMessages; i++) { @@ -138,7 +139,7 @@ public class RoutingTest extends ActiveMQTestBase { @Test public void testRouteToSingleQueueWithFilter() throws Exception { ClientSession sendSession = cf.createSession(false, true, true); - sendSession.createQueue(addressA, queueA, new SimpleString("foo = 'bar'"), false); + sendSession.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setFilterString(new SimpleString("foo = 'bar'")).setDurable(false)); int numMessages = 300; ClientProducer p = sendSession.createProducer(addressA); for (int i = 0; i < numMessages; i++) { @@ -162,9 +163,9 @@ public class RoutingTest extends ActiveMQTestBase { @Test public void testRouteToMultipleQueueWithFilters() throws Exception { ClientSession sendSession = cf.createSession(false, true, true); - sendSession.createQueue(addressA, queueA, new SimpleString("foo = 'bar'"), false); - sendSession.createQueue(addressA, queueB, new SimpleString("x = 1"), false); - sendSession.createQueue(addressA, queueC, new SimpleString("b = false"), false); + sendSession.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setFilterString(new SimpleString("foo = 'bar'")).setDurable(false)); + sendSession.createQueue(new QueueConfiguration(queueB).setAddress(addressA).setFilterString(new SimpleString("x = 1")).setDurable(false)); + sendSession.createQueue(new QueueConfiguration(queueC).setAddress(addressA).setFilterString(new SimpleString("b = false")).setDurable(false)); int numMessages = 300; ClientProducer p = sendSession.createProducer(addressA); for (int i = 0; i < numMessages; i++) { @@ -204,7 +205,7 @@ public class RoutingTest extends ActiveMQTestBase { @Test public void testRouteToSingleTemporaryQueue() throws Exception { ClientSession sendSession = cf.createSession(false, true, true); - sendSession.createTemporaryQueue(addressA, queueA); + sendSession.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setDurable(false).setTemporary(true)); int numMessages = 300; ClientProducer p = sendSession.createProducer(addressA); for (int i = 0; i < numMessages; i++) { @@ -228,9 +229,9 @@ public class RoutingTest extends ActiveMQTestBase { ClientSession sendSession = cf.createSession(false, true, true); EnumSet routingTypes = EnumSet.of(RoutingType.ANYCAST, RoutingType.MULTICAST); sendSession.createAddress(addressA, routingTypes, false); - sendSession.createQueue(addressA, RoutingType.ANYCAST, queueA); - sendSession.createQueue(addressA, RoutingType.ANYCAST, queueB); - sendSession.createQueue(addressA, RoutingType.MULTICAST, queueC); + sendSession.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setRoutingType(RoutingType.ANYCAST)); + sendSession.createQueue(new QueueConfiguration(queueB).setAddress(addressA).setRoutingType(RoutingType.ANYCAST)); + sendSession.createQueue(new QueueConfiguration(queueC).setAddress(addressA)); ClientProducer p = sendSession.createProducer(addressA); ClientMessage message = sendSession.createMessage(false); message.setRoutingType(RoutingType.ANYCAST); @@ -245,9 +246,9 @@ public class RoutingTest extends ActiveMQTestBase { ClientSession sendSession = cf.createSession(false, true, true); EnumSet routingTypes = EnumSet.of(RoutingType.ANYCAST, RoutingType.MULTICAST); sendSession.createAddress(addressA, routingTypes, false); - sendSession.createQueue(addressA, RoutingType.ANYCAST, queueA); - sendSession.createQueue(addressA, RoutingType.MULTICAST, queueB); - sendSession.createQueue(addressA, RoutingType.MULTICAST, queueC); + sendSession.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setRoutingType(RoutingType.ANYCAST)); + sendSession.createQueue(new QueueConfiguration(queueB).setAddress(addressA)); + sendSession.createQueue(new QueueConfiguration(queueC).setAddress(addressA)); ClientProducer p = sendSession.createProducer(addressA); ClientMessage message = sendSession.createMessage(false); message.setRoutingType(RoutingType.MULTICAST); @@ -262,10 +263,10 @@ public class RoutingTest extends ActiveMQTestBase { ClientSession sendSession = cf.createSession(false, true, true); EnumSet routingTypes = EnumSet.of(RoutingType.ANYCAST, RoutingType.MULTICAST); sendSession.createAddress(addressA, routingTypes, false); - sendSession.createQueue(addressA, RoutingType.ANYCAST, queueA); - sendSession.createQueue(addressA, RoutingType.ANYCAST, queueB); - sendSession.createQueue(addressA, RoutingType.MULTICAST, queueC); - sendSession.createQueue(addressA, RoutingType.MULTICAST, queueD); + sendSession.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setRoutingType(RoutingType.ANYCAST)); + sendSession.createQueue(new QueueConfiguration(queueB).setAddress(addressA).setRoutingType(RoutingType.ANYCAST)); + sendSession.createQueue(new QueueConfiguration(queueC).setAddress(addressA)); + sendSession.createQueue(new QueueConfiguration(queueD).setAddress(addressA)); ClientProducer p = sendSession.createProducer(addressA); ClientMessage message = sendSession.createMessage(false); p.send(message); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SelfExpandingBufferTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SelfExpandingBufferTest.java index aff0475ca7..f9be93ae1c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SelfExpandingBufferTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SelfExpandingBufferTest.java @@ -17,6 +17,7 @@ package org.apache.activemq.artemis.tests.integration.client; import org.apache.activemq.artemis.api.core.ActiveMQBuffer; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -72,7 +73,7 @@ public class SelfExpandingBufferTest extends ActiveMQTestBase { try { - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); ClientMessage msg = session.createMessage(true); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SendAckFailTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SendAckFailTest.java index 3980b3bb71..3d77d1a1dc 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SendAckFailTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SendAckFailTest.java @@ -33,6 +33,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQBuffer; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.Message; import org.apache.activemq.artemis.api.core.Pair; +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.api.core.client.ClientConsumer; @@ -136,7 +137,7 @@ public class SendAckFailTest extends SpawnedTestBase { ClientSession session = sf.createSession(); session.createAddress(SimpleString.toSimpleString("T1"), RoutingType.ANYCAST, true); - session.createQueue(SimpleString.toSimpleString("T1"), RoutingType.ANYCAST, SimpleString.toSimpleString("T1"), true); + session.createQueue(new QueueConfiguration("T1").setRoutingType(RoutingType.ANYCAST)); ClientProducer producer = session.createProducer("T1"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionCloseTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionCloseTest.java index 5d32fc1274..bf939cc2e0 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionCloseTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionCloseTest.java @@ -21,6 +21,7 @@ import javax.transaction.xa.XAResource; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQExceptionType; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientProducer; @@ -79,14 +80,14 @@ public class SessionCloseTest extends ActiveMQTestBase { ActiveMQTestBase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction() { @Override public void run() throws ActiveMQException { - session.createQueue(RandomUtil.randomSimpleString(), RandomUtil.randomSimpleString(), RandomUtil.randomBoolean()); + session.createQueue(new QueueConfiguration(RandomUtil.randomSimpleString()).setDurable(RandomUtil.randomBoolean())); } }); ActiveMQTestBase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction() { @Override public void run() throws ActiveMQException { - session.createTemporaryQueue(RandomUtil.randomSimpleString(), RandomUtil.randomSimpleString()); + session.createQueue(new QueueConfiguration(RandomUtil.randomSimpleString()).setAddress(RandomUtil.randomSimpleString()).setDurable(false).setTemporary(true)); } }); @@ -209,7 +210,7 @@ public class SessionCloseTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - session.createQueue(address, queue, false); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false)); ClientProducer producer = session.createProducer(address); ClientConsumer consumer = session.createConsumer(queue); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionClosedOnRemotingConnectionFailureTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionClosedOnRemotingConnectionFailureTest.java index 7ddbb3b48f..cf506610d4 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionClosedOnRemotingConnectionFailureTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionClosedOnRemotingConnectionFailureTest.java @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.integration.client; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException; import org.apache.activemq.artemis.api.core.ActiveMQObjectClosedException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientProducer; import org.apache.activemq.artemis.api.core.client.ClientSession; @@ -44,7 +45,7 @@ public class SessionClosedOnRemotingConnectionFailureTest extends ActiveMQTestBa public void testSessionClosedOnRemotingConnectionFailure() throws Exception { ClientSession session = addClientSession(sf.createSession()); - session.createQueue("fooaddress", RoutingType.ANYCAST, "fooqueue"); + session.createQueue(new QueueConfiguration("fooqueue").setAddress("fooaddress").setRoutingType(RoutingType.ANYCAST)); ClientProducer prod = session.createProducer("fooaddress"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionCreateAndDeleteQueueTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionCreateAndDeleteQueueTest.java index af4ab8db97..f4c1da4883 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionCreateAndDeleteQueueTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionCreateAndDeleteQueueTest.java @@ -18,6 +18,7 @@ package org.apache.activemq.artemis.tests.integration.client; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQNonExistentQueueException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientSession; import org.apache.activemq.artemis.api.core.client.ServerLocator; @@ -44,7 +45,7 @@ public class SessionCreateAndDeleteQueueTest extends ActiveMQTestBase { @Test public void testDurableFalse() throws Exception { ClientSession session = createSessionFactory(locator).createSession(false, true, true); - session.createQueue(address, queueName, false); + session.createQueue(new QueueConfiguration(queueName).setAddress(address).setDurable(false)); Binding binding = server.getPostOffice().getBinding(queueName); Queue q = (Queue) binding.getBindable(); Assert.assertFalse(q.isDurable()); @@ -55,7 +56,7 @@ public class SessionCreateAndDeleteQueueTest extends ActiveMQTestBase { @Test public void testDurableTrue() throws Exception { ClientSession session = createSessionFactory(locator).createSession(false, true, true); - session.createQueue(address, queueName, true); + session.createQueue(new QueueConfiguration(queueName).setAddress(address)); Binding binding = server.getPostOffice().getBinding(queueName); Queue q = (Queue) binding.getBindable(); Assert.assertTrue(q.isDurable()); @@ -66,7 +67,7 @@ public class SessionCreateAndDeleteQueueTest extends ActiveMQTestBase { @Test public void testTemporaryFalse() throws Exception { ClientSession session = createSessionFactory(locator).createSession(false, true, true); - session.createQueue(address, queueName, false); + session.createQueue(new QueueConfiguration(queueName).setAddress(address).setDurable(false)); Binding binding = server.getPostOffice().getBinding(queueName); Queue q = (Queue) binding.getBindable(); Assert.assertFalse(q.isTemporary()); @@ -77,7 +78,7 @@ public class SessionCreateAndDeleteQueueTest extends ActiveMQTestBase { @Test public void testTemporaryTrue() throws Exception { ClientSession session = createSessionFactory(locator).createSession(false, true, true); - session.createTemporaryQueue(address, queueName); + session.createQueue(new QueueConfiguration(queueName).setAddress(address).setDurable(false).setTemporary(true)); Binding binding = server.getPostOffice().getBinding(queueName); Queue q = (Queue) binding.getBindable(); Assert.assertTrue(q.isTemporary()); @@ -89,7 +90,7 @@ public class SessionCreateAndDeleteQueueTest extends ActiveMQTestBase { public void testcreateWithFilter() throws Exception { ClientSession session = createSessionFactory(locator).createSession(false, true, true); SimpleString filterString = new SimpleString("x=y"); - session.createQueue(address, queueName, filterString, false); + session.createQueue(new QueueConfiguration(queueName).setAddress(address).setFilterString(filterString).setDurable(false)); Binding binding = server.getPostOffice().getBinding(queueName); Queue q = (Queue) binding.getBindable(); Assert.assertEquals(q.getFilter().getFilterString(), filterString); @@ -102,7 +103,7 @@ public class SessionCreateAndDeleteQueueTest extends ActiveMQTestBase { server.getAddressSettingsRepository().addMatch(address.toString(), new AddressSettings().setDefaultLastValueQueue(true)); ClientSession session = createSessionFactory(locator).createSession(false, true, true); SimpleString filterString = new SimpleString("x=y"); - session.createQueue(address, queueName, filterString, false); + session.createQueue(new QueueConfiguration(queueName).setAddress(address).setFilterString(filterString).setDurable(false)); Binding binding = server.getPostOffice().getBinding(queueName); Assert.assertTrue(binding.getBindable() instanceof LastValueQueue); @@ -112,7 +113,7 @@ public class SessionCreateAndDeleteQueueTest extends ActiveMQTestBase { @Test public void testDeleteQueue() throws Exception { ClientSession session = createSessionFactory(locator).createSession(false, true, true); - session.createQueue(address, queueName, false); + session.createQueue(new QueueConfiguration(queueName).setAddress(address).setDurable(false)); Binding binding = server.getPostOffice().getBinding(queueName); Assert.assertNotNull(binding); session.deleteQueue(queueName); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionCreateConsumerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionCreateConsumerTest.java index 8d40d4c68e..630f7e93c3 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionCreateConsumerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionCreateConsumerTest.java @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.integration.client; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQInvalidFilterExpressionException; import org.apache.activemq.artemis.api.core.ActiveMQNonExistentQueueException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; import org.apache.activemq.artemis.api.core.client.ServerLocator; @@ -53,7 +54,7 @@ public class SessionCreateConsumerTest extends ActiveMQTestBase { @Test public void testCreateConsumer() throws Exception { - clientSession.createQueue(queueName, queueName, false); + clientSession.createQueue(new QueueConfiguration(queueName).setDurable(false)); ClientConsumer consumer = clientSession.createConsumer(queueName); Assert.assertNotNull(consumer); } @@ -72,14 +73,14 @@ public class SessionCreateConsumerTest extends ActiveMQTestBase { @Test public void testCreateConsumerWithFilter() throws Exception { - clientSession.createQueue(queueName, queueName, false); + clientSession.createQueue(new QueueConfiguration(queueName).setDurable(false)); ClientConsumer consumer = clientSession.createConsumer(queueName, "foo=bar"); Assert.assertNotNull(consumer); } @Test public void testCreateConsumerWithInvalidFilter() throws Exception { - clientSession.createQueue(queueName, queueName, false); + clientSession.createQueue(new QueueConfiguration(queueName).setDurable(false)); try { clientSession.createConsumer(queueName, "this is not valid filter"); Assert.fail("should throw exception"); @@ -92,14 +93,14 @@ public class SessionCreateConsumerTest extends ActiveMQTestBase { @Test public void testCreateConsumerWithBrowseOnly() throws Exception { - clientSession.createQueue(queueName, queueName, false); + clientSession.createQueue(new QueueConfiguration(queueName).setDurable(false)); ClientConsumer consumer = clientSession.createConsumer(queueName, null, true); Assert.assertNotNull(consumer); } @Test public void testCreateConsumerWithOverrides() throws Exception { - clientSession.createQueue(queueName, queueName, false); + clientSession.createQueue(new QueueConfiguration(queueName).setDurable(false)); ClientConsumer consumer = clientSession.createConsumer(queueName, null, 100, 100, false); Assert.assertNotNull(consumer); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionSendAcknowledgementHandlerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionSendAcknowledgementHandlerTest.java index 8b88073b94..f0794e6e0d 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionSendAcknowledgementHandlerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionSendAcknowledgementHandlerTest.java @@ -21,6 +21,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import org.apache.activemq.artemis.api.core.Message; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientProducer; @@ -74,7 +75,7 @@ public class SessionSendAcknowledgementHandlerTest extends ActiveMQTestBase { assertTrue("Expected a failure on setting ACK Handler", failed); - session.createQueue(address, queueName, false); + session.createQueue(new QueueConfiguration(queueName).setAddress(address).setDurable(false)); } @Test @@ -105,7 +106,7 @@ public class SessionSendAcknowledgementHandlerTest extends ActiveMQTestBase { ClientSessionFactory csf = createSessionFactory(locator); ClientSession session = csf.createSession(null, null, false, true, true, false, 1); - session.createQueue(address, queueName, false); + session.createQueue(new QueueConfiguration(queueName).setAddress(address).setDurable(false)); ClientProducer prod = session.createProducer(address); @@ -137,7 +138,7 @@ public class SessionSendAcknowledgementHandlerTest extends ActiveMQTestBase { ClientSessionFactory csf = createSessionFactory(locator); ClientSession session = csf.createSession(null, null, false, true, true, false, 1); - session.createQueue(address, queueName, false); + session.createQueue(new QueueConfiguration(queueName).setAddress(address).setDurable(false)); ClientProducer prod = session.createProducer(address); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionStopStartTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionStopStartTest.java index afc7a1ce0f..083ac7c673 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionStopStartTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionStopStartTest.java @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.integration.client; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -60,7 +61,7 @@ public class SessionStopStartTest extends ActiveMQTestBase { final ClientSession session = sf.createSession(false, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); @@ -101,7 +102,7 @@ public class SessionStopStartTest extends ActiveMQTestBase { final ClientSession session = sf.createSession(false, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); @@ -145,7 +146,7 @@ public class SessionStopStartTest extends ActiveMQTestBase { final ClientSession session = sf.createSession(false, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); @@ -227,7 +228,7 @@ public class SessionStopStartTest extends ActiveMQTestBase { final ClientSession session = sf.createSession(false, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); @@ -314,7 +315,7 @@ public class SessionStopStartTest extends ActiveMQTestBase { final ClientSession session = sf.createSession(false, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); @@ -408,7 +409,7 @@ public class SessionStopStartTest extends ActiveMQTestBase { final ClientSession session = sf.createSession(false, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); @@ -516,7 +517,7 @@ public class SessionStopStartTest extends ActiveMQTestBase { final ClientSession session = sf.createSession(false, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); @@ -568,7 +569,7 @@ public class SessionStopStartTest extends ActiveMQTestBase { final ClientSession session = sf.createSession(false, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); @@ -606,7 +607,7 @@ public class SessionStopStartTest extends ActiveMQTestBase { final ClientSession session = sf.createSession(false, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionTest.java index ed6ab541a1..8e51681835 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionTest.java @@ -16,12 +16,15 @@ */ package org.apache.activemq.artemis.tests.integration.client; +import java.util.Arrays; +import java.util.Collection; import java.util.List; import java.util.UUID; import java.util.concurrent.TimeUnit; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQInternalErrorException; +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.api.core.client.ClientConsumer; @@ -44,18 +47,32 @@ import org.apache.activemq.artemis.tests.util.Wait; import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; /** * This test covers the API for ClientSession although XA tests are tested separately. */ +@RunWith(Parameterized.class) public class SessionTest extends ActiveMQTestBase { + private boolean legacyCreateQueue; + private final String queueName = "ClientSessionTestQ"; private ServerLocator locator; private ActiveMQServer server; private ClientSessionFactory cf; + @Parameterized.Parameters(name = "legacyCreateQueue={0}") + public static Collection getParams() { + return Arrays.asList(new Object[][]{{true}, {false}}); + } + + public SessionTest(boolean legacyCreateQueue) { + this.legacyCreateQueue = legacyCreateQueue; + } + @Override @Before public void setUp() throws Exception { @@ -127,7 +144,11 @@ public class SessionTest extends ActiveMQTestBase { server.start(); cf = createSessionFactory(locator); ClientSessionInternal clientSession = (ClientSessionInternal) cf.createSession(false, true, true); - clientSession.createQueue(queueName, queueName, false); + if (legacyCreateQueue) { + clientSession.createQueue(queueName, queueName, false); + } else { + clientSession.createQueue(new QueueConfiguration(queueName).setDurable(false)); + } /** keep unused variables in order to maintain references to both objects */ @SuppressWarnings("unused") ClientProducer producer = clientSession.createProducer(); @@ -165,11 +186,19 @@ public class SessionTest extends ActiveMQTestBase { public void testBindingQuery() throws Exception { cf = createSessionFactory(locator); ClientSession clientSession = cf.createSession(false, true, true); - clientSession.createQueue("a1", "q1", false); - clientSession.createQueue("a1", "q2", false); - clientSession.createQueue("a2", "q3", false); - clientSession.createQueue("a2", "q4", false); - clientSession.createQueue("a2", "q5", false); + if (legacyCreateQueue) { + clientSession.createQueue("a1", "q1", false); + clientSession.createQueue("a1", "q2", false); + clientSession.createQueue("a2", "q3", false); + clientSession.createQueue("a2", "q4", false); + clientSession.createQueue("a2", "q5", false); + } else { + clientSession.createQueue(new QueueConfiguration("q1").setAddress("a1").setDurable(false)); + clientSession.createQueue(new QueueConfiguration("q2").setAddress("a1").setDurable(false)); + clientSession.createQueue(new QueueConfiguration("q3").setAddress("a2").setDurable(false)); + clientSession.createQueue(new QueueConfiguration("q4").setAddress("a2").setDurable(false)); + clientSession.createQueue(new QueueConfiguration("q5").setAddress("a2").setDurable(false)); + } ClientSession.AddressQuery resp = clientSession.addressQuery(new SimpleString("a")); List queues = resp.getQueueNames(); Assert.assertTrue(queues.isEmpty()); @@ -191,7 +220,11 @@ public class SessionTest extends ActiveMQTestBase { public void testQueueQuery() throws Exception { cf = createSessionFactory(locator); ClientSession clientSession = cf.createSession(false, true, true); - clientSession.createQueue("a1", queueName, false); + if (legacyCreateQueue) { + clientSession.createQueue("a1", queueName, false); + } else { + clientSession.createQueue(new QueueConfiguration(queueName).setAddress("a1").setDurable(false)); + } clientSession.createConsumer(queueName); clientSession.createConsumer(queueName); ClientProducer cp = clientSession.createProducer("a1"); @@ -218,7 +251,11 @@ public class SessionTest extends ActiveMQTestBase { public void testQueueQueryWithFilter() throws Exception { cf = createSessionFactory(locator); ClientSession clientSession = cf.createSession(false, true, true); - clientSession.createQueue("a1", queueName, "foo=bar", false); + if (legacyCreateQueue) { + clientSession.createQueue("a1", queueName, "foo=bar", false); + } else { + clientSession.createQueue(new QueueConfiguration(queueName).setAddress("a1").setFilterString("foo=bar").setDurable(false)); + } clientSession.createConsumer(queueName); clientSession.createConsumer(queueName); @@ -246,7 +283,11 @@ public class SessionTest extends ActiveMQTestBase { public void testClose() throws Exception { cf = createSessionFactory(locator); ClientSession clientSession = cf.createSession(false, true, true); - clientSession.createQueue(queueName, queueName, false); + if (legacyCreateQueue) { + clientSession.createQueue(queueName, queueName, false); + } else { + clientSession.createQueue(new QueueConfiguration(queueName).setDurable(false)); + } ClientProducer p = clientSession.createProducer(); ClientProducer p1 = clientSession.createProducer(queueName); ClientConsumer c = clientSession.createConsumer(queueName); @@ -310,7 +351,11 @@ public class SessionTest extends ActiveMQTestBase { public void testStart() throws Exception { cf = createSessionFactory(locator); ClientSession clientSession = cf.createSession(false, true, true); - clientSession.createQueue(queueName, queueName, false); + if (legacyCreateQueue) { + clientSession.createQueue(queueName, queueName, false); + } else { + clientSession.createQueue(new QueueConfiguration(queueName).setDurable(false)); + } clientSession.start(); clientSession.close(); } @@ -319,7 +364,11 @@ public class SessionTest extends ActiveMQTestBase { public void testStop() throws Exception { cf = createSessionFactory(locator); ClientSession clientSession = cf.createSession(false, true, true); - clientSession.createQueue(queueName, queueName, false); + if (legacyCreateQueue) { + clientSession.createQueue(queueName, queueName, false); + } else { + clientSession.createQueue(new QueueConfiguration(queueName).setDurable(false)); + } clientSession.start(); clientSession.stop(); clientSession.close(); @@ -329,7 +378,11 @@ public class SessionTest extends ActiveMQTestBase { public void testCommitWithSend() throws Exception { cf = createSessionFactory(locator); ClientSession clientSession = cf.createSession(false, false, true); - clientSession.createQueue(queueName, queueName, false); + if (legacyCreateQueue) { + clientSession.createQueue(queueName, queueName, false); + } else { + clientSession.createQueue(new QueueConfiguration(queueName).setDurable(false)); + } ClientProducer cp = clientSession.createProducer(queueName); for (int i = 0; i < 10; i++) { cp.send(clientSession.createMessage(false)); @@ -345,7 +398,11 @@ public class SessionTest extends ActiveMQTestBase { public void testRollbackWithSend() throws Exception { cf = createSessionFactory(locator); ClientSession clientSession = cf.createSession(false, false, true); - clientSession.createQueue(queueName, queueName, false); + if (legacyCreateQueue) { + clientSession.createQueue(queueName, queueName, false); + } else { + clientSession.createQueue(new QueueConfiguration(queueName).setDurable(false)); + } ClientProducer cp = clientSession.createProducer(queueName); for (int i = 0; i < 10; i++) { cp.send(clientSession.createMessage(false)); @@ -367,7 +424,11 @@ public class SessionTest extends ActiveMQTestBase { ClientSession sendSession = cf.createSession(false, true, true); ClientProducer cp = sendSession.createProducer(queueName); ClientSession clientSession = cf.createSession(false, true, false); - clientSession.createQueue(queueName, queueName, false); + if (legacyCreateQueue) { + clientSession.createQueue(queueName, queueName, false); + } else { + clientSession.createQueue(new QueueConfiguration(queueName).setDurable(false)); + } for (int i = 0; i < 10; i++) { cp.send(clientSession.createMessage(false)); } @@ -395,7 +456,11 @@ public class SessionTest extends ActiveMQTestBase { ClientSession sendSession = cf.createSession(false, true, true); ClientProducer cp = sendSession.createProducer(queueName); ClientSession clientSession = cf.createSession(false, true, false); - clientSession.createQueue(queueName, queueName, false); + if (legacyCreateQueue) { + clientSession.createQueue(queueName, queueName, false); + } else { + clientSession.createQueue(new QueueConfiguration(queueName).setDurable(false)); + } for (int i = 0; i < 10; i++) { cp.send(clientSession.createMessage(false)); } @@ -428,7 +493,11 @@ public class SessionTest extends ActiveMQTestBase { SimpleString queueName = SimpleString.toSimpleString(UUID.randomUUID().toString()); SimpleString addressName = SimpleString.toSimpleString(UUID.randomUUID().toString()); { - clientSession.createQueue(addressName, RoutingType.ANYCAST, queueName); + if (legacyCreateQueue) { + clientSession.createQueue(addressName, RoutingType.ANYCAST, queueName); + } else { + clientSession.createQueue(new QueueConfiguration(queueName).setAddress(addressName).setRoutingType(RoutingType.ANYCAST)); + } Queue result = server.locateQueue(queueName); assertEquals(addressName, result.getAddress()); assertEquals(queueName, result.getName()); @@ -436,7 +505,11 @@ public class SessionTest extends ActiveMQTestBase { server.destroyQueue(queueName); } { - clientSession.createQueue(addressName.toString(), RoutingType.ANYCAST, queueName.toString()); + if (legacyCreateQueue) { + clientSession.createQueue(addressName.toString(), RoutingType.ANYCAST, queueName.toString()); + } else { + clientSession.createQueue(new QueueConfiguration(queueName).setAddress(addressName).setRoutingType(RoutingType.ANYCAST)); + } Queue result = server.locateQueue(queueName); assertEquals(addressName, result.getAddress()); assertEquals(queueName, result.getName()); @@ -444,7 +517,11 @@ public class SessionTest extends ActiveMQTestBase { server.destroyQueue(queueName); } { - clientSession.createQueue(addressName, RoutingType.ANYCAST, queueName, true); + if (legacyCreateQueue) { + clientSession.createQueue(addressName, RoutingType.ANYCAST, queueName, true); + } else { + clientSession.createQueue(new QueueConfiguration(queueName).setAddress(addressName).setRoutingType(RoutingType.ANYCAST)); + } Queue result = server.locateQueue(queueName); assertEquals(addressName, result.getAddress()); assertEquals(queueName, result.getName()); @@ -453,7 +530,11 @@ public class SessionTest extends ActiveMQTestBase { server.destroyQueue(queueName); } { - clientSession.createQueue(addressName.toString(), RoutingType.ANYCAST, queueName.toString(), true); + if (legacyCreateQueue) { + clientSession.createQueue(addressName.toString(), RoutingType.ANYCAST, queueName.toString(), true); + } else { + clientSession.createQueue(new QueueConfiguration(queueName).setAddress(addressName).setRoutingType(RoutingType.ANYCAST)); + } Queue result = server.locateQueue(queueName); assertEquals(addressName, result.getAddress()); assertEquals(queueName, result.getName()); @@ -462,7 +543,11 @@ public class SessionTest extends ActiveMQTestBase { server.destroyQueue(queueName); } { - clientSession.createQueue(addressName, RoutingType.ANYCAST, queueName, SimpleString.toSimpleString("filter"), true); + if (legacyCreateQueue) { + clientSession.createQueue(addressName, RoutingType.ANYCAST, queueName, SimpleString.toSimpleString("filter"), true); + } else { + clientSession.createQueue(new QueueConfiguration(queueName).setAddress(addressName).setRoutingType(RoutingType.ANYCAST).setFilterString("filter")); + } Queue result = server.locateQueue(queueName); assertEquals(addressName, result.getAddress()); assertEquals(queueName, result.getName()); @@ -472,7 +557,11 @@ public class SessionTest extends ActiveMQTestBase { server.destroyQueue(queueName); } { - clientSession.createQueue(addressName.toString(), RoutingType.ANYCAST, queueName.toString(), "filter", true); + if (legacyCreateQueue) { + clientSession.createQueue(addressName.toString(), RoutingType.ANYCAST, queueName.toString(), "filter", true); + } else { + clientSession.createQueue(new QueueConfiguration(queueName).setAddress(addressName).setRoutingType(RoutingType.ANYCAST).setFilterString("filter")); + } Queue result = server.locateQueue(queueName); assertEquals(addressName, result.getAddress()); assertEquals(queueName, result.getName()); @@ -482,7 +571,11 @@ public class SessionTest extends ActiveMQTestBase { server.destroyQueue(queueName); } { - clientSession.createQueue(addressName, RoutingType.ANYCAST, queueName, SimpleString.toSimpleString("filter"), true, true); + if (legacyCreateQueue) { + clientSession.createQueue(addressName, RoutingType.ANYCAST, queueName, SimpleString.toSimpleString("filter"), true, true); + } else { + clientSession.createQueue(new QueueConfiguration(queueName).setAddress(addressName).setRoutingType(RoutingType.ANYCAST).setFilterString("filter").setAutoCreated(true)); + } Queue result = server.locateQueue(queueName); assertEquals(addressName, result.getAddress()); assertEquals(queueName, result.getName()); @@ -493,7 +586,11 @@ public class SessionTest extends ActiveMQTestBase { server.destroyQueue(queueName); } { - clientSession.createQueue(addressName.toString(), RoutingType.ANYCAST, queueName.toString(), "filter", true, true); + if (legacyCreateQueue) { + clientSession.createQueue(addressName.toString(), RoutingType.ANYCAST, queueName.toString(), "filter", true, true); + } else { + clientSession.createQueue(new QueueConfiguration(queueName).setAddress(addressName).setRoutingType(RoutingType.ANYCAST).setFilterString("filter").setAutoCreated(true)); + } Queue result = server.locateQueue(queueName); assertEquals(addressName, result.getAddress()); assertEquals(queueName, result.getName()); @@ -504,7 +601,11 @@ public class SessionTest extends ActiveMQTestBase { server.destroyQueue(queueName); } { - clientSession.createQueue(addressName, RoutingType.ANYCAST, queueName, SimpleString.toSimpleString("filter"), true, true, 0, true); + if (legacyCreateQueue) { + clientSession.createQueue(addressName, RoutingType.ANYCAST, queueName, SimpleString.toSimpleString("filter"), true, true, 0, true); + } else { + clientSession.createQueue(new QueueConfiguration(queueName).setAddress(addressName).setRoutingType(RoutingType.ANYCAST).setFilterString("filter").setAutoCreated(true).setMaxConsumers(0).setPurgeOnNoConsumers(true)); + } Queue result = server.locateQueue(queueName); assertEquals(addressName, result.getAddress()); assertEquals(queueName, result.getName()); @@ -517,7 +618,11 @@ public class SessionTest extends ActiveMQTestBase { server.destroyQueue(queueName); } { - clientSession.createQueue(addressName.toString(), RoutingType.ANYCAST, queueName.toString(), "filter", true, true, 0, true); + if (legacyCreateQueue) { + clientSession.createQueue(addressName.toString(), RoutingType.ANYCAST, queueName.toString(), "filter", true, true, 0, true); + } else { + clientSession.createQueue(new QueueConfiguration(queueName).setAddress(addressName).setRoutingType(RoutingType.ANYCAST).setFilterString("filter").setAutoCreated(true).setMaxConsumers(0).setPurgeOnNoConsumers(true)); + } Queue result = server.locateQueue(queueName); assertEquals(addressName, result.getAddress()); assertEquals(queueName, result.getName()); @@ -530,7 +635,11 @@ public class SessionTest extends ActiveMQTestBase { server.destroyQueue(queueName); } { - clientSession.createQueue(addressName, RoutingType.ANYCAST, queueName, SimpleString.toSimpleString("filter"), true, true, 0, true, true, true); + if (legacyCreateQueue) { + clientSession.createQueue(addressName, RoutingType.ANYCAST, queueName, SimpleString.toSimpleString("filter"), true, true, 0, true, true, true); + } else { + clientSession.createQueue(new QueueConfiguration(queueName).setAddress(addressName).setRoutingType(RoutingType.ANYCAST).setFilterString("filter").setAutoCreated(true).setMaxConsumers(0).setPurgeOnNoConsumers(true).setExclusive(true).setLastValue(true)); + } Queue result = server.locateQueue(queueName); assertEquals(addressName, result.getAddress()); assertEquals(queueName, result.getName()); @@ -545,7 +654,11 @@ public class SessionTest extends ActiveMQTestBase { server.destroyQueue(queueName); } { - clientSession.createQueue(addressName.toString(), RoutingType.ANYCAST, queueName.toString(), "filter", true, true, 0, true, true, true); + if (legacyCreateQueue) { + clientSession.createQueue(addressName.toString(), RoutingType.ANYCAST, queueName.toString(), "filter", true, true, 0, true, true, true); + } else { + clientSession.createQueue(new QueueConfiguration(queueName).setAddress(addressName).setRoutingType(RoutingType.ANYCAST).setFilterString("filter").setAutoCreated(true).setMaxConsumers(0).setPurgeOnNoConsumers(true).setExclusive(true).setLastValue(true)); + } Queue result = server.locateQueue(queueName); assertEquals(addressName, result.getAddress()); assertEquals(queueName, result.getName()); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SimpleSendMultipleQueuesTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SimpleSendMultipleQueuesTest.java index 75a04f0136..06250f2fa6 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SimpleSendMultipleQueuesTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SimpleSendMultipleQueuesTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.client; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientProducer; @@ -23,7 +24,6 @@ import org.apache.activemq.artemis.api.core.client.ClientSession; import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.core.server.ActiveMQServer; -import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.utils.RandomUtil; import org.junit.Assert; @@ -92,9 +92,9 @@ public class SimpleSendMultipleQueuesTest extends ActiveMQTestBase { session = cf.createSession(); - session.createQueue(SimpleSendMultipleQueuesTest.address, RoutingType.MULTICAST, "queue1"); - session.createQueue(SimpleSendMultipleQueuesTest.address, RoutingType.MULTICAST, "queue2"); - session.createQueue(SimpleSendMultipleQueuesTest.address, RoutingType.MULTICAST, "queue3"); + session.createQueue(new QueueConfiguration("queue1").setAddress(SimpleSendMultipleQueuesTest.address)); + session.createQueue(new QueueConfiguration("queue2").setAddress(SimpleSendMultipleQueuesTest.address)); + session.createQueue(new QueueConfiguration("queue3").setAddress(SimpleSendMultipleQueuesTest.address)); producer = session.createProducer(SimpleSendMultipleQueuesTest.address); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SlowConsumerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SlowConsumerTest.java index 8a83845bfa..a03d5ec5c5 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SlowConsumerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SlowConsumerTest.java @@ -27,6 +27,7 @@ import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQExceptionType; import org.apache.activemq.artemis.api.core.ActiveMQObjectClosedException; +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.api.core.client.ClientConsumer; @@ -109,7 +110,7 @@ public class SlowConsumerTest extends ActiveMQTestBase { server.getAddressSettingsRepository().addMatch(QUEUE.toString(), addressSettings); - server.createQueue(QUEUE, RoutingType.ANYCAST, QUEUE, null, true, false).getPageSubscription().getPagingStore().startPaging(); + server.createQueue(new QueueConfiguration(QUEUE).setRoutingType(RoutingType.ANYCAST)).getPageSubscription().getPagingStore().startPaging(); locator = createFactory(isNetty); } @@ -244,7 +245,7 @@ public class SlowConsumerTest extends ActiveMQTestBase { SimpleString notifQueue = RandomUtil.randomSimpleString(); - session.createQueue(ActiveMQDefaultConfiguration.getDefaultManagementNotificationAddress(), notifQueue, null, false); + session.createQueue(new QueueConfiguration(notifQueue).setAddress(ActiveMQDefaultConfiguration.getDefaultManagementNotificationAddress()).setDurable(false)); ClientConsumer notifConsumer = session.createConsumer(notifQueue.toString(), ManagementHelper.HDR_NOTIFICATION_TYPE + "='" + CoreNotificationType.CONSUMER_SLOW + "'"); @@ -393,9 +394,9 @@ public class SlowConsumerTest extends ActiveMQTestBase { ClientSessionFactory sf = createSessionFactory(locator); ClientSession session = addClientSession(sf.createSession(false, true, true, false)); - session.createQueue(addressAB, queueName1, null, false); - session.createQueue(addressAC, queueName2, null, false); - session.createQueue(address, queueName, null, false); + session.createQueue(new QueueConfiguration(queueName1).setAddress(addressAB).setDurable(false)); + session.createQueue(new QueueConfiguration(queueName2).setAddress(addressAC).setDurable(false)); + session.createQueue(new QueueConfiguration(queueName).setAddress(address).setDurable(false)); ClientProducer producer = session.createProducer(addressAB); ClientProducer producer2 = session.createProducer(addressAC); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/TemporaryQueueTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/TemporaryQueueTest.java index bb359f9369..96bdfe07d6 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/TemporaryQueueTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/TemporaryQueueTest.java @@ -28,6 +28,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQIOErrorException; import org.apache.activemq.artemis.api.core.ActiveMQInternalErrorException; import org.apache.activemq.artemis.api.core.ActiveMQNonExistentQueueException; import org.apache.activemq.artemis.api.core.Interceptor; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -42,7 +43,6 @@ import org.apache.activemq.artemis.core.protocol.core.Packet; import org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl; import org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl; import org.apache.activemq.artemis.core.remoting.CloseListener; -import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.core.server.ServerSession; import org.apache.activemq.artemis.core.server.impl.ServerSessionImpl; import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy; @@ -74,7 +74,7 @@ public class TemporaryQueueTest extends SingleServerTestBase { SimpleString queue = RandomUtil.randomSimpleString(); SimpleString address = RandomUtil.randomSimpleString(); - session.createTemporaryQueue(address, queue); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false).setTemporary(true)); ClientProducer producer = session.createProducer(address); ClientMessage msg = session.createMessage(false); @@ -98,7 +98,7 @@ public class TemporaryQueueTest extends SingleServerTestBase { for (int i = 0; i < 1000; i++) { SimpleString queue = RandomUtil.randomSimpleString(); SimpleString address = RandomUtil.randomSimpleString(); - session.createTemporaryQueue(address, queue); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false).setTemporary(true)); session.close(); session = sf.createSession(); @@ -118,7 +118,7 @@ public class TemporaryQueueTest extends SingleServerTestBase { SimpleString queue = RandomUtil.randomSimpleString(); SimpleString address = RandomUtil.randomSimpleString(); - session.createTemporaryQueue(address, queue); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false).setTemporary(true)); ClientProducer producer = session.createProducer(address); ClientMessage msg = session.createMessage(false); @@ -149,7 +149,7 @@ public class TemporaryQueueTest extends SingleServerTestBase { SimpleString queue = RandomUtil.randomSimpleString(); SimpleString address = RandomUtil.randomSimpleString(); - session.createTemporaryQueue(address, queue); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false).setTemporary(true)); ClientProducer producer = session.createProducer(address); producer.send(session.createMessage(false)); @@ -170,7 +170,7 @@ public class TemporaryQueueTest extends SingleServerTestBase { SimpleString queue = RandomUtil.randomSimpleString(); SimpleString address = RandomUtil.randomSimpleString(); - session.createTemporaryQueue(address, queue); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false).setTemporary(true)); RemotingConnectionImpl conn = (RemotingConnectionImpl) server.getRemotingService().getConnections().iterator().next(); final CountDownLatch latch = new CountDownLatch(1); @@ -203,9 +203,9 @@ public class TemporaryQueueTest extends SingleServerTestBase { @Test public void testQueueWithWildcard() throws Exception { - session.createQueue("a.b", RoutingType.MULTICAST, "queue1"); - session.createTemporaryQueue("a.#", RoutingType.MULTICAST, "queue2"); - session.createTemporaryQueue("a.#", RoutingType.MULTICAST, "queue3"); + session.createQueue(new QueueConfiguration("queue1").setAddress("a.b")); + session.createQueue(new QueueConfiguration("queue2").setAddress("a.#").setDurable(false).setTemporary(true)); + session.createQueue(new QueueConfiguration("queue3").setAddress("a.#").setDurable(false).setTemporary(true)); ClientProducer producer = session.createProducer("a.b"); producer.send(session.createMessage(false)); @@ -242,9 +242,9 @@ public class TemporaryQueueTest extends SingleServerTestBase { @Test public void testQueueWithWildcard2() throws Exception { - session.createQueue("a.b", RoutingType.MULTICAST, "queue1"); - session.createTemporaryQueue("a.#", RoutingType.MULTICAST, "queue2"); - session.createTemporaryQueue("a.#", RoutingType.MULTICAST, "queue3"); + session.createQueue(new QueueConfiguration("queue1").setAddress("a.b")); + session.createQueue(new QueueConfiguration("queue2").setAddress("a.#").setDurable(false).setTemporary(true)); + session.createQueue(new QueueConfiguration("queue3").setAddress("a.#").setDurable(false).setTemporary(true)); ClientProducer producer = session.createProducer("a.b"); producer.send(session.createMessage(false)); @@ -281,9 +281,9 @@ public class TemporaryQueueTest extends SingleServerTestBase { @Test public void testQueueWithWildcard3() throws Exception { - session.createQueue("a.b", RoutingType.MULTICAST, "queue1"); - session.createTemporaryQueue("a.#", RoutingType.MULTICAST, "queue2"); - session.createTemporaryQueue("a.#", RoutingType.MULTICAST, "queue2.1"); + session.createQueue(new QueueConfiguration("queue1").setAddress("a.b")); + session.createQueue(new QueueConfiguration("queue2").setAddress("a.#").setDurable(false).setTemporary(true)); + session.createQueue(new QueueConfiguration("queue2.1").setAddress("a.#").setDurable(false).setTemporary(true)); session.deleteQueue("queue2"); } @@ -293,7 +293,7 @@ public class TemporaryQueueTest extends SingleServerTestBase { SimpleString queue = RandomUtil.randomSimpleString(); SimpleString address = RandomUtil.randomSimpleString(); - session.createTemporaryQueue(address, queue); + session.createQueue(new QueueConfiguration(queue).setAddress(address)); assertEquals(1, server.getConnectionCount()); // we create a second session. the temp queue must be present @@ -318,7 +318,7 @@ public class TemporaryQueueTest extends SingleServerTestBase { ClientSessionFactory reattachSF = createSessionFactory(serverWithReattach); ClientSession session = reattachSF.createSession(false, false); - session.createTemporaryQueue("tmpAd", "tmpQ"); + session.createQueue(new QueueConfiguration("tmpQ").setAddress("tmpAd").setDurable(false).setTemporary(true)); ClientConsumer consumer = session.createConsumer("tmpQ"); ClientProducer prod = session.createProducer("tmpAd"); @@ -403,14 +403,14 @@ public class TemporaryQueueTest extends SingleServerTestBase { String queueBlue = address + "_blue_" + (countTmpQueue++); ClientSession sessConsumerRed = clientsConnecton.createSession(); - sessConsumerRed.createTemporaryQueue(address, queueRed, "color='red'"); + sessConsumerRed.createQueue(new QueueConfiguration(queueRed).setAddress(address).setFilterString("color='red'").setDurable(false).setTemporary(true)); MyHandler redHandler = new MyHandler(sessConsumerRed, "red", msgs); ClientConsumer redClientConsumer = sessConsumerRed.createConsumer(queueRed); redClientConsumer.setMessageHandler(redHandler); sessConsumerRed.start(); ClientSession sessConsumerBlue = clientsConnecton.createSession(); - sessConsumerBlue.createTemporaryQueue(address, queueBlue, "color='blue'"); + sessConsumerBlue.createQueue(new QueueConfiguration(queueBlue).setAddress(address).setFilterString("color='blue'").setDurable(false).setTemporary(true)); MyHandler blueHandler = new MyHandler(sessConsumerBlue, "blue", msgs); ClientConsumer blueClientConsumer = sessConsumerBlue.createConsumer(queueBlue); blueClientConsumer.setMessageHandler(blueHandler); @@ -471,7 +471,7 @@ public class TemporaryQueueTest extends SingleServerTestBase { sf = addSessionFactory(createSessionFactory(locator)); session = sf.createSession(false, true, true); - session.createTemporaryQueue(address, queue); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false).setTemporary(true)); assertTrue("server has not received any ping from the client", pingOnServerLatch.await(2 * server.getConfiguration().getConnectionTtlCheckInterval(), TimeUnit.MILLISECONDS)); assertEquals(1, server.getConnectionCount()); @@ -529,7 +529,7 @@ public class TemporaryQueueTest extends SingleServerTestBase { ClientSessionFactory consumerCF = createSessionFactory(locator); ClientSession consumerSession = consumerCF.createSession(true, true); consumerSession.addMetaData("consumer", "consumer"); - consumerSession.createTemporaryQueue("TestAD", "Q1"); + consumerSession.createQueue(new QueueConfiguration("Q1").setAddress("TestAD").setDurable(false).setTemporary(true)); consumerSession.createConsumer("Q1"); consumerSession.start(); @@ -582,7 +582,7 @@ public class TemporaryQueueTest extends SingleServerTestBase { ClientSessionFactory newConsumerCF = createSessionFactory(locator); ClientSession newConsumerSession = newConsumerCF.createSession(true, true); - newConsumerSession.createTemporaryQueue("TestAD", "Q2"); + newConsumerSession.createQueue(new QueueConfiguration("Q2").setAddress("TestAD").setDurable(false).setTemporary(true)); ClientConsumer newConsumer = newConsumerSession.createConsumer("Q2"); newConsumerSession.start(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/TransactionDurabilityTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/TransactionDurabilityTest.java index e9f3b31e79..b9da4440d0 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/TransactionDurabilityTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/TransactionDurabilityTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.client; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -65,9 +66,9 @@ public class TransactionDurabilityTest extends ActiveMQTestBase { ClientSession session2 = addClientSession(sf.createSession(false, false, false)); - session1.createQueue(testAddress, queue1, null, true); + session1.createQueue(new QueueConfiguration(queue1).setAddress(testAddress)); - session1.createQueue(testAddress, queue2, null, true); + session1.createQueue(new QueueConfiguration(queue2).setAddress(testAddress)); ClientProducer producer = session1.createProducer(testAddress); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/TransactionalSendTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/TransactionalSendTest.java index 3185d1559b..b72e7a9399 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/TransactionalSendTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/TransactionalSendTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.client; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientProducer; import org.apache.activemq.artemis.api.core.client.ClientSession; @@ -53,7 +54,7 @@ public class TransactionalSendTest extends ActiveMQTestBase { server.start(); ClientSessionFactory cf = createSessionFactory(locator); ClientSession session = cf.createSession(false, false, false); - session.createQueue(addressA, queueA, false); + session.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setDurable(false)); ClientProducer cp = session.createProducer(addressA); int numMessages = 100; for (int i = 0; i < numMessages; i++) { @@ -79,7 +80,7 @@ public class TransactionalSendTest extends ActiveMQTestBase { server.start(); ClientSessionFactory cf = createSessionFactory(locator); ClientSession session = cf.createSession(false, false, false); - session.createQueue(addressA, queueA, false); + session.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setDurable(false)); ClientProducer cp = session.createProducer(addressA); int numMessages = 100; for (int i = 0; i < numMessages; i++) { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/TransientQueueTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/TransientQueueTest.java index e9acf3cef5..745affac86 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/TransientQueueTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/TransientQueueTest.java @@ -17,6 +17,7 @@ package org.apache.activemq.artemis.tests.integration.client; import org.apache.activemq.artemis.api.core.ActiveMQInvalidTransientQueueUseException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -35,7 +36,7 @@ public class TransientQueueTest extends SingleServerTestBase { SimpleString queue = RandomUtil.randomSimpleString(); SimpleString address = RandomUtil.randomSimpleString(); - session.createSharedQueue(address, queue, false); + session.createSharedQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false)); assertEquals(1, server.getConnectionCount()); // we create a second session. the temp queue must be present @@ -56,7 +57,7 @@ public class TransientQueueTest extends SingleServerTestBase { SimpleString queue = SimpleString.toSimpleString("queue"); SimpleString address = SimpleString.toSimpleString("address"); - session.createSharedQueue(address, queue, false); + session.createSharedQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false)); assertEquals(1, server.getConnectionCount()); assertNotNull(server.locateQueue(queue)); @@ -68,7 +69,7 @@ public class TransientQueueTest extends SingleServerTestBase { // At this point this has no effect, other than making sure the queue exists... // the JMS implementation will certainly create the queue again when dealing with // non durable shared subscriptions - session2.createSharedQueue(address, queue, false); + session2.createSharedQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false)); ClientConsumer consumer1 = session.createConsumer(queue); ClientConsumer consumer2 = session2.createConsumer(queue); @@ -114,7 +115,7 @@ public class TransientQueueTest extends SingleServerTestBase { consumer2.close(); - session.createSharedQueue(address, queue, false); + session.createSharedQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false)); consumer1 = session.createConsumer(queue); @@ -137,7 +138,7 @@ public class TransientQueueTest extends SingleServerTestBase { server.locateQueue(queue); SimpleString address2 = RandomUtil.randomSimpleString(); - session.createSharedQueue(address, queue, false); + session.createSharedQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false)); assertEquals(1, server.getConnectionCount()); ServerLocator locator2 = createLocator(); @@ -149,7 +150,7 @@ public class TransientQueueTest extends SingleServerTestBase { try { // There's already a queue with that name, we are supposed to throw an exception - session2.createSharedQueue(address2, queue, false); + session2.createSharedQueue(new QueueConfiguration(queue).setAddress(address2).setDurable(false)); } catch (ActiveMQInvalidTransientQueueUseException e) { exHappened = true; } @@ -160,7 +161,7 @@ public class TransientQueueTest extends SingleServerTestBase { try { // There's already a queue with that name, we are supposed to throw an exception - session2.createSharedQueue(address, queue, SimpleString.toSimpleString("a=1"), false); + session2.createSharedQueue(new QueueConfiguration(queue).setAddress(address).setFilterString(SimpleString.toSimpleString("a=1")).setDurable(false)); } catch (ActiveMQInvalidTransientQueueUseException e) { exHappened = true; } @@ -172,13 +173,13 @@ public class TransientQueueTest extends SingleServerTestBase { assertNull(server.locateQueue(queue)); - session.createSharedQueue(address, queue, SimpleString.toSimpleString("q=1"), false); + session.createSharedQueue(new QueueConfiguration(queue).setAddress(address).setFilterString(SimpleString.toSimpleString("q=1")).setDurable(false)); exHappened = false; try { // There's already a queue with that name, we are supposed to throw an exception - session2.createSharedQueue(address, queue, SimpleString.toSimpleString("q=2"), false); + session2.createSharedQueue(new QueueConfiguration(queue).setAddress(address).setFilterString(SimpleString.toSimpleString("q=2")).setDurable(false)); } catch (ActiveMQInvalidTransientQueueUseException e) { exHappened = true; } @@ -188,7 +189,7 @@ public class TransientQueueTest extends SingleServerTestBase { exHappened = false; try { // There's already a queue with that name, we are supposed to throw an exception - session2.createSharedQueue(address, queue, false); + session2.createSharedQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false)); } catch (ActiveMQInvalidTransientQueueUseException e) { exHappened = true; } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/UpdateQueueTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/UpdateQueueTest.java index 0901ece432..a9250b3164 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/UpdateQueueTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/UpdateQueueTest.java @@ -25,6 +25,7 @@ import java.util.EnumSet; import java.util.HashMap; import java.util.concurrent.atomic.AtomicInteger; +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.persistence.impl.journal.JournalRecordIds; @@ -50,7 +51,7 @@ public class UpdateQueueTest extends ActiveMQTestBase { final SimpleString user = new SimpleString("newUser"); - Queue queue = server.createQueue(ADDRESS, RoutingType.ANYCAST, ADDRESS, user, null, true, false); + Queue queue = server.createQueue(new QueueConfiguration(ADDRESS).setRoutingType(RoutingType.ANYCAST).setUser(user)); long originalID = queue.getID(); @@ -64,7 +65,7 @@ public class UpdateQueueTest extends ActiveMQTestBase { prod.send(session.createTextMessage("message " + i)); } - server.updateQueue(ADDRESS.toString(), RoutingType.ANYCAST, 1, false, false, null); + server.updateQueue(new QueueConfiguration(ADDRESS).setRoutingType(RoutingType.ANYCAST).setMaxConsumers(1).setExclusive(false)); conn.close(); factory.close(); @@ -118,7 +119,7 @@ public class UpdateQueueTest extends ActiveMQTestBase { SimpleString ADDRESS = SimpleString.toSimpleString("queue.0"); - Queue queue = server.createQueue(ADDRESS, RoutingType.ANYCAST, ADDRESS, null, null, true, false); + Queue queue = server.createQueue(new QueueConfiguration(ADDRESS).setRoutingType(RoutingType.ANYCAST)); long originalID = queue.getID(); @@ -132,7 +133,19 @@ public class UpdateQueueTest extends ActiveMQTestBase { prod.send(session.createTextMessage("message " + i)); } - server.updateQueue(ADDRESS.toString(), RoutingType.ANYCAST, null, 1, false, true, true, 5, "gfk", true, 1, 10L, "newUser", 180L); + server.updateQueue(new QueueConfiguration(ADDRESS.toString()) + .setRoutingType(RoutingType.ANYCAST) + .setMaxConsumers(1) + .setPurgeOnNoConsumers(false) + .setExclusive(true) + .setGroupRebalance(true) + .setGroupBuckets(5) + .setGroupFirstKey("gfk") + .setNonDestructive(true) + .setConsumersBeforeDispatch(1) + .setDelayBeforeDispatch(10L) + .setUser("newUser") + .setRingSize(180L)); conn.close(); factory.close(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/WildCardRoutingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/WildCardRoutingTest.java index 6a3619b510..0afe80e218 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/WildCardRoutingTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/WildCardRoutingTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.client; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -46,9 +47,9 @@ public class WildCardRoutingTest extends ActiveMQTestBase { SimpleString queueName1 = new SimpleString("Q1"); SimpleString queueName2 = new SimpleString("Q2"); SimpleString queueName = new SimpleString("Q"); - clientSession.createQueue(addressAB, queueName1, null, false); - clientSession.createQueue(addressAC, queueName2, null, false); - clientSession.createQueue(address, queueName, null, false); + clientSession.createQueue(new QueueConfiguration(queueName1).setAddress(addressAB).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName2).setAddress(addressAC).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName).setAddress(address).setDurable(false)); ClientProducer producer = clientSession.createProducer(addressAB); ClientProducer producer2 = clientSession.createProducer(addressAC); ClientConsumer clientConsumer = clientSession.createConsumer(queueName); @@ -73,7 +74,7 @@ public class WildCardRoutingTest extends ActiveMQTestBase { SimpleString addressAC = new SimpleString("a.c"); SimpleString address = new SimpleString("a.*"); SimpleString queueName = new SimpleString("Q"); - clientSession.createQueue(address, queueName, null, false); + clientSession.createQueue(new QueueConfiguration(queueName).setAddress(address).setDurable(false)); ClientProducer producer = clientSession.createProducer(addressAB); ClientProducer producer2 = clientSession.createProducer(addressAC); ClientConsumer clientConsumer = clientSession.createConsumer(queueName); @@ -105,8 +106,8 @@ public class WildCardRoutingTest extends ActiveMQTestBase { SimpleString address = new SimpleString("a.*"); SimpleString queueName = new SimpleString("Q"); SimpleString queueName2 = new SimpleString("Q2"); - clientSession.createQueue(address, queueName, null, false); - clientSession.createQueue(address, queueName2, null, false); + clientSession.createQueue(new QueueConfiguration(queueName).setAddress(address).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName2).setAddress(address).setDurable(false)); ClientProducer producer = clientSession.createProducer(addressAB); ClientProducer producer2 = clientSession.createProducer(addressAC); ClientConsumer clientConsumer = clientSession.createConsumer(queueName); @@ -145,9 +146,9 @@ public class WildCardRoutingTest extends ActiveMQTestBase { SimpleString queueName1 = new SimpleString("Q1"); SimpleString queueName2 = new SimpleString("Q2"); SimpleString queueName = new SimpleString("Q"); - clientSession.createQueue(addressAB, queueName1, null, false); - clientSession.createQueue(addressAC, queueName2, null, false); - clientSession.createQueue(address, queueName, null, false); + clientSession.createQueue(new QueueConfiguration(queueName1).setAddress(addressAB).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName2).setAddress(addressAC).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName).setAddress(address).setDurable(false)); ClientProducer producer = clientSession.createProducer(addressAB); ClientProducer producer2 = clientSession.createProducer(addressAC); ClientConsumer clientConsumer = clientSession.createConsumer(queueName); @@ -174,12 +175,12 @@ public class WildCardRoutingTest extends ActiveMQTestBase { SimpleString queueName1 = new SimpleString("Q1"); SimpleString queueName2 = new SimpleString("Q2"); SimpleString queueName = new SimpleString("Q"); - clientSession.createQueue(address, queueName, null, false); + clientSession.createQueue(new QueueConfiguration(queueName).setAddress(address).setDurable(false)); ClientProducer producer = clientSession.createProducer(addressAB); ClientProducer producer2 = clientSession.createProducer(addressAC); ClientConsumer clientConsumer = clientSession.createConsumer(queueName); - clientSession.createQueue(addressAB, queueName1, null, false); - clientSession.createQueue(addressAC, queueName2, null, false); + clientSession.createQueue(new QueueConfiguration(queueName1).setAddress(addressAB).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName2).setAddress(addressAC).setDurable(false)); clientSession.start(); producer.send(createTextMessage(clientSession, "m1")); producer2.send(createTextMessage(clientSession, "m2")); @@ -203,9 +204,9 @@ public class WildCardRoutingTest extends ActiveMQTestBase { SimpleString queueName1 = new SimpleString("Q1"); SimpleString queueName2 = new SimpleString("Q2"); SimpleString queueName = new SimpleString("Q"); - clientSession.createQueue(addressAB, queueName1, null, false); - clientSession.createQueue(addressAC, queueName2, null, false); - clientSession.createQueue(address, queueName, null, false); + clientSession.createQueue(new QueueConfiguration(queueName1).setAddress(addressAB).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName2).setAddress(addressAC).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName).setAddress(address).setDurable(false)); ClientProducer producer = clientSession.createProducer(addressAB); ClientProducer producer2 = clientSession.createProducer(addressAC); ClientConsumer clientConsumer = clientSession.createConsumer(queueName); @@ -250,16 +251,16 @@ public class WildCardRoutingTest extends ActiveMQTestBase { SimpleString queueName8 = new SimpleString("Q8"); SimpleString queueName9 = new SimpleString("Q9"); SimpleString queueName = new SimpleString("Q"); - clientSession.createQueue(addressAB, queueName1, null, false); - clientSession.createQueue(addressAC, queueName2, null, false); - clientSession.createQueue(addressAD, queueName3, null, false); - clientSession.createQueue(addressAE, queueName4, null, false); - clientSession.createQueue(addressAF, queueName5, null, false); - clientSession.createQueue(addressAG, queueName6, null, false); - clientSession.createQueue(addressAH, queueName7, null, false); - clientSession.createQueue(addressAJ, queueName8, null, false); - clientSession.createQueue(addressAK, queueName9, null, false); - clientSession.createQueue(address, queueName, null, false); + clientSession.createQueue(new QueueConfiguration(queueName1).setAddress(addressAB).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName2).setAddress(addressAC).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName3).setAddress(addressAD).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName4).setAddress(addressAE).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName5).setAddress(addressAF).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName6).setAddress(addressAG).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName7).setAddress(addressAH).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName8).setAddress(addressAJ).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName9).setAddress(addressAK).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName).setAddress(address).setDurable(false)); ClientProducer producer = clientSession.createProducer(); ClientConsumer clientConsumer = clientSession.createConsumer(queueName); clientSession.start(); @@ -347,16 +348,16 @@ public class WildCardRoutingTest extends ActiveMQTestBase { SimpleString queueName8 = new SimpleString("Q8"); SimpleString queueName9 = new SimpleString("Q9"); SimpleString queueName = new SimpleString("Q"); - clientSession.createQueue(addressAB, queueName1, null, false); - clientSession.createQueue(addressAC, queueName2, null, false); - clientSession.createQueue(addressAD, queueName3, null, false); - clientSession.createQueue(addressAE, queueName4, null, false); - clientSession.createQueue(addressAF, queueName5, null, false); - clientSession.createQueue(addressAG, queueName6, null, false); - clientSession.createQueue(addressAH, queueName7, null, false); - clientSession.createQueue(addressAJ, queueName8, null, false); - clientSession.createQueue(addressAK, queueName9, null, false); - clientSession.createQueue(address, queueName, null, false); + clientSession.createQueue(new QueueConfiguration(queueName1).setAddress(addressAB).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName2).setAddress(addressAC).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName3).setAddress(addressAD).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName4).setAddress(addressAE).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName5).setAddress(addressAF).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName6).setAddress(addressAG).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName7).setAddress(addressAH).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName8).setAddress(addressAJ).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName9).setAddress(addressAK).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName).setAddress(address).setDurable(false)); ClientProducer producer = clientSession.createProducer(); ClientConsumer clientConsumer = clientSession.createConsumer(queueName); clientSession.start(); @@ -430,9 +431,9 @@ public class WildCardRoutingTest extends ActiveMQTestBase { SimpleString queueName1 = new SimpleString("Q1"); SimpleString queueName2 = new SimpleString("Q2"); SimpleString queueName = new SimpleString("Q"); - clientSession.createQueue(addressAB, queueName1, null, false); - clientSession.createQueue(addressAC, queueName2, null, false); - clientSession.createQueue(address, queueName, null, false); + clientSession.createQueue(new QueueConfiguration(queueName1).setAddress(addressAB).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName2).setAddress(addressAC).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName).setAddress(address).setDurable(false)); ClientProducer producer = clientSession.createProducer(addressAB); ClientProducer producer2 = clientSession.createProducer(addressAC); ClientConsumer clientConsumer = clientSession.createConsumer(queueName); @@ -459,9 +460,9 @@ public class WildCardRoutingTest extends ActiveMQTestBase { SimpleString queueName1 = new SimpleString("Q1"); SimpleString queueName2 = new SimpleString("Q2"); SimpleString queueName = new SimpleString("Q"); - clientSession.createQueue(addressAB, queueName1, null, false); - clientSession.createQueue(addressAC, queueName2, null, false); - clientSession.createQueue(address, queueName, null, false); + clientSession.createQueue(new QueueConfiguration(queueName1).setAddress(addressAB).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName2).setAddress(addressAC).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName).setAddress(address).setDurable(false)); ClientProducer producer = clientSession.createProducer(addressAB); ClientProducer producer2 = clientSession.createProducer(addressAC); ClientConsumer clientConsumer = clientSession.createConsumer(queueName); @@ -488,9 +489,9 @@ public class WildCardRoutingTest extends ActiveMQTestBase { SimpleString queueName1 = new SimpleString("Q1"); SimpleString queueName2 = new SimpleString("Q2"); SimpleString queueName = new SimpleString("Q"); - clientSession.createQueue(addressAB, queueName1, null, false); - clientSession.createQueue(addressAC, queueName2, null, false); - clientSession.createQueue(address, queueName, null, false); + clientSession.createQueue(new QueueConfiguration(queueName1).setAddress(addressAB).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName2).setAddress(addressAC).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName).setAddress(address).setDurable(false)); ClientProducer producer = clientSession.createProducer(addressAB); ClientProducer producer2 = clientSession.createProducer(addressAC); ClientConsumer clientConsumer = clientSession.createConsumer(queueName); @@ -517,9 +518,9 @@ public class WildCardRoutingTest extends ActiveMQTestBase { SimpleString queueName1 = new SimpleString("Q1"); SimpleString queueName2 = new SimpleString("Q2"); SimpleString queueName = new SimpleString("Q"); - clientSession.createQueue(addressAB, queueName1, null, false); - clientSession.createQueue(addressAC, queueName2, null, false); - clientSession.createQueue(address, queueName, null, false); + clientSession.createQueue(new QueueConfiguration(queueName1).setAddress(addressAB).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName2).setAddress(addressAC).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName).setAddress(address).setDurable(false)); ClientProducer producer = clientSession.createProducer(addressAB); ClientProducer producer2 = clientSession.createProducer(addressAC); ClientConsumer clientConsumer = clientSession.createConsumer(queueName); @@ -546,9 +547,9 @@ public class WildCardRoutingTest extends ActiveMQTestBase { SimpleString queueName1 = new SimpleString("Q1"); SimpleString queueName2 = new SimpleString("Q2"); SimpleString queueName = new SimpleString("Q"); - clientSession.createQueue(addressAB, queueName1, null, false); - clientSession.createQueue(addressAC, queueName2, null, false); - clientSession.createQueue(address, queueName, null, false); + clientSession.createQueue(new QueueConfiguration(queueName1).setAddress(addressAB).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName2).setAddress(addressAC).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName).setAddress(address).setDurable(false)); ClientProducer producer = clientSession.createProducer(addressAB); ClientProducer producer2 = clientSession.createProducer(addressAC); ClientConsumer clientConsumer = clientSession.createConsumer(queueName); @@ -571,9 +572,9 @@ public class WildCardRoutingTest extends ActiveMQTestBase { SimpleString queueName1 = new SimpleString("Q1"); SimpleString queueName2 = new SimpleString("Q2"); SimpleString queueName = new SimpleString("Q"); - clientSession.createQueue(addressAB, queueName1, null, false); - clientSession.createQueue(addressAC, queueName2, null, false); - clientSession.createQueue(address, queueName, null, false); + clientSession.createQueue(new QueueConfiguration(queueName1).setAddress(addressAB).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName2).setAddress(addressAC).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName).setAddress(address).setDurable(false)); ClientProducer producer = clientSession.createProducer(addressAB); ClientProducer producer2 = clientSession.createProducer(addressAC); ClientConsumer clientConsumer = clientSession.createConsumer(queueName); @@ -598,9 +599,9 @@ public class WildCardRoutingTest extends ActiveMQTestBase { SimpleString queueName1 = new SimpleString("Q1"); SimpleString queueName2 = new SimpleString("Q2"); SimpleString queueName = new SimpleString("Q"); - clientSession.createQueue(addressAB, queueName1, null, false); - clientSession.createQueue(addressAC, queueName2, null, false); - clientSession.createQueue(address, queueName, null, false); + clientSession.createQueue(new QueueConfiguration(queueName1).setAddress(addressAB).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName2).setAddress(addressAC).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName).setAddress(address).setDurable(false)); ClientProducer producer = clientSession.createProducer(addressAB); ClientProducer producer2 = clientSession.createProducer(addressAC); ClientConsumer clientConsumer = clientSession.createConsumer(queueName); @@ -623,9 +624,9 @@ public class WildCardRoutingTest extends ActiveMQTestBase { SimpleString queueName1 = new SimpleString("Q1"); SimpleString queueName2 = new SimpleString("Q2"); SimpleString queueName = new SimpleString("Q"); - clientSession.createQueue(addressAB, queueName1, null, false); - clientSession.createQueue(addressAC, queueName2, null, false); - clientSession.createQueue(address, queueName, null, false); + clientSession.createQueue(new QueueConfiguration(queueName1).setAddress(addressAB).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName2).setAddress(addressAC).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName).setAddress(address).setDurable(false)); ClientProducer producer = clientSession.createProducer(addressAB); ClientProducer producer2 = clientSession.createProducer(addressAC); ClientConsumer clientConsumer = clientSession.createConsumer(queueName); @@ -648,9 +649,9 @@ public class WildCardRoutingTest extends ActiveMQTestBase { SimpleString queueName1 = new SimpleString("Q1"); SimpleString queueName2 = new SimpleString("Q2"); SimpleString queueName = new SimpleString("Q"); - clientSession.createQueue(addressAB, queueName1, null, false); - clientSession.createQueue(addressAC, queueName2, null, false); - clientSession.createQueue(address, queueName, null, false); + clientSession.createQueue(new QueueConfiguration(queueName1).setAddress(addressAB).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName2).setAddress(addressAC).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName).setAddress(address).setDurable(false)); ClientProducer producer = clientSession.createProducer(addressAB); ClientProducer producer2 = clientSession.createProducer(addressAC); ClientConsumer clientConsumer = clientSession.createConsumer(queueName); @@ -673,9 +674,9 @@ public class WildCardRoutingTest extends ActiveMQTestBase { SimpleString queueName1 = new SimpleString("Q1"); SimpleString queueName2 = new SimpleString("Q2"); SimpleString queueName = new SimpleString("Q"); - clientSession.createQueue(addressAB, queueName1, null, false); - clientSession.createQueue(addressAC, queueName2, null, false); - clientSession.createQueue(address, queueName, null, false); + clientSession.createQueue(new QueueConfiguration(queueName1).setAddress(addressAB).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName2).setAddress(addressAC).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName).setAddress(address).setDurable(false)); ClientProducer producer = clientSession.createProducer(addressAB); ClientProducer producer2 = clientSession.createProducer(addressAC); ClientConsumer clientConsumer = clientSession.createConsumer(queueName); @@ -698,9 +699,9 @@ public class WildCardRoutingTest extends ActiveMQTestBase { SimpleString queueName1 = new SimpleString("Q1"); SimpleString queueName2 = new SimpleString("Q2"); SimpleString queueName = new SimpleString("Q"); - clientSession.createQueue(addressAB, queueName1, null, false); - clientSession.createQueue(addressAC, queueName2, null, false); - clientSession.createQueue(address, queueName, null, false); + clientSession.createQueue(new QueueConfiguration(queueName1).setAddress(addressAB).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName2).setAddress(addressAC).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName).setAddress(address).setDurable(false)); ClientProducer producer = clientSession.createProducer(addressAB); ClientProducer producer2 = clientSession.createProducer(addressAC); ClientConsumer clientConsumer = clientSession.createConsumer(queueName); @@ -723,9 +724,9 @@ public class WildCardRoutingTest extends ActiveMQTestBase { SimpleString queueName1 = new SimpleString("Q1"); SimpleString queueName2 = new SimpleString("Q2"); SimpleString queueName = new SimpleString("Q"); - clientSession.createQueue(addressAB, queueName1, null, false); - clientSession.createQueue(addressAC, queueName2, null, false); - clientSession.createQueue(address, queueName, null, false); + clientSession.createQueue(new QueueConfiguration(queueName1).setAddress(addressAB).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName2).setAddress(addressAC).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName).setAddress(address).setDurable(false)); Assert.assertEquals(2, server.getPostOffice().getBindingsForAddress(addressAB).getBindings().size()); Assert.assertEquals(2, server.getPostOffice().getBindingsForAddress(addressAC).getBindings().size()); Assert.assertEquals(1, server.getPostOffice().getBindingsForAddress(address).getBindings().size()); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/WildcardConfigurationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/WildcardConfigurationTest.java index dd8a470d11..b861919297 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/WildcardConfigurationTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/WildcardConfigurationTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.client; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -62,9 +63,9 @@ public class WildcardConfigurationTest extends ActiveMQTestBase { SimpleString queueName1 = new SimpleString("Q1"); SimpleString queueName2 = new SimpleString("Q2"); SimpleString queueName = new SimpleString("Q"); - clientSession.createQueue(addressAB, queueName1, null, false); - clientSession.createQueue(addressAC, queueName2, null, false); - clientSession.createQueue(address, queueName, null, false); + clientSession.createQueue(new QueueConfiguration(queueName1).setAddress(addressAB).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName2).setAddress(addressAC).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(queueName).setAddress(address).setDurable(false)); ClientProducer producer = clientSession.createProducer(addressAB); ClientProducer producer2 = clientSession.createProducer(addressAC); ClientConsumer clientConsumer = clientSession.createConsumer(queueName); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/clientcrash/ClientCrashTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/clientcrash/ClientCrashTest.java index 01df8b7f3c..ff92b113c5 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/clientcrash/ClientCrashTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/clientcrash/ClientCrashTest.java @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.integration.clientcrash; import java.util.concurrent.TimeUnit; import org.apache.activemq.artemis.api.core.Message; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -94,7 +95,7 @@ public class ClientCrashTest extends ClientTestBase { assertActiveConnections(1); ClientSession session = sf.createSession(false, true, true); - session.createQueue(ClientCrashTest.QUEUE, ClientCrashTest.QUEUE, null, false); + session.createQueue(new QueueConfiguration(ClientCrashTest.QUEUE).setDurable(false)); // spawn a JVM that creates a Core client, which sends a message // It has to be spawned after the queue was created. @@ -148,7 +149,7 @@ public class ClientCrashTest extends ClientTestBase { ClientSession session = sf.createSession(false, true, true); - session.createQueue(ClientCrashTest.QUEUE2, ClientCrashTest.QUEUE2, null, false); + session.createQueue(new QueueConfiguration(ClientCrashTest.QUEUE2).setDurable(false)); // spawn a JVM that creates a Core client, which sends a message p = SpawnedVMSupport.spawnVM(CrashClient2.class.getName()); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/clientcrash/ClientExitTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/clientcrash/ClientExitTest.java index 0c0f27e2f1..e179826cb2 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/clientcrash/ClientExitTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/clientcrash/ClientExitTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.clientcrash; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -101,7 +102,7 @@ public class ClientExitTest extends ClientTestBase { addServerLocator(locator); ClientSessionFactory sf = createSessionFactory(locator); session = sf.createSession(false, true, true); - session.createQueue(ClientExitTest.QUEUE, ClientExitTest.QUEUE, null, false); + session.createQueue(new QueueConfiguration(ClientExitTest.QUEUE).setDurable(false)); consumer = session.createConsumer(ClientExitTest.QUEUE); session.start(); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/clientcrash/PendingDeliveriesTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/clientcrash/PendingDeliveriesTest.java index 8af9290ee2..703de6b136 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/clientcrash/PendingDeliveriesTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/clientcrash/PendingDeliveriesTest.java @@ -25,6 +25,7 @@ import javax.jms.MessageConsumer; import javax.jms.MessageProducer; import javax.jms.Session; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.core.server.impl.AddressInfo; @@ -42,7 +43,7 @@ public class PendingDeliveriesTest extends ClientTestBase { @Before public void createQueue() throws Exception { server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("queue1"), RoutingType.ANYCAST)); - server.createQueue(SimpleString.toSimpleString("queue1"), RoutingType.ANYCAST, SimpleString.toSimpleString("queue1"), null, true, false); + server.createQueue(new QueueConfiguration("queue1").setRoutingType(RoutingType.ANYCAST)); } @After diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeFailoverTest.java index d46a61e143..559c996f13 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeFailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeFailoverTest.java @@ -20,6 +20,7 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.TimeUnit; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientProducer; @@ -27,7 +28,6 @@ import org.apache.activemq.artemis.api.core.client.ClientSession; import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.core.config.BridgeConfiguration; -import org.apache.activemq.artemis.core.config.CoreQueueConfiguration; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.cluster.impl.BridgeImpl; import org.apache.activemq.artemis.tests.integration.cluster.util.MultiServerTestBase; @@ -56,8 +56,8 @@ public class BridgeFailoverTest extends MultiServerTestBase { servers[2].getConfiguration().getBridgeConfigurations().add(bridgeConfiguration); for (ActiveMQServer server : servers) { - server.getConfiguration().getQueueConfigurations().add(new CoreQueueConfiguration().setAddress(ORIGINAL_QUEUE).setName(ORIGINAL_QUEUE)); - server.getConfiguration().getQueueConfigurations().add(new CoreQueueConfiguration().setAddress(TARGET_QUEUE).setName(TARGET_QUEUE)); + server.getConfiguration().addQueueConfiguration(new QueueConfiguration(ORIGINAL_QUEUE)); + server.getConfiguration().addQueueConfiguration(new QueueConfiguration(TARGET_QUEUE)); } startServers(); @@ -124,8 +124,8 @@ public class BridgeFailoverTest extends MultiServerTestBase { servers[2].getConfiguration().getBridgeConfigurations().add(bridgeConfiguration); for (ActiveMQServer server : servers) { - server.getConfiguration().getQueueConfigurations().add(new CoreQueueConfiguration().setAddress(ORIGINAL_QUEUE).setName(ORIGINAL_QUEUE)); - server.getConfiguration().getQueueConfigurations().add(new CoreQueueConfiguration().setAddress(TARGET_QUEUE).setName(TARGET_QUEUE)); + server.getConfiguration().addQueueConfiguration(new QueueConfiguration(ORIGINAL_QUEUE)); + server.getConfiguration().addQueueConfiguration(new QueueConfiguration(TARGET_QUEUE)); } startServers(); @@ -227,8 +227,8 @@ public class BridgeFailoverTest extends MultiServerTestBase { servers[2].getConfiguration().getBridgeConfigurations().add(bridgeConfiguration); for (ActiveMQServer server : servers) { - server.getConfiguration().getQueueConfigurations().add(new CoreQueueConfiguration().setAddress(ORIGINAL_QUEUE).setName(ORIGINAL_QUEUE)); - server.getConfiguration().getQueueConfigurations().add(new CoreQueueConfiguration().setAddress(TARGET_QUEUE).setName(TARGET_QUEUE)); + server.getConfiguration().addQueueConfiguration(new QueueConfiguration(ORIGINAL_QUEUE)); + server.getConfiguration().addQueueConfiguration(new QueueConfiguration(TARGET_QUEUE)); } startBackups(0, 1, 3, 4); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeReconnectTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeReconnectTest.java index 23ce8a77d2..e2b819ea2b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeReconnectTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeReconnectTest.java @@ -24,6 +24,7 @@ import java.util.Map; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQExceptionType; import org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; @@ -36,7 +37,6 @@ import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.api.core.management.QueueControl; import org.apache.activemq.artemis.api.core.management.ResourceNames; import org.apache.activemq.artemis.core.config.BridgeConfiguration; -import org.apache.activemq.artemis.core.config.CoreQueueConfiguration; import org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnector; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.NodeManager; @@ -141,16 +141,16 @@ public class BridgeReconnectTest extends BridgeTestBase { server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); server2.getConfiguration().setBridgeConfigurations(bridgeConfigs); - CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName); - List queueConfigs0 = new ArrayList<>(); + QueueConfiguration queueConfig0 = new QueueConfiguration(queueName).setAddress(testAddress); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); - server1.getConfiguration().setQueueConfigurations(queueConfigs0); + server1.getConfiguration().setQueueConfigs(queueConfigs0); - CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName); - List queueConfigs1 = new ArrayList<>(); + QueueConfiguration queueConfig1 = new QueueConfiguration(queueName).setAddress(forwardAddress); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); - server0.getConfiguration().setQueueConfigurations(queueConfigs1); - server2.getConfiguration().setQueueConfigurations(queueConfigs1); + server0.getConfiguration().setQueueConfigs(queueConfigs1); + server2.getConfiguration().setQueueConfigs(queueConfigs1); startServers(); @@ -191,16 +191,16 @@ public class BridgeReconnectTest extends BridgeTestBase { bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); - CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName); - List queueConfigs0 = new ArrayList<>(); + QueueConfiguration queueConfig0 = new QueueConfiguration(queueName).setAddress(testAddress); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); - server0.getConfiguration().setQueueConfigurations(queueConfigs0); + server0.getConfiguration().setQueueConfigs(queueConfigs0); - CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName); - List queueConfigs1 = new ArrayList<>(); + QueueConfiguration queueConfig1 = new QueueConfiguration(queueName).setAddress(forwardAddress); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); - server1.getConfiguration().setQueueConfigurations(queueConfigs1); - server2.getConfiguration().setQueueConfigurations(queueConfigs1); + server1.getConfiguration().setQueueConfigs(queueConfigs1); + server2.getConfiguration().setQueueConfigs(queueConfigs1); startServers(); @@ -272,16 +272,16 @@ public class BridgeReconnectTest extends BridgeTestBase { bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); - CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName); - List queueConfigs0 = new ArrayList<>(); + QueueConfiguration queueConfig0 = new QueueConfiguration(queueName).setAddress(testAddress); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); - server0.getConfiguration().setQueueConfigurations(queueConfigs0); + server0.getConfiguration().setQueueConfigs(queueConfigs0); - CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName); - List queueConfigs1 = new ArrayList<>(); + QueueConfiguration queueConfig1 = new QueueConfiguration(queueName).setAddress(forwardAddress); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); - server1.getConfiguration().setQueueConfigurations(queueConfigs1); - server2.getConfiguration().setQueueConfigurations(queueConfigs1); + server1.getConfiguration().setQueueConfigs(queueConfigs1); + server2.getConfiguration().setQueueConfigs(queueConfigs1); startServers(); // Now we will simulate a failure of the bridge connection between server0 and server1 @@ -337,15 +337,15 @@ public class BridgeReconnectTest extends BridgeTestBase { bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); - CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName); - List queueConfigs0 = new ArrayList<>(); + QueueConfiguration queueConfig0 = new QueueConfiguration(queueName).setAddress(testAddress); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); - server0.getConfiguration().setQueueConfigurations(queueConfigs0); + server0.getConfiguration().setQueueConfigs(queueConfigs0); - CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName); - List queueConfigs1 = new ArrayList<>(); + QueueConfiguration queueConfig1 = new QueueConfiguration(queueName).setAddress(forwardAddress); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); - server1.getConfiguration().setQueueConfigurations(queueConfigs1); + server1.getConfiguration().setQueueConfigs(queueConfigs1); startServers(); @@ -425,15 +425,15 @@ public class BridgeReconnectTest extends BridgeTestBase { bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); - CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName); - List queueConfigs0 = new ArrayList<>(); + QueueConfiguration queueConfig0 = new QueueConfiguration(queueName).setAddress(testAddress); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); - server0.getConfiguration().setQueueConfigurations(queueConfigs0); + server0.getConfiguration().setQueueConfigs(queueConfigs0); - CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName); - List queueConfigs1 = new ArrayList<>(); + QueueConfiguration queueConfig1 = new QueueConfiguration(queueName).setAddress(forwardAddress); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); - server1.getConfiguration().setQueueConfigurations(queueConfigs1); + server1.getConfiguration().setQueueConfigs(queueConfigs1); startServers(); waitForServerStart(server0); @@ -529,15 +529,15 @@ public class BridgeReconnectTest extends BridgeTestBase { bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); - CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName); - List queueConfigs0 = new ArrayList<>(); + QueueConfiguration queueConfig0 = new QueueConfiguration(queueName).setAddress(testAddress); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); - server0.getConfiguration().setQueueConfigurations(queueConfigs0); + server0.getConfiguration().setQueueConfigs(queueConfigs0); - CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName); - List queueConfigs1 = new ArrayList<>(); + QueueConfiguration queueConfig1 = new QueueConfiguration(queueName).setAddress(forwardAddress); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); - server1.getConfiguration().setQueueConfigurations(queueConfigs1); + server1.getConfiguration().setQueueConfigs(queueConfigs1); startServers(); @@ -631,15 +631,15 @@ public class BridgeReconnectTest extends BridgeTestBase { bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); - CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName); - List queueConfigs0 = new ArrayList<>(); + QueueConfiguration queueConfig0 = new QueueConfiguration(queueName).setAddress(testAddress); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); - server0.getConfiguration().setQueueConfigurations(queueConfigs0); + server0.getConfiguration().setQueueConfigs(queueConfigs0); - CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName); - List queueConfigs1 = new ArrayList<>(); + QueueConfiguration queueConfig1 = new QueueConfiguration(queueName).setAddress(forwardAddress); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); - server1.getConfiguration().setQueueConfigurations(queueConfigs1); + server1.getConfiguration().setQueueConfigs(queueConfigs1); startServers(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeStartTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeStartTest.java index 29cb8e6492..ee52ea490d 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeStartTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeStartTest.java @@ -23,6 +23,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; @@ -33,7 +34,6 @@ import org.apache.activemq.artemis.api.core.client.ClientSession; import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.core.config.BridgeConfiguration; -import org.apache.activemq.artemis.core.config.CoreQueueConfiguration; import org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.cluster.Bridge; @@ -108,15 +108,15 @@ public class BridgeStartTest extends ActiveMQTestBase { bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); - CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0); - List queueConfigs0 = new ArrayList<>(); + QueueConfiguration queueConfig0 = new QueueConfiguration(queueName0).setAddress(testAddress); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); - server0.getConfiguration().setQueueConfigurations(queueConfigs0); + server0.getConfiguration().setQueueConfigs(queueConfigs0); - CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName1); - List queueConfigs1 = new ArrayList<>(); + QueueConfiguration queueConfig1 = new QueueConfiguration(queueName1).setAddress(forwardAddress); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); - server1.getConfiguration().setQueueConfigurations(queueConfigs1); + server1.getConfiguration().setQueueConfigs(queueConfigs1); server1.start(); waitForServerToStart(server1); @@ -252,15 +252,15 @@ public class BridgeStartTest extends ActiveMQTestBase { bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); - CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0); - List queueConfigs0 = new ArrayList<>(); + QueueConfiguration queueConfig0 = new QueueConfiguration(queueName0).setAddress(testAddress); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); - server0.getConfiguration().setQueueConfigurations(queueConfigs0); + server0.getConfiguration().setQueueConfigs(queueConfigs0); - CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName1); - List queueConfigs1 = new ArrayList<>(); + QueueConfiguration queueConfig1 = new QueueConfiguration(queueName1).setAddress(forwardAddress); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); - server1.getConfiguration().setQueueConfigurations(queueConfigs1); + server1.getConfiguration().setQueueConfigs(queueConfigs1); ServerLocator locator = null; try { // Don't start server 1 yet @@ -437,15 +437,15 @@ public class BridgeStartTest extends ActiveMQTestBase { bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); - CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0); - List queueConfigs0 = new ArrayList<>(); + QueueConfiguration queueConfig0 = new QueueConfiguration(queueName0).setAddress(testAddress); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); - server0.getConfiguration().setQueueConfigurations(queueConfigs0); + server0.getConfiguration().setQueueConfigs(queueConfigs0); - CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName1); - List queueConfigs1 = new ArrayList<>(); + QueueConfiguration queueConfig1 = new QueueConfiguration(queueName1).setAddress(forwardAddress); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); - server1.getConfiguration().setQueueConfigurations(queueConfigs1); + server1.getConfiguration().setQueueConfigs(queueConfigs1); // Don't start server 1 yet @@ -567,15 +567,15 @@ public class BridgeStartTest extends ActiveMQTestBase { bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); - CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0); - List queueConfigs0 = new ArrayList<>(); + QueueConfiguration queueConfig0 = new QueueConfiguration(queueName0).setAddress(testAddress); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); - server0.getConfiguration().setQueueConfigurations(queueConfigs0); + server0.getConfiguration().setQueueConfigs(queueConfigs0); - CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName1); - List queueConfigs1 = new ArrayList<>(); + QueueConfiguration queueConfig1 = new QueueConfiguration(queueName1).setAddress(forwardAddress); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); - server1.getConfiguration().setQueueConfigurations(queueConfigs1); + server1.getConfiguration().setQueueConfigs(queueConfigs1); server1.start(); waitForServerToStart(server1); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeTest.java index 3c8b5c2895..e734042a02 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeTest.java @@ -37,6 +37,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQBuffer; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.Interceptor; import org.apache.activemq.artemis.api.core.Message; +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.api.core.TransportConfiguration; @@ -49,7 +50,6 @@ import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.core.config.BridgeConfiguration; import org.apache.activemq.artemis.core.config.Configuration; -import org.apache.activemq.artemis.core.config.CoreQueueConfiguration; import org.apache.activemq.artemis.core.config.TransformerConfiguration; import org.apache.activemq.artemis.core.io.SequentialFileFactory; import org.apache.activemq.artemis.core.io.nio.NIOSequentialFileFactory; @@ -180,15 +180,15 @@ public class BridgeTest extends ActiveMQTestBase { bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); - CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0); - List queueConfigs0 = new ArrayList<>(); + QueueConfiguration queueConfig0 = new QueueConfiguration(queueName0).setAddress(testAddress); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); - server0.getConfiguration().setQueueConfigurations(queueConfigs0); + server0.getConfiguration().setQueueConfigs(queueConfigs0); - CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName1); - List queueConfigs1 = new ArrayList<>(); + QueueConfiguration queueConfig1 = new QueueConfiguration(queueName1).setAddress(forwardAddress); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); - server1.getConfiguration().setQueueConfigurations(queueConfigs1); + server1.getConfiguration().setQueueConfigs(queueConfigs1); server1.start(); server0.start(); @@ -291,15 +291,15 @@ public class BridgeTest extends ActiveMQTestBase { bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); - CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0); - List queueConfigs0 = new ArrayList<>(); + QueueConfiguration queueConfig0 = new QueueConfiguration(queueName0).setAddress(testAddress); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); - server0.getConfiguration().setQueueConfigurations(queueConfigs0); + server0.getConfiguration().setQueueConfigs(queueConfigs0); - CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName1); - List queueConfigs1 = new ArrayList<>(); + QueueConfiguration queueConfig1 = new QueueConfiguration(queueName1).setAddress(forwardAddress); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); - server1.getConfiguration().setQueueConfigurations(queueConfigs1); + server1.getConfiguration().setQueueConfigs(queueConfigs1); server1.start(); server0.start(); @@ -428,15 +428,15 @@ public class BridgeTest extends ActiveMQTestBase { bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); - CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0); - List queueConfigs0 = new ArrayList<>(); + QueueConfiguration queueConfig0 = new QueueConfiguration(queueName0).setAddress(testAddress); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); - server0.getConfiguration().setQueueConfigurations(queueConfigs0); + server0.getConfiguration().setQueueConfigs(queueConfigs0); - CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName1); - List queueConfigs1 = new ArrayList<>(); + QueueConfiguration queueConfig1 = new QueueConfiguration(queueName1).setAddress(forwardAddress); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); - server1.getConfiguration().setQueueConfigurations(queueConfigs1); + server1.getConfiguration().setQueueConfigs(queueConfigs1); server1.start(); server0.start(); @@ -583,15 +583,15 @@ public class BridgeTest extends ActiveMQTestBase { bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); - CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0); - List queueConfigs0 = new ArrayList<>(); + QueueConfiguration queueConfig0 = new QueueConfiguration(queueName0).setAddress(testAddress); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); - server0.getConfiguration().setQueueConfigurations(queueConfigs0); + server0.getConfiguration().setQueueConfigs(queueConfigs0); - CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName1); - List queueConfigs1 = new ArrayList<>(); + QueueConfiguration queueConfig1 = new QueueConfiguration(queueName1).setAddress(forwardAddress); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); - server1.getConfiguration().setQueueConfigurations(queueConfigs1); + server1.getConfiguration().setQueueConfigs(queueConfigs1); server1.start(); server0.start(); @@ -717,10 +717,10 @@ public class BridgeTest extends ActiveMQTestBase { bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); - CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0); - List queueConfigs0 = new ArrayList<>(); + QueueConfiguration queueConfig0 = new QueueConfiguration(queueName0).setAddress(testAddress); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); - server0.getConfiguration().setQueueConfigurations(queueConfigs0); + server0.getConfiguration().setQueueConfigs(queueConfigs0); server0.start(); @@ -758,7 +758,7 @@ public class BridgeTest extends ActiveMQTestBase { ClientSession session1 = sf1.createSession(false, true, true); try { - session1.createQueue(forwardAddress, RoutingType.ANYCAST, queueName1); + session1.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress).setRoutingType(RoutingType.ANYCAST)); } catch (Throwable ignored) { ignored.printStackTrace(); } @@ -825,12 +825,12 @@ public class BridgeTest extends ActiveMQTestBase { bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); - CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0); - List queueConfigs0 = new ArrayList<>(); + QueueConfiguration queueConfig0 = new QueueConfiguration(queueName0).setAddress(testAddress); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); - queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(secondQueue); + queueConfig0 = new QueueConfiguration(secondQueue).setAddress(testAddress); queueConfigs0.add(queueConfig0); - server0.getConfiguration().setQueueConfigurations(queueConfigs0); + server0.getConfiguration().setQueueConfigs(queueConfigs0); server0.start(); @@ -893,7 +893,7 @@ public class BridgeTest extends ActiveMQTestBase { ClientSession session1 = sf1.createSession(false, true, true); try { - session1.createQueue(forwardAddress, RoutingType.ANYCAST, queueName1); + session1.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress).setRoutingType(RoutingType.ANYCAST)); } catch (Throwable ignored) { ignored.printStackTrace(); } @@ -995,15 +995,15 @@ public class BridgeTest extends ActiveMQTestBase { bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); - CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0); - List queueConfigs0 = new ArrayList<>(); + QueueConfiguration queueConfig0 = new QueueConfiguration(queueName0).setAddress(testAddress); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); - server0.getConfiguration().setQueueConfigurations(queueConfigs0); + server0.getConfiguration().setQueueConfigs(queueConfigs0); - CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName1); - List queueConfigs1 = new ArrayList<>(); + QueueConfiguration queueConfig1 = new QueueConfiguration(queueName1).setAddress(forwardAddress); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); - server1.getConfiguration().setQueueConfigurations(queueConfigs1); + server1.getConfiguration().setQueueConfigs(queueConfigs1); server1.start(); server0.start(); @@ -1105,15 +1105,15 @@ public class BridgeTest extends ActiveMQTestBase { bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); - CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0); - List queueConfigs0 = new ArrayList<>(); + QueueConfiguration queueConfig0 = new QueueConfiguration(queueName0).setAddress(testAddress); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); - server0.getConfiguration().setQueueConfigurations(queueConfigs0); + server0.getConfiguration().setQueueConfigs(queueConfigs0); - CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName1); - List queueConfigs1 = new ArrayList<>(); + QueueConfiguration queueConfig1 = new QueueConfiguration(queueName1).setAddress(forwardAddress); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); - server1.getConfiguration().setQueueConfigurations(queueConfigs1); + server1.getConfiguration().setQueueConfigs(queueConfigs1); server1.start(); server0.start(); @@ -1207,15 +1207,15 @@ public class BridgeTest extends ActiveMQTestBase { bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); - CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0); - List queueConfigs0 = new ArrayList<>(); + QueueConfiguration queueConfig0 = new QueueConfiguration(queueName0).setAddress(testAddress); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); - server0.getConfiguration().setQueueConfigurations(queueConfigs0); + server0.getConfiguration().setQueueConfigs(queueConfigs0); - CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName1); - List queueConfigs1 = new ArrayList<>(); + QueueConfiguration queueConfig1 = new QueueConfiguration(queueName1).setAddress(forwardAddress); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); - server1.getConfiguration().setQueueConfigurations(queueConfigs1); + server1.getConfiguration().setQueueConfigs(queueConfigs1); try { server1.start(); @@ -1410,15 +1410,15 @@ public class BridgeTest extends ActiveMQTestBase { bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); - CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0); - List queueConfigs0 = new ArrayList<>(); + QueueConfiguration queueConfig0 = new QueueConfiguration(queueName0).setAddress(testAddress); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); - server0.getConfiguration().setQueueConfigurations(queueConfigs0); + server0.getConfiguration().setQueueConfigs(queueConfigs0); - CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName1); - List queueConfigs1 = new ArrayList<>(); + QueueConfiguration queueConfig1 = new QueueConfiguration(queueName1).setAddress(forwardAddress); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); - server1.getConfiguration().setQueueConfigurations(queueConfigs1); + server1.getConfiguration().setQueueConfigs(queueConfigs1); List interceptorToStop = new ArrayList<>(); interceptorToStop.add(StopInterceptor.class.getName()); @@ -1638,15 +1638,15 @@ public class BridgeTest extends ActiveMQTestBase { bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); - CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0); - List queueConfigs0 = new ArrayList<>(); + QueueConfiguration queueConfig0 = new QueueConfiguration(queueName0).setAddress(testAddress); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); - server0.getConfiguration().setQueueConfigurations(queueConfigs0); + server0.getConfiguration().setQueueConfigs(queueConfigs0); - CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName1); - List queueConfigs1 = new ArrayList<>(); + QueueConfiguration queueConfig1 = new QueueConfiguration(queueName1).setAddress(forwardAddress); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); - server1.getConfiguration().setQueueConfigurations(queueConfigs1); + server1.getConfiguration().setQueueConfigs(queueConfigs1); server1.start(); server0.start(); @@ -1770,15 +1770,15 @@ public class BridgeTest extends ActiveMQTestBase { bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); - CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0); - List queueConfigs0 = new ArrayList<>(); + QueueConfiguration queueConfig0 = new QueueConfiguration(queueName0).setAddress(testAddress); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); - server0.getConfiguration().setQueueConfigurations(queueConfigs0); + server0.getConfiguration().setQueueConfigs(queueConfigs0); - CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName1); - List queueConfigs1 = new ArrayList<>(); + QueueConfiguration queueConfig1 = new QueueConfiguration(queueName1).setAddress(forwardAddress); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); - server1.getConfiguration().setQueueConfigurations(queueConfigs1); + server1.getConfiguration().setQueueConfigs(queueConfigs1); server1.start(); server0.start(); @@ -1923,16 +1923,16 @@ public class BridgeTest extends ActiveMQTestBase { bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); - CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0); - List queueConfigs0 = new ArrayList<>(); + QueueConfiguration queueConfig0 = new QueueConfiguration(queueName0).setAddress(testAddress); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); - server0.getConfiguration().setQueueConfigurations(queueConfigs0); + server0.getConfiguration().setQueueConfigs(queueConfigs0); // on server #1, we bind queueName1 to same address testAddress - CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName1); - List queueConfigs1 = new ArrayList<>(); + QueueConfiguration queueConfig1 = new QueueConfiguration(queueName1).setAddress(testAddress); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); - server1.getConfiguration().setQueueConfigurations(queueConfigs1); + server1.getConfiguration().setQueueConfigs(queueConfigs1); server1.start(); server0.start(); @@ -2007,7 +2007,7 @@ public class BridgeTest extends ActiveMQTestBase { ActiveMQServer server = addServer(new ActiveMQServerImpl(config, null, null, null, serviceRegistry)); server.start(); server.waitForActivation(100, TimeUnit.MILLISECONDS); - server.createQueue(ADDRESS, RoutingType.ANYCAST, QUEUE, null, false, false); + server.createQueue(new QueueConfiguration(QUEUE).setAddress(ADDRESS).setRoutingType(RoutingType.ANYCAST).setDurable(false)); List connectors = new ArrayList<>(); connectors.add("in-vm"); server.deployBridge(new BridgeConfiguration().setName(BRIDGE).setQueueName(QUEUE.toString()).setForwardingAddress(ADDRESS.toString()).setStaticConnectors(connectors)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java index bf67e0798a..97ee50099f 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration; import org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory; @@ -36,7 +37,6 @@ import org.apache.activemq.artemis.api.core.client.ClientSession; import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.core.config.BridgeConfiguration; -import org.apache.activemq.artemis.core.config.CoreQueueConfiguration; import org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory; import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory; import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants; @@ -120,15 +120,15 @@ public class BridgeWithDiscoveryGroupStartTest extends ActiveMQTestBase { bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); - CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0); - List queueConfigs0 = new ArrayList<>(); + QueueConfiguration queueConfig0 = new QueueConfiguration(queueName0).setAddress(testAddress); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); - server0.getConfiguration().setQueueConfigurations(queueConfigs0); + server0.getConfiguration().setQueueConfigs(queueConfigs0); - CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName1); - List queueConfigs1 = new ArrayList<>(); + QueueConfiguration queueConfig1 = new QueueConfiguration(queueName1).setAddress(forwardAddress); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); - server1.getConfiguration().setQueueConfigurations(queueConfigs1); + server1.getConfiguration().setQueueConfigs(queueConfigs1); server1.start(); server0.start(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/crossprotocol/ProtocolsMessageLoadBalancingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/crossprotocol/ProtocolsMessageLoadBalancingTest.java index c6624def38..3213953890 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/crossprotocol/ProtocolsMessageLoadBalancingTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/crossprotocol/ProtocolsMessageLoadBalancingTest.java @@ -27,6 +27,7 @@ import java.util.Arrays; import java.util.Collection; import org.apache.activemq.artemis.api.core.ActiveMQException; +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.api.core.client.ActiveMQClient; @@ -100,8 +101,9 @@ public class ProtocolsMessageLoadBalancingTest extends ClusterTestBase { } private void createQueue(SimpleString queueName) throws Exception { - servers[0].createQueue(queueName, RoutingType.ANYCAST, queueName, (SimpleString) null, (SimpleString) null, true, false, false, false, false, -1, false, false, false, true); - servers[1].createQueue(queueName, RoutingType.ANYCAST, queueName, (SimpleString) null, (SimpleString) null, true, false, false, false, false, -1, false, false, false, true); + QueueConfiguration queueConfiguration = new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST); + servers[0].createQueue(queueConfiguration); + servers[1].createQueue(queueConfiguration); } protected boolean isNetty() { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterTestBase.java index 32d5d2918d..02adf2b51d 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterTestBase.java @@ -39,6 +39,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration; import org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration; import org.apache.activemq.artemis.api.core.Message; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory; @@ -541,7 +542,7 @@ public abstract class ClusterTestBase extends ActiveMQTestBase { log.info("Creating " + queueName + " , address " + address + " on " + servers[node]); - session.createQueue(address, routingType, queueName, filterString, durable); + session.createQueue(new QueueConfiguration(queueName).setAddress(address).setRoutingType(routingType).setFilterString(filterString).setDurable(durable)); session.close(); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ExpireWhileLoadBalanceTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ExpireWhileLoadBalanceTest.java index 059d776193..5c5002631e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ExpireWhileLoadBalanceTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ExpireWhileLoadBalanceTest.java @@ -17,6 +17,7 @@ package org.apache.activemq.artemis.tests.integration.cluster.distribution; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -75,7 +76,7 @@ public class ExpireWhileLoadBalanceTest extends ClusterTestBase { for (int i = 0; i <= 2; i++) { createQueue(i, "queues.testaddress", "queue0", null, true); - getServer(i).createQueue(expiryQueue, RoutingType.ANYCAST, expiryQueue, null, true, false); + getServer(i).createQueue(new QueueConfiguration(expiryQueue).setRoutingType(RoutingType.ANYCAST)); getServer(i).getAddressSettingsRepository().addMatch("#", as); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/TemporaryQueueClusterTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/TemporaryQueueClusterTest.java index 3f4c113947..ffc9b061fd 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/TemporaryQueueClusterTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/TemporaryQueueClusterTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.cluster.distribution; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientSession; @@ -57,7 +58,7 @@ public class TemporaryQueueClusterTest extends ClusterTestBase { String tempQueue = "tempqueue"; // create temp queue on node #0 ClientSession session = sfs[0].createSession(false, true, true); - session.createTemporaryQueue(tempAddress, tempQueue); + session.createQueue(new QueueConfiguration(tempQueue).setAddress(tempAddress).setDurable(false).setTemporary(true)); ClientConsumer consumer = session.createConsumer(tempQueue); // check the binding is created on node #1 diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/AsynchronousFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/AsynchronousFailoverTest.java index 82b6286612..3ae5b64d40 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/AsynchronousFailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/AsynchronousFailoverTest.java @@ -28,6 +28,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQTransactionOutcomeUnknownExc import org.apache.activemq.artemis.api.core.ActiveMQTransactionRolledBackException; import org.apache.activemq.artemis.api.core.ActiveMQUnBlockedException; import org.apache.activemq.artemis.api.core.Message; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; @@ -147,7 +148,7 @@ public class AsynchronousFailoverTest extends FailoverTestBase { ClientSession createSession = sf.createSession(true, true); - createSession.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, (SimpleString) null, true); + createSession.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS).setAddress(FailoverTestBase.ADDRESS)); RemotingConnection conn = ((ClientSessionInternal) createSession).getConnection(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/AutomaticColocatedQuorumVoteTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/AutomaticColocatedQuorumVoteTest.java index 0f792b5232..7ea9317b91 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/AutomaticColocatedQuorumVoteTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/AutomaticColocatedQuorumVoteTest.java @@ -24,6 +24,7 @@ import java.util.List; import java.util.Map; import java.util.Set; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; @@ -31,7 +32,6 @@ import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.core.client.impl.Topology; import org.apache.activemq.artemis.core.client.impl.TopologyMemberImpl; import org.apache.activemq.artemis.core.config.Configuration; -import org.apache.activemq.artemis.core.config.CoreQueueConfiguration; import org.apache.activemq.artemis.core.config.ScaleDownConfiguration; import org.apache.activemq.artemis.core.config.ha.ColocatedPolicyConfiguration; import org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration; @@ -281,7 +281,7 @@ public class AutomaticColocatedQuorumVoteTest extends ActiveMQTestBase { TransportConfiguration liveConnector, TransportConfiguration liveAcceptor, TransportConfiguration... otherLiveNodes) throws Exception { - Configuration configuration = createDefaultInVMConfig().clearAcceptorConfigurations().addAcceptorConfiguration(liveAcceptor).addConnectorConfiguration(liveConnector.getName(), liveConnector).setJournalDirectory(getJournalDir() + identity).setBindingsDirectory(getBindingsDir() + identity).setLargeMessagesDirectory(getLargeMessagesDir() + identity).setPagingDirectory(getPageDir() + identity).addQueueConfiguration(new CoreQueueConfiguration().setAddress("testQueue").setName("testQueue")); + Configuration configuration = createDefaultInVMConfig().clearAcceptorConfigurations().addAcceptorConfiguration(liveAcceptor).addConnectorConfiguration(liveConnector.getName(), liveConnector).setJournalDirectory(getJournalDir() + identity).setBindingsDirectory(getBindingsDir() + identity).setLargeMessagesDirectory(getLargeMessagesDir() + identity).setPagingDirectory(getPageDir() + identity).addQueueConfiguration(new QueueConfiguration("testQueue")); List transportConfigurationList = new ArrayList<>(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/BackupSyncJournalTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/BackupSyncJournalTest.java index aae8427802..336ea9b62b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/BackupSyncJournalTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/BackupSyncJournalTest.java @@ -27,6 +27,7 @@ import java.util.concurrent.TimeUnit; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.Pair; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; @@ -46,7 +47,6 @@ import org.apache.activemq.artemis.core.paging.PagingStore; import org.apache.activemq.artemis.core.persistence.impl.journal.DescribeJournal; import org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager; import org.apache.activemq.artemis.core.server.Queue; -import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.core.server.files.FileMoveManager; import org.apache.activemq.artemis.tests.integration.cluster.util.BackupSyncDelay; import org.apache.activemq.artemis.tests.integration.cluster.util.TestableServer; @@ -364,7 +364,7 @@ public class BackupSyncJournalTest extends FailoverTestBase { protected void createProducerSendSomeMessages() throws ActiveMQException { session = addClientSession(sessionFactory.createSession(true, true)); - session.createQueue(ADDRESS, RoutingType.MULTICAST, ADDRESS, null, true); + session.createQueue(new QueueConfiguration(ADDRESS)); if (producer != null) producer.close(); producer = addClientProducer(session.createProducer(ADDRESS)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/BackupSyncLargeMessageTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/BackupSyncLargeMessageTest.java index f90af32657..6599a1abec 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/BackupSyncLargeMessageTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/BackupSyncLargeMessageTest.java @@ -26,6 +26,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import org.apache.activemq.artemis.api.core.ActiveMQBuffer; import org.apache.activemq.artemis.api.core.ActiveMQException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientProducer; @@ -110,7 +111,7 @@ public class BackupSyncLargeMessageTest extends BackupSyncJournalTest { @Test public void testBackupStartsWhenLiveIsReceivingLargeMessage() throws Exception { final ClientSession session = addClientSession(sessionFactory.createSession(true, true)); - session.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS)); final ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS); final ClientMessage message = session.createMessage(true); final int largeMessageSize = 1000 * MIN_LARGE_MESSAGE; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailBackAutoTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailBackAutoTest.java index 6f66d86c64..4840b02040 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailBackAutoTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailBackAutoTest.java @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.integration.cluster.failover; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; @@ -272,7 +273,7 @@ public class FailBackAutoTest extends FailoverTestBase { ClientSession session = sf.createSession(false, true, true); if (createQueue) { - session.createQueue(ADDRESS, ADDRESS, null, true); + session.createQueue(new QueueConfiguration(ADDRESS)); } ClientProducer producer = session.createProducer(ADDRESS); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailBackManualTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailBackManualTest.java index b74af0d1f4..629876c29b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailBackManualTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailBackManualTest.java @@ -18,6 +18,7 @@ package org.apache.activemq.artemis.tests.integration.cluster.failover; import java.util.concurrent.TimeUnit; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; @@ -128,7 +129,7 @@ public class FailBackManualTest extends FailoverTestBase { ClientSession session = sf.createSession(false, true, true); if (createQueue) { - session.createQueue(ADDRESS, ADDRESS, null, false); + session.createQueue(new QueueConfiguration(ADDRESS).setDurable(false)); } ClientProducer producer = session.createProducer(ADDRESS); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverListenerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverListenerTest.java index 0eb8e2e824..259deebd04 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverListenerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverListenerTest.java @@ -20,6 +20,7 @@ import java.util.ArrayList; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; @@ -210,7 +211,7 @@ public class FailoverListenerTest extends FailoverTestBase { ClientSession session = sf.createSession(false, true, true); if (createQueue) { - session.createQueue(ADDRESS, ADDRESS, null, true); + session.createQueue(new QueueConfiguration(ADDRESS)); } ClientProducer producer = session.createProducer(ADDRESS); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverOnFlowControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverOnFlowControlTest.java index f7d6d562bb..cc2d1db33e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverOnFlowControlTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverOnFlowControlTest.java @@ -21,6 +21,7 @@ import java.util.concurrent.atomic.AtomicInteger; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.Interceptor; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientProducer; @@ -78,7 +79,7 @@ public class FailoverOnFlowControlTest extends FailoverTestBase { ClientSession session = sf.createSession(true, true); sessionList.add(session); - session.createQueue(ADDRESS, ADDRESS, null, true); + session.createQueue(new QueueConfiguration(ADDRESS)); ClientProducer producer = session.createProducer(ADDRESS); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTest.java index a6af13b255..094462087b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTest.java @@ -36,6 +36,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQTransactionOutcomeUnknownExc import org.apache.activemq.artemis.api.core.ActiveMQTransactionRolledBackException; import org.apache.activemq.artemis.api.core.Interceptor; import org.apache.activemq.artemis.api.core.Message; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; @@ -48,7 +49,6 @@ import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.api.core.client.SessionFailureListener; import org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl; import org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryInternal; -import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.core.server.cluster.ha.BackupPolicy; import org.apache.activemq.artemis.core.server.cluster.ha.HAPolicy; import org.apache.activemq.artemis.core.server.cluster.ha.ReplicaPolicy; @@ -122,7 +122,7 @@ public class FailoverTest extends FailoverTestBase { final ClientSession session = createSession(sf1, true, true); - session.createQueue(FailoverTestBase.ADDRESS, RoutingType.MULTICAST, FailoverTestBase.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS)); final ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS); @@ -189,7 +189,7 @@ public class FailoverTest extends FailoverTestBase { final ClientSession session = createSession(sf1, true, false); - session.createQueue(FailoverTestBase.ADDRESS, RoutingType.MULTICAST, FailoverTestBase.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS)); final ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS); @@ -259,7 +259,7 @@ public class FailoverTest extends FailoverTestBase { final ClientSession session = createSession(sf1, true, true); - session.createQueue(FailoverTestBase.ADDRESS, RoutingType.MULTICAST, FailoverTestBase.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS)); final ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS); @@ -354,7 +354,7 @@ public class FailoverTest extends FailoverTestBase { final ClientSession session = createSession(sf1, true, false, false); - session.createQueue(FailoverTestBase.ADDRESS, RoutingType.MULTICAST, FailoverTestBase.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS)); final CountDownLatch connectionFailed = new CountDownLatch(1); @@ -422,7 +422,7 @@ public class FailoverTest extends FailoverTestBase { ClientSessionFactoryInternal sf1 = (ClientSessionFactoryInternal) createSessionFactory(locator); final ClientSession session = createSession(sf1, false, false, false); - session.createQueue(FailoverTestBase.ADDRESS, RoutingType.MULTICAST, FailoverTestBase.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS)); final CountDownLatch connectionFailed = new CountDownLatch(1); @@ -501,7 +501,7 @@ public class FailoverTest extends FailoverTestBase { final ClientSession session = createSession(sf1, true, false, false); - session.createQueue(FailoverTestBase.ADDRESS, RoutingType.MULTICAST, FailoverTestBase.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS)); final ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS); @@ -552,7 +552,7 @@ public class FailoverTest extends FailoverTestBase { ClientSession session = createSession(sf, true, true); - session.createQueue(FailoverTestBase.ADDRESS, RoutingType.MULTICAST, FailoverTestBase.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS)); ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS); @@ -597,7 +597,7 @@ public class FailoverTest extends FailoverTestBase { ClientSession session = createSession(sf, true, true); - session.createQueue(FailoverTestBase.ADDRESS, RoutingType.MULTICAST, FailoverTestBase.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS)); ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS); @@ -630,7 +630,7 @@ public class FailoverTest extends FailoverTestBase { ClientSession session = createSession(sf, true, true); - session.createQueue(FailoverTestBase.ADDRESS, RoutingType.MULTICAST, FailoverTestBase.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS)); ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS); @@ -687,7 +687,7 @@ public class FailoverTest extends FailoverTestBase { ClientSession session = createSession(sf, true, true); - session.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, true); + session.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS)); //crash 1 crash(); @@ -1019,7 +1019,7 @@ public class FailoverTest extends FailoverTestBase { protected ClientSession createSessionAndQueue() throws Exception { ClientSession session = createSession(sf, false, false); - session.createQueue(FailoverTestBase.ADDRESS, RoutingType.MULTICAST, FailoverTestBase.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS)); return session; } @@ -1035,7 +1035,7 @@ public class FailoverTest extends FailoverTestBase { ClientSession session = createSession(sf); - session.createQueue(FailoverTestBase.ADDRESS, RoutingType.MULTICAST, FailoverTestBase.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS)); ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS); @@ -1307,7 +1307,7 @@ public class FailoverTest extends FailoverTestBase { Xid xid = new XidImpl("uhuhuhu".getBytes(), 126512, "auhsduashd".getBytes()); - session.createQueue(FailoverTestBase.ADDRESS, RoutingType.MULTICAST, FailoverTestBase.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS)); ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS); @@ -1343,7 +1343,7 @@ public class FailoverTest extends FailoverTestBase { Xid xid = new XidImpl("uhuhuhu".getBytes(), 126512, "auhsduashd".getBytes()); - session.createQueue(FailoverTestBase.ADDRESS, RoutingType.MULTICAST, FailoverTestBase.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS)); ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS); @@ -1380,7 +1380,7 @@ public class FailoverTest extends FailoverTestBase { Xid xid = new XidImpl("uhuhuhu".getBytes(), 126512, "auhsduashd".getBytes()); - session.createQueue(FailoverTestBase.ADDRESS, RoutingType.MULTICAST, FailoverTestBase.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS)); final ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS); @@ -1422,7 +1422,7 @@ public class FailoverTest extends FailoverTestBase { Xid xid = new XidImpl("uhuhuhu".getBytes(), 126512, "auhsduashd".getBytes()); - session.createQueue(FailoverTestBase.ADDRESS, RoutingType.MULTICAST, FailoverTestBase.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS)); ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS); @@ -1459,7 +1459,7 @@ public class FailoverTest extends FailoverTestBase { Xid xid = new XidImpl("uhuhuhu".getBytes(), 126512, "auhsduashd".getBytes()); - session.createQueue(FailoverTestBase.ADDRESS, RoutingType.MULTICAST, FailoverTestBase.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS)); ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS); @@ -1692,7 +1692,7 @@ public class FailoverTest extends FailoverTestBase { for (int j = 0; j < numConsumersPerSession; j++) { SimpleString queueName = new SimpleString("queue" + i + "-" + j); - session.createQueue(FailoverTestBase.ADDRESS, RoutingType.MULTICAST, queueName, null, true); + session.createQueue(new QueueConfiguration(queueName).setAddress(FailoverTestBase.ADDRESS)); ClientConsumer consumer = session.createConsumer(queueName); @@ -1732,7 +1732,7 @@ public class FailoverTest extends FailoverTestBase { createSessionFactory(); ClientSession session = createSession(sf, true, true); - session.createQueue(FailoverTestBase.ADDRESS, RoutingType.MULTICAST, FailoverTestBase.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS)); ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS); @@ -1762,7 +1762,7 @@ public class FailoverTest extends FailoverTestBase { ClientSession session = createSession(sf, true, true); - session.createQueue(FailoverTestBase.ADDRESS, RoutingType.MULTICAST, FailoverTestBase.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS)); ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS); @@ -1841,7 +1841,7 @@ public class FailoverTest extends FailoverTestBase { ClientSession session = createSession(sf, true, true, 0); - session.createQueue(FailoverTestBase.ADDRESS, RoutingType.MULTICAST, FailoverTestBase.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS)); ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS); @@ -1893,11 +1893,7 @@ public class FailoverTest extends FailoverTestBase { ClientSession session = createSession(sf, true, true, 0); - if (temporary) { - session.createTemporaryQueue(FailoverTestBase.ADDRESS, RoutingType.MULTICAST, FailoverTestBase.ADDRESS, null); - } else { - session.createQueue(FailoverTestBase.ADDRESS, RoutingType.MULTICAST, FailoverTestBase.ADDRESS, null, durable); - } + session.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS).setDurable(durable && !temporary).setTemporary(temporary)); ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS); @@ -1924,7 +1920,7 @@ public class FailoverTest extends FailoverTestBase { final ClientSession session = createSession(sf, true, true, 0); - session.createQueue(FailoverTestBase.ADDRESS, RoutingType.MULTICAST, FailoverTestBase.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS)); final ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS); @@ -1978,7 +1974,7 @@ public class FailoverTest extends FailoverTestBase { final ClientSession session = createSession(sf, false, false); - session.createQueue(FailoverTestBase.ADDRESS, RoutingType.MULTICAST, FailoverTestBase.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS)); ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS); @@ -2109,7 +2105,7 @@ public class FailoverTest extends FailoverTestBase { final ClientSession session = createSession(sf, false, false); - session.createQueue(FailoverTestBase.ADDRESS, RoutingType.MULTICAST, FailoverTestBase.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS)); ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS); sendMessages(session, producer, NUM_MESSAGES); @@ -2376,7 +2372,7 @@ public class FailoverTest extends FailoverTestBase { ClientSession session = createSession(sf1, false, true, true); if (createQueue) { - session.createQueue(FailoverTestBase.ADDRESS, RoutingType.MULTICAST, FailoverTestBase.ADDRESS, null, false); + session.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS).setDurable(false)); } ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverWithDivertTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverWithDivertTest.java index 943bb9deb6..82fd2074ba 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverWithDivertTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverWithDivertTest.java @@ -16,7 +16,12 @@ */ package org.apache.activemq.artemis.tests.integration.cluster.failover; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.apache.activemq.artemis.api.core.ActiveMQBuffer; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; @@ -28,16 +33,11 @@ import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryInternal; import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.config.CoreAddressConfiguration; -import org.apache.activemq.artemis.core.config.CoreQueueConfiguration; import org.apache.activemq.artemis.core.config.DivertConfiguration; import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants; import org.junit.Before; import org.junit.Test; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class FailoverWithDivertTest extends FailoverTestBase { private static final String DIVERT_ADDRESS = "jms.queue.testQueue"; @@ -78,10 +78,7 @@ public class FailoverWithDivertTest extends FailoverTestBase { CoreAddressConfiguration addrCfg = new CoreAddressConfiguration(); addrCfg.setName(address); addrCfg.addRoutingType(RoutingType.ANYCAST); - CoreQueueConfiguration qConfig = new CoreQueueConfiguration(); - qConfig.setName(name); - qConfig.setAddress(address); - addrCfg.addQueueConfiguration(qConfig); + addrCfg.addQueueConfiguration(new QueueConfiguration(name).setAddress(address)); addrConfigs.add(addrCfg); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/LiveCrashOnBackupSyncTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/LiveCrashOnBackupSyncTest.java index c788700238..426aea6c0f 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/LiveCrashOnBackupSyncTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/LiveCrashOnBackupSyncTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.cluster.failover; +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.api.core.client.ClientConsumer; @@ -154,7 +155,7 @@ public class LiveCrashOnBackupSyncTest extends ActiveMQTestBase { locator.setConnectionTTL(60_000L); final ClientSessionFactory csf = locator.createSessionFactory(); ClientSession session = csf.createSession(); - session.createQueue("LiveCrashTestQueue", RoutingType.ANYCAST, "LiveCrashTestQueue", true); + session.createQueue(new QueueConfiguration("LiveCrashTestQueue").setRoutingType(RoutingType.ANYCAST)); ClientProducer producer = session.createProducer("LiveCrashTestQueue"); ClientMessage msgs = session.createMessage(true); msgs.getBodyBuffer().writeBytes(buffer); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/LiveToLiveFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/LiveToLiveFailoverTest.java index f73785eef4..961eac8f8c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/LiveToLiveFailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/LiveToLiveFailoverTest.java @@ -20,6 +20,7 @@ import java.util.Map; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientProducer; @@ -118,7 +119,7 @@ public class LiveToLiveFailoverTest extends FailoverTest { sf2 = (ClientSessionFactoryInternal) locator.createSessionFactory(backupServer.getServer().getNodeID().toString()); ClientSession session2 = createSession(sf2, false, false); - session2.createQueue(ADDRESS, ADDRESS, null, true); + session2.createQueue(new QueueConfiguration(ADDRESS)); addSessionFactory(sf2); } @@ -146,7 +147,7 @@ public class LiveToLiveFailoverTest extends FailoverTest { sf2 = (ClientSessionFactoryInternal) locator.createSessionFactory(backupServer.getServer().getNodeID().toString()); ClientSession session2 = createSession(sf2, false, false); - session2.createQueue(ADDRESS, ADDRESS, null, true); + session2.createQueue(new QueueConfiguration(ADDRESS)); addSessionFactory(sf2); } return sf; @@ -172,7 +173,7 @@ public class LiveToLiveFailoverTest extends FailoverTest { sf2 = (ClientSessionFactoryInternal) locator.createSessionFactory(backupServer.getServer().getNodeID().toString()); addSessionFactory(sf2); ClientSession session2 = createSession(sf2, false, false); - session2.createQueue(ADDRESS, ADDRESS, null, true); + session2.createQueue(new QueueConfiguration(ADDRESS)); } } @@ -190,7 +191,7 @@ public class LiveToLiveFailoverTest extends FailoverTest { ClientSession session = createSession(sf, true, true); - session.createQueue(ADDRESS, ADDRESS, null, true); + session.createQueue(new QueueConfiguration(ADDRESS)); ClientProducer producer = session.createProducer(ADDRESS); @@ -227,7 +228,7 @@ public class LiveToLiveFailoverTest extends FailoverTest { ClientSession session = createSession(sf); - //session.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true); + //session.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS)); ClientProducer producer = session.createProducer(ADDRESS); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/MultipleBackupsFailoverTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/MultipleBackupsFailoverTestBase.java index b8f50f2306..4e0362afef 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/MultipleBackupsFailoverTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/MultipleBackupsFailoverTestBase.java @@ -20,6 +20,7 @@ import java.util.Map; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; @@ -81,7 +82,7 @@ public abstract class MultipleBackupsFailoverTestBase extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); if (createQueue) { - session.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, false); + session.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS).setDurable(false)); } ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NettyFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NettyFailoverTest.java index 88549dba6e..0173f9d016 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NettyFailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NettyFailoverTest.java @@ -26,6 +26,7 @@ import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ThreadFactory; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; import org.apache.activemq.artemis.api.core.client.ClientConsumer; @@ -175,7 +176,7 @@ public class NettyFailoverTest extends FailoverTest { ClientSession session = createSession(sf, true, true, 0); - session.createQueue(ADDRESS, ADDRESS, null, true); + session.createQueue(new QueueConfiguration(ADDRESS)); ClientProducer producer = session.createProducer(ADDRESS); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NettyReplicationStopTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NettyReplicationStopTest.java index 64343e308e..88678c5e21 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NettyReplicationStopTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NettyReplicationStopTest.java @@ -22,6 +22,7 @@ import java.util.Map; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -96,7 +97,7 @@ public class NettyReplicationStopTest extends FailoverTestBase { ClientSession session = sf.createSession(true, true); - session.createQueue(ADDRESS, ADDRESS, null, true); + session.createQueue(new QueueConfiguration(ADDRESS)); ClientProducer producer = session.createProducer(ADDRESS); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NetworkFailureFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NetworkFailureFailoverTest.java index 8f9f6dc7cb..b86e32983e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NetworkFailureFailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NetworkFailureFailoverTest.java @@ -24,6 +24,7 @@ import java.util.concurrent.atomic.AtomicInteger; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.Interceptor; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; import org.apache.activemq.artemis.api.core.client.ClientConsumer; @@ -219,7 +220,7 @@ public class NetworkFailureFailoverTest extends FailoverTestBase { ClientSession sessionProducer = createSession(sfProducer, true, true, 0); - sessionProducer.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true); + sessionProducer.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS)); ClientProducer producer = sessionProducer.createProducer(FailoverTestBase.ADDRESS); @@ -351,7 +352,7 @@ public class NetworkFailureFailoverTest extends FailoverTestBase { ClientSession sessionProducer = createSession(sfProducer, true, true, 0); - sessionProducer.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true); + sessionProducer.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS)); ClientProducer producer = sessionProducer.createProducer(FailoverTestBase.ADDRESS); @@ -633,7 +634,7 @@ public class NetworkFailureFailoverTest extends FailoverTestBase { final ClientSession sessionProducer = createSession(sfProducer, true, true, 0); - sessionProducer.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true); + sessionProducer.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS)); final ClientProducer producer = sessionProducer.createProducer(FailoverTestBase.ADDRESS); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NetworkIsolationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NetworkIsolationTest.java index 6daa546249..95db530039 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NetworkIsolationTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NetworkIsolationTest.java @@ -20,6 +20,7 @@ package org.apache.activemq.artemis.tests.integration.cluster.failover; import java.net.InetAddress; import java.util.concurrent.TimeUnit; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ClientSession; import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; @@ -108,7 +109,7 @@ public class NetworkIsolationTest extends FailoverTestBase { ClientSession session = createSession(sf, false, true, true); - session.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS)); Assert.assertFalse(backupServer.getServer().getNetworkHealthCheck().check()); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/PagingFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/PagingFailoverTest.java index abbc5d0029..07a8d38f32 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/PagingFailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/PagingFailoverTest.java @@ -18,6 +18,7 @@ package org.apache.activemq.artemis.tests.integration.cluster.failover; import java.util.HashMap; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; @@ -91,7 +92,7 @@ public class PagingFailoverTest extends FailoverTestBase { sf = createSessionFactoryAndWaitForTopology(locator, 2); session = addClientSession(sf.createSession(!transacted, !transacted, 0)); - session.createQueue(PagingFailoverTest.ADDRESS, PagingFailoverTest.ADDRESS, true); + session.createQueue(new QueueConfiguration(PagingFailoverTest.ADDRESS)); ClientProducer prod = session.createProducer(PagingFailoverTest.ADDRESS); @@ -167,7 +168,7 @@ public class PagingFailoverTest extends FailoverTestBase { ClientSessionFactoryInternal sf = createSessionFactoryAndWaitForTopology(locator, 2); session = sf.createSession(false, false, 0); - session.createQueue(PagingFailoverTest.ADDRESS, PagingFailoverTest.ADDRESS, true); + session.createQueue(new QueueConfiguration(PagingFailoverTest.ADDRESS)); ClientProducer prod = session.createProducer(PagingFailoverTest.ADDRESS); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicaTimeoutTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicaTimeoutTest.java index df3e2b802c..91bbd20cfd 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicaTimeoutTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicaTimeoutTest.java @@ -23,6 +23,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.Interceptor; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; @@ -167,7 +168,7 @@ public class ReplicaTimeoutTest extends ActiveMQTestBase { ClientSession session = createSession(sf, true, true); - session.createQueue(ADDRESS, ADDRESS, null, true); + session.createQueue(new QueueConfiguration(ADDRESS)); crash(liveServer, backupServer, session); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedDistributionTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedDistributionTest.java index acbca91b0f..f76ca1678f 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedDistributionTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedDistributionTest.java @@ -20,6 +20,7 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -200,8 +201,8 @@ public class ReplicatedDistributionTest extends ClusterTestBase { sessionOne = sfs[1].createSession(true, true); sessionThree = sfs[3].createSession(false, false); - sessionOne.createQueue(ReplicatedDistributionTest.ADDRESS, ReplicatedDistributionTest.ADDRESS, true); - sessionThree.createQueue(ReplicatedDistributionTest.ADDRESS, ReplicatedDistributionTest.ADDRESS, true); + sessionOne.createQueue(new QueueConfiguration(ReplicatedDistributionTest.ADDRESS)); + sessionThree.createQueue(new QueueConfiguration(ReplicatedDistributionTest.ADDRESS)); consThree = sessionThree.createConsumer(ReplicatedDistributionTest.ADDRESS); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedFailoverTest.java index f7dffe1f00..cea8706881 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedFailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedFailoverTest.java @@ -25,6 +25,7 @@ import java.util.concurrent.TimeUnit; import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpHandler; import com.sun.net.httpserver.HttpServer; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.client.ClientSession; import org.apache.activemq.artemis.component.WebServerComponent; import org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration; @@ -88,7 +89,7 @@ public class ReplicatedFailoverTest extends FailoverTest { ClientSession session = createSession(sf, true, true); - session.createQueue(ADDRESS, ADDRESS, null, true); + session.createQueue(new QueueConfiguration(ADDRESS)); crash(session); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedMultipleServerFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedMultipleServerFailoverTest.java index 383b371ca2..82777a71db 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedMultipleServerFailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedMultipleServerFailoverTest.java @@ -16,13 +16,13 @@ */ package org.apache.activemq.artemis.tests.integration.cluster.failover; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientProducer; import org.apache.activemq.artemis.api.core.client.ClientSession; import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; import org.apache.activemq.artemis.api.core.client.ServerLocator; -import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.tests.integration.cluster.util.TestableServer; import org.junit.Test; @@ -67,7 +67,7 @@ public class ReplicatedMultipleServerFailoverTest extends MultipleServerFailover ClientSession[] sessions = new ClientSession[liveServers.size()]; for (int i = 0; i < factories.length; i++) { sessions[i] = createSession(factories[i], true, true); - sessions[i].createQueue(ADDRESS, RoutingType.MULTICAST, ADDRESS, null, true); + sessions[i].createQueue(new QueueConfiguration(ADDRESS)); } //make sure bindings are ready before sending messages diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedPagedFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedPagedFailoverTest.java index 0797590bbc..7f722176e2 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedPagedFailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedPagedFailoverTest.java @@ -18,7 +18,7 @@ package org.apache.activemq.artemis.tests.integration.cluster.failover; import java.util.HashMap; -import org.apache.activemq.artemis.api.core.RoutingType; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientProducer; @@ -70,7 +70,7 @@ public class ReplicatedPagedFailoverTest extends ReplicatedFailoverTest { createSessionFactory(); ClientSession session = createSession(sf, true, true); - session.createQueue(FailoverTestBase.ADDRESS, RoutingType.MULTICAST, FailoverTestBase.ADDRESS, null, false); + session.createQueue(new QueueConfiguration(FailoverTestBase.ADDRESS).setDurable(false)); ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/MultiThreadRandomReattachTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/MultiThreadRandomReattachTestBase.java index bbf753cb9d..8299f2c62b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/MultiThreadRandomReattachTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/MultiThreadRandomReattachTestBase.java @@ -24,6 +24,7 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import org.apache.activemq.artemis.api.core.ActiveMQException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -251,7 +252,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt ClientSession session = addClientSession(sf.createSession(false, true, true)); - session.createQueue(MultiThreadRandomReattachTestBase.ADDRESS, subName, (SimpleString) null, false); + session.createQueue(new QueueConfiguration(subName).setAddress(MultiThreadRandomReattachTestBase.ADDRESS).setDurable(false)); ClientProducer producer = session.createProducer(MultiThreadRandomReattachTestBase.ADDRESS); @@ -307,7 +308,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt sessConsume.start(); - sessConsume.createQueue(MultiThreadRandomReattachTestBase.ADDRESS, subName, (SimpleString) null, false); + sessConsume.createQueue(new QueueConfiguration(subName).setAddress(MultiThreadRandomReattachTestBase.ADDRESS).setDurable(false)); ClientConsumer consumer = sessConsume.createConsumer(subName); @@ -383,7 +384,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt ClientSession sessConsume = createAutoCommitSession(sf); - sessConsume.createQueue(MultiThreadRandomReattachTestBase.ADDRESS, subName, (SimpleString) null, false); + sessConsume.createQueue(new QueueConfiguration(subName).setAddress(MultiThreadRandomReattachTestBase.ADDRESS).setDurable(false)); ClientConsumer consumer = sessConsume.createConsumer(subName); @@ -467,7 +468,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt sessConsume.start(); - sessConsume.createQueue(MultiThreadRandomReattachTestBase.ADDRESS, subName, (SimpleString) null, false); + sessConsume.createQueue(new QueueConfiguration(subName).setAddress(MultiThreadRandomReattachTestBase.ADDRESS).setDurable(false)); ClientConsumer consumer = sessConsume.createConsumer(subName); @@ -566,7 +567,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt ClientSession sessConsume = sf.createSession(false, false, false); sessConsume.addMetaData("data", RandomUtil.randomString()); - sessConsume.createQueue(MultiThreadRandomReattachTestBase.ADDRESS, subName, (SimpleString) null, false); + sessConsume.createQueue(new QueueConfiguration(subName).setAddress(MultiThreadRandomReattachTestBase.ADDRESS).setDurable(false)); ClientConsumer consumer = sessConsume.createConsumer(subName); @@ -695,7 +696,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt sessConsume.start(); - sessConsume.createQueue(MultiThreadRandomReattachTestBase.ADDRESS, subName, (SimpleString) null, false); + sessConsume.createQueue(new QueueConfiguration(subName).setAddress(MultiThreadRandomReattachTestBase.ADDRESS).setDurable(false)); ClientConsumer consumer = sessConsume.createConsumer(subName); @@ -750,7 +751,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt ClientSession sessConsume = sf.createSession(false, true, true); sessConsume.addMetaData("data", RandomUtil.randomString()); - sessConsume.createQueue(MultiThreadRandomReattachTestBase.ADDRESS, subName, (SimpleString) null, false); + sessConsume.createQueue(new QueueConfiguration(subName).setAddress(MultiThreadRandomReattachTestBase.ADDRESS).setDurable(false)); ClientConsumer consumer = sessConsume.createConsumer(subName); @@ -811,7 +812,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt sessConsume.start(); - sessConsume.createQueue(MultiThreadRandomReattachTestBase.ADDRESS, subName, (SimpleString) null, false); + sessConsume.createQueue(new QueueConfiguration(subName).setAddress(MultiThreadRandomReattachTestBase.ADDRESS).setDurable(false)); ClientConsumer consumer = sessConsume.createConsumer(subName); @@ -882,7 +883,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt ClientSession sessConsume = sf.createSession(false, false, false); sessConsume.addMetaData("data", RandomUtil.randomString()); - sessConsume.createQueue(MultiThreadRandomReattachTestBase.ADDRESS, subName, (SimpleString) null, false); + sessConsume.createQueue(new QueueConfiguration(subName).setAddress(MultiThreadRandomReattachTestBase.ADDRESS).setDurable(false)); ClientConsumer consumer = sessConsume.createConsumer(subName); @@ -942,7 +943,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt ClientSession sessCreate = sf.createSession(false, true, true); sessCreate.addMetaData("data", RandomUtil.randomString()); - sessCreate.createQueue(MultiThreadRandomReattachTestBase.ADDRESS, new SimpleString(threadNum + MultiThreadRandomReattachTestBase.ADDRESS.toString()), (SimpleString) null, false); + sessCreate.createQueue(new QueueConfiguration(new SimpleString(threadNum + MultiThreadRandomReattachTestBase.ADDRESS.toString())).setAddress(MultiThreadRandomReattachTestBase.ADDRESS).setDurable(false)); ClientSession sess = sf.createSession(false, true, true); sess.addMetaData("data", RandomUtil.randomString()); @@ -973,7 +974,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt ClientSession sessCreate = sf.createSession(false, true, true); sessCreate.addMetaData("data", RandomUtil.randomString()); - sessCreate.createQueue(MultiThreadRandomReattachTestBase.ADDRESS, new SimpleString(threadNum + MultiThreadRandomReattachTestBase.ADDRESS.toString()), (SimpleString) null, false); + sessCreate.createQueue(new QueueConfiguration(new SimpleString(threadNum + MultiThreadRandomReattachTestBase.ADDRESS.toString())).setAddress(MultiThreadRandomReattachTestBase.ADDRESS).setDurable(false)); ClientSession sess = sf.createSession(false, true, true); sess.addMetaData("data", RandomUtil.randomString()); @@ -1004,7 +1005,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt ClientSession s = sf.createSession(false, false, false); s.addMetaData("data", RandomUtil.randomString()); - s.createQueue(MultiThreadRandomReattachTestBase.ADDRESS, new SimpleString(threadNum + MultiThreadRandomReattachTestBase.ADDRESS.toString()), (SimpleString) null, false); + s.createQueue(new QueueConfiguration(new SimpleString(threadNum + MultiThreadRandomReattachTestBase.ADDRESS.toString())).setAddress(MultiThreadRandomReattachTestBase.ADDRESS).setDurable(false)); final int numConsumers = 100; @@ -1037,7 +1038,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt protected void doTestN(final ClientSessionFactory sf, final int threadNum) throws Exception { ClientSession sessCreate = sf.createSession(false, true, true); - sessCreate.createQueue(MultiThreadRandomReattachTestBase.ADDRESS, new SimpleString(threadNum + MultiThreadRandomReattachTestBase.ADDRESS.toString()), (SimpleString) null, false); + sessCreate.createQueue(new QueueConfiguration(new SimpleString(threadNum + MultiThreadRandomReattachTestBase.ADDRESS.toString())).setAddress(MultiThreadRandomReattachTestBase.ADDRESS).setDurable(false)); ClientSession sess = sf.createSession(false, true, true); sess.addMetaData("data", RandomUtil.randomString()); @@ -1077,7 +1078,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt protected void doTestO(final ClientSessionFactory sf, final int threadNum) throws Exception { ClientSession sessCreate = sf.createSession(false, true, true); - sessCreate.createQueue(MultiThreadRandomReattachTestBase.ADDRESS, new SimpleString(threadNum + MultiThreadRandomReattachTestBase.ADDRESS.toString()), (SimpleString) null, false); + sessCreate.createQueue(new QueueConfiguration(new SimpleString(threadNum + MultiThreadRandomReattachTestBase.ADDRESS.toString())).setAddress(MultiThreadRandomReattachTestBase.ADDRESS).setDurable(false)); ClientSession sess = sf.createSession(false, true, true); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/OrderReattachTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/OrderReattachTest.java index e8ba41768c..b820311cd7 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/OrderReattachTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/OrderReattachTest.java @@ -23,6 +23,7 @@ import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.TimeUnit; import org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -34,7 +35,6 @@ import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.core.client.impl.ClientSessionInternal; import org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl; import org.apache.activemq.artemis.core.server.ActiveMQServer; -import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.jms.client.ActiveMQTextMessage; import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; @@ -160,7 +160,7 @@ public class OrderReattachTest extends ActiveMQTestBase { ClientSession sessConsume = sf.createSession(false, true, true); - sessConsume.createQueue(ADDRESS, RoutingType.MULTICAST, subName, null, false); + sessConsume.createQueue(new QueueConfiguration(subName).setAddress(ADDRESS).setDurable(false)); ClientConsumer consumer = sessConsume.createConsumer(subName); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/RandomReattachTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/RandomReattachTest.java index 286a7bbd58..38f3fcb062 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/RandomReattachTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/RandomReattachTest.java @@ -26,6 +26,7 @@ import java.util.concurrent.TimeUnit; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -243,7 +244,7 @@ public class RandomReattachTest extends ActiveMQTestBase { sessConsume.start(); - sessConsume.createQueue(RandomReattachTest.ADDRESS, subName, null, false); + sessConsume.createQueue(new QueueConfiguration(subName).setAddress(RandomReattachTest.ADDRESS).setDurable(false)); ClientConsumer consumer = sessConsume.createConsumer(subName); @@ -343,7 +344,7 @@ public class RandomReattachTest extends ActiveMQTestBase { ClientSession sessConsume = sf.createSession(false, true, true); - sessConsume.createQueue(RandomReattachTest.ADDRESS, subName, null, false); + sessConsume.createQueue(new QueueConfiguration(subName).setAddress(RandomReattachTest.ADDRESS).setDurable(false)); ClientConsumer consumer = sessConsume.createConsumer(subName); @@ -445,7 +446,7 @@ public class RandomReattachTest extends ActiveMQTestBase { sessConsume.start(); - sessConsume.createQueue(RandomReattachTest.ADDRESS, subName, null, false); + sessConsume.createQueue(new QueueConfiguration(subName).setAddress(RandomReattachTest.ADDRESS).setDurable(false)); ClientConsumer consumer = sessConsume.createConsumer(subName); @@ -583,7 +584,7 @@ public class RandomReattachTest extends ActiveMQTestBase { ClientSession sessConsume = sf.createSession(false, false, false); - sessConsume.createQueue(RandomReattachTest.ADDRESS, subName, null, false); + sessConsume.createQueue(new QueueConfiguration(subName).setAddress(RandomReattachTest.ADDRESS).setDurable(false)); ClientConsumer consumer = sessConsume.createConsumer(subName); @@ -722,7 +723,7 @@ public class RandomReattachTest extends ActiveMQTestBase { sessConsume.start(); - sessConsume.createQueue(RandomReattachTest.ADDRESS, subName, null, false); + sessConsume.createQueue(new QueueConfiguration(subName).setAddress(RandomReattachTest.ADDRESS).setDurable(false)); ClientConsumer consumer = sessConsume.createConsumer(subName); @@ -796,7 +797,7 @@ public class RandomReattachTest extends ActiveMQTestBase { ClientSession sessConsume = sf.createSession(false, true, true); - sessConsume.createQueue(RandomReattachTest.ADDRESS, subName, null, false); + sessConsume.createQueue(new QueueConfiguration(subName).setAddress(RandomReattachTest.ADDRESS).setDurable(false)); ClientConsumer consumer = sessConsume.createConsumer(subName); @@ -882,7 +883,7 @@ public class RandomReattachTest extends ActiveMQTestBase { sessConsume.start(); - sessConsume.createQueue(RandomReattachTest.ADDRESS, subName, null, false); + sessConsume.createQueue(new QueueConfiguration(subName).setAddress(RandomReattachTest.ADDRESS).setDurable(false)); ClientConsumer consumer = sessConsume.createConsumer(subName); @@ -992,7 +993,7 @@ public class RandomReattachTest extends ActiveMQTestBase { ClientSession sessConsume = sf.createSession(false, false, false); - sessConsume.createQueue(RandomReattachTest.ADDRESS, subName, null, false); + sessConsume.createQueue(new QueueConfiguration(subName).setAddress(RandomReattachTest.ADDRESS).setDurable(false)); ClientConsumer consumer = sessConsume.createConsumer(subName); @@ -1094,7 +1095,7 @@ public class RandomReattachTest extends ActiveMQTestBase { protected void doTestI(final ClientSessionFactory sf) throws Exception { ClientSession sessCreate = sf.createSession(false, true, true); - sessCreate.createQueue(RandomReattachTest.ADDRESS, RandomReattachTest.ADDRESS, null, false); + sessCreate.createQueue(new QueueConfiguration(RandomReattachTest.ADDRESS).setDurable(false)); ClientSession sess = sf.createSession(false, true, true); @@ -1123,7 +1124,7 @@ public class RandomReattachTest extends ActiveMQTestBase { protected void doTestJ(final ClientSessionFactory sf) throws Exception { ClientSession sessCreate = sf.createSession(false, true, true); - sessCreate.createQueue(RandomReattachTest.ADDRESS, RandomReattachTest.ADDRESS, null, false); + sessCreate.createQueue(new QueueConfiguration(RandomReattachTest.ADDRESS).setDurable(false)); ClientSession sess = sf.createSession(false, true, true); @@ -1152,7 +1153,7 @@ public class RandomReattachTest extends ActiveMQTestBase { protected void doTestK(final ClientSessionFactory sf) throws Exception { ClientSession s = sf.createSession(false, false, false); - s.createQueue(RandomReattachTest.ADDRESS, RandomReattachTest.ADDRESS, null, false); + s.createQueue(new QueueConfiguration(RandomReattachTest.ADDRESS).setDurable(false)); final int numConsumers = 100; @@ -1180,7 +1181,7 @@ public class RandomReattachTest extends ActiveMQTestBase { protected void doTestN(final ClientSessionFactory sf) throws Exception { ClientSession sessCreate = sf.createSession(false, true, true); - sessCreate.createQueue(RandomReattachTest.ADDRESS, new SimpleString(RandomReattachTest.ADDRESS.toString()), null, false); + sessCreate.createQueue(new QueueConfiguration(new SimpleString(RandomReattachTest.ADDRESS.toString())).setAddress(RandomReattachTest.ADDRESS).setDurable(false)); ClientSession sess = sf.createSession(false, true, true); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/ReattachTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/ReattachTest.java index a20bf74062..03e1efce0f 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/ReattachTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/ReattachTest.java @@ -26,6 +26,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQExceptionType; import org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException; import org.apache.activemq.artemis.api.core.ActiveMQObjectClosedException; import org.apache.activemq.artemis.api.core.Interceptor; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -74,7 +75,7 @@ public class ReattachTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - session.createQueue(ReattachTest.ADDRESS, ReattachTest.ADDRESS, null, false); + session.createQueue(new QueueConfiguration(ReattachTest.ADDRESS).setDurable(false)); final int numIterations = 10; @@ -165,7 +166,7 @@ public class ReattachTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - session.createQueue(ReattachTest.ADDRESS, ReattachTest.ADDRESS, null, false); + session.createQueue(new QueueConfiguration(ReattachTest.ADDRESS).setDurable(false)); ClientProducer producer = session.createProducer(ReattachTest.ADDRESS); @@ -201,7 +202,7 @@ public class ReattachTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - session.createQueue(ReattachTest.ADDRESS, ReattachTest.ADDRESS, null, false); + session.createQueue(new QueueConfiguration(ReattachTest.ADDRESS).setDurable(false)); ClientProducer producer = session.createProducer(ReattachTest.ADDRESS); @@ -303,7 +304,7 @@ public class ReattachTest extends ActiveMQTestBase { session2.addFailureListener(listener); - session.createQueue(ReattachTest.ADDRESS, ReattachTest.ADDRESS, null, false); + session.createQueue(new QueueConfiguration(ReattachTest.ADDRESS).setDurable(false)); ClientProducer producer = session.createProducer(ReattachTest.ADDRESS); @@ -384,7 +385,7 @@ public class ReattachTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - session.createQueue(ReattachTest.ADDRESS, ReattachTest.ADDRESS, null, false); + session.createQueue(new QueueConfiguration(ReattachTest.ADDRESS).setDurable(false)); ClientProducer producer = session.createProducer(ReattachTest.ADDRESS); @@ -657,7 +658,7 @@ public class ReattachTest extends ActiveMQTestBase { t.start(); for (int i = 0; i < 10; i++) { - session.createQueue("address", RoutingType.ANYCAST, "queue" + i); + session.createQueue(new QueueConfiguration("queue" + i).setAddress("address").setRoutingType(RoutingType.ANYCAST)); } // @@ -698,7 +699,7 @@ public class ReattachTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - session.createQueue(ReattachTest.ADDRESS, ReattachTest.ADDRESS, null, false); + session.createQueue(new QueueConfiguration(ReattachTest.ADDRESS).setDurable(false)); ClientProducer producer = session.createProducer(ReattachTest.ADDRESS); @@ -757,7 +758,7 @@ public class ReattachTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - session.createQueue(ReattachTest.ADDRESS, ReattachTest.ADDRESS, null, false); + session.createQueue(new QueueConfiguration(ReattachTest.ADDRESS).setDurable(false)); ClientProducer producer = session.createProducer(ReattachTest.ADDRESS); @@ -836,7 +837,7 @@ public class ReattachTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - session.createQueue(ReattachTest.ADDRESS, ReattachTest.ADDRESS, null, false); + session.createQueue(new QueueConfiguration(ReattachTest.ADDRESS).setDurable(false)); ClientProducer producer = session.createProducer(ReattachTest.ADDRESS); @@ -905,7 +906,7 @@ public class ReattachTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - session.createQueue(ReattachTest.ADDRESS, ReattachTest.ADDRESS, null, false); + session.createQueue(new QueueConfiguration(ReattachTest.ADDRESS).setDurable(false)); ClientProducer producer = session.createProducer(ReattachTest.ADDRESS); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/topology/TopologyClusterTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/topology/TopologyClusterTestBase.java index b2453d83c9..337b5aa912 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/topology/TopologyClusterTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/topology/TopologyClusterTestBase.java @@ -26,6 +26,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQExceptionType; import org.apache.activemq.artemis.api.core.ActiveMQObjectClosedException; import org.apache.activemq.artemis.api.core.ActiveMQUnBlockedException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientProducer; import org.apache.activemq.artemis.api.core.client.ClientSession; @@ -35,7 +36,6 @@ import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.api.core.client.TopologyMember; import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.server.ActiveMQServer; -import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.core.server.cluster.ClusterConnection; import org.apache.activemq.artemis.core.server.cluster.ClusterManager; import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger; @@ -151,7 +151,7 @@ public abstract class TopologyClusterTestBase extends ClusterTestBase { protected ClientSession checkSessionOrReconnect(ClientSession session, ServerLocator locator) throws Exception { try { String rand = RandomUtil.randomString(); - session.createQueue(rand, RoutingType.MULTICAST, rand); + session.createQueue(new QueueConfiguration(rand)); session.deleteQueue(rand); return session; } catch (ActiveMQObjectClosedException oce) { @@ -361,7 +361,7 @@ public abstract class TopologyClusterTestBase extends ClusterTestBase { ServerLocator locator = createNonHALocator(isNetty()); ClientSessionFactory sf = createSessionFactory(locator); ClientSession session = sf.createSession(config.getClusterUser(), ActiveMQTestBase.CLUSTER_PASSWORD, false, true, true, false, 1); - session.createQueue(address, address, true); + session.createQueue(new QueueConfiguration(address)); ClientProducer producer = session.createProducer(address); sendMessages(session, producer, 100); ClientConsumer consumer = session.createConsumer(address); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/AMQPToJMSCoreTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/AMQPToJMSCoreTest.java index 08b6c811ef..45b5aa3597 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/AMQPToJMSCoreTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/AMQPToJMSCoreTest.java @@ -23,6 +23,7 @@ import javax.jms.Session; import java.net.URI; import java.util.concurrent.TimeUnit; +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.api.jms.ActiveMQJMSClient; @@ -64,7 +65,7 @@ public class AMQPToJMSCoreTest extends ActiveMQTestBase { .setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ"))); serverConfig.setSecurityEnabled(false); coreQueue = new SimpleString(queueName); - server.createQueue(coreQueue, RoutingType.ANYCAST, coreQueue, null, false, false); + server.createQueue(new QueueConfiguration(coreQueue).setRoutingType(RoutingType.ANYCAST).setDurable(false)); } @Override diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/AMQPToOpenwireTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/AMQPToOpenwireTest.java index 4dc2dfa9c9..9782cd1f7c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/AMQPToOpenwireTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/AMQPToOpenwireTest.java @@ -32,6 +32,7 @@ import java.util.concurrent.TimeUnit; import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.ActiveMQXAConnectionFactory; +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.config.Configuration; @@ -75,7 +76,7 @@ public class AMQPToOpenwireTest extends ActiveMQTestBase { serverConfig.getAddressesSettings().put("#", new AddressSettings().setAutoCreateQueues(false).setAutoCreateAddresses(false).setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ"))); serverConfig.setSecurityEnabled(false); coreQueue = new SimpleString(queueName); - server.createQueue(coreQueue, RoutingType.ANYCAST, coreQueue, null, false, false); + server.createQueue(new QueueConfiguration(coreQueue).setRoutingType(RoutingType.ANYCAST).setDurable(false)); qpidfactory = new JmsConnectionFactory("amqp://localhost:61616"); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/AMQPToStompTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/AMQPToStompTest.java index 739750e444..4106f85215 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/AMQPToStompTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/AMQPToStompTest.java @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.integration.crossprotocol; import java.net.URI; import java.util.concurrent.TimeUnit; +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.config.Configuration; @@ -58,7 +59,7 @@ public class AMQPToStompTest extends ActiveMQTestBase { .setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ"))); serverConfig.setSecurityEnabled(false); coreQueue = new SimpleString(queueName); - server.createQueue(coreQueue, RoutingType.ANYCAST, coreQueue, null, false, false); + server.createQueue(new QueueConfiguration(coreQueue).setRoutingType(RoutingType.ANYCAST).setDurable(false)); } @Override diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/MessageIDMultiProtocolTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/MessageIDMultiProtocolTest.java index e652f79283..f5275c72fb 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/MessageIDMultiProtocolTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/MessageIDMultiProtocolTest.java @@ -17,6 +17,7 @@ package org.apache.activemq.artemis.tests.integration.crossprotocol; +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.tests.integration.openwire.OpenWireTestBase; @@ -79,7 +80,7 @@ public class MessageIDMultiProtocolTest extends OpenWireTestBase { public void setupQueue() throws Exception { Wait.assertTrue(server::isStarted); Wait.assertTrue(server::isActive); - this.server.createQueue(queueName, RoutingType.ANYCAST, queueName, null, true, false, -1, false, true); + this.server.createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST)); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/OpenWireToAMQPTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/OpenWireToAMQPTest.java index a078eb58c3..394de4c362 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/OpenWireToAMQPTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/OpenWireToAMQPTest.java @@ -27,6 +27,7 @@ import javax.jms.Session; import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.ActiveMQXAConnectionFactory; +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.config.Configuration; @@ -61,7 +62,7 @@ public class OpenWireToAMQPTest extends ActiveMQTestBase { serverConfig.setSecurityEnabled(false); server.start(); coreQueue = new SimpleString(queueName); - server.createQueue(coreQueue, RoutingType.ANYCAST, coreQueue, null, false, false); + server.createQueue(new QueueConfiguration(coreQueue).setRoutingType(RoutingType.ANYCAST).setDurable(false)); qpidfactory = new JmsConnectionFactory("amqp://localhost:61616"); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/OpenwireAmqpResenderTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/OpenwireAmqpResenderTest.java index beeaad5566..2439ec9318 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/OpenwireAmqpResenderTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/OpenwireAmqpResenderTest.java @@ -25,6 +25,7 @@ import javax.jms.Queue; import javax.jms.Session; import org.apache.activemq.ActiveMQConnectionFactory; +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.config.Configuration; @@ -62,11 +63,9 @@ public class OpenwireAmqpResenderTest extends ActiveMQTestBase { serverConfig.setSecurityEnabled(false); server.start(); - SimpleString coreQueueZero = new SimpleString(QUEUE_ZERO_NAME); - server.createQueue(coreQueueZero, RoutingType.ANYCAST, coreQueueZero, null, false, false); + server.createQueue(new QueueConfiguration(QUEUE_ZERO_NAME).setRoutingType(RoutingType.ANYCAST).setDurable(false)); - SimpleString coreQueueOne = new SimpleString(QUEUE_ONE_NAME); - server.createQueue(coreQueueOne, RoutingType.ANYCAST, coreQueueOne, null, false, false); + server.createQueue(new QueueConfiguration(QUEUE_ONE_NAME).setRoutingType(RoutingType.ANYCAST).setDurable(false)); } @Override diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/RequestReplyMultiProtocolTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/RequestReplyMultiProtocolTest.java index d3efc6816a..6ca7b968bc 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/RequestReplyMultiProtocolTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/RequestReplyMultiProtocolTest.java @@ -32,6 +32,7 @@ import java.util.Arrays; import java.util.LinkedList; import java.util.List; +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.server.impl.AddressInfo; @@ -88,8 +89,8 @@ public class RequestReplyMultiProtocolTest extends OpenWireTestBase { public void setupQueue() throws Exception { Wait.assertTrue(server::isStarted); Wait.assertTrue(server::isActive); - this.server.createQueue(queueName, RoutingType.ANYCAST, queueName, null, true, false, -1, false, true); - this.server.createQueue(replyQueue, RoutingType.ANYCAST, replyQueue, null, true, false, -1, false, true); + this.server.createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST)); + this.server.createQueue(new QueueConfiguration(replyQueue).setRoutingType(RoutingType.ANYCAST)); AddressInfo info = new AddressInfo(topicName, RoutingType.MULTICAST); this.server.addAddressInfo(info); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/RequestReplyNonJMSTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/RequestReplyNonJMSTest.java index a523bd2a1b..96e4d6b86e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/RequestReplyNonJMSTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/RequestReplyNonJMSTest.java @@ -28,6 +28,7 @@ import java.net.URI; import java.util.Arrays; import java.util.UUID; +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.server.impl.AddressInfo; @@ -79,8 +80,8 @@ public class RequestReplyNonJMSTest extends OpenWireTestBase { public void setupQueue() throws Exception { Wait.assertTrue(server::isStarted); Wait.assertTrue(server::isActive); - this.server.createQueue(queueName, RoutingType.ANYCAST, queueName, null, true, false, -1, false, true); - this.server.createQueue(replyQueue, RoutingType.ANYCAST, replyQueue, null, true, false, -1, false, true); + this.server.createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST)); + this.server.createQueue(new QueueConfiguration(replyQueue).setRoutingType(RoutingType.ANYCAST)); AddressInfo info = new AddressInfo(topicName, RoutingType.MULTICAST); this.server.addAddressInfo(info); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/divert/DivertTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/divert/DivertTest.java index f851872719..ad75c08d26 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/divert/DivertTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/divert/DivertTest.java @@ -32,6 +32,7 @@ import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; import org.apache.activemq.artemis.api.core.Message; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -122,9 +123,9 @@ public class DivertTest extends ActiveMQTestBase { final SimpleString queueName2 = new SimpleString("queue2"); - session.createQueue(new SimpleString(forwardAddress), RoutingType.MULTICAST, queueName1, null, false); + session.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress).setDurable(false)); - session.createQueue(new SimpleString(testAddress), RoutingType.MULTICAST, queueName2, null, false); + session.createQueue(new QueueConfiguration(queueName2).setAddress(testAddress).setDurable(false)); session.start(); @@ -205,11 +206,11 @@ public class DivertTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - session.createQueue(new SimpleString(testAddress), RoutingType.ANYCAST, queueName1, null, true); + session.createQueue(new QueueConfiguration(queueName1).setAddress(testAddress).setRoutingType(RoutingType.ANYCAST)); - session.createQueue(new SimpleString(testForConvert), RoutingType.ANYCAST, SimpleString.toSimpleString(testForConvert), null, true); + session.createQueue(new QueueConfiguration(SimpleString.toSimpleString(testForConvert)).setAddress(testForConvert).setRoutingType(RoutingType.ANYCAST)); - session.createQueue(new SimpleString(forwardAddress), RoutingType.ANYCAST, queueName2, null, true); + session.createQueue(new QueueConfiguration(queueName2).setAddress(forwardAddress).setRoutingType(RoutingType.ANYCAST)); } ConnectionFactory coreCF = CFUtil.createConnectionFactory("CORE", "tcp://localhost:61616"); @@ -280,9 +281,9 @@ public class DivertTest extends ActiveMQTestBase { final SimpleString queueName2 = new SimpleString("queue2"); - session.createQueue(new SimpleString(forwardAddress), RoutingType.ANYCAST, queueName1, null, false); + session.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress).setRoutingType(RoutingType.ANYCAST).setDurable(false)); - session.createQueue(new SimpleString(testAddress), RoutingType.MULTICAST, queueName2, null, false); + session.createQueue(new QueueConfiguration(queueName2).setAddress(testAddress).setDurable(false)); session.start(); @@ -355,9 +356,9 @@ public class DivertTest extends ActiveMQTestBase { final SimpleString queueName2 = new SimpleString("queue2"); - session.createQueue(new SimpleString(forwardAddress), RoutingType.ANYCAST, queueName1, null, false); + session.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress).setRoutingType(RoutingType.ANYCAST).setDurable(false)); - session.createQueue(new SimpleString(testAddress), RoutingType.MULTICAST, queueName2, null, false); + session.createQueue(new QueueConfiguration(queueName2).setAddress(testAddress).setDurable(false)); session.start(); @@ -420,11 +421,11 @@ public class DivertTest extends ActiveMQTestBase { final SimpleString queueName2 = new SimpleString("queue2"); - session.createQueue(new SimpleString(forwardAddress), RoutingType.MULTICAST, queueName1, null, true); + session.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress)); - session.createQueue(new SimpleString(testAddress), RoutingType.MULTICAST, queueName2, null, true); + session.createQueue(new QueueConfiguration(queueName2).setAddress(testAddress)); - session.createQueue(new SimpleString(expiryAddress), RoutingType.MULTICAST, new SimpleString(expiryAddress), null, true); + session.createQueue(new QueueConfiguration(expiryAddress)); session.start(); @@ -525,13 +526,13 @@ public class DivertTest extends ActiveMQTestBase { final SimpleString queueName4 = new SimpleString("queue4"); - session.createQueue(new SimpleString(forwardAddress), RoutingType.MULTICAST, queueName1, null, false); + session.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress).setDurable(false)); - session.createQueue(new SimpleString(testAddress), RoutingType.MULTICAST, queueName2, null, false); + session.createQueue(new QueueConfiguration(queueName2).setAddress(testAddress).setDurable(false)); - session.createQueue(new SimpleString(testAddress), RoutingType.MULTICAST, queueName3, null, false); + session.createQueue(new QueueConfiguration(queueName3).setAddress(testAddress).setDurable(false)); - session.createQueue(new SimpleString(testAddress), RoutingType.MULTICAST, queueName4, null, false); + session.createQueue(new QueueConfiguration(queueName4).setAddress(testAddress).setDurable(false)); session.start(); @@ -627,7 +628,7 @@ public class DivertTest extends ActiveMQTestBase { final SimpleString queueName1 = new SimpleString("queue1"); - session.createQueue(new SimpleString(forwardAddress), RoutingType.MULTICAST, queueName1, null, false); + session.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress).setDurable(false)); session.start(); @@ -687,11 +688,11 @@ public class DivertTest extends ActiveMQTestBase { final SimpleString queueName4 = new SimpleString("queue4"); - session.createQueue(new SimpleString(forwardAddress), RoutingType.MULTICAST, queueName1, null, false); + session.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress).setDurable(false)); - session.createQueue(new SimpleString(testAddress), RoutingType.MULTICAST, queueName2, null, false); - session.createQueue(new SimpleString(testAddress), RoutingType.MULTICAST, queueName3, null, false); - session.createQueue(new SimpleString(testAddress), RoutingType.MULTICAST, queueName4, null, false); + session.createQueue(new QueueConfiguration(queueName2).setAddress(testAddress).setDurable(false)); + session.createQueue(new QueueConfiguration(queueName3).setAddress(testAddress).setDurable(false)); + session.createQueue(new QueueConfiguration(queueName4).setAddress(testAddress).setDurable(false)); session.start(); @@ -773,13 +774,13 @@ public class DivertTest extends ActiveMQTestBase { final SimpleString queueName4 = new SimpleString("queue4"); - session.createQueue(new SimpleString(forwardAddress1), RoutingType.MULTICAST, queueName1, null, false); + session.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress1).setDurable(false)); - session.createQueue(new SimpleString(forwardAddress2), RoutingType.MULTICAST, queueName2, null, false); + session.createQueue(new QueueConfiguration(queueName2).setAddress(forwardAddress2).setDurable(false)); - session.createQueue(new SimpleString(forwardAddress3), RoutingType.MULTICAST, queueName3, null, false); + session.createQueue(new QueueConfiguration(queueName3).setAddress(forwardAddress3).setDurable(false)); - session.createQueue(new SimpleString(testAddress), RoutingType.MULTICAST, queueName4, null, false); + session.createQueue(new QueueConfiguration(queueName4).setAddress(testAddress).setDurable(false)); session.start(); @@ -888,13 +889,13 @@ public class DivertTest extends ActiveMQTestBase { final SimpleString queueName4 = new SimpleString("queue4"); - session.createQueue(new SimpleString(forwardAddress1), RoutingType.MULTICAST, queueName1, null, false); + session.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress1).setDurable(false)); - session.createQueue(new SimpleString(forwardAddress2), RoutingType.MULTICAST, queueName2, null, false); + session.createQueue(new QueueConfiguration(queueName2).setAddress(forwardAddress2).setDurable(false)); - session.createQueue(new SimpleString(forwardAddress3), RoutingType.MULTICAST, queueName3, null, false); + session.createQueue(new QueueConfiguration(queueName3).setAddress(forwardAddress3).setDurable(false)); - session.createQueue(new SimpleString(testAddress), RoutingType.MULTICAST, queueName4, null, false); + session.createQueue(new QueueConfiguration(queueName4).setAddress(testAddress).setDurable(false)); session.start(); @@ -992,13 +993,13 @@ public class DivertTest extends ActiveMQTestBase { final SimpleString queueName4 = new SimpleString("queue4"); - session.createQueue(new SimpleString(forwardAddress1), RoutingType.MULTICAST, queueName1, null, false); + session.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress1).setDurable(false)); - session.createQueue(new SimpleString(forwardAddress2), RoutingType.MULTICAST, queueName2, null, false); + session.createQueue(new QueueConfiguration(queueName2).setAddress(forwardAddress2).setDurable(false)); - session.createQueue(new SimpleString(forwardAddress3), RoutingType.MULTICAST, queueName3, null, false); + session.createQueue(new QueueConfiguration(queueName3).setAddress(forwardAddress3).setDurable(false)); - session.createQueue(new SimpleString(testAddress), RoutingType.MULTICAST, queueName4, null, false); + session.createQueue(new QueueConfiguration(queueName4).setAddress(testAddress).setDurable(false)); session.start(); @@ -1090,13 +1091,13 @@ public class DivertTest extends ActiveMQTestBase { final SimpleString queueName4 = new SimpleString("queue4"); - session.createQueue(new SimpleString(forwardAddress1), RoutingType.MULTICAST, queueName1, null, false); + session.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress1).setDurable(false)); - session.createQueue(new SimpleString(forwardAddress2), RoutingType.MULTICAST, queueName2, null, false); + session.createQueue(new QueueConfiguration(queueName2).setAddress(forwardAddress2).setDurable(false)); - session.createQueue(new SimpleString(forwardAddress3), RoutingType.MULTICAST, queueName3, null, false); + session.createQueue(new QueueConfiguration(queueName3).setAddress(forwardAddress3).setDurable(false)); - session.createQueue(new SimpleString(testAddress), RoutingType.MULTICAST, queueName4, null, false); + session.createQueue(new QueueConfiguration(queueName4).setAddress(testAddress).setDurable(false)); session.start(); @@ -1236,13 +1237,13 @@ public class DivertTest extends ActiveMQTestBase { final SimpleString queueName4 = new SimpleString("queue4"); - session.createQueue(new SimpleString(forwardAddress1), RoutingType.MULTICAST, queueName1, null, false); + session.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress1).setDurable(false)); - session.createQueue(new SimpleString(forwardAddress2), RoutingType.MULTICAST, queueName2, null, false); + session.createQueue(new QueueConfiguration(queueName2).setAddress(forwardAddress2).setDurable(false)); - session.createQueue(new SimpleString(forwardAddress3), RoutingType.MULTICAST, queueName3, null, false); + session.createQueue(new QueueConfiguration(queueName3).setAddress(forwardAddress3).setDurable(false)); - session.createQueue(new SimpleString(testAddress), RoutingType.MULTICAST, queueName4, null, false); + session.createQueue(new QueueConfiguration(queueName4).setAddress(testAddress).setDurable(false)); session.start(); @@ -1361,13 +1362,13 @@ public class DivertTest extends ActiveMQTestBase { final SimpleString queueName4 = new SimpleString("queue4"); - session.createQueue(new SimpleString(forwardAddress1), RoutingType.MULTICAST, queueName1, null, false); + session.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress1).setDurable(false)); - session.createQueue(new SimpleString(forwardAddress2), RoutingType.MULTICAST, queueName2, null, false); + session.createQueue(new QueueConfiguration(queueName2).setAddress(forwardAddress2).setDurable(false)); - session.createQueue(new SimpleString(forwardAddress3), RoutingType.MULTICAST, queueName3, null, false); + session.createQueue(new QueueConfiguration(queueName3).setAddress(forwardAddress3).setDurable(false)); - session.createQueue(new SimpleString(testAddress), RoutingType.MULTICAST, queueName4, null, false); + session.createQueue(new QueueConfiguration(queueName4).setAddress(testAddress).setDurable(false)); session.start(); @@ -1449,7 +1450,7 @@ public class DivertTest extends ActiveMQTestBase { ActiveMQServer server = addServer(new ActiveMQServerImpl(createBasicConfig(), null, null, null, serviceRegistry)); server.start(); server.waitForActivation(100, TimeUnit.MILLISECONDS); - server.createQueue(ADDRESS, RoutingType.MULTICAST, SimpleString.toSimpleString("myQueue"), null, false, false); + server.createQueue(new QueueConfiguration("myQueue").setAddress(ADDRESS).setDurable(false)); server.deployDivert(new DivertConfiguration().setName(DIVERT).setAddress(ADDRESS.toString()).setForwardingAddress(ADDRESS.toString())); Collection bindings = server.getPostOffice().getBindingsForAddress(ADDRESS).getBindings(); Divert divert = null; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/divert/PersistentDivertTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/divert/PersistentDivertTest.java index 38489303ad..f132ab91f3 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/divert/PersistentDivertTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/divert/PersistentDivertTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.divert; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; import org.apache.activemq.artemis.api.core.client.ClientConsumer; @@ -81,13 +82,13 @@ public class PersistentDivertTest extends ActiveMQTestBase { final SimpleString queueName4 = new SimpleString("queue4"); - session.createQueue(new SimpleString(forwardAddress1), queueName1, null, true); + session.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress1)); - session.createQueue(new SimpleString(forwardAddress2), queueName2, null, true); + session.createQueue(new QueueConfiguration(queueName2).setAddress(forwardAddress2)); - session.createQueue(new SimpleString(forwardAddress3), queueName3, null, true); + session.createQueue(new QueueConfiguration(queueName3).setAddress(forwardAddress3)); - session.createQueue(new SimpleString(testAddress), queueName4, null, true); + session.createQueue(new QueueConfiguration(queueName4).setAddress(testAddress)); session.start(); @@ -236,13 +237,13 @@ public class PersistentDivertTest extends ActiveMQTestBase { final SimpleString queueName4 = new SimpleString("queue4"); - session.createQueue(new SimpleString(forwardAddress1), queueName1, null, true); + session.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress1)); - session.createQueue(new SimpleString(forwardAddress2), queueName2, null, true); + session.createQueue(new QueueConfiguration(queueName2).setAddress(forwardAddress2)); - session.createQueue(new SimpleString(forwardAddress3), queueName3, null, true); + session.createQueue(new QueueConfiguration(queueName3).setAddress(forwardAddress3)); - session.createQueue(new SimpleString(testAddress), queueName4, null, true); + session.createQueue(new QueueConfiguration(queueName4).setAddress(testAddress)); ClientProducer producer = session.createProducer(new SimpleString(testAddress)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/divert/ReplicationWithDivertTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/divert/ReplicationWithDivertTest.java index dc179f92c7..400c822983 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/divert/ReplicationWithDivertTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/divert/ReplicationWithDivertTest.java @@ -25,14 +25,14 @@ import javax.jms.Session; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import org.apache.activemq.artemis.api.core.QueueConfiguration; +import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.FailoverEventListener; import org.apache.activemq.artemis.api.core.client.FailoverEventType; import org.apache.activemq.artemis.core.config.Configuration; -import org.apache.activemq.artemis.core.config.CoreQueueConfiguration; import org.apache.activemq.artemis.core.config.DivertConfiguration; import org.apache.activemq.artemis.core.server.ActiveMQServer; -import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.jms.client.ActiveMQConnection; import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; @@ -99,14 +99,14 @@ public class ReplicationWithDivertTest extends ActiveMQTestBase { backupConfig = createDefaultInVMConfig().setBindingsDirectory(getBindingsDir(0, true)). setJournalDirectory(getJournalDir(0, true)).setPagingDirectory(getPageDir(0, true)). setLargeMessagesDirectory(getLargeMessagesDir(0, true)); - backupConfig.addQueueConfiguration(new CoreQueueConfiguration().setAddress(SOURCE_QUEUE).setName(SOURCE_QUEUE).setRoutingType(RoutingType.ANYCAST)); - backupConfig.addQueueConfiguration(new CoreQueueConfiguration().setAddress(TARGET_QUEUE).setName(TARGET_QUEUE).setRoutingType(RoutingType.ANYCAST)); + backupConfig.addQueueConfiguration(new QueueConfiguration(SOURCE_QUEUE).setRoutingType(RoutingType.ANYCAST)); + backupConfig.addQueueConfiguration(new QueueConfiguration(TARGET_QUEUE).setRoutingType(RoutingType.ANYCAST)); DivertConfiguration divertConfiguration = new DivertConfiguration().setName("Test").setAddress(SOURCE_QUEUE).setForwardingAddress(TARGET_QUEUE).setRoutingName("Test"); liveConfig = createDefaultInVMConfig(); - liveConfig.addQueueConfiguration(new CoreQueueConfiguration().setAddress(SOURCE_QUEUE).setName(SOURCE_QUEUE).setDurable(true).setRoutingType(RoutingType.ANYCAST)); - liveConfig.addQueueConfiguration(new CoreQueueConfiguration().setAddress(TARGET_QUEUE).setName(TARGET_QUEUE).setDurable(true).setRoutingType(RoutingType.ANYCAST)); + liveConfig.addQueueConfiguration(new QueueConfiguration(SOURCE_QUEUE).setRoutingType(RoutingType.ANYCAST)); + liveConfig.addQueueConfiguration(new QueueConfiguration(TARGET_QUEUE).setRoutingType(RoutingType.ANYCAST)); liveConfig.addDivertConfiguration(divertConfiguration); backupConfig.addDivertConfiguration(divertConfiguration); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/federation/FederatedAddressTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/federation/FederatedAddressTest.java index bc876613d8..9bb6059a4c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/federation/FederatedAddressTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/federation/FederatedAddressTest.java @@ -524,7 +524,7 @@ public class FederatedAddressTest extends FederatedTestBase { //Set queue up on all three brokers // for (int i = 0; i < 3; i++) { -// getServer(i).createQueue(SimpleString.toSimpleString(queueName), RoutingType.ANYCAST, SimpleString.toSimpleString(queueName), null, true, false); +// getServer(i).createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST)); // } //Connect broker 0 (consumer will be here at end of chain) to broker 1 diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/federation/FederatedTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/federation/FederatedTestBase.java index 1cb6f19baa..0cc4995a86 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/federation/FederatedTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/federation/FederatedTestBase.java @@ -16,17 +16,17 @@ */ package org.apache.activemq.artemis.tests.integration.federation; -import java.util.ArrayList; -import java.util.List; import javax.management.MBeanServer; import javax.management.MBeanServerFactory; +import java.util.ArrayList; +import java.util.List; +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.config.Configuration; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServers; -import org.apache.activemq.artemis.core.server.impl.AddressInfo; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.junit.Before; @@ -65,8 +65,7 @@ public class FederatedTestBase extends ActiveMQTestBase { protected void createSimpleQueue(ActiveMQServer server, String queueName) throws Exception { SimpleString simpleStringQueueName = SimpleString.toSimpleString(queueName); try { - server.addAddressInfo(new AddressInfo(simpleStringQueueName, RoutingType.ANYCAST)); - server.createQueue(simpleStringQueueName, RoutingType.ANYCAST, simpleStringQueueName, null, true, false); + server.createQueue(new QueueConfiguration(simpleStringQueueName).setRoutingType(RoutingType.ANYCAST).setAutoCreateAddress(true)); } catch (Exception ignored) { } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/http/CoreClientOverHttpTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/http/CoreClientOverHttpTest.java index 7393498a2a..bdcf1c5624 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/http/CoreClientOverHttpTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/http/CoreClientOverHttpTest.java @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.integration.http; import java.util.HashMap; import java.util.Random; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; @@ -64,7 +65,7 @@ public class CoreClientOverHttpTest extends ActiveMQTestBase { ClientSessionFactory sf = createSessionFactory(locator); ClientSession session = sf.createSession(false, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); @@ -98,7 +99,7 @@ public class CoreClientOverHttpTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); @@ -113,7 +114,7 @@ public class CoreClientOverHttpTest extends ActiveMQTestBase { ClientSessionFactory sf = createSessionFactory(locator); ClientSession session = sf.createSession(false, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/interceptors/InterceptorTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/interceptors/InterceptorTest.java index eff1615096..c283a7ea40 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/interceptors/InterceptorTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/interceptors/InterceptorTest.java @@ -30,6 +30,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQExceptionType; import org.apache.activemq.artemis.api.core.Interceptor; import org.apache.activemq.artemis.api.core.Message; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -397,7 +398,7 @@ public class InterceptorTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); @@ -464,9 +465,9 @@ public class InterceptorTest extends ActiveMQTestBase { ClientSession sessionAnotherUser = sf.createSession("an", "other", false, false, false, false, 0); - session.createQueue(QUEUE, QUEUE, null, true); + session.createQueue(new QueueConfiguration(QUEUE)); - sessionAnotherUser.createQueue(QUEUE, ANOTHER_QUEUE, null, true); + sessionAnotherUser.createQueue(new QueueConfiguration(ANOTHER_QUEUE).setAddress(QUEUE)); ClientProducer prod = session.createProducer(QUEUE); @@ -517,7 +518,7 @@ public class InterceptorTest extends ActiveMQTestBase { ClientSession sessionAnotherUser = sf.createSession("an", "other", false, false, false, false, 0); - session.createQueue(QUEUE, QUEUE, null, true); + session.createQueue(new QueueConfiguration(QUEUE)); ClientProducer prod = session.createProducer(QUEUE); @@ -564,7 +565,7 @@ public class InterceptorTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); @@ -597,7 +598,7 @@ public class InterceptorTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); @@ -650,7 +651,7 @@ public class InterceptorTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); @@ -703,7 +704,7 @@ public class InterceptorTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); @@ -737,7 +738,7 @@ public class InterceptorTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); @@ -772,7 +773,7 @@ public class InterceptorTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); @@ -803,7 +804,7 @@ public class InterceptorTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); @@ -887,7 +888,7 @@ public class InterceptorTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); @@ -965,7 +966,7 @@ public class InterceptorTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); @@ -1026,7 +1027,7 @@ public class InterceptorTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); @@ -1053,7 +1054,7 @@ public class InterceptorTest extends ActiveMQTestBase { public void testInterceptorOnURI() throws Exception { locator.close(); - server.createQueue(QUEUE, RoutingType.ANYCAST, QUEUE, null, true, false); + server.createQueue(new QueueConfiguration(QUEUE).setRoutingType(RoutingType.ANYCAST)); String uri = "tcp://localhost:61616?incomingInterceptorList=" + Incoming.class.getCanonicalName() + "&outgoingInterceptorList=" + Outgoing.class.getName(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jdbc/store/journal/ShutdownServerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jdbc/store/journal/ShutdownServerTest.java index cf2815c677..61ebc65551 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jdbc/store/journal/ShutdownServerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jdbc/store/journal/ShutdownServerTest.java @@ -17,6 +17,7 @@ package org.apache.activemq.artemis.tests.integration.jdbc.store.journal; import org.apache.activemq.artemis.api.core.Message; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -60,7 +61,7 @@ public class ShutdownServerTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true, false); - session.createQueue(QUEUE, QUEUE, null, true); + session.createQueue(new QueueConfiguration(QUEUE)); ClientConsumer consumer = session.createConsumer(QUEUE); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/ActiveMQConnectionFactoryTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/ActiveMQConnectionFactoryTest.java index c235c5c6c8..8ab5ba65de 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/ActiveMQConnectionFactoryTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/ActiveMQConnectionFactoryTest.java @@ -35,6 +35,7 @@ import java.util.Map; import org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration; import org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration; +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.api.core.TransportConfiguration; @@ -244,7 +245,8 @@ public class ActiveMQConnectionFactoryTest extends ActiveMQTestBase { private void testDeserializationOptions(boolean useJndi, boolean useBrowser) throws Exception { String qname = "SerialTestQueue"; SimpleString qaddr = new SimpleString(qname); - liveService.createQueue(qaddr, RoutingType.ANYCAST, qaddr, null, true, false); + liveService.createQueue(new QueueConfiguration(qaddr) + .setRoutingType(RoutingType.ANYCAST)); //default ok String blackList = null; @@ -317,7 +319,7 @@ public class ActiveMQConnectionFactoryTest extends ActiveMQTestBase { String qname = "SerialTestQueue"; SimpleString qaddr = new SimpleString(qname); - liveService.createQueue(qaddr, RoutingType.ANYCAST, qaddr, null, true, false); + liveService.createQueue(new QueueConfiguration(qaddr).setRoutingType(RoutingType.ANYCAST)); try { String blackList = null; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/JmsProducerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/JmsProducerTest.java index 1dae11f77a..80d83dcfcb 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/JmsProducerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/JmsProducerTest.java @@ -28,6 +28,7 @@ import javax.jms.TextMessage; import java.util.ArrayList; import java.util.Random; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.core.client.impl.ClientSessionImpl; import org.apache.activemq.artemis.api.core.RoutingType; @@ -96,7 +97,7 @@ public class JmsProducerTest extends JMSTestBase { @Test public void multipleSendsUsingSetters() throws Exception { - server.createQueue(SimpleString.toSimpleString("q1"), RoutingType.ANYCAST, SimpleString.toSimpleString("q1"), null, true, false); + server.createQueue(new QueueConfiguration("q1").setRoutingType(RoutingType.ANYCAST)); Queue q1 = context.createQueue("q1"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/ManualReconnectionToSingleServerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/ManualReconnectionToSingleServerTest.java index 1d63835c60..1d4df12799 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/ManualReconnectionToSingleServerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/ManualReconnectionToSingleServerTest.java @@ -31,10 +31,10 @@ import java.util.ArrayList; import java.util.Date; import java.util.concurrent.CountDownLatch; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient; import org.apache.activemq.artemis.core.config.Configuration; -import org.apache.activemq.artemis.core.config.CoreQueueConfiguration; import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; @@ -136,7 +136,7 @@ public class ManualReconnectionToSingleServerTest extends ActiveMQTestBase { Configuration configuration = new ConfigurationImpl(); - configuration.getQueueConfigurations().add(new CoreQueueConfiguration().setName(QUEUE_NAME)); + configuration.getQueueConfigs().add(new QueueConfiguration(QUEUE_NAME)); ArrayList configs = new ArrayList<>(); configs.add(new TransportConfiguration(NETTY_CONNECTOR_FACTORY)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/ConsumerDelayDispatchTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/ConsumerDelayDispatchTest.java index 51ccaf7c91..3240911484 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/ConsumerDelayDispatchTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/ConsumerDelayDispatchTest.java @@ -25,6 +25,8 @@ import javax.jms.MessageConsumer; import javax.jms.MessageProducer; import javax.jms.Session; import javax.jms.TextMessage; + +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.tests.util.JMSTestBase; @@ -46,9 +48,8 @@ public class ConsumerDelayDispatchTest extends JMSTestBase { @Before public void setUp() throws Exception { super.setUp(); - server.createQueue(queueName, RoutingType.ANYCAST, queueName, null, null, true, false, false, false, false, -1, false, true, false, -1, false, null, false, 2, DELAY_BEFORE_DISPATCH, false, 0, 0, true); - server.createQueue(normalQueueName, RoutingType.ANYCAST, normalQueueName, null, null, true, false, false, false, false, -1, false, true, false, -1, false, null, false, 0, -1, false, 0, 0, true); - + server.createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST).setExclusive(true).setConsumersBeforeDispatch(2).setDelayBeforeDispatch(DELAY_BEFORE_DISPATCH)); + server.createQueue(new QueueConfiguration(normalQueueName).setRoutingType(RoutingType.ANYCAST).setExclusive(true)); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/ConsumerPriorityTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/ConsumerPriorityTest.java index 47b9f5615c..c9077f5b98 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/ConsumerPriorityTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/ConsumerPriorityTest.java @@ -67,10 +67,13 @@ public class ConsumerPriorityTest extends JMSTestBase { ActiveMQDestination b = (ActiveMQDestination) queue1; assertEquals(3, b.getQueueAttributes().getConsumerPriority().intValue()); + assertEquals(3, b.getQueueConfiguration().getConsumerPriority().intValue()); ActiveMQDestination c = (ActiveMQDestination) queue2; assertEquals(2, c.getQueueAttributes().getConsumerPriority().intValue()); + assertEquals(2, c.getQueueConfiguration().getConsumerPriority().intValue()); ActiveMQDestination d = (ActiveMQDestination) queue3; assertEquals(1, d.getQueueAttributes().getConsumerPriority().intValue()); + assertEquals(1, d.getQueueConfiguration().getConsumerPriority().intValue()); MessageProducer producer = session.createProducer(queue); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/ExclusiveTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/ExclusiveTest.java index 1331615623..f1f70d2cbf 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/ExclusiveTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/ExclusiveTest.java @@ -29,6 +29,7 @@ import javax.jms.Session; import javax.jms.TextMessage; import javax.jms.Topic; +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.jms.client.ActiveMQDestination; @@ -47,7 +48,7 @@ public class ExclusiveTest extends JMSTestBase { @Before public void setUp() throws Exception { super.setUp(); - server.createQueue(queueName, RoutingType.ANYCAST, queueName, null, null, true, false, false, false, false, -1, false, true, false,true); + server.createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST).setExclusive(true)); } @@ -159,6 +160,7 @@ public class ExclusiveTest extends JMSTestBase { ActiveMQDestination a = (ActiveMQDestination) queue; assertTrue(a.getQueueAttributes().getExclusive()); + assertTrue(a.getQueueConfiguration().isExclusive()); MessageProducer producer = session.createProducer(queue); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/GroupingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/GroupingTest.java index fc32c44c2d..23de95689b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/GroupingTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/GroupingTest.java @@ -31,6 +31,7 @@ import javax.jms.TextMessage; import java.util.UUID; import org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException; +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.QueueBinding; @@ -314,8 +315,7 @@ public class GroupingTest extends JMSTestBase { String testQueueName = getName() + "_bucket_group"; - server.createQueue(SimpleString.toSimpleString(testQueueName), RoutingType.ANYCAST, SimpleString.toSimpleString(testQueueName), null, null, true, false, false, false, false, -1, false, false, false, 2, false, null, false, 0, 0, false, 0, 0, true); - + server.createQueue(new QueueConfiguration(testQueueName).setRoutingType(RoutingType.ANYCAST).setGroupBuckets(2)); JMSContext ctx = addContext(getCF().createContext(JMSContext.SESSION_TRANSACTED)); @@ -396,7 +396,7 @@ public class GroupingTest extends JMSTestBase { Assume.assumeTrue("only makes sense withOUT explicit group-id", ((ActiveMQConnectionFactory) fact).getGroupID() == null); String testQueueName = getName() + "_group_rebalance"; - server.createQueue(SimpleString.toSimpleString(testQueueName), RoutingType.ANYCAST, SimpleString.toSimpleString(testQueueName), null, null, true, false, false, false, false, -1, false, false, true, -1, false, null, false, 0, 0, false, 0, 0, true); + server.createQueue(new QueueConfiguration(testQueueName).setRoutingType(RoutingType.ANYCAST).setGroupRebalance(true)); JMSContext ctx = addContext(getCF().createContext(JMSContext.SESSION_TRANSACTED)); @@ -528,7 +528,7 @@ public class GroupingTest extends JMSTestBase { Assume.assumeTrue("only makes sense withOUT explicit group-id", ((ActiveMQConnectionFactory) fact).getGroupID() == null); String testQueueName = getName() + "_group_first_key"; - server.createQueue(SimpleString.toSimpleString(testQueueName), RoutingType.ANYCAST, SimpleString.toSimpleString(testQueueName), null, null, true, false, false, false, false, -1, false, false, true, -1, SimpleString.toSimpleString(customFirstGroupKey), false, null, false, 0, 0, false, 0, 0, true); + server.createQueue(new QueueConfiguration(testQueueName).setRoutingType(RoutingType.ANYCAST).setGroupRebalance(true).setGroupFirstKey(customFirstGroupKey)); JMSContext ctx = addContext(getCF().createContext(JMSContext.SESSION_TRANSACTED)); @@ -624,7 +624,7 @@ public class GroupingTest extends JMSTestBase { Assume.assumeTrue("only makes sense withOUT explicit group-id", ((ActiveMQConnectionFactory) fact).getGroupID() == null); String testQueueName = getName() + "_group_disable"; - server.createQueue(SimpleString.toSimpleString(testQueueName), RoutingType.ANYCAST, SimpleString.toSimpleString(testQueueName), null, null, true, false, false, false, false, -1, false, false, false, 0, false, null, false, 0, 0, false, 0, 0, true); + server.createQueue(new QueueConfiguration(testQueueName).setRoutingType(RoutingType.ANYCAST).setGroupBuckets(0)); JMSContext ctx = addContext(getCF().createContext(JMSContext.SESSION_TRANSACTED)); @@ -714,6 +714,7 @@ public class GroupingTest extends JMSTestBase { ActiveMQDestination a = (ActiveMQDestination) queue; assertEquals(Integer.valueOf(4), a.getQueueAttributes().getGroupBuckets()); + assertEquals(Integer.valueOf(4), a.getQueueConfiguration().getGroupBuckets()); MessageProducer producer = session.createProducer(queue); @@ -742,6 +743,7 @@ public class GroupingTest extends JMSTestBase { ActiveMQDestination a = (ActiveMQDestination) queue; assertTrue(a.getQueueAttributes().getGroupRebalance()); + assertTrue(a.getQueueConfiguration().isGroupRebalance()); MessageProducer producer = session.createProducer(queue); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/LVQTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/LVQTest.java index faccf9d66c..1274713b1d 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/LVQTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/LVQTest.java @@ -65,6 +65,7 @@ public class LVQTest extends JMSTestBase { ActiveMQDestination a = (ActiveMQDestination) queue; assertTrue(a.getQueueAttributes().getLastValue()); + assertTrue(a.getQueueConfiguration().isLastValue()); MessageProducer producer = session.createProducer(queue); MessageConsumer consumer1 = session.createConsumer(queue); @@ -107,6 +108,7 @@ public class LVQTest extends JMSTestBase { ActiveMQDestination a = (ActiveMQDestination) topic; assertTrue(a.getQueueAttributes().getLastValue()); + assertTrue(a.getQueueConfiguration().isLastValue()); MessageProducer producer = session.createProducer(topic); MessageConsumer consumer1 = session.createConsumer(topic); @@ -159,6 +161,7 @@ public class LVQTest extends JMSTestBase { ActiveMQDestination a = (ActiveMQDestination) queue; assertEquals("reuters_code", a.getQueueAttributes().getLastValueKey().toString()); + assertEquals("reuters_code", a.getQueueConfiguration().getLastValueKey().toString()); MessageProducer producer = session.createProducer(queue); MessageConsumer consumer1 = session.createConsumer(queue); @@ -201,6 +204,7 @@ public class LVQTest extends JMSTestBase { ActiveMQDestination a = (ActiveMQDestination) topic; assertEquals("reuters_code", a.getQueueAttributes().getLastValueKey().toString()); + assertEquals("reuters_code", a.getQueueConfiguration().getLastValueKey().toString()); MessageProducer producer = session.createProducer(topic); MessageConsumer consumer1 = session.createConsumer(topic); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/QueueAutoDeleteTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/QueueAutoDeleteTest.java index 4c078e97cf..df14e4ab59 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/QueueAutoDeleteTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/QueueAutoDeleteTest.java @@ -73,6 +73,7 @@ public class QueueAutoDeleteTest extends JMSTestBase { assertEquals(testQueueName, queue.getQueueName()); assertEquals(true, activeMQDestination.getQueueAttributes().getAutoDelete()); + assertEquals(true, activeMQDestination.getQueueConfiguration().isAutoDelete()); MessageProducer producer = session.createProducer(queue); producer.send(session.createTextMessage("hello1")); @@ -127,6 +128,7 @@ public class QueueAutoDeleteTest extends JMSTestBase { assertEquals(testQueueName, topic.getTopicName()); assertEquals(true, activeMQDestination.getQueueAttributes().getAutoDelete()); + assertEquals(true, activeMQDestination.getQueueConfiguration().isAutoDelete()); MessageConsumer consumer = session.createSharedDurableConsumer(topic, sub); @@ -240,6 +242,7 @@ public class QueueAutoDeleteTest extends JMSTestBase { assertEquals(testQueueName, queue.getQueueName()); assertEquals(false, activeMQDestination.getQueueAttributes().getAutoDelete()); + assertEquals(false, activeMQDestination.getQueueConfiguration().isAutoDelete()); MessageProducer producer = session.createProducer(queue); producer.send(session.createTextMessage("hello1")); @@ -295,6 +298,7 @@ public class QueueAutoDeleteTest extends JMSTestBase { assertEquals(testQueueName, queue.getQueueName()); assertEquals(Long.valueOf(100), activeMQDestination.getQueueAttributes().getAutoDeleteDelay()); + assertEquals(Long.valueOf(100), activeMQDestination.getQueueConfiguration().getAutoDeleteDelay()); MessageProducer producer = session.createProducer(queue); producer.send(session.createTextMessage("hello1")); @@ -354,6 +358,7 @@ public class QueueAutoDeleteTest extends JMSTestBase { assertEquals(testQueueName, queue.getQueueName()); assertEquals(Long.valueOf(1), activeMQDestination.getQueueAttributes().getAutoDeleteMessageCount()); + assertEquals(Long.valueOf(1), activeMQDestination.getQueueConfiguration().getAutoDeleteMessageCount()); MessageProducer producer = session.createProducer(queue); producer.send(session.createTextMessage("hello1")); @@ -398,6 +403,7 @@ public class QueueAutoDeleteTest extends JMSTestBase { assertEquals(testQueueName, queue.getQueueName()); assertEquals(Long.valueOf(-1), activeMQDestination.getQueueAttributes().getAutoDeleteMessageCount()); + assertEquals(Long.valueOf(-1), activeMQDestination.getQueueConfiguration().getAutoDeleteMessageCount()); MessageProducer producer = session.createProducer(queue); for (int i = 0; i < 100; i++) { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/JMSFailoverListenerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/JMSFailoverListenerTest.java index 4bd0b7ca4f..5992ff47e7 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/JMSFailoverListenerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/JMSFailoverListenerTest.java @@ -29,6 +29,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +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.api.core.TransportConfiguration; @@ -127,7 +128,7 @@ public class JMSFailoverListenerTest extends ActiveMQTestBase { SimpleString jmsQueueName = new SimpleString("myqueue"); - coreSession.createQueue(jmsQueueName, RoutingType.ANYCAST, jmsQueueName, null, true); + coreSession.createQueue(new QueueConfiguration(jmsQueueName).setRoutingType(RoutingType.ANYCAST)); Queue queue = sess.createQueue("myqueue"); @@ -202,7 +203,7 @@ public class JMSFailoverListenerTest extends ActiveMQTestBase { SimpleString jmsQueueName = new SimpleString("myqueue"); - coreSessionLive.createQueue(jmsQueueName, RoutingType.ANYCAST, jmsQueueName, null, true); + coreSessionLive.createQueue(new QueueConfiguration(jmsQueueName).setRoutingType(RoutingType.ANYCAST)); Queue queue = sessLive.createQueue("myqueue"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/JMSFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/JMSFailoverTest.java index 4b4e89b1be..83d62446a2 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/JMSFailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/JMSFailoverTest.java @@ -34,6 +34,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.Interceptor; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ClientSession; @@ -199,7 +200,7 @@ public class JMSFailoverTest extends ActiveMQTestBase { SimpleString jmsQueueName = new SimpleString("myqueue"); - coreSession.createQueue(jmsQueueName, RoutingType.ANYCAST, jmsQueueName, null, true); + coreSession.createQueue(new QueueConfiguration(jmsQueueName).setRoutingType(RoutingType.ANYCAST)); Queue queue = sess.createQueue("myqueue"); @@ -272,7 +273,7 @@ public class JMSFailoverTest extends ActiveMQTestBase { SimpleString jmsQueueName = new SimpleString("myqueue"); - coreSessionLive.createQueue(jmsQueueName, RoutingType.ANYCAST, jmsQueueName, null, true); + coreSessionLive.createQueue(new QueueConfiguration(jmsQueueName).setRoutingType(RoutingType.ANYCAST)); Queue queue = sessLive.createQueue("myqueue"); @@ -378,7 +379,7 @@ public class JMSFailoverTest extends ActiveMQTestBase { } }; - coreSession.createQueue(QUEUE, RoutingType.ANYCAST, QUEUE, true); + coreSession.createQueue(new QueueConfiguration(QUEUE).setRoutingType(RoutingType.ANYCAST)); Queue queue = sess.createQueue("somequeue"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/JMSReconnectTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/JMSReconnectTest.java index 2a7742a9ab..2527201747 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/JMSReconnectTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/JMSReconnectTest.java @@ -31,6 +31,7 @@ import javax.jms.Topic; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ClientSession; @@ -101,7 +102,7 @@ public class JMSReconnectTest extends ActiveMQTestBase { SimpleString jmsQueueName = new SimpleString("myqueue"); - coreSession.createQueue(jmsQueueName, RoutingType.ANYCAST, jmsQueueName, null, true); + coreSession.createQueue(new QueueConfiguration(jmsQueueName).setRoutingType(RoutingType.ANYCAST)); Queue queue = sess.createQueue("myqueue"); @@ -179,7 +180,7 @@ public class JMSReconnectTest extends ActiveMQTestBase { Destination dest; if (nonDurableSub) { - coreSession.createQueue("mytopic", "blahblah", null, false); + coreSession.createQueue(new QueueConfiguration("blahblah").setAddress("mytopic").setDurable(false)); dest = ActiveMQJMSClient.createTopic("mytopic"); } else { @@ -242,7 +243,7 @@ public class JMSReconnectTest extends ActiveMQTestBase { ClientSession coreSession = ((ActiveMQSession) sess).getCoreSession(); - coreSession.createQueue("mytopic", "blahblah", null, false); + coreSession.createQueue(new QueueConfiguration("blahblah").setAddress("mytopic").setDurable(false)); Topic topic = ActiveMQJMSClient.createTopic("mytopic"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/consumer/JmsConsumerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/consumer/JmsConsumerTest.java index c4fd897229..dc865d195c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/consumer/JmsConsumerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/consumer/JmsConsumerTest.java @@ -32,6 +32,7 @@ import javax.jms.QueueBrowser; import javax.jms.Session; import javax.jms.TextMessage; +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.api.core.TransportConfiguration; @@ -832,8 +833,7 @@ public class JmsConsumerTest extends JMSTestBase { //Create a new address along with 1 queue for it (this cases a wildcard address to get registered //inside the WildcardAddressManager manager when the binding is created) server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(queue1), RoutingType.ANYCAST)); - server.createQueue(SimpleString.toSimpleString(queue1), RoutingType.ANYCAST, - SimpleString.toSimpleString(queue1), null, false, false); + server.createQueue(new QueueConfiguration(queue1).setRoutingType(RoutingType.ANYCAST).setDurable(false)); //create addresses for both topics server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(topic1), RoutingType.MULTICAST)); @@ -866,8 +866,7 @@ public class JmsConsumerTest extends JMSTestBase { //Create a new address along with 1 queue for it (this cases a wildcard address to get registered //inside the WildcardAddressManager manager when the binding is created) server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(queue1), RoutingType.ANYCAST)); - server.createQueue(SimpleString.toSimpleString(queue1), RoutingType.ANYCAST, - SimpleString.toSimpleString(queue1), null, false, false); + server.createQueue(new QueueConfiguration(queue1).setRoutingType(RoutingType.ANYCAST).setDurable(false)); //create addresses for both topics server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(topic1), RoutingType.MULTICAST)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/largemessage/LargeMessageTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/largemessage/LargeMessageTestBase.java index 1b1a930892..df4500c6a5 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/largemessage/LargeMessageTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/largemessage/LargeMessageTestBase.java @@ -33,6 +33,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQBuffer; import org.apache.activemq.artemis.api.core.ActiveMQBuffers; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.Message; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -161,7 +162,7 @@ public abstract class LargeMessageTestBase extends ActiveMQTestBase { session.start(xid, XAResource.TMNOFLAGS); } - session.createQueue(ADDRESS, ADDRESS, null, true); + session.createQueue(new QueueConfiguration(ADDRESS)); ClientProducer producer = session.createProducer(ADDRESS); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/largemessage/ServerLargeMessageTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/largemessage/ServerLargeMessageTest.java index a4c256e638..35b960cdc3 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/largemessage/ServerLargeMessageTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/largemessage/ServerLargeMessageTest.java @@ -28,6 +28,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import org.apache.activemq.artemis.api.core.ActiveMQBuffer; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.Message; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; import org.apache.activemq.artemis.api.core.client.ClientConsumer; @@ -117,7 +118,7 @@ public class ServerLargeMessageTest extends ActiveMQTestBase { fileMessage.releaseResources(false); - session.createQueue("A", RoutingType.ANYCAST, "A"); + session.createQueue(new QueueConfiguration("A").setRoutingType(RoutingType.ANYCAST)); ClientProducer prod = session.createProducer("A"); @@ -172,7 +173,7 @@ public class ServerLargeMessageTest extends ActiveMQTestBase { ClientMessage clientMessage = session.createMessage(false); clientMessage.setBodyInputStream(ActiveMQTestBase.createFakeLargeStream(ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE)); - session.createQueue("A", RoutingType.ANYCAST, "A"); + session.createQueue(new QueueConfiguration("A").setRoutingType(RoutingType.ANYCAST)); ClientProducer prod = session.createProducer("A"); prod.send(clientMessage); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java index 2b5255d869..35ab95cadc 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java @@ -26,6 +26,8 @@ import javax.transaction.xa.XAResource; import javax.transaction.xa.Xid; import java.nio.ByteBuffer; import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -34,6 +36,8 @@ import java.util.UUID; import org.apache.activemq.artemis.api.core.ActiveMQBuffer; import org.apache.activemq.artemis.api.core.JsonUtil; +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.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; @@ -65,17 +69,16 @@ import org.apache.activemq.artemis.core.security.Role; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServers; import org.apache.activemq.artemis.core.server.Queue; -import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.core.server.ServerConsumer; import org.apache.activemq.artemis.core.server.ServerSession; import org.apache.activemq.artemis.core.server.impl.AddressInfo; import org.apache.activemq.artemis.core.settings.impl.DeletionPolicy; import org.apache.activemq.artemis.core.settings.impl.SlowConsumerPolicy; import org.apache.activemq.artemis.core.transaction.impl.XidImpl; -import org.apache.activemq.artemis.nativo.jlibaio.LibaioContext; import org.apache.activemq.artemis.jms.client.ActiveMQConnection; import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; import org.apache.activemq.artemis.jms.client.ActiveMQSession; +import org.apache.activemq.artemis.nativo.jlibaio.LibaioContext; import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager; import org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule; import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger; @@ -86,21 +89,35 @@ import org.apache.activemq.artemis.utils.UUIDGenerator; import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; import static org.apache.activemq.artemis.jms.client.ActiveMQConnection.JMS_SESSION_CLIENT_ID_PROPERTY; +@RunWith(Parameterized.class) public class ActiveMQServerControlTest extends ManagementTestBase { // Constants ----------------------------------------------------- // Attributes ---------------------------------------------------- + protected boolean legacyCreateQueue; + private ActiveMQServer server; private Configuration conf; private TransportConfiguration connectorConfig; + @Parameterized.Parameters(name = "legacyCreateQueue={0}") + public static Collection getParams() { + return Arrays.asList(new Object[][]{{true}, {false}}); + } + + public ActiveMQServerControlTest(boolean legacyCreateQueue) { + this.legacyCreateQueue = legacyCreateQueue; + } + // Static -------------------------------------------------------- private static boolean contains(final String name, final String[] strings) { @@ -212,7 +229,11 @@ public class ActiveMQServerControlTest extends ManagementTestBase { checkNoResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name, RoutingType.ANYCAST)); serverControl.createAddress(address.toString(), "ANYCAST"); - serverControl.createQueue(address.toString(), "ANYCAST", name.toString(), null, true, -1, false, false); + if (legacyCreateQueue) { + serverControl.createQueue(address.toString(), "ANYCAST", name.toString(), null, true, -1, false, false); + } else { + serverControl.createQueue(new QueueConfiguration(name).setAddress(address).setRoutingType(RoutingType.ANYCAST).setAutoCreateAddress(false).toJSON()); + } checkResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name, RoutingType.ANYCAST)); QueueControl queueControl = ManagementControlHelper.createQueueControl(address, name, RoutingType.ANYCAST, mbeanServer); @@ -235,7 +256,11 @@ public class ActiveMQServerControlTest extends ManagementTestBase { ActiveMQServerControl serverControl = createManagementControl(); checkNoResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name, RoutingType.ANYCAST)); - serverControl.createQueue(null, name.toString(), "ANYCAST"); + if (legacyCreateQueue) { + serverControl.createQueue(null, name.toString(), "ANYCAST"); + } else { + serverControl.createQueue(new QueueConfiguration(name).setRoutingType(RoutingType.ANYCAST).toJSON()); + } checkResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(name, name, RoutingType.ANYCAST)); QueueControl queueControl = ManagementControlHelper.createQueueControl(address, name, RoutingType.ANYCAST, mbeanServer); @@ -261,7 +286,11 @@ public class ActiveMQServerControlTest extends ManagementTestBase { checkNoResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name, RoutingType.ANYCAST)); serverControl.createAddress(address.toString(), "ANYCAST"); - serverControl.createQueue(address.toString(), "ANYCAST", name.toString(), filter, durable, -1, false, false); + if (legacyCreateQueue) { + serverControl.createQueue(address.toString(), "ANYCAST", name.toString(), filter, durable, -1, false, false); + } else { + serverControl.createQueue(new QueueConfiguration(name).setAddress(address).setRoutingType(RoutingType.ANYCAST).setFilterString(filter).setAutoCreateAddress(false).toJSON()); + } checkResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name, RoutingType.ANYCAST)); QueueControl queueControl = ManagementControlHelper.createQueueControl(address, name, RoutingType.ANYCAST, mbeanServer); @@ -286,7 +315,11 @@ public class ActiveMQServerControlTest extends ManagementTestBase { checkNoResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name, RoutingType.ANYCAST)); serverControl.createAddress(address.toString(), "ANYCAST"); - serverControl.createQueue(address.toString(), "ANYCAST", name.toString(), null, durable, -1, false, false); + if (legacyCreateQueue) { + serverControl.createQueue(address.toString(), "ANYCAST", name.toString(), null, durable, -1, false, false); + } else { + serverControl.createQueue(new QueueConfiguration(name).setAddress(address).setRoutingType(RoutingType.ANYCAST).setDurable(durable).setAutoCreateAddress(false).toJSON()); + } checkResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name, RoutingType.ANYCAST)); QueueControl queueControl = ManagementControlHelper.createQueueControl(address, name, RoutingType.ANYCAST, mbeanServer); @@ -313,7 +346,18 @@ public class ActiveMQServerControlTest extends ManagementTestBase { ActiveMQServerControl serverControl = createManagementControl(); checkNoResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name, RoutingType.ANYCAST)); - serverControl.createQueue(address.toString(), RoutingType.ANYCAST.toString(), name.toString(), null, durable, maxConsumers, purgeOnNoConsumers, autoCreateAddress); + if (legacyCreateQueue) { + serverControl.createQueue(address.toString(), RoutingType.ANYCAST.toString(), name.toString(), null, durable, maxConsumers, purgeOnNoConsumers, autoCreateAddress); + } else { + serverControl.createQueue(new QueueConfiguration(name) + .setAddress(address) + .setRoutingType(RoutingType.ANYCAST) + .setDurable(durable) + .setMaxConsumers(maxConsumers) + .setPurgeOnNoConsumers(purgeOnNoConsumers) + .setAutoCreateAddress(autoCreateAddress) + .toJSON()); + } checkResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name, RoutingType.ANYCAST)); QueueControl queueControl = ManagementControlHelper.createQueueControl(address, name, RoutingType.ANYCAST, mbeanServer); @@ -360,7 +404,31 @@ public class ActiveMQServerControlTest extends ManagementTestBase { ActiveMQServerControl serverControl = createManagementControl(); checkNoResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name, RoutingType.ANYCAST)); - serverControl.createQueue(address.toString(), RoutingType.ANYCAST.toString(), name.toString(), null, durable, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, groupFirstKey, lastValue, lastValueKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, autoDelete, autoDeleteDelay, autoDeleteMessageCount, autoCreateAddress, ringSize); + if (legacyCreateQueue) { + serverControl.createQueue(address.toString(), RoutingType.ANYCAST.toString(), name.toString(), null, durable, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, groupFirstKey, lastValue, lastValueKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, autoDelete, autoDeleteDelay, autoDeleteMessageCount, autoCreateAddress, ringSize); + } else { + serverControl.createQueue(new QueueConfiguration(name) + .setAddress(address) + .setRoutingType(RoutingType.ANYCAST) + .setDurable(durable) + .setMaxConsumers(maxConsumers) + .setPurgeOnNoConsumers(purgeOnNoConsumers) + .setExclusive(exclusive) + .setGroupRebalance(groupRebalance) + .setGroupBuckets(groupBuckets) + .setGroupFirstKey(groupFirstKey) + .setLastValue(lastValue) + .setLastValueKey(lastValueKey) + .setNonDestructive(nonDestructive) + .setConsumersBeforeDispatch(consumersBeforeDispatch) + .setDelayBeforeDispatch(delayBeforeDispatch) + .setAutoDelete(autoDelete) + .setAutoDeleteDelay(autoDeleteDelay) + .setAutoDeleteMessageCount(autoDeleteMessageCount) + .setRingSize(ringSize) + .setAutoCreateAddress(autoCreateAddress) + .toJSON()); + } checkResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name, RoutingType.ANYCAST)); QueueControl queueControl = ManagementControlHelper.createQueueControl(address, name, RoutingType.ANYCAST, mbeanServer); @@ -405,7 +473,11 @@ public class ActiveMQServerControlTest extends ManagementTestBase { checkNoResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name, RoutingType.ANYCAST)); serverControl.createAddress(address.toString(), "ANYCAST"); - serverControl.createQueue(address.toString(), "ANYCAST", name.toString(), null, durable, -1, false, false); + if (legacyCreateQueue) { + serverControl.createQueue(address.toString(), "ANYCAST", name.toString(), null, durable, -1, false, false); + } else { + serverControl.createQueue(new QueueConfiguration(name).setAddress(address).setRoutingType(RoutingType.ANYCAST).setDurable(durable).setAutoCreateAddress(false).toJSON()); + } ServerLocator receiveLocator = createInVMNonHALocator(); ClientSessionFactory receiveCsf = createSessionFactory(receiveLocator); @@ -438,7 +510,11 @@ public class ActiveMQServerControlTest extends ManagementTestBase { checkNoResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name, RoutingType.ANYCAST)); serverControl.createAddress(address.toString(), "ANYCAST"); - serverControl.createQueue(address.toString(), "ANYCAST", name.toString(), filter, durable, -1, false, false); + if (legacyCreateQueue) { + serverControl.createQueue(address.toString(), "ANYCAST", name.toString(), filter, durable, -1, false, false); + } else { + serverControl.createQueue(new QueueConfiguration(name).setAddress(address).setRoutingType(RoutingType.ANYCAST).setDurable(durable).setAutoCreateAddress(false).toJSON()); + } checkResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name, RoutingType.ANYCAST)); QueueControl queueControl = ManagementControlHelper.createQueueControl(address, name, RoutingType.ANYCAST, mbeanServer); @@ -464,7 +540,11 @@ public class ActiveMQServerControlTest extends ManagementTestBase { checkNoResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name, RoutingType.ANYCAST)); serverControl.createAddress(address.toString(), "ANYCAST"); - serverControl.createQueue(address.toString(), "ANYCAST", name.toString(), filter, durable, -1, false, false); + if (legacyCreateQueue) { + serverControl.createQueue(address.toString(), "ANYCAST", name.toString(), filter, durable, -1, false, false); + } else { + serverControl.createQueue(new QueueConfiguration(name).setAddress(address).setRoutingType(RoutingType.ANYCAST).setFilterString(filter).setDurable(durable).setAutoCreateAddress(false).toJSON()); + } checkResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name, RoutingType.ANYCAST)); QueueControl queueControl = ManagementControlHelper.createQueueControl(address, name, RoutingType.ANYCAST, mbeanServer); @@ -491,7 +571,11 @@ public class ActiveMQServerControlTest extends ManagementTestBase { Assert.assertFalse(ActiveMQServerControlTest.contains(name.toString(), serverControl.getQueueNames())); serverControl.createAddress(address.toString(), "ANYCAST"); - serverControl.createQueue(address.toString(), "ANYCAST", name.toString(), null, true, -1, false, false); + if (legacyCreateQueue) { + serverControl.createQueue(address.toString(), "ANYCAST", name.toString(), null, true, -1, false, false); + } else { + serverControl.createQueue(new QueueConfiguration(name).setAddress(address).setRoutingType(RoutingType.ANYCAST).setDurable(true).setAutoCreateAddress(false).toJSON()); + } Assert.assertTrue(ActiveMQServerControlTest.contains(name.toString(), serverControl.getQueueNames())); serverControl.destroyQueue(name.toString()); @@ -512,11 +596,19 @@ public class ActiveMQServerControlTest extends ManagementTestBase { Assert.assertFalse(ActiveMQServerControlTest.contains(anycastName.toString(), serverControl.getQueueNames())); Assert.assertFalse(ActiveMQServerControlTest.contains(multicastName.toString(), serverControl.getQueueNames())); - serverControl.createQueue(address.toString(), RoutingType.ANYCAST.toString(), anycastName.toString(), null, true, -1, false, true); + if (legacyCreateQueue) { + serverControl.createQueue(address.toString(), RoutingType.ANYCAST.toString(), anycastName.toString(), null, true, -1, false, true); + } else { + serverControl.createQueue(new QueueConfiguration(anycastName).setAddress(address).setRoutingType(RoutingType.ANYCAST).toJSON()); + } Assert.assertTrue(ActiveMQServerControlTest.contains(anycastName.toString(), serverControl.getQueueNames(RoutingType.ANYCAST.toString()))); Assert.assertFalse(ActiveMQServerControlTest.contains(anycastName.toString(), serverControl.getQueueNames(RoutingType.MULTICAST.toString()))); - serverControl.createQueue(address.toString(), RoutingType.MULTICAST.toString(), multicastName.toString(), null, true, -1, false, true); + if (legacyCreateQueue) { + serverControl.createQueue(address.toString(), RoutingType.MULTICAST.toString(), multicastName.toString(), null, true, -1, false, true); + } else { + serverControl.createQueue(new QueueConfiguration(multicastName).setAddress(address).setRoutingType(RoutingType.MULTICAST).toJSON()); + } Assert.assertTrue(ActiveMQServerControlTest.contains(multicastName.toString(), serverControl.getQueueNames(RoutingType.MULTICAST.toString()))); Assert.assertFalse(ActiveMQServerControlTest.contains(multicastName.toString(), serverControl.getQueueNames(RoutingType.ANYCAST.toString()))); @@ -558,7 +650,11 @@ public class ActiveMQServerControlTest extends ManagementTestBase { // management operations Assert.assertFalse(ActiveMQServerControlTest.contains(address.toString(), serverControl.getAddressNames())); - serverControl.createQueue(address.toString(), "ANYCAST", name.toString(), null, true, -1, false, true); + if (legacyCreateQueue) { + serverControl.createQueue(address.toString(), "ANYCAST", name.toString(), null, true, -1, false, true); + } else { + serverControl.createQueue(new QueueConfiguration(name).setAddress(address).setRoutingType(RoutingType.ANYCAST).toJSON()); + } Assert.assertTrue(ActiveMQServerControlTest.contains(address.toString(), serverControl.getAddressNames())); serverControl.destroyQueue(name.toString(), true, true); @@ -1167,8 +1263,13 @@ public class ActiveMQServerControlTest extends ManagementTestBase { String divertQueue = RandomUtil.randomString(); String queue = RandomUtil.randomString(); - session.createQueue(forwardingAddress, RoutingType.ANYCAST, divertQueue); - session.createQueue(address, RoutingType.ANYCAST, queue); + if (legacyCreateQueue) { + session.createQueue(forwardingAddress, RoutingType.ANYCAST, divertQueue); + session.createQueue(address, RoutingType.ANYCAST, queue); + } else { + session.createQueue(new QueueConfiguration(divertQueue).setAddress(forwardingAddress).setRoutingType(RoutingType.ANYCAST)); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setRoutingType(RoutingType.ANYCAST)); + } ClientProducer producer = session.createProducer(address); ClientMessage message = session.createMessage(false); @@ -1229,8 +1330,13 @@ public class ActiveMQServerControlTest extends ManagementTestBase { ClientSessionFactory csf = createSessionFactory(locator); ClientSession session = csf.createSession(); - session.createQueue(sourceAddress, RoutingType.ANYCAST, sourceQueue); - session.createQueue(targetAddress, RoutingType.ANYCAST, targetQueue); + if (legacyCreateQueue) { + session.createQueue(sourceAddress, RoutingType.ANYCAST, sourceQueue); + session.createQueue(targetAddress, RoutingType.ANYCAST, targetQueue); + } else { + session.createQueue(new QueueConfiguration(sourceQueue).setAddress(sourceAddress).setRoutingType(RoutingType.ANYCAST)); + session.createQueue(new QueueConfiguration(targetQueue).setAddress(targetAddress).setRoutingType(RoutingType.ANYCAST)); + } serverControl.createBridge(name, sourceQueue, targetAddress, null, // forwardingAddress null, // filterString @@ -1301,7 +1407,11 @@ public class ActiveMQServerControlTest extends ManagementTestBase { ServerLocator locator = createInVMNonHALocator(); ClientSessionFactory csf = createSessionFactory(locator); ClientSession clientSession = csf.createSession(true, false, false); - clientSession.createQueue(atestq, atestq, null, true); + if (legacyCreateQueue) { + clientSession.createQueue(atestq, atestq, null, true); + } else { + clientSession.createQueue(new QueueConfiguration(atestq)); + } ClientMessage m1 = createTextMessage(clientSession, ""); ClientMessage m2 = createTextMessage(clientSession, ""); @@ -1367,7 +1477,11 @@ public class ActiveMQServerControlTest extends ManagementTestBase { ServerLocator locator = createInVMNonHALocator(); ClientSessionFactory csf = createSessionFactory(locator); ClientSession clientSession = csf.createSession(true, false, false); - clientSession.createQueue(atestq, atestq, null, true); + if (legacyCreateQueue) { + clientSession.createQueue(atestq, atestq, null, true); + } else { + clientSession.createQueue(new QueueConfiguration(atestq)); + } ClientMessage m1 = createTextMessage(clientSession, ""); ClientMessage m2 = createTextMessage(clientSession, ""); @@ -1416,7 +1530,11 @@ public class ActiveMQServerControlTest extends ManagementTestBase { ServerLocator locator = createInVMNonHALocator(); ClientSessionFactory csf = createSessionFactory(locator); ClientSession clientSession = csf.createSession(true, false, false); - clientSession.createQueue(atestq, atestq, null, true); + if (legacyCreateQueue) { + clientSession.createQueue(atestq, atestq, null, true); + } else { + clientSession.createQueue(new QueueConfiguration(atestq)); + } ClientMessage m1 = createTextMessage(clientSession, ""); ClientMessage m2 = createTextMessage(clientSession, ""); @@ -1458,8 +1576,13 @@ public class ActiveMQServerControlTest extends ManagementTestBase { ServerLocator locator = createInVMNonHALocator(); ClientSessionFactory csf = createSessionFactory(locator); ClientSession clientSession = csf.createSession(true, false, false); - clientSession.createQueue(recQueue, recQueue, null, true); - clientSession.createQueue(sendQueue, sendQueue, null, true); + if (legacyCreateQueue) { + clientSession.createQueue(recQueue, recQueue, null, true); + clientSession.createQueue(sendQueue, sendQueue, null, true); + } else { + clientSession.createQueue(new QueueConfiguration(recQueue)); + clientSession.createQueue(new QueueConfiguration(sendQueue)); + } ClientMessage m1 = createTextMessage(clientSession, ""); m1.putStringProperty("m1", "m1"); ClientProducer clientProducer = clientSession.createProducer(recQueue); @@ -1548,8 +1671,13 @@ public class ActiveMQServerControlTest extends ManagementTestBase { ClientSessionFactory csf = createSessionFactory(locator); ClientSession session = csf.createSession(); - session.createQueue(random1, RoutingType.ANYCAST, random1); - session.createQueue(random2, RoutingType.ANYCAST, random2); + if (legacyCreateQueue) { + session.createQueue(random1, RoutingType.ANYCAST, random1); + session.createQueue(random2, RoutingType.ANYCAST, random2); + } else { + session.createQueue(new QueueConfiguration(random1).setRoutingType(RoutingType.ANYCAST)); + session.createQueue(new QueueConfiguration(random2).setRoutingType(RoutingType.ANYCAST)); + } ClientProducer producer1 = session.createProducer(random1); ClientProducer producer2 = session.createProducer(random2); @@ -1603,8 +1731,13 @@ public class ActiveMQServerControlTest extends ManagementTestBase { ClientSessionFactory csf = createSessionFactory(locator); ClientSession session = csf.createSession(); - session.createQueue(random1, RoutingType.ANYCAST, random1); - session.createQueue(random2, RoutingType.ANYCAST, random2); + if (legacyCreateQueue) { + session.createQueue(random1, RoutingType.ANYCAST, random1); + session.createQueue(random2, RoutingType.ANYCAST, random2); + } else { + session.createQueue(new QueueConfiguration(random1).setRoutingType(RoutingType.ANYCAST)); + session.createQueue(new QueueConfiguration(random2).setRoutingType(RoutingType.ANYCAST)); + } ClientProducer producer1 = session.createProducer(random1); ClientProducer producer2 = session.createProducer(random2); @@ -1650,8 +1783,13 @@ public class ActiveMQServerControlTest extends ManagementTestBase { ClientSessionFactory csf = createSessionFactory(locator); ClientSession session = csf.createSession(); - session.createQueue(random1, RoutingType.ANYCAST, random1); - session.createQueue(random2, RoutingType.ANYCAST, random2); + if (legacyCreateQueue) { + session.createQueue(random1, RoutingType.ANYCAST, random1); + session.createQueue(random2, RoutingType.ANYCAST, random2); + } else { + session.createQueue(new QueueConfiguration(random1).setRoutingType(RoutingType.ANYCAST)); + session.createQueue(new QueueConfiguration(random2).setRoutingType(RoutingType.ANYCAST)); + } ClientProducer producer1 = session.createProducer(random1); ClientProducer producer2 = session.createProducer(random2); @@ -1698,8 +1836,13 @@ public class ActiveMQServerControlTest extends ManagementTestBase { ClientSessionFactory csf = createSessionFactory(locator); ClientSession session = csf.createSession(); - session.createQueue(random1, RoutingType.ANYCAST, random1); - session.createQueue(random2, RoutingType.ANYCAST, random2); + if (legacyCreateQueue) { + session.createQueue(random1, RoutingType.ANYCAST, random1); + session.createQueue(random2, RoutingType.ANYCAST, random2); + } else { + session.createQueue(new QueueConfiguration(random1).setRoutingType(RoutingType.ANYCAST)); + session.createQueue(new QueueConfiguration(random2).setRoutingType(RoutingType.ANYCAST)); + } ClientConsumer consumer1 = session.createConsumer(random1); ClientConsumer consumer2 = session.createConsumer(random2); @@ -1784,7 +1927,11 @@ public class ActiveMQServerControlTest extends ManagementTestBase { ClientSessionFactory factory = createSessionFactory(locator); ClientSession session = addClientSession(factory.createSession()); server.addAddressInfo(new AddressInfo(queueName, RoutingType.ANYCAST)); - server.createQueue(queueName, RoutingType.ANYCAST, queueName, null, false, false); + if (legacyCreateQueue) { + server.createQueue(queueName, RoutingType.ANYCAST, queueName, null, false, false); + } else { + server.createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST).setDurable(false)); + } addClientConsumer(session.createConsumer(queueName)); Thread.sleep(100); // We check the timestamp for the creation time. We need to make sure it's different addClientConsumer(session.createConsumer(queueName, SimpleString.toSimpleString(filter), true)); @@ -1842,7 +1989,11 @@ public class ActiveMQServerControlTest extends ManagementTestBase { ClientSessionFactory factory2 = createSessionFactory(locator2); ClientSession session2 = addClientSession(factory2.createSession()); serverControl.createAddress(queueName.toString(), "ANYCAST"); - server.createQueue(queueName, RoutingType.ANYCAST, queueName, null, false, false); + if (legacyCreateQueue) { + server.createQueue(queueName, RoutingType.ANYCAST, queueName, null, false, false); + } else { + server.createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST).setDurable(false)); + } addClientConsumer(session.createConsumer(queueName)); Thread.sleep(200); @@ -1908,7 +2059,11 @@ public class ActiveMQServerControlTest extends ManagementTestBase { public void testListSessionsAsJSON() throws Exception { SimpleString queueName = new SimpleString(UUID.randomUUID().toString()); server.addAddressInfo(new AddressInfo(queueName, RoutingType.ANYCAST)); - server.createQueue(queueName, RoutingType.ANYCAST, queueName, null, false, false); + if (legacyCreateQueue) { + server.createQueue(queueName, RoutingType.ANYCAST, queueName, null, false, false); + } else { + server.createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST).setDurable(false)); + } ActiveMQServerControl serverControl = createManagementControl(); ServerLocator locator = createInVMNonHALocator(); @@ -1963,7 +2118,11 @@ public class ActiveMQServerControlTest extends ManagementTestBase { public void testListAllSessionsAsJSON() throws Exception { SimpleString queueName = new SimpleString(UUID.randomUUID().toString()); server.addAddressInfo(new AddressInfo(queueName, RoutingType.ANYCAST)); - server.createQueue(queueName, RoutingType.ANYCAST, queueName, null, false, false); + if (legacyCreateQueue) { + server.createQueue(queueName, RoutingType.ANYCAST, queueName, null, false, false); + } else { + server.createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST).setDurable(false)); + } ActiveMQServerControl serverControl = createManagementControl(); ServerLocator locator = createInVMNonHALocator(); @@ -2006,7 +2165,11 @@ public class ActiveMQServerControlTest extends ManagementTestBase { public void testListAllSessionsAsJSONWithJMS() throws Exception { SimpleString queueName = new SimpleString(UUID.randomUUID().toString()); server.addAddressInfo(new AddressInfo(queueName, RoutingType.ANYCAST)); - server.createQueue(queueName, RoutingType.ANYCAST, queueName, null, false, false); + if (legacyCreateQueue) { + server.createQueue(queueName, RoutingType.ANYCAST, queueName, null, false, false); + } else { + server.createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST).setDurable(false)); + } ActiveMQServerControl serverControl = createManagementControl(); ActiveMQConnectionFactory cf = ActiveMQJMSClient.createConnectionFactory("vm://0", "cf"); @@ -2033,13 +2196,25 @@ public class ActiveMQServerControlTest extends ManagementTestBase { ActiveMQServerControl serverControl = createManagementControl(); server.addAddressInfo(new AddressInfo(queueName1, RoutingType.ANYCAST)); - server.createQueue(queueName1, RoutingType.ANYCAST, queueName1, null, false, false); + if (legacyCreateQueue) { + server.createQueue(queueName1, RoutingType.ANYCAST, queueName1, null, false, false); + } else { + server.createQueue(new QueueConfiguration(queueName1).setRoutingType(RoutingType.ANYCAST).setDurable(false)); + } server.addAddressInfo(new AddressInfo(queueName2, RoutingType.ANYCAST)); - server.createQueue(queueName2, RoutingType.ANYCAST, queueName2, null, false, false); + if (legacyCreateQueue) { + server.createQueue(queueName2, RoutingType.ANYCAST, queueName2, null, false, false); + } else { + server.createQueue(new QueueConfiguration(queueName2).setRoutingType(RoutingType.ANYCAST).setDurable(false)); + } server.addAddressInfo(new AddressInfo(queueName3, RoutingType.ANYCAST)); - server.createQueue(queueName3, RoutingType.ANYCAST, queueName3, null, false, false); + if (legacyCreateQueue) { + server.createQueue(queueName3, RoutingType.ANYCAST, queueName3, null, false, false); + } else { + server.createQueue(new QueueConfiguration(queueName3).setRoutingType(RoutingType.ANYCAST).setDurable(false)); + } //test with filter that matches 2 queues String filterString = createJsonFilter("name", "CONTAINS", "my_queue"); @@ -2113,16 +2288,28 @@ public class ActiveMQServerControlTest extends ManagementTestBase { ActiveMQServerControl serverControl = createManagementControl(); server.addAddressInfo(new AddressInfo(queueName1, RoutingType.ANYCAST)); - server.createQueue(queueName1, RoutingType.ANYCAST, queueName1, new SimpleString("filter1"),null,true, - false, false,20,false,false); + if (legacyCreateQueue) { + server.createQueue(queueName1, RoutingType.ANYCAST, queueName1, new SimpleString("filter1"),null,true, + false, false,20,false,false); + } else { + server.createQueue(new QueueConfiguration(queueName1).setRoutingType(RoutingType.ANYCAST).setFilterString("filter1").setMaxConsumers(20).setAutoCreateAddress(false)); + } Thread.sleep(500); server.addAddressInfo(new AddressInfo(queueName2, RoutingType.ANYCAST)); - server.createQueue(queueName2, RoutingType.ANYCAST, queueName2, new SimpleString("filter3"), null,true, - false, true,40,false,false); + if (legacyCreateQueue) { + server.createQueue(queueName2, RoutingType.ANYCAST, queueName2, new SimpleString("filter3"), null,true, + false, true,40,false,false); + } else { + server.createQueue(new QueueConfiguration(queueName2).setRoutingType(RoutingType.ANYCAST).setFilterString("filter3").setAutoCreated(true).setMaxConsumers(40).setAutoCreateAddress(false)); + } Thread.sleep(500); server.addAddressInfo(new AddressInfo(queueName3, RoutingType.ANYCAST)); - server.createQueue(queueName3, RoutingType.ANYCAST, queueName3, new SimpleString("filter0"),null,true, - false, false,10,false,false); + if (legacyCreateQueue) { + server.createQueue(queueName3, RoutingType.ANYCAST, queueName3, new SimpleString("filter0"),null,true, + false, false,10,false,false); + } else { + server.createQueue(new QueueConfiguration(queueName3).setRoutingType(RoutingType.ANYCAST).setFilterString("filter0").setMaxConsumers(10).setAutoCreateAddress(false)); + } //test default order String filterString = createJsonFilter("name", "CONTAINS", "my_queue"); @@ -2227,16 +2414,32 @@ public class ActiveMQServerControlTest extends ManagementTestBase { ActiveMQServerControl serverControl = createManagementControl(); server.addAddressInfo(new AddressInfo(queueName1, RoutingType.ANYCAST)); - server.createQueue(queueName1, RoutingType.ANYCAST, queueName1, null, false, false); + if (legacyCreateQueue) { + server.createQueue(queueName1, RoutingType.ANYCAST, queueName1, null, false, false); + } else { + server.createQueue(new QueueConfiguration(queueName1).setRoutingType(RoutingType.ANYCAST).setDurable(false)); + } server.addAddressInfo(new AddressInfo(queueName2, RoutingType.ANYCAST)); - server.createQueue(queueName2, RoutingType.ANYCAST, queueName2, null, false, false); + if (legacyCreateQueue) { + server.createQueue(queueName2, RoutingType.ANYCAST, queueName2, null, false, false); + } else { + server.createQueue(new QueueConfiguration(queueName2).setRoutingType(RoutingType.ANYCAST).setDurable(false)); + } server.addAddressInfo(new AddressInfo(queueName3, RoutingType.ANYCAST)); - server.createQueue(queueName3, RoutingType.ANYCAST, queueName3, null, false, false, 10, false, false); + if (legacyCreateQueue) { + server.createQueue(queueName3, RoutingType.ANYCAST, queueName3, null, false, false, 10, false, false); + } else { + server.createQueue(new QueueConfiguration(queueName3).setRoutingType(RoutingType.ANYCAST).setDurable(false).setMaxConsumers(10)); + } server.addAddressInfo(new AddressInfo(queueName4, RoutingType.ANYCAST)); - server.createQueue(queueName4, RoutingType.ANYCAST, queueName4, null, false, false); + if (legacyCreateQueue) { + server.createQueue(queueName4, RoutingType.ANYCAST, queueName4, null, false, false); + } else { + server.createQueue(new QueueConfiguration(queueName4).setRoutingType(RoutingType.ANYCAST).setDurable(false)); + } // create some consumers try (ServerLocator locator = createInVMNonHALocator(); ClientSessionFactory csf = createSessionFactory(locator); ClientSession session = csf.createSession()) { @@ -2365,16 +2568,32 @@ public class ActiveMQServerControlTest extends ManagementTestBase { ActiveMQServerControl serverControl = createManagementControl(); server.addAddressInfo(new AddressInfo(queueName1, RoutingType.ANYCAST)); - server.createQueue(queueName1, RoutingType.ANYCAST, queueName1, null, false, false); + if (legacyCreateQueue) { + server.createQueue(queueName1, RoutingType.ANYCAST, queueName1, null, false, false); + } else { + server.createQueue(new QueueConfiguration(queueName1).setRoutingType(RoutingType.ANYCAST).setDurable(false)); + } server.addAddressInfo(new AddressInfo(queueName2, RoutingType.ANYCAST)); - server.createQueue(queueName2, RoutingType.ANYCAST, queueName2, null, false, false); + if (legacyCreateQueue) { + server.createQueue(queueName2, RoutingType.ANYCAST, queueName2, null, false, false); + } else { + server.createQueue(new QueueConfiguration(queueName2).setRoutingType(RoutingType.ANYCAST).setDurable(false)); + } server.addAddressInfo(new AddressInfo(queueName3, RoutingType.ANYCAST)); - server.createQueue(queueName3, RoutingType.ANYCAST, queueName3, null, false, false, 10, false, false); + if (legacyCreateQueue) { + server.createQueue(queueName3, RoutingType.ANYCAST, queueName3, null, false, false, 10, false, false); + } else { + server.createQueue(new QueueConfiguration(queueName3).setRoutingType(RoutingType.ANYCAST).setDurable(false).setMaxConsumers(10)); + } server.addAddressInfo(new AddressInfo(queueName4, RoutingType.ANYCAST)); - server.createQueue(queueName4, RoutingType.ANYCAST, queueName4, null, false, false); + if (legacyCreateQueue) { + server.createQueue(queueName4, RoutingType.ANYCAST, queueName4, null, false, false); + } else { + server.createQueue(new QueueConfiguration(queueName4).setRoutingType(RoutingType.ANYCAST).setDurable(false)); + } // create some consumers try (ServerLocator locator = createInVMNonHALocator(); ClientSessionFactory csf = createSessionFactory(locator); ClientSession session = csf.createSession()) { @@ -2465,12 +2684,25 @@ public class ActiveMQServerControlTest extends ManagementTestBase { ActiveMQServerControl serverControl = createManagementControl(); server.addAddressInfo(new AddressInfo(addressName1, RoutingType.ANYCAST)); - server.createQueue(addressName1, RoutingType.ANYCAST, queueName1, null, false, false); + if (legacyCreateQueue) { + server.createQueue(addressName1, RoutingType.ANYCAST, queueName1, null, false, false); + } else { + server.createQueue(new QueueConfiguration(queueName1).setAddress(addressName1).setRoutingType(RoutingType.ANYCAST).setDurable(false)); + } server.addAddressInfo(new AddressInfo(addressName2, RoutingType.ANYCAST)); - server.createQueue(addressName2, RoutingType.ANYCAST, queueName2, null, false, false); + if (legacyCreateQueue) { + server.createQueue(addressName2, RoutingType.ANYCAST, queueName2, null, false, false); + } else { + server.createQueue(new QueueConfiguration(queueName2).setAddress(addressName2).setRoutingType(RoutingType.ANYCAST).setDurable(false)); + } server.addAddressInfo(new AddressInfo(addressName3, RoutingType.ANYCAST)); - server.createQueue(addressName3, RoutingType.ANYCAST, queueName3, null, false, false); - server.createQueue(addressName3, RoutingType.ANYCAST, queueName4, null, false, false); + if (legacyCreateQueue) { + server.createQueue(addressName3, RoutingType.ANYCAST, queueName3, null, false, false); + server.createQueue(addressName3, RoutingType.ANYCAST, queueName4, null, false, false); + } else { + server.createQueue(new QueueConfiguration(queueName3).setAddress(addressName3).setRoutingType(RoutingType.ANYCAST).setDurable(false)); + server.createQueue(new QueueConfiguration(queueName4).setAddress(addressName3).setRoutingType(RoutingType.ANYCAST).setDurable(false)); + } //test with CONTAINS filter String filterString = createJsonFilter("name", "CONTAINS", "my_address"); @@ -2544,11 +2776,20 @@ public class ActiveMQServerControlTest extends ManagementTestBase { ActiveMQServerControl serverControl = createManagementControl(); server.addAddressInfo(new AddressInfo(addressName1, RoutingType.ANYCAST)); - server.createQueue(addressName1, RoutingType.ANYCAST, queueName1, null, false, false); + if (legacyCreateQueue) { + server.createQueue(addressName1, RoutingType.ANYCAST, queueName1, null, false, false); + } else { + server.createQueue(new QueueConfiguration(queueName1).setAddress(addressName1).setRoutingType(RoutingType.ANYCAST).setDurable(false)); + } server.addAddressInfo(new AddressInfo(addressName2, RoutingType.ANYCAST)); server.addAddressInfo(new AddressInfo(addressName3, RoutingType.ANYCAST)); - server.createQueue(addressName3, RoutingType.ANYCAST, queueName3, null, false, false); - server.createQueue(addressName3, RoutingType.ANYCAST, queueName4, null, false, false); + if (legacyCreateQueue) { + server.createQueue(addressName3, RoutingType.ANYCAST, queueName3, null, false, false); + server.createQueue(addressName3, RoutingType.ANYCAST, queueName4, null, false, false); + } else { + server.createQueue(new QueueConfiguration(queueName3).setAddress(addressName3).setRoutingType(RoutingType.ANYCAST).setDurable(false)); + server.createQueue(new QueueConfiguration(queueName4).setAddress(addressName3).setRoutingType(RoutingType.ANYCAST).setDurable(false)); + } //test default order String filterString = createJsonFilter("name", "CONTAINS", "my"); @@ -2595,11 +2836,20 @@ public class ActiveMQServerControlTest extends ManagementTestBase { ActiveMQServerControl serverControl = createManagementControl(); server.addAddressInfo(new AddressInfo(addressName1, RoutingType.ANYCAST)); - server.createQueue(addressName1, RoutingType.ANYCAST, queueName1, null, false, false); + if (legacyCreateQueue) { + server.createQueue(addressName1, RoutingType.ANYCAST, queueName1, null, false, false); + } else { + server.createQueue(new QueueConfiguration(queueName1).setAddress(addressName1).setRoutingType(RoutingType.ANYCAST).setDurable(false)); + } server.addAddressInfo(new AddressInfo(addressName2, RoutingType.ANYCAST)); - server.createQueue(addressName2, RoutingType.ANYCAST, queueName2, null, false, false); - server.createQueue(addressName2, RoutingType.ANYCAST, queueName3, null, false, false); + if (legacyCreateQueue) { + server.createQueue(addressName2, RoutingType.ANYCAST, queueName2, null, false, false); + server.createQueue(addressName2, RoutingType.ANYCAST, queueName3, null, false, false); + } else { + server.createQueue(new QueueConfiguration(queueName2).setAddress(addressName2).setRoutingType(RoutingType.ANYCAST).setDurable(false)); + server.createQueue(new QueueConfiguration(queueName3).setAddress(addressName2).setRoutingType(RoutingType.ANYCAST).setDurable(false)); + } // create some consumers try (ServerLocator locator = createInVMNonHALocator(); ClientSessionFactory csf = createSessionFactory(locator); ClientSession session = csf.createSession()) { @@ -2683,7 +2933,11 @@ public class ActiveMQServerControlTest extends ManagementTestBase { ActiveMQServerControl serverControl = createManagementControl(); server.addAddressInfo(new AddressInfo(addressName1, RoutingType.ANYCAST)); - server.createQueue(addressName1, RoutingType.ANYCAST, queueName1, null, false, false); + if (legacyCreateQueue) { + server.createQueue(addressName1, RoutingType.ANYCAST, queueName1, null, false, false); + } else { + server.createQueue(new QueueConfiguration(queueName1).setAddress(addressName1).setRoutingType(RoutingType.ANYCAST).setDurable(false)); + } try (ServerLocator locator = createInVMNonHALocator(); ClientSessionFactory csf = createSessionFactory(locator);) { @@ -2731,7 +2985,11 @@ public class ActiveMQServerControlTest extends ManagementTestBase { ActiveMQServerControl serverControl = createManagementControl(); server.addAddressInfo(new AddressInfo(addressName1, RoutingType.ANYCAST)); - server.createQueue(addressName1, RoutingType.ANYCAST, queueName1, null, false, false); + if (legacyCreateQueue) { + server.createQueue(addressName1, RoutingType.ANYCAST, queueName1, null, false, false); + } else { + server.createQueue(new QueueConfiguration(queueName1).setAddress(addressName1).setRoutingType(RoutingType.ANYCAST).setDurable(false)); + } // create some consumers try (ServerLocator locator = createInVMNonHALocator(); ClientSessionFactory csf = createSessionFactory(locator);) { @@ -2819,7 +3077,11 @@ public class ActiveMQServerControlTest extends ManagementTestBase { ActiveMQServerControl serverControl = createManagementControl(); server.addAddressInfo(new AddressInfo(addressName1, RoutingType.ANYCAST)); - server.createQueue(addressName1, RoutingType.ANYCAST, queueName1, null, false, false); + if (legacyCreateQueue) { + server.createQueue(addressName1, RoutingType.ANYCAST, queueName1, null, false, false); + } else { + server.createQueue(new QueueConfiguration(queueName1).setAddress(addressName1).setRoutingType(RoutingType.ANYCAST).setDurable(false)); + } ClientSessionFactoryImpl csf = null; ClientSessionFactoryImpl csf2 = null; @@ -2936,7 +3198,11 @@ public class ActiveMQServerControlTest extends ManagementTestBase { ActiveMQServerControl serverControl = createManagementControl(); server.addAddressInfo(new AddressInfo(addressName1, RoutingType.ANYCAST)); - server.createQueue(addressName1, RoutingType.ANYCAST, queueName1, null, false, false); + if (legacyCreateQueue) { + server.createQueue(addressName1, RoutingType.ANYCAST, queueName1, null, false, false); + } else { + server.createQueue(new QueueConfiguration(queueName1).setAddress(addressName1).setRoutingType(RoutingType.ANYCAST).setDurable(false)); + } ClientSessionFactoryImpl csf = null; @@ -2974,7 +3240,11 @@ public class ActiveMQServerControlTest extends ManagementTestBase { ActiveMQServerControl serverControl = createManagementControl(); server.addAddressInfo(new AddressInfo(addressName1, RoutingType.ANYCAST)); - server.createQueue(addressName1, RoutingType.ANYCAST, queueName1, null, false, false); + if (legacyCreateQueue) { + server.createQueue(addressName1, RoutingType.ANYCAST, queueName1, null, false, false); + } else { + server.createQueue(new QueueConfiguration(queueName1).setAddress(addressName1).setRoutingType(RoutingType.ANYCAST).setDurable(false)); + } // create some consumers try (ServerLocator locator = createInVMNonHALocator(); ClientSessionFactory csf = createSessionFactory(locator);) { @@ -3037,7 +3307,11 @@ public class ActiveMQServerControlTest extends ManagementTestBase { assertEquals("MemoryUsagePercentage", 0, serverControl.getAddressMemoryUsagePercentage()); try (ServerLocator locator = createInVMNonHALocator(); ClientSessionFactory csf = createSessionFactory(locator); ClientSession session = csf.createSession()) { - session.createQueue(name1, RoutingType.ANYCAST, name1); + if (legacyCreateQueue) { + session.createQueue(name1, RoutingType.ANYCAST, name1); + } else { + session.createQueue(new QueueConfiguration(name1).setRoutingType(RoutingType.ANYCAST)); + } ClientProducer producer1 = session.createProducer(name1); sendMessagesWithPredefinedSize(30, session, producer1, MESSAGE_SIZE); @@ -3066,8 +3340,13 @@ public class ActiveMQServerControlTest extends ManagementTestBase { assertEquals("MemoryUsagePercentage", 0, serverControl.getAddressMemoryUsagePercentage()); try (ServerLocator locator = createInVMNonHALocator(); ClientSessionFactory csf = createSessionFactory(locator); ClientSession session = csf.createSession()) { - session.createQueue(name1, RoutingType.ANYCAST, name1); - session.createQueue(name2, RoutingType.ANYCAST, name2); + if (legacyCreateQueue) { + session.createQueue(name1, RoutingType.ANYCAST, name1); + session.createQueue(name2, RoutingType.ANYCAST, name2); + } else { + session.createQueue(new QueueConfiguration(name1).setRoutingType(RoutingType.ANYCAST)); + session.createQueue(new QueueConfiguration(name2).setRoutingType(RoutingType.ANYCAST)); + } ClientProducer producer1 = session.createProducer(name1); ClientProducer producer2 = session.createProducer(name2); sendMessagesWithPredefinedSize(10, session, producer1, MESSAGE_SIZE); @@ -3104,7 +3383,11 @@ public class ActiveMQServerControlTest extends ManagementTestBase { checkNoResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name, RoutingType.ANYCAST)); serverControl.createAddress(address.toString(), "ANYCAST"); - serverControl.createQueue(address.toString(), "ANYCAST", name.toString(), null, durable, -1, false, false); + if (legacyCreateQueue) { + serverControl.createQueue(address.toString(), "ANYCAST", name.toString(), null, durable, -1, false, false); + } else { + serverControl.createQueue(new QueueConfiguration(name).setAddress(address).setRoutingType(RoutingType.ANYCAST).setDurable(durable).setAutoCreateAddress(false).toJSON()); + } ServerLocator receiveLocator = createInVMNonHALocator(); ClientSessionFactory receiveCsf = createSessionFactory(receiveLocator); @@ -3203,9 +3486,17 @@ public class ActiveMQServerControlTest extends ManagementTestBase { server2.start(); server.addAddressInfo(new AddressInfo(address, RoutingType.ANYCAST)); - server.createQueue(address, RoutingType.ANYCAST, address, null, true, false, -1, false, false); + if (legacyCreateQueue) { + server.createQueue(address, RoutingType.ANYCAST, address, null, true, false, -1, false, false); + } else { + server.createQueue(new QueueConfiguration(address).setRoutingType(RoutingType.ANYCAST).setAutoCreateAddress(false)); + } server2.addAddressInfo(new AddressInfo(address, RoutingType.ANYCAST)); - server2.createQueue(address, RoutingType.ANYCAST, address, null, true, false, -1, false, false); + if (legacyCreateQueue) { + server2.createQueue(address, RoutingType.ANYCAST, address, null, true, false, -1, false, false); + } else { + server2.createQueue(new QueueConfiguration(address).setRoutingType(RoutingType.ANYCAST).setAutoCreateAddress(false)); + } ServerLocator locator = createInVMNonHALocator(); ClientSessionFactory csf = createSessionFactory(locator); ClientSession session = csf.createSession(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java index 0418a4e294..19039783ed 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java @@ -22,7 +22,10 @@ import org.apache.activemq.artemis.api.core.ActiveMQAddressDoesNotExistException import org.apache.activemq.artemis.api.core.management.ActiveMQServerControl; import org.apache.activemq.artemis.api.core.management.Parameter; import org.apache.activemq.artemis.api.core.management.ResourceNames; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +@RunWith(Parameterized.class) public class ActiveMQServerControlUsingCoreTest extends ActiveMQServerControlTest { // Constants ----------------------------------------------------- @@ -33,6 +36,10 @@ public class ActiveMQServerControlUsingCoreTest extends ActiveMQServerControlTes // Constructors -------------------------------------------------- + public ActiveMQServerControlUsingCoreTest(boolean legacyCreateQueue) { + super(legacyCreateQueue); + } + // Public -------------------------------------------------------- // ActiveMQServerControlTest overrides -------------------------- @@ -125,6 +132,21 @@ public class ActiveMQServerControlUsingCoreTest extends ActiveMQServerControlTes return (String) proxy.invokeOperation("createQueue", address, routingType, name, filterStr, durable, maxConsumers, purgeOnNoConsumers, autoCreateAddress); } + @Override + public String createQueue(String queueConfiguration) throws Exception { + return (String) proxy.invokeOperation("createQueue", queueConfiguration); + } + + @Override + public String createQueue(String queueConfiguration, boolean ignoreIfExists) throws Exception { + return (String) proxy.invokeOperation("createQueue", queueConfiguration, ignoreIfExists); + } + + @Override + public String updateQueue(String queueConfiguration) throws Exception { + return (String) proxy.invokeOperation("updateQueue", queueConfiguration); + } + @Override public String updateQueue(@Parameter(name = "name", desc = "Name of the queue") String name, @Parameter(name = "routingType", desc = "The routing type used for this address, MULTICAST or ANYCAST") String routingType, diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AddressControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AddressControlTest.java index 6bd562f071..4754f5efff 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AddressControlTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AddressControlTest.java @@ -27,6 +27,7 @@ import java.util.Set; import org.apache.activemq.artemis.api.core.JsonUtil; import org.apache.activemq.artemis.api.core.Message; +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.api.core.client.ClientConsumer; @@ -75,7 +76,7 @@ public class AddressControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, queue, false); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false)); AddressControl addressControl = createManagementControl(address); @@ -102,14 +103,14 @@ public class AddressControlTest extends ManagementTestBase { SimpleString queue = RandomUtil.randomSimpleString(); SimpleString anotherQueue = RandomUtil.randomSimpleString(); - session.createQueue(address, queue, true); + session.createQueue(new QueueConfiguration(queue).setAddress(address)); AddressControl addressControl = createManagementControl(address); String[] queueNames = addressControl.getQueueNames(); Assert.assertEquals(1, queueNames.length); Assert.assertEquals(queue.toString(), queueNames[0]); - session.createQueue(address, anotherQueue, false); + session.createQueue(new QueueConfiguration(anotherQueue).setAddress(address).setDurable(false)); queueNames = addressControl.getQueueNames(); Assert.assertEquals(2, queueNames.length); @@ -128,7 +129,7 @@ public class AddressControlTest extends ManagementTestBase { SimpleString queue = RandomUtil.randomSimpleString(); String divertName = RandomUtil.randomString(); - session.createQueue(address, queue, false); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false)); AddressControl addressControl = createManagementControl(address); String[] bindingNames = addressControl.getBindingNames(); @@ -153,7 +154,7 @@ public class AddressControlTest extends ManagementTestBase { SimpleString queue = RandomUtil.randomSimpleString(); Role role = new Role(RandomUtil.randomString(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean()); - session.createQueue(address, queue, true); + session.createQueue(new QueueConfiguration(queue).setAddress(address)); AddressControl addressControl = createManagementControl(address); Object[] roles = addressControl.getRoles(); @@ -184,7 +185,7 @@ public class AddressControlTest extends ManagementTestBase { SimpleString queue = RandomUtil.randomSimpleString(); Role role = new Role(RandomUtil.randomString(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean(), RandomUtil.randomBoolean()); - session.createQueue(address, queue, true); + session.createQueue(new QueueConfiguration(queue).setAddress(address)); AddressControl addressControl = createManagementControl(address); String jsonString = addressControl.getRolesAsJSON(); @@ -232,7 +233,7 @@ public class AddressControlTest extends ManagementTestBase { session = sf2.createSession(false, true, false); session.start(); - session.createQueue(address, address, true); + session.createQueue(new QueueConfiguration(address)); QueueImpl serverQueue = (QueueImpl) server.locateQueue(address); @@ -278,7 +279,7 @@ public class AddressControlTest extends ManagementTestBase { @Test public void testGetNumberOfBytesPerPage() throws Exception { SimpleString address = RandomUtil.randomSimpleString(); - session.createQueue(address, address, true); + session.createQueue(new QueueConfiguration(address)); AddressControl addressControl = createManagementControl(address); Assert.assertEquals(AddressSettings.DEFAULT_PAGE_SIZE, addressControl.getNumberOfBytesPerPage()); @@ -295,7 +296,7 @@ public class AddressControlTest extends ManagementTestBase { ClientSessionFactory sf2 = createSessionFactory(locator2); session = sf2.createSession(false, true, false); - session.createQueue(address, address, true); + session.createQueue(new QueueConfiguration(address)); Assert.assertEquals(1024, addressControl.getNumberOfBytesPerPage()); } @@ -345,11 +346,11 @@ public class AddressControlTest extends ManagementTestBase { producer.send(session.createMessage(false)); assertEquals(0, addressControl.getMessageCount()); - session.createQueue(address, RoutingType.ANYCAST, address); + session.createQueue(new QueueConfiguration(address).setRoutingType(RoutingType.ANYCAST)); producer.send(session.createMessage(false)); assertTrue(Wait.waitFor(() -> addressControl.getMessageCount() == 1, 2000, 100)); - session.createQueue(address, RoutingType.ANYCAST, address.concat('2')); + session.createQueue(new QueueConfiguration(address.concat('2')).setAddress(address).setRoutingType(RoutingType.ANYCAST)); producer.send(session.createMessage(false)); assertTrue(Wait.waitFor(() -> addressControl.getMessageCount() == 2, 2000, 100)); } @@ -367,12 +368,12 @@ public class AddressControlTest extends ManagementTestBase { assertTrue(Wait.waitFor(() -> addressControl.getRoutedMessageCount() == 0, 2000, 100)); assertTrue(Wait.waitFor(() -> addressControl.getUnRoutedMessageCount() == 1, 2000, 100)); - session.createQueue(address, RoutingType.ANYCAST, address); + session.createQueue(new QueueConfiguration(address).setRoutingType(RoutingType.ANYCAST)); producer.send(session.createMessage(false)); assertTrue(Wait.waitFor(() -> addressControl.getRoutedMessageCount() == 1, 2000, 100)); assertTrue(Wait.waitFor(() -> addressControl.getUnRoutedMessageCount() == 1, 2000, 100)); - session.createQueue(address, RoutingType.ANYCAST, address.concat('2')); + session.createQueue(new QueueConfiguration(address.concat('2')).setAddress(address).setRoutingType(RoutingType.ANYCAST)); producer.send(session.createMessage(false)); assertTrue(Wait.waitFor(() -> addressControl.getRoutedMessageCount() == 2, 2000, 100)); assertTrue(Wait.waitFor(() -> addressControl.getUnRoutedMessageCount() == 1, 2000, 100)); @@ -391,7 +392,7 @@ public class AddressControlTest extends ManagementTestBase { AddressControl addressControl = createManagementControl(address); Assert.assertEquals(0, addressControl.getQueueNames().length); - session.createQueue(address, RoutingType.ANYCAST, address); + session.createQueue(new QueueConfiguration(address).setRoutingType(RoutingType.ANYCAST)); Assert.assertEquals(1, addressControl.getQueueNames().length); addressControl.sendMessage(null, Message.BYTES_TYPE, Base64.encodeBytes("test".getBytes()), false, null, null); @@ -413,7 +414,7 @@ public class AddressControlTest extends ManagementTestBase { AddressControl addressControl = createManagementControl(address); Assert.assertEquals(0, addressControl.getQueueNames().length); - session.createQueue(address, RoutingType.ANYCAST, address); + session.createQueue(new QueueConfiguration(address).setRoutingType(RoutingType.ANYCAST)); Assert.assertEquals(1, addressControl.getQueueNames().length); Map headers = new HashMap<>(); headers.put("myProp1", "myValue1"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AuditLoggerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AuditLoggerTest.java index b5498f50b0..10a6f4a113 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AuditLoggerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AuditLoggerTest.java @@ -17,6 +17,7 @@ package org.apache.activemq.artemis.tests.integration.management; import org.apache.activemq.artemis.api.core.Message; +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.api.core.TransportConfiguration; @@ -115,7 +116,7 @@ public class AuditLoggerTest extends ManagementTestBase { final AddressControl addressControl = ManagementControlHelper.createAddressControl(address, mbeanServer); Assert.assertEquals(0, addressControl.getQueueNames().length); - session.createQueue(address, RoutingType.ANYCAST, address); + session.createQueue(new QueueConfiguration(address).setRoutingType(RoutingType.ANYCAST)); Assert.assertEquals(1, addressControl.getQueueNames().length); String uniqueStr = Base64.encodeBytes(UUID.randomUUID().toString().getBytes()); addressControl.sendMessage(null, Message.BYTES_TYPE, uniqueStr, false, null, null); @@ -133,7 +134,7 @@ public class AuditLoggerTest extends ManagementTestBase { Assert.assertEquals(1, addressControl.getQueueNames().length); - session.createQueue(address, RoutingType.ANYCAST, address); + session.createQueue(new QueueConfiguration(address).setRoutingType(RoutingType.ANYCAST).setDurable(false)); Wait.waitFor(() -> addressControl2.getQueueNames().length == 1); try { @@ -169,7 +170,7 @@ public class AuditLoggerTest extends ManagementTestBase { final AddressControl addressControl = ManagementControlHelper.createAddressControl(address, mbeanServer); Assert.assertEquals(0, addressControl.getQueueNames().length); - session.createQueue(address, RoutingType.ANYCAST, address); + session.createQueue(new QueueConfiguration(address).setRoutingType(RoutingType.ANYCAST)); Assert.assertEquals(1, addressControl.getQueueNames().length); String uniqueStr = Base64.encodeBytes(UUID.randomUUID().toString().getBytes()); addressControl.sendMessage(null, Message.BYTES_TYPE, uniqueStr, false, null, null); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/BridgeControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/BridgeControlTest.java index c0dd06da92..7c50984a45 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/BridgeControlTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/BridgeControlTest.java @@ -23,6 +23,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.management.BridgeControl; @@ -30,7 +31,6 @@ import org.apache.activemq.artemis.api.core.management.CoreNotificationType; import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder; import org.apache.activemq.artemis.core.config.BridgeConfiguration; import org.apache.activemq.artemis.core.config.Configuration; -import org.apache.activemq.artemis.core.config.CoreQueueConfiguration; import org.apache.activemq.artemis.core.remoting.impl.invm.InVMAcceptorFactory; import org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory; import org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants; @@ -127,14 +127,14 @@ public class BridgeControlTest extends ManagementTestBase { TransportConfiguration connectorConfig = new TransportConfiguration(InVMConnectorFactory.class.getName(), acceptorParams, RandomUtil.randomString()); - CoreQueueConfiguration sourceQueueConfig = new CoreQueueConfiguration().setAddress(RandomUtil.randomString()).setName(RandomUtil.randomString()).setDurable(false); - CoreQueueConfiguration targetQueueConfig = new CoreQueueConfiguration().setAddress(RandomUtil.randomString()).setName(RandomUtil.randomString()).setDurable(false); + QueueConfiguration sourceQueueConfig = new QueueConfiguration(RandomUtil.randomString()).setDurable(false); + QueueConfiguration targetQueueConfig = new QueueConfiguration(RandomUtil.randomString()).setDurable(false); List connectors = new ArrayList<>(); connectors.add(connectorConfig.getName()); Configuration conf_1 = createBasicConfig().addAcceptorConfiguration(acceptorConfig).addQueueConfiguration(targetQueueConfig); - bridgeConfig = new BridgeConfiguration().setName(RandomUtil.randomString()).setQueueName(sourceQueueConfig.getName()).setForwardingAddress(targetQueueConfig.getAddress()).setRetryInterval(RandomUtil.randomPositiveLong()).setRetryIntervalMultiplier(RandomUtil.randomDouble()).setInitialConnectAttempts(RandomUtil.randomPositiveInt()).setReconnectAttempts(RandomUtil.randomPositiveInt()).setReconnectAttemptsOnSameNode(RandomUtil.randomPositiveInt()).setUseDuplicateDetection(RandomUtil.randomBoolean()).setConfirmationWindowSize(RandomUtil.randomPositiveInt()).setStaticConnectors(connectors).setPassword(CLUSTER_PASSWORD); + bridgeConfig = new BridgeConfiguration().setName(RandomUtil.randomString()).setQueueName(sourceQueueConfig.getName().toString()).setForwardingAddress(targetQueueConfig.getAddress().toString()).setRetryInterval(RandomUtil.randomPositiveLong()).setRetryIntervalMultiplier(RandomUtil.randomDouble()).setInitialConnectAttempts(RandomUtil.randomPositiveInt()).setReconnectAttempts(RandomUtil.randomPositiveInt()).setReconnectAttemptsOnSameNode(RandomUtil.randomPositiveInt()).setUseDuplicateDetection(RandomUtil.randomBoolean()).setConfirmationWindowSize(RandomUtil.randomPositiveInt()).setStaticConnectors(connectors).setPassword(CLUSTER_PASSWORD); Configuration conf_0 = createBasicConfig().addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getName())).addConnectorConfiguration(connectorConfig.getName(), connectorConfig).addQueueConfiguration(sourceQueueConfig).addBridgeConfiguration(bridgeConfig); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/BridgeControlUsingCoreTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/BridgeControlUsingCoreTest.java index bd8b51dcfb..76edbde5f7 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/BridgeControlUsingCoreTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/BridgeControlUsingCoreTest.java @@ -22,12 +22,12 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder; import org.apache.activemq.artemis.api.core.management.ResourceNames; import org.apache.activemq.artemis.core.config.BridgeConfiguration; import org.apache.activemq.artemis.core.config.Configuration; -import org.apache.activemq.artemis.core.config.CoreQueueConfiguration; import org.apache.activemq.artemis.core.remoting.impl.invm.InVMAcceptorFactory; import org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory; import org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants; @@ -113,11 +113,11 @@ public class BridgeControlUsingCoreTest extends ManagementTestBase { TransportConfiguration connectorConfig = new TransportConfiguration(InVMConnectorFactory.class.getName(), acceptorParams, RandomUtil.randomString()); - CoreQueueConfiguration sourceQueueConfig = new CoreQueueConfiguration().setAddress(RandomUtil.randomString()).setName(RandomUtil.randomString()).setDurable(false); - CoreQueueConfiguration targetQueueConfig = new CoreQueueConfiguration().setAddress(RandomUtil.randomString()).setName(RandomUtil.randomString()).setDurable(false); + QueueConfiguration sourceQueueConfig = new QueueConfiguration(RandomUtil.randomString()).setDurable(false); + QueueConfiguration targetQueueConfig = new QueueConfiguration(RandomUtil.randomString()).setDurable(false); List connectors = new ArrayList<>(); connectors.add(connectorConfig.getName()); - bridgeConfig = new BridgeConfiguration().setName(RandomUtil.randomString()).setQueueName(sourceQueueConfig.getName()).setForwardingAddress(targetQueueConfig.getAddress()).setRetryInterval(RandomUtil.randomPositiveLong()).setRetryIntervalMultiplier(RandomUtil.randomDouble()).setInitialConnectAttempts(RandomUtil.randomPositiveInt()).setReconnectAttempts(RandomUtil.randomPositiveInt()).setReconnectAttemptsOnSameNode(RandomUtil.randomPositiveInt()).setUseDuplicateDetection(RandomUtil.randomBoolean()).setConfirmationWindowSize(RandomUtil.randomPositiveInt()).setStaticConnectors(connectors); + bridgeConfig = new BridgeConfiguration().setName(RandomUtil.randomString()).setQueueName(sourceQueueConfig.getName().toString()).setForwardingAddress(targetQueueConfig.getAddress().toString()).setRetryInterval(RandomUtil.randomPositiveLong()).setRetryIntervalMultiplier(RandomUtil.randomDouble()).setInitialConnectAttempts(RandomUtil.randomPositiveInt()).setReconnectAttempts(RandomUtil.randomPositiveInt()).setReconnectAttemptsOnSameNode(RandomUtil.randomPositiveInt()).setUseDuplicateDetection(RandomUtil.randomBoolean()).setConfirmationWindowSize(RandomUtil.randomPositiveInt()).setStaticConnectors(connectors); Configuration conf_1 = createBasicConfig().addAcceptorConfiguration(acceptorConfig).addQueueConfiguration(targetQueueConfig); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ClusterConnectionControl2Test.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ClusterConnectionControl2Test.java index 445fae5109..4e9a872106 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ClusterConnectionControl2Test.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ClusterConnectionControl2Test.java @@ -25,12 +25,12 @@ import java.util.Map; import org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration; import org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory; import org.apache.activemq.artemis.api.core.management.ClusterConnectionControl; import org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration; import org.apache.activemq.artemis.core.config.Configuration; -import org.apache.activemq.artemis.core.config.CoreQueueConfiguration; import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServers; @@ -108,7 +108,7 @@ public class ClusterConnectionControl2Test extends ManagementTestBase { TransportConfiguration connectorConfig_1 = new TransportConfiguration(ActiveMQTestBase.NETTY_CONNECTOR_FACTORY, acceptorParams_1); TransportConfiguration connectorConfig_0 = new TransportConfiguration(ActiveMQTestBase.NETTY_CONNECTOR_FACTORY); - CoreQueueConfiguration queueConfig = new CoreQueueConfiguration().setAddress(RandomUtil.randomString()).setName(RandomUtil.randomString()).setDurable(false); + QueueConfiguration queueConfig = new QueueConfiguration(RandomUtil.randomString()).setDurable(false); List connectorInfos = new ArrayList<>(); connectorInfos.add("netty"); @@ -116,7 +116,7 @@ public class ClusterConnectionControl2Test extends ManagementTestBase { DiscoveryGroupConfiguration discoveryGroupConfig = new DiscoveryGroupConfiguration().setName(discoveryName).setRefreshTimeout(0).setDiscoveryInitialWaitTimeout(0).setBroadcastEndpointFactory(new UDPBroadcastEndpointFactory().setGroupAddress(groupAddress).setGroupPort(groupPort)); - clusterConnectionConfig_0 = new ClusterConnectionConfiguration().setName(clusterName).setAddress(queueConfig.getAddress()).setConnectorName("netty").setRetryInterval(1000).setDuplicateDetection(false).setMessageLoadBalancingType(MessageLoadBalancingType.ON_DEMAND).setMaxHops(1).setConfirmationWindowSize(1024).setDiscoveryGroupName(discoveryName); + clusterConnectionConfig_0 = new ClusterConnectionConfiguration().setName(clusterName).setAddress(queueConfig.getAddress().toString()).setConnectorName("netty").setRetryInterval(1000).setDuplicateDetection(false).setMessageLoadBalancingType(MessageLoadBalancingType.ON_DEMAND).setMaxHops(1).setConfirmationWindowSize(1024).setDiscoveryGroupName(discoveryName); Configuration conf_1 = createBasicConfig().addClusterConfiguration(clusterConnectionConfig_0).addAcceptorConfiguration(acceptorConfig_1).addConnectorConfiguration("netty", connectorConfig_1).addQueueConfiguration(queueConfig).addDiscoveryGroupConfiguration(discoveryName, discoveryGroupConfig).addBroadcastGroupConfiguration(broadcastGroupConfig); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ClusterConnectionControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ClusterConnectionControlTest.java index 1fc2c5ecdd..c8d37123e6 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ClusterConnectionControlTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ClusterConnectionControlTest.java @@ -16,17 +16,17 @@ */ package org.apache.activemq.artemis.tests.integration.management; +import javax.json.JsonArray; +import javax.management.MBeanServer; +import javax.management.MBeanServerFactory; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.json.JsonArray; -import javax.management.MBeanServer; -import javax.management.MBeanServerFactory; - import org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration; import org.apache.activemq.artemis.api.core.JsonUtil; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory; @@ -35,7 +35,6 @@ import org.apache.activemq.artemis.api.core.management.CoreNotificationType; import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder; import org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration; import org.apache.activemq.artemis.core.config.Configuration; -import org.apache.activemq.artemis.core.config.CoreQueueConfiguration; import org.apache.activemq.artemis.core.remoting.impl.invm.InVMAcceptorFactory; import org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory; import org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants; @@ -200,7 +199,7 @@ public class ClusterConnectionControlTest extends ManagementTestBase { TransportConfiguration connectorConfig = new TransportConfiguration(InVMConnectorFactory.class.getName(), acceptorParams, RandomUtil.randomString()); - CoreQueueConfiguration queueConfig = new CoreQueueConfiguration().setAddress(RandomUtil.randomString()).setName(RandomUtil.randomString()).setDurable(false); + QueueConfiguration queueConfig = new QueueConfiguration(RandomUtil.randomString()).setDurable(false); List connectors = new ArrayList<>(); connectors.add(connectorConfig.getName()); @@ -209,9 +208,9 @@ public class ClusterConnectionControlTest extends ManagementTestBase { Configuration conf_1 = createBasicConfig().addAcceptorConfiguration(acceptorConfig).addQueueConfiguration(queueConfig); - clusterConnectionConfig1 = new ClusterConnectionConfiguration().setName(RandomUtil.randomString()).setAddress(queueConfig.getAddress()).setConnectorName(connectorConfig.getName()).setRetryInterval(RandomUtil.randomPositiveLong()).setDuplicateDetection(RandomUtil.randomBoolean()).setMessageLoadBalancingType(MessageLoadBalancingType.STRICT).setMaxHops(RandomUtil.randomPositiveInt()).setConfirmationWindowSize(RandomUtil.randomPositiveInt()).setMessageLoadBalancingType(MessageLoadBalancingType.ON_DEMAND).setStaticConnectors(connectors); + clusterConnectionConfig1 = new ClusterConnectionConfiguration().setName(RandomUtil.randomString()).setAddress(queueConfig.getAddress().toString()).setConnectorName(connectorConfig.getName()).setRetryInterval(RandomUtil.randomPositiveLong()).setDuplicateDetection(RandomUtil.randomBoolean()).setMessageLoadBalancingType(MessageLoadBalancingType.STRICT).setMaxHops(RandomUtil.randomPositiveInt()).setConfirmationWindowSize(RandomUtil.randomPositiveInt()).setMessageLoadBalancingType(MessageLoadBalancingType.ON_DEMAND).setStaticConnectors(connectors); - clusterConnectionConfig2 = new ClusterConnectionConfiguration().setName(RandomUtil.randomString()).setAddress(queueConfig.getAddress()).setConnectorName(connectorConfig.getName()).setRetryInterval(RandomUtil.randomPositiveLong()).setDuplicateDetection(RandomUtil.randomBoolean()).setMessageLoadBalancingType(MessageLoadBalancingType.OFF).setMaxHops(RandomUtil.randomPositiveInt()).setConfirmationWindowSize(RandomUtil.randomPositiveInt()).setMessageLoadBalancingType(MessageLoadBalancingType.ON_DEMAND).setDiscoveryGroupName(discoveryGroupName); + clusterConnectionConfig2 = new ClusterConnectionConfiguration().setName(RandomUtil.randomString()).setAddress(queueConfig.getAddress().toString()).setConnectorName(connectorConfig.getName()).setRetryInterval(RandomUtil.randomPositiveLong()).setDuplicateDetection(RandomUtil.randomBoolean()).setMessageLoadBalancingType(MessageLoadBalancingType.OFF).setMaxHops(RandomUtil.randomPositiveInt()).setConfirmationWindowSize(RandomUtil.randomPositiveInt()).setMessageLoadBalancingType(MessageLoadBalancingType.ON_DEMAND).setDiscoveryGroupName(discoveryGroupName); Configuration conf_0 = createBasicConfig().addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getName())).addConnectorConfiguration(connectorConfig.getName(), connectorConfig).addClusterConfiguration(clusterConnectionConfig1).addClusterConfiguration(clusterConnectionConfig2).addDiscoveryGroupConfiguration(discoveryGroupName, discoveryGroupConfig); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/DivertControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/DivertControlTest.java index 3c4b9830fa..d1424cac83 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/DivertControlTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/DivertControlTest.java @@ -16,13 +16,13 @@ */ package org.apache.activemq.artemis.tests.integration.management; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.management.DivertControl; import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder; import org.apache.activemq.artemis.api.core.management.ResourceNames; import org.apache.activemq.artemis.core.config.Configuration; -import org.apache.activemq.artemis.core.config.CoreQueueConfiguration; import org.apache.activemq.artemis.core.config.DivertConfiguration; import org.apache.activemq.artemis.core.config.TransformerConfiguration; import org.apache.activemq.artemis.core.server.ActiveMQServer; @@ -73,13 +73,13 @@ public class DivertControlTest extends ManagementTestBase { @Test public void testRetroactiveResourceAttribute() throws Exception { String address = RandomUtil.randomString(); - CoreQueueConfiguration queueConfig = new CoreQueueConfiguration().setAddress(RandomUtil.randomString()).setName(RandomUtil.randomString()).setDurable(false); - CoreQueueConfiguration forwardQueueConfig = new CoreQueueConfiguration().setAddress(address).setName(RandomUtil.randomString()).setDurable(false); + QueueConfiguration queueConfig = new QueueConfiguration(RandomUtil.randomString()).setDurable(false); + QueueConfiguration forwardQueueConfig = new QueueConfiguration(RandomUtil.randomString()).setAddress(address).setDurable(false); divertConfig = new DivertConfiguration() .setName(ResourceNames.getRetroactiveResourceDivertName(server.getInternalNamingPrefix(), server.getConfiguration().getWildcardConfiguration().getDelimiterString(), SimpleString.toSimpleString(address)).toString()) - .setRoutingName(RandomUtil.randomString()).setAddress(queueConfig.getAddress()) - .setForwardingAddress(forwardQueueConfig.getAddress()) + .setRoutingName(RandomUtil.randomString()).setAddress(queueConfig.getAddress().toString()) + .setForwardingAddress(forwardQueueConfig.getAddress().toString()) .setExclusive(RandomUtil.randomBoolean()) .setTransformerConfiguration(new TransformerConfiguration(AddHeadersTransformer.class.getName())); @@ -101,15 +101,25 @@ public class DivertControlTest extends ManagementTestBase { public void setUp() throws Exception { super.setUp(); - CoreQueueConfiguration queueConfig = new CoreQueueConfiguration().setAddress(RandomUtil.randomString()).setName(RandomUtil.randomString()).setDurable(false); - CoreQueueConfiguration forwardQueueConfig = new CoreQueueConfiguration().setAddress(RandomUtil.randomString()).setName(RandomUtil.randomString()).setDurable(false); + QueueConfiguration queueConfig = new QueueConfiguration(RandomUtil.randomString()).setDurable(false); + QueueConfiguration forwardQueueConfig = new QueueConfiguration(RandomUtil.randomString()).setDurable(false); - divertConfig = new DivertConfiguration().setName(RandomUtil.randomString()).setRoutingName(RandomUtil.randomString()).setAddress(queueConfig.getAddress()).setForwardingAddress(forwardQueueConfig.getAddress()).setExclusive(RandomUtil.randomBoolean()). - setTransformerConfiguration(new TransformerConfiguration(AddHeadersTransformer.class.getName())); + divertConfig = new DivertConfiguration() + .setName(RandomUtil.randomString()) + .setRoutingName(RandomUtil.randomString()) + .setAddress(queueConfig.getAddress().toString()) + .setForwardingAddress(forwardQueueConfig.getAddress().toString()) + .setExclusive(RandomUtil.randomBoolean()) + .setTransformerConfiguration(new TransformerConfiguration(AddHeadersTransformer.class.getName())); TransportConfiguration connectorConfig = new TransportConfiguration(INVM_CONNECTOR_FACTORY); - Configuration config = createDefaultInVMConfig().setJMXManagementEnabled(true).addQueueConfiguration(queueConfig).addQueueConfiguration(forwardQueueConfig).addDivertConfiguration(divertConfig).addConnectorConfiguration(connectorConfig.getName(), connectorConfig); + Configuration config = createDefaultInVMConfig() + .setJMXManagementEnabled(true) + .addQueueConfiguration(queueConfig) + .addQueueConfiguration(forwardQueueConfig) + .addDivertConfiguration(divertConfig) + .addConnectorConfiguration(connectorConfig.getName(), connectorConfig); server = addServer(ActiveMQServers.newActiveMQServer(config, mbeanServer, false)); server.start(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/LargeMessageOverManagementTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/LargeMessageOverManagementTest.java index 45f14da7e5..639e96047e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/LargeMessageOverManagementTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/LargeMessageOverManagementTest.java @@ -17,6 +17,7 @@ package org.apache.activemq.artemis.tests.integration.management; import org.apache.activemq.artemis.api.core.Message; +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.api.core.TransportConfiguration; @@ -75,8 +76,8 @@ public class LargeMessageOverManagementTest extends ManagementTestBase { SimpleString queue = RandomUtil.randomSimpleString(); SimpleString emptyqueue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, true); - session.createQueue(address, RoutingType.MULTICAST, emptyqueue, null, true); + session.createQueue(new QueueConfiguration(queue).setAddress(address)); + session.createQueue(new QueueConfiguration(emptyqueue).setAddress(address)); QueueControl queueControl = createManagementControl(address, queue); @@ -117,7 +118,7 @@ public class LargeMessageOverManagementTest extends ManagementTestBase { session.createAddress(address, RoutingType.ANYCAST, false); AddressControl addressControl = createManagementControl(address); - session.createQueue(address, RoutingType.ANYCAST, address); + session.createQueue(new QueueConfiguration(address).setRoutingType(RoutingType.ANYCAST)); int bodySize = server.getConfiguration().getJournalBufferSize_AIO(); byte[] bigData = createBytesData(bodySize); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementWithPagingServerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementWithPagingServerTest.java index 65374505d6..ffc27eef69 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementWithPagingServerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementWithPagingServerTest.java @@ -25,6 +25,7 @@ import java.util.List; import org.apache.activemq.artemis.api.core.ActiveMQBuffer; import org.apache.activemq.artemis.api.core.JsonUtil; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -61,7 +62,7 @@ public class ManagementWithPagingServerTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session1.createQueue(address, queue, null, true); + session1.createQueue(new QueueConfiguration(queue).setAddress(address)); QueueControl queueControl = createManagementControl(address, queue); @@ -113,7 +114,7 @@ public class ManagementWithPagingServerTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session1.createQueue(address, queue, null, true); + session1.createQueue(new QueueConfiguration(queue).setAddress(address)); QueueControl queueControl = createManagementControl(address, queue); @@ -167,7 +168,7 @@ public class ManagementWithPagingServerTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session1.createQueue(address, queue, null, true); + session1.createQueue(new QueueConfiguration(queue).setAddress(address)); QueueControl queueControl = createManagementControl(address, queue); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/NotificationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/NotificationTest.java index 225f18afdf..0f2417c7b8 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/NotificationTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/NotificationTest.java @@ -18,6 +18,7 @@ package org.apache.activemq.artemis.tests.integration.management; import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; import org.apache.activemq.artemis.api.core.ActiveMQException; +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.api.core.client.ClientConsumer; @@ -80,7 +81,7 @@ public class NotificationTest extends ActiveMQTestBase { NotificationTest.flush(notifConsumer); long start = System.currentTimeMillis(); - session.createQueue(address, queue, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); //the first message received will be for the address creation ClientMessage[] notifications = NotificationTest.consumeMessages(2, notifConsumer); @@ -108,7 +109,7 @@ public class NotificationTest extends ActiveMQTestBase { NotificationTest.flush(notifConsumer); long start = System.currentTimeMillis(); - session.createQueue(address, queue, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); ClientMessage[] notifications = NotificationTest.consumeMessages(1, notifConsumer); Assert.assertEquals(BINDING_ADDED.toString(), notifications[0].getObjectProperty(ManagementHelper.HDR_NOTIFICATION_TYPE).toString()); @@ -133,7 +134,7 @@ public class NotificationTest extends ActiveMQTestBase { queue + "' AND " + ManagementHelper.HDR_ADDRESS + " <> '" + address + "'"); NotificationTest.flush(notifConsumer); - session.createQueue(address, queue, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); NotificationTest.consumeMessages(0, notifConsumer); @@ -146,7 +147,7 @@ public class NotificationTest extends ActiveMQTestBase { SimpleString address = RandomUtil.randomSimpleString(); boolean durable = RandomUtil.randomBoolean(); - session.createQueue(address, queue, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); NotificationTest.flush(notifConsumer); @@ -174,7 +175,7 @@ public class NotificationTest extends ActiveMQTestBase { SimpleString address = RandomUtil.randomSimpleString(); boolean durable = RandomUtil.randomBoolean(); - session.createQueue(address, queue, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); NotificationTest.flush(notifConsumer); @@ -211,7 +212,7 @@ public class NotificationTest extends ActiveMQTestBase { SimpleString address = RandomUtil.randomSimpleString(); boolean durable = RandomUtil.randomBoolean(); - mySession.createQueue(address, queue, durable); + mySession.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); ClientConsumer consumer = mySession.createConsumer(queue); SimpleString sessionName = SimpleString.toSimpleString(((ClientSessionInternal) mySession).getName()); @@ -330,7 +331,7 @@ public class NotificationTest extends ActiveMQTestBase { SimpleString address = RandomUtil.randomSimpleString(); boolean durable = RandomUtil.randomBoolean(); - session.createQueue(address, queue, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); ClientConsumer consumer = mySession.createConsumer(queue); ClientProducer producer = mySession.createProducer(address); @@ -370,7 +371,7 @@ public class NotificationTest extends ActiveMQTestBase { SimpleString address = RandomUtil.randomSimpleString(); boolean durable = RandomUtil.randomBoolean(); - session.createQueue(address, queue, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); ClientConsumer consumer = mySession.createConsumer(queue); ClientProducer producer = mySession.createProducer(address); @@ -410,7 +411,7 @@ public class NotificationTest extends ActiveMQTestBase { SimpleString address = RandomUtil.randomSimpleString(); boolean durable = RandomUtil.randomBoolean(); - session.createQueue(address, queue, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); ClientProducer producer = mySession.createProducer(address); NotificationTest.flush(notifConsumer); @@ -459,7 +460,7 @@ public class NotificationTest extends ActiveMQTestBase { notifQueue = RandomUtil.randomSimpleString(); - session.createQueue(ActiveMQDefaultConfiguration.getDefaultManagementNotificationAddress(), notifQueue, null, false); + session.createQueue(new QueueConfiguration(notifQueue).setAddress(ActiveMQDefaultConfiguration.getDefaultManagementNotificationAddress()).setDurable(false)); notifConsumer = session.createConsumer(notifQueue); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlTest.java index 178ac58ec5..f220d6b7d6 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlTest.java @@ -41,6 +41,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQBuffer; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.JsonUtil; import org.apache.activemq.artemis.api.core.Message; +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.api.core.client.ClientConsumer; @@ -110,7 +111,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString queue = RandomUtil.randomSimpleString(); SimpleString filter = new SimpleString("color = 'blue'"); - session.createQueue(address, RoutingType.MULTICAST, queue, filter, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setFilterString(filter).setDurable(durable)); QueueControl queueControl = createManagementControl(address, queue); Assert.assertEquals(queue.toString(), queueControl.getName()); @@ -146,8 +147,8 @@ public class QueueControlTest extends ManagementTestBase { SimpleString multicastQueue = ResourceNames.getRetroactiveResourceQueueName(internalNamingPrefix, delimiter, baseAddress, RoutingType.MULTICAST); SimpleString anycastQueue = ResourceNames.getRetroactiveResourceQueueName(internalNamingPrefix, delimiter, baseAddress, RoutingType.ANYCAST); - session.createQueue(address, RoutingType.MULTICAST, multicastQueue, null, durable); - session.createQueue(address, RoutingType.MULTICAST, anycastQueue, null, durable); + session.createQueue(new QueueConfiguration(multicastQueue).setAddress(address).setDurable(durable)); + session.createQueue(new QueueConfiguration(anycastQueue).setAddress(address).setDurable(durable)); QueueControl queueControl = createManagementControl(address, multicastQueue); Assert.assertTrue(queueControl.isRetroactiveResource()); @@ -163,7 +164,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); QueueControl queueControl = createManagementControl(address, queue); Assert.assertEquals(queue.toString(), queueControl.getName()); @@ -178,7 +179,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString queue = RandomUtil.randomSimpleString(); final SimpleString deadLetterAddress = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); QueueControl queueControl = createManagementControl(address, queue); Assert.assertNull(queueControl.getDeadLetterAddress()); @@ -203,7 +204,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString queue = RandomUtil.randomSimpleString(); String deadLetterAddress = RandomUtil.randomString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); QueueControl queueControl = createManagementControl(address, queue); @@ -221,7 +222,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString queue = RandomUtil.randomSimpleString(); final SimpleString expiryAddress = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); QueueControl queueControl = createManagementControl(address, queue); Assert.assertNull(queueControl.getExpiryAddress()); @@ -246,7 +247,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString queue = RandomUtil.randomSimpleString(); String expiryAddress = RandomUtil.randomString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); QueueControl queueControl = createManagementControl(address, queue); @@ -266,7 +267,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); QueueControl queueControl = createManagementControl(address, queue); @@ -286,7 +287,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); QueueControl queueControl = createManagementControl(address, queue); @@ -316,7 +317,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); QueueControl queueControl = createManagementControl(address, queue); Assert.assertEquals(0, getMessageCount(queueControl)); @@ -337,7 +338,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); QueueControl queueControl = createManagementControl(address, queue); Assert.assertEquals(0, getMessageCount(queueControl)); @@ -368,7 +369,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); QueueControl queueControl = createManagementControl(address, queue); Assert.assertEquals(0, getMessagesAdded(queueControl)); @@ -391,7 +392,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, false); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false)); QueueControl queueControl = createManagementControl(address, queue); Assert.assertEquals(0, queueControl.getMessagesAcknowledged()); @@ -416,7 +417,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); QueueControl queueControl = createManagementControl(address, queue); Assert.assertEquals(0, queueControl.getMessagesAcknowledged()); @@ -462,7 +463,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); QueueControl queueControl = createManagementControl(address, queue); Assert.assertEquals(0, queueControl.getMessagesAcknowledged()); @@ -503,7 +504,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); QueueControl queueControl = createManagementControl(address, queue); Assert.assertEquals(0, queueControl.getScheduledCount()); @@ -551,7 +552,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); queue = RandomUtil.randomSimpleString(); - transSession.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + transSession.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); final QueueControl queueControl = createManagementControl(address, queue); @@ -636,7 +637,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); int intValue = RandomUtil.randomInt(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); Queue srvqueue = server.locateQueue(queue); @@ -680,7 +681,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); int intValue = RandomUtil.randomInt(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); Queue srvqueue = server.locateQueue(queue); @@ -718,7 +719,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); int intValue = RandomUtil.randomInt(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); QueueControl queueControl = createManagementControl(address, queue); @@ -752,7 +753,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); int intValue = RandomUtil.randomInt(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); QueueControl queueControl = createManagementControl(address, queue); @@ -788,7 +789,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); ClientProducer producer = session.createProducer(address); producer.send(session.createMessage(durable)); @@ -824,7 +825,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString queue = RandomUtil.randomSimpleString(); try { - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); for (int i = 0; i < THREAD_COUNT; i++) { producerExecutor.submit(() -> { @@ -890,7 +891,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); int intValue = RandomUtil.randomInt(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); QueueControl queueControl = createManagementControl(address, queue); @@ -927,7 +928,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); QueueControl queueControl = createManagementControl(address, queue); ClientProducer producer = session.createProducer(address); @@ -957,7 +958,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); QueueControl queueControl = createManagementControl(address, queue); ClientProducer producer = session.createProducer(address); @@ -978,7 +979,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); QueueControl queueControl = createManagementControl(address, queue); ClientProducer producer = session.createProducer(address); @@ -1004,7 +1005,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); QueueControl queueControl = createManagementControl(address, queue); ClientProducer producer = session.createProducer(address); @@ -1047,8 +1048,8 @@ public class QueueControlTest extends ManagementTestBase { AddressSettings addressSettings = new AddressSettings().setMaxDeliveryAttempts(1).setDeadLetterAddress(dla); server.getAddressSettingsRepository().addMatch(adName.toString(), addressSettings); - session.createQueue(dla, RoutingType.MULTICAST, dlq, null, durable); - session.createQueue(adName, RoutingType.MULTICAST, qName, null, durable); + session.createQueue(new QueueConfiguration(dlq).setAddress(dla).setDurable(durable)); + session.createQueue(new QueueConfiguration(qName).setAddress(adName).setDurable(durable)); // Send message to queue. ClientProducer producer = session.createProducer(adName); @@ -1103,7 +1104,7 @@ public class QueueControlTest extends ManagementTestBase { server.getAddressSettingsRepository().addMatch(adName.toString(), new AddressSettings().setMaxDeliveryAttempts(1).setDeadLetterAddress(dla).setAutoCreateDeadLetterResources(true)); - session.createQueue(adName, RoutingType.MULTICAST, qName, null, durable); + session.createQueue(new QueueConfiguration(qName).setAddress(adName).setDurable(durable)); // Send message to queue. ClientProducer producer = session.createProducer(adName); @@ -1151,8 +1152,8 @@ public class QueueControlTest extends ManagementTestBase { final SimpleString adName2 = new SimpleString("ad2"); final String sampleText = "Put me on DLQ"; - session.createQueue(adName, RoutingType.MULTICAST, qName, null, durable); - session.createQueue(adName2, RoutingType.MULTICAST, qName2, null, durable); + session.createQueue(new QueueConfiguration(qName).setAddress(adName).setDurable(durable)); + session.createQueue(new QueueConfiguration(qName2).setAddress(adName2).setDurable(durable)); // Send message to queue. ClientProducer producer = session.createProducer(adName); @@ -1210,8 +1211,8 @@ public class QueueControlTest extends ManagementTestBase { server.getAddressSettingsRepository().addMatch(forwardingAddress.toString(), addressSettings); // create target queue, DLQ and source topic - session.createQueue(dla, RoutingType.MULTICAST, dlq, null, durable); - session.createQueue(forwardingAddress, RoutingType.MULTICAST, forwardingQueue, null, durable); + session.createQueue(new QueueConfiguration(dlq).setAddress(dla).setDurable(durable)); + session.createQueue(new QueueConfiguration(forwardingQueue).setAddress(forwardingAddress).setDurable(durable)); session.createAddress(myTopic, RoutingType.MULTICAST, false); DivertConfiguration divert = new DivertConfiguration().setName("local-divert") @@ -1272,8 +1273,8 @@ public class QueueControlTest extends ManagementTestBase { AddressSettings addressSettings = new AddressSettings().setMaxDeliveryAttempts(1).setDeadLetterAddress(dla); server.getAddressSettingsRepository().addMatch(adName.toString(), addressSettings); - session.createQueue(dla, RoutingType.MULTICAST, dlq, null, durable); - session.createQueue(adName, RoutingType.MULTICAST, qName, null, durable); + session.createQueue(new QueueConfiguration(dlq).setAddress(dla).setDurable(durable)); + session.createQueue(new QueueConfiguration(qName).setAddress(adName).setDurable(durable)); // Send message to queue. ClientProducer producer = session.createProducer(adName); @@ -1358,8 +1359,8 @@ public class QueueControlTest extends ManagementTestBase { SimpleString otherAddress = RandomUtil.randomSimpleString(); SimpleString otherQueue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); - session.createQueue(otherAddress, RoutingType.MULTICAST, otherQueue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); + session.createQueue(new QueueConfiguration(otherQueue).setAddress(otherAddress).setDurable(durable)); ClientProducer producer = session.createProducer(address); // send on queue @@ -1413,9 +1414,9 @@ public class QueueControlTest extends ManagementTestBase { SimpleString queueB = new SimpleString("B"); SimpleString queueC = new SimpleString("C"); - server.createQueue(address, RoutingType.MULTICAST, queueA, null, durable, false); - server.createQueue(address, RoutingType.MULTICAST, queueB, null, durable, false); - server.createQueue(address, RoutingType.MULTICAST, queueC, null, durable, false); + server.createQueue(new QueueConfiguration(queueA).setAddress(address).setDurable(durable)); + server.createQueue(new QueueConfiguration(queueB).setAddress(address).setDurable(durable)); + server.createQueue(new QueueConfiguration(queueC).setAddress(address).setDurable(durable)); QueueControl queueControlA = createManagementControl(address, queueA); @@ -1476,7 +1477,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString queue = RandomUtil.randomSimpleString(); SimpleString unknownQueue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); ClientProducer producer = session.createProducer(address); // send on queue @@ -1522,8 +1523,8 @@ public class QueueControlTest extends ManagementTestBase { SimpleString otherAddress = RandomUtil.randomSimpleString(); SimpleString otherQueue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); - session.createQueue(otherAddress, RoutingType.MULTICAST,otherQueue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); + session.createQueue(new QueueConfiguration(otherQueue).setAddress(otherAddress).setDurable(durable)); ClientProducer producer = session.createProducer(address); // send on queue @@ -1569,8 +1570,8 @@ public class QueueControlTest extends ManagementTestBase { SimpleString otherAddress = RandomUtil.randomSimpleString(); SimpleString otherQueue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); - session.createQueue(otherAddress, RoutingType.MULTICAST, otherQueue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); + session.createQueue(new QueueConfiguration(otherQueue).setAddress(otherAddress).setDurable(durable)); ClientProducer producer = session.createProducer(address); // send 2 messages on queue @@ -1622,9 +1623,9 @@ public class QueueControlTest extends ManagementTestBase { SimpleString otherQueue1 = new SimpleString("child.queue.1"); SimpleString otherQueue2 = new SimpleString("child.queue.2"); - session.createQueue(address, RoutingType.ANYCAST, queue, null, durable); - session.createQueue(otherAddress, RoutingType.MULTICAST, otherQueue1, null, durable); - session.createQueue(otherAddress, RoutingType.MULTICAST, otherQueue2, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setRoutingType(RoutingType.ANYCAST).setDurable(durable)); + session.createQueue(new QueueConfiguration(otherQueue1).setAddress(otherAddress).setDurable(durable)); + session.createQueue(new QueueConfiguration(otherQueue2).setAddress(otherAddress).setDurable(durable)); ClientProducer producer = session.createProducer(address); producer.send(session.createMessage(durable)); @@ -1662,7 +1663,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString queue = RandomUtil.randomSimpleString(); SimpleString unknownQueue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); ClientProducer producer = session.createProducer(address); // send 2 messages on queue @@ -1706,7 +1707,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); ClientProducer producer = session.createProducer(address); // send on queue @@ -1750,7 +1751,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); ClientProducer producer = session.createProducer(address); // send on queue @@ -1790,7 +1791,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); ClientProducer producer = session.createProducer(address); // send on queue @@ -1813,7 +1814,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); ClientProducer producer = session.createProducer(address); // send on queue @@ -1845,7 +1846,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queueName = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queueName, null, durable); + session.createQueue(new QueueConfiguration(queueName).setAddress(address).setDurable(durable)); Queue queue = server.locateQueue(queueName); Assert.assertFalse(queue.getPageSubscription().isPaging()); @@ -1893,7 +1894,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); ClientProducer producer = session.createProducer(address); // send on queue @@ -1916,7 +1917,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); ClientProducer producer = session.createProducer(address); // send 2 messages on queue @@ -1947,7 +1948,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); ClientProducer producer = session.createProducer(address); // send 2 messages on queue, both scheduled @@ -1987,7 +1988,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); ClientProducer producer = session.createProducer(address); // send messages on queue @@ -2039,7 +2040,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, queue, null, false); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false)); ClientProducer producer = session.createProducer(address); ClientMessage matchingMessage = session.createMessage(false); @@ -2075,7 +2076,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, queue, null, false); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false)); ClientProducer producer = session.createProducer(address); ClientMessage matchingMessage = session.createMessage(false); @@ -2107,7 +2108,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, queue, null, false); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false)); ClientProducer producer = session.createProducer(address); ClientMessage matchingMessage = session.createMessage(false); @@ -2145,7 +2146,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, queue, null, false); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false)); ClientProducer producer = session.createProducer(address); ClientMessage message1 = session.createMessage(false); @@ -2184,7 +2185,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, queue, null, false); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false)); ClientProducer producer = session.createProducer(address); ClientMessage message1 = session.createMessage(false); @@ -2224,7 +2225,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); ClientProducer producer = session.createProducer(address); // send on queue @@ -2255,7 +2256,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); ClientProducer producer = session.createProducer(address); // send on queue @@ -2302,7 +2303,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, queue, null, false); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false)); ClientProducer producer = session.createProducer(address); for (int i = 0; i < 100; i++) { @@ -2335,7 +2336,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, queue, null, false); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false)); ClientProducer producer = session.createProducer(address); for (int i = 0; i < 100; i++) { @@ -2362,7 +2363,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); ClientProducer producer = session.createProducer(address); // send on queue @@ -2404,8 +2405,8 @@ public class QueueControlTest extends ManagementTestBase { SimpleString expiryAddress = RandomUtil.randomSimpleString(); SimpleString expiryQueue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); - session.createQueue(expiryAddress, RoutingType.MULTICAST, expiryQueue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); + session.createQueue(new QueueConfiguration(expiryQueue).setAddress(expiryAddress).setDurable(durable)); ClientProducer producer = session.createProducer(address); // send on queue @@ -2445,8 +2446,8 @@ public class QueueControlTest extends ManagementTestBase { SimpleString deadLetterAddress = RandomUtil.randomSimpleString(); SimpleString deadLetterQueue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); - session.createQueue(deadLetterAddress, RoutingType.MULTICAST, deadLetterQueue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); + session.createQueue(new QueueConfiguration(deadLetterQueue).setAddress(deadLetterAddress).setDurable(durable)); ClientProducer producer = session.createProducer(address); // send 2 messages on queue @@ -2490,7 +2491,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); ClientProducer producer = session.createProducer(address); ClientMessage message = session.createMessage(durable); @@ -2524,7 +2525,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); ClientProducer producer = session.createProducer(address); ClientMessage message = session.createMessage(durable); @@ -2558,7 +2559,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); QueueControl queueControl = createManagementControl(address, queue); ActiveMQServerControl serverControl = ManagementControlHelper.createActiveMQServerControl(mbeanServer); @@ -2610,7 +2611,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); QueueControl queueControl = createManagementControl(address, queue); ActiveMQServerControl serverControl = ManagementControlHelper.createActiveMQServerControl(mbeanServer); @@ -2662,7 +2663,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); QueueControl queueControl = createManagementControl(address, queue); String history = queueControl.listMessageCounterAsHTML(); @@ -2677,7 +2678,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); QueueControl queueControl = createManagementControl(address, queue); ActiveMQServerControl serverControl = ManagementControlHelper.createActiveMQServerControl(mbeanServer); @@ -2697,7 +2698,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); QueueControl queueControl = createManagementControl(address, queue); ActiveMQServerControl serverControl = ManagementControlHelper.createActiveMQServerControl(mbeanServer); @@ -2713,8 +2714,8 @@ public class QueueControlTest extends ManagementTestBase { @Test public void testMoveMessagesBack() throws Exception { - server.createQueue(new SimpleString("q1"), RoutingType.MULTICAST, new SimpleString("q1"), null, durable, false); - server.createQueue(new SimpleString("q2"), RoutingType.MULTICAST, new SimpleString("q2"), null, durable, false); + server.createQueue(new QueueConfiguration(new SimpleString("q1")).setRoutingType(RoutingType.MULTICAST).setDurable(durable)); + server.createQueue(new QueueConfiguration(new SimpleString("q2")).setRoutingType(RoutingType.MULTICAST).setDurable(durable)); ServerLocator locator = createInVMNonHALocator(); @@ -2777,8 +2778,8 @@ public class QueueControlTest extends ManagementTestBase { @Test public void testMoveMessagesBack2() throws Exception { - server.createQueue(new SimpleString("q1"), RoutingType.MULTICAST, new SimpleString("q1"), null, durable, false); - server.createQueue(new SimpleString("q2"), RoutingType.MULTICAST, new SimpleString("q2"), null, durable, false); + server.createQueue(new QueueConfiguration(new SimpleString("q1")).setRoutingType(RoutingType.MULTICAST).setDurable(durable)); + server.createQueue(new QueueConfiguration(new SimpleString("q2")).setRoutingType(RoutingType.MULTICAST).setDurable(durable)); ServerLocator locator = createInVMNonHALocator(); @@ -2855,7 +2856,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString queue = RandomUtil.randomSimpleString(); try { - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); QueueControl queueControl = createManagementControl(address, queue); ActiveMQServerControl serverControl = ManagementControlHelper.createActiveMQServerControl(mbeanServer); @@ -2876,7 +2877,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); QueueControl queueControl = createManagementControl(address, queue); Assert.assertEquals(0, getMessagesAdded(queueControl)); @@ -2903,7 +2904,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); QueueControl queueControl = createManagementControl(address, queue); Assert.assertEquals(0, queueControl.getMessagesAcknowledged()); @@ -2928,7 +2929,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); QueueControl queueControl = createManagementControl(address, queue); Assert.assertEquals(0, queueControl.getMessagesExpired()); @@ -2973,7 +2974,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); QueueControl queueControl = createManagementControl(address, queue); Assert.assertEquals(0, queueControl.getMessagesExpired()); @@ -3024,7 +3025,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString testQueueName = new SimpleString("newQueue"); String testQueueName2 = "newQueue2"; - this.server.createQueue(testQueueName, RoutingType.MULTICAST, testQueueName, null, durable, false); + this.server.createQueue(new QueueConfiguration(testQueueName).setDurable(durable)); Notification notif = listener.getNotification(); @@ -3039,7 +3040,7 @@ public class QueueControlTest extends ManagementTestBase { ActiveMQServerControl control = ManagementControlHelper.createActiveMQServerControl(mbeanServer); - control.createQueue(testQueueName2, testQueueName2, RoutingType.MULTICAST.toString()); + control.createQueue(new QueueConfiguration(testQueueName2).setRoutingType(RoutingType.MULTICAST).toJSON()); notif = listener.getNotification(); System.out.println("got notif: " + notif); @@ -3057,7 +3058,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); QueueControl queueControl = createManagementControl(address, queue); @@ -3089,7 +3090,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); QueueControl queueControl = createManagementControl(address, queue); @@ -3130,7 +3131,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); QueueControl queueControl = createManagementControl(address, queue); @@ -3173,7 +3174,7 @@ public class QueueControlTest extends ManagementTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, durable); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); QueueControl queueControl = createManagementControl(address, queue); Assert.assertEquals(0, queueControl.getScheduledCount()); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/SSLSecurityNotificationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/SSLSecurityNotificationTest.java index 83ec599d78..56e2773846 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/SSLSecurityNotificationTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/SSLSecurityNotificationTest.java @@ -25,6 +25,7 @@ import java.util.Set; import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; import org.apache.activemq.artemis.api.core.ActiveMQException; +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.api.core.TransportConfiguration; @@ -125,7 +126,7 @@ public class SSLSecurityNotificationTest extends ActiveMQTestBase { ClientSession guestSession = sf.createSession("guest", "guest", false, true, true, false, 1); - guestSession.createQueue(address, RoutingType.ANYCAST, queue, true); + guestSession.createQueue(new QueueConfiguration(queue).setAddress(address).setRoutingType(RoutingType.ANYCAST)); SSLSecurityNotificationTest.flush(notifConsumer); long start = System.currentTimeMillis(); @@ -182,7 +183,7 @@ public class SSLSecurityNotificationTest extends ActiveMQTestBase { adminSession = sf.createSession(true, true, 1); adminSession.start(); - adminSession.createTemporaryQueue(ActiveMQDefaultConfiguration.getDefaultManagementNotificationAddress(), notifQueue); + adminSession.createQueue(new QueueConfiguration(notifQueue).setAddress(ActiveMQDefaultConfiguration.getDefaultManagementNotificationAddress()).setDurable(false).setTemporary(true)); notifConsumer = adminSession.createConsumer(notifQueue); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/SecurityNotificationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/SecurityNotificationTest.java index 932350a9dd..2066987027 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/SecurityNotificationTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/SecurityNotificationTest.java @@ -21,6 +21,7 @@ import java.util.Set; import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; import org.apache.activemq.artemis.api.core.ActiveMQException; +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.api.core.client.ClientConsumer; @@ -112,7 +113,7 @@ public class SecurityNotificationTest extends ActiveMQTestBase { long start = System.currentTimeMillis(); try { - guestSession.createQueue(address, queue, true); + guestSession.createQueue(new QueueConfiguration(queue).setAddress(address)); Assert.fail("session creation must fail and a notification of security violation must be sent"); } catch (Exception e) { } @@ -153,7 +154,7 @@ public class SecurityNotificationTest extends ActiveMQTestBase { ClientSessionFactory sf = createSessionFactory(locator); ClientSession guestSession = sf.createSession("guest", "guest", false, true, true, false, 1); - guestSession.createQueue(address, RoutingType.ANYCAST, queue, true); + guestSession.createQueue(new QueueConfiguration(queue).setAddress(address).setRoutingType(RoutingType.ANYCAST)); SecurityNotificationTest.flush(notifConsumer); long start = System.currentTimeMillis(); @@ -204,7 +205,7 @@ public class SecurityNotificationTest extends ActiveMQTestBase { adminSession = sf.createSession("admin", "admin", false, true, true, false, 1); adminSession.start(); - adminSession.createTemporaryQueue(ActiveMQDefaultConfiguration.getDefaultManagementNotificationAddress(), notifQueue); + adminSession.createQueue(new QueueConfiguration(notifQueue).setAddress(ActiveMQDefaultConfiguration.getDefaultManagementNotificationAddress()).setDurable(false).setTemporary(true)); notifConsumer = adminSession.createConsumer(notifQueue); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTest.java index d32355442c..96e1d28af1 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTest.java @@ -37,11 +37,11 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; import java.util.regex.Pattern; +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.config.Configuration; import org.apache.activemq.artemis.core.config.CoreAddressConfiguration; -import org.apache.activemq.artemis.core.config.CoreQueueConfiguration; import org.apache.activemq.artemis.core.postoffice.Binding; import org.apache.activemq.artemis.core.postoffice.QueueBinding; import org.apache.activemq.artemis.core.protocol.mqtt.MQTTUtil; @@ -1027,7 +1027,7 @@ public class MQTTTest extends MQTTTestSupport { @Test(timeout = 60 * 1000) public void testClientConnectionFailureSendsWillMessage() throws Exception { - getServer().createQueue(SimpleString.toSimpleString("will"), RoutingType.MULTICAST, SimpleString.toSimpleString("will"), null, true, false); + getServer().createQueue(new QueueConfiguration("will")); MQTT mqtt = createMQTTConnection("1", false); mqtt.setKeepAlive((short) 1); @@ -1053,7 +1053,7 @@ public class MQTTTest extends MQTTTestSupport { @Test(timeout = 60 * 1000) public void testWillMessageIsRetained() throws Exception { - getServer().createQueue(SimpleString.toSimpleString("will"), RoutingType.MULTICAST, SimpleString.toSimpleString("will"), null, true, false); + getServer().createQueue(new QueueConfiguration("will")); MQTT mqtt = createMQTTConnection("1", false); mqtt.setKeepAlive((short) 1); @@ -1746,7 +1746,7 @@ public class MQTTTest extends MQTTTestSupport { SimpleString coreAddress = new SimpleString("foo.bar"); Topic[] mqttSubscription = new Topic[]{new Topic("foo/bar", QoS.AT_LEAST_ONCE)}; - getServer().createQueue(coreAddress, RoutingType.MULTICAST, new SimpleString(clientId + "." + coreAddress), null, false, true, 0, false, true); + getServer().createQueue(new QueueConfiguration(new SimpleString(clientId + "." + coreAddress)).setAddress(coreAddress).setRoutingType(RoutingType.MULTICAST).setDurable(false).setTemporary(true).setMaxConsumers(0)); MQTT mqtt = createMQTTConnection(); mqtt.setClientId(clientId); @@ -1900,15 +1900,12 @@ public class MQTTTest extends MQTTTestSupport { public void testBrokerRestartAfterSubHashWithConfigurationQueues() throws Exception { // Add some pre configured queues - CoreQueueConfiguration coreQueueConfiguration = new CoreQueueConfiguration(); - coreQueueConfiguration.setName("DLQ"); - coreQueueConfiguration.setRoutingType(RoutingType.ANYCAST); - coreQueueConfiguration.setAddress("DLA"); - CoreAddressConfiguration coreAddressConfiguration = new CoreAddressConfiguration(); coreAddressConfiguration.setName("DLA"); coreAddressConfiguration.addRoutingType(RoutingType.ANYCAST); - coreAddressConfiguration.addQueueConfiguration(coreQueueConfiguration); + coreAddressConfiguration.addQueueConfiguration(new QueueConfiguration("DLQ") + .setAddress("DLA") + .setRoutingType(RoutingType.ANYCAST)); getServer().getConfiguration().getAddressConfigurations().add(coreAddressConfiguration); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MqttClusterRemoteSubscribeTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MqttClusterRemoteSubscribeTest.java index f8391098a8..4cf520526c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MqttClusterRemoteSubscribeTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MqttClusterRemoteSubscribeTest.java @@ -17,9 +17,10 @@ package org.apache.activemq.artemis.tests.integration.mqtt.imported; import java.util.concurrent.TimeUnit; + +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.core.config.CoreAddressConfiguration; -import org.apache.activemq.artemis.core.config.CoreQueueConfiguration; import org.apache.activemq.artemis.core.config.WildcardConfiguration; import org.apache.activemq.artemis.core.protocol.mqtt.MQTTProtocolManager; import org.apache.activemq.artemis.core.remoting.impl.AbstractAcceptor; @@ -1313,11 +1314,7 @@ public class MqttClusterRemoteSubscribeTest extends ClusterTestBase { CoreAddressConfiguration coreAddressConfiguration = new CoreAddressConfiguration(); coreAddressConfiguration.addRoutingType(RoutingType.ANYCAST); coreAddressConfiguration.setName(TOPIC); - CoreQueueConfiguration coreQueueConfiguration = new CoreQueueConfiguration(); - coreQueueConfiguration.setName(TOPIC); - coreQueueConfiguration.setAddress(TOPIC); - coreQueueConfiguration.setRoutingType(RoutingType.ANYCAST); - coreAddressConfiguration.addQueueConfiguration(coreQueueConfiguration); + coreAddressConfiguration.addQueueConfiguration(new QueueConfiguration(TOPIC).setRoutingType(RoutingType.ANYCAST)); return coreAddressConfiguration; } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/BasicOpenWireTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/BasicOpenWireTest.java index 0a079f2377..30118f9641 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/BasicOpenWireTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/BasicOpenWireTest.java @@ -31,6 +31,7 @@ import org.apache.activemq.ActiveMQConnection; import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.ActiveMQXAConnectionFactory; import org.apache.activemq.artemis.api.core.ActiveMQNonExistentQueueException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.command.ActiveMQDestination; @@ -66,15 +67,15 @@ public class BasicOpenWireTest extends OpenWireTestBase { System.setProperty("org.apache.activemq.transport.AbstractInactivityMonitor.keepAliveTime", "5"); createFactories(); SimpleString coreQueue = new SimpleString(queueName); - this.server.createQueue(coreQueue, RoutingType.ANYCAST, coreQueue, null, true, false, -1, false, true); + this.server.createQueue(new QueueConfiguration(coreQueue).setRoutingType(RoutingType.ANYCAST)); testQueues.put(queueName, coreQueue); SimpleString coreQueue2 = new SimpleString(queueName2); - this.server.createQueue(coreQueue2, RoutingType.ANYCAST, coreQueue2, null, true, false, -1, false, true); + this.server.createQueue(new QueueConfiguration(coreQueue2).setRoutingType(RoutingType.ANYCAST)); testQueues.put(queueName2, coreQueue2); SimpleString durableQueue = new SimpleString(durableQueueName); - this.server.createQueue(durableQueue, RoutingType.ANYCAST, durableQueue, null, true, false, -1, false, true); + this.server.createQueue(new QueueConfiguration(durableQueue).setRoutingType(RoutingType.ANYCAST)); testQueues.put(durableQueueName, durableQueue); if (!enableSecurity) { @@ -151,7 +152,7 @@ public class BasicOpenWireTest extends OpenWireTestBase { SimpleString coreQ = testQueues.get(qname); if (coreQ == null) { coreQ = new SimpleString(qname); - this.server.createQueue(coreQ, RoutingType.ANYCAST, coreQ, null, true, false, -1, false, true); + this.server.createQueue(new QueueConfiguration(coreQ).setRoutingType(RoutingType.ANYCAST)); testQueues.put(qname, coreQ); } } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/FQQNOpenWireTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/FQQNOpenWireTest.java index bb0fb3077a..a88651425b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/FQQNOpenWireTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/FQQNOpenWireTest.java @@ -31,6 +31,7 @@ import java.util.Arrays; import java.util.Collection; import org.apache.activemq.ActiveMQConnectionFactory; +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.api.core.client.ServerLocator; @@ -127,8 +128,8 @@ public class FQQNOpenWireTest extends OpenWireTestBase { SimpleString queueName1 = new SimpleString("sub.queue1"); SimpleString queueName2 = new SimpleString("sub.queue2"); - server.createQueue(multicastAddress, RoutingType.MULTICAST, queueName1, null, false, false); - server.createQueue(multicastAddress, RoutingType.MULTICAST, queueName2, null, false, false); + server.createQueue(new QueueConfiguration(queueName1).setAddress(multicastAddress).setDurable(false)); + server.createQueue(new QueueConfiguration(queueName2).setAddress(multicastAddress).setDurable(false)); Connection connection = factory.createConnection(); try { @@ -236,7 +237,7 @@ public class FQQNOpenWireTest extends OpenWireTestBase { Connection exConn = null; SimpleString durableQueue = new SimpleString("myqueue"); - this.server.createQueue(durableQueue, RoutingType.ANYCAST, durableQueue, null, true, false, -1, false, true); + this.server.createQueue(new QueueConfiguration(durableQueue).setRoutingType(RoutingType.ANYCAST)); try { ActiveMQConnectionFactory exFact = new ActiveMQConnectionFactory(); @@ -274,7 +275,7 @@ public class FQQNOpenWireTest extends OpenWireTestBase { Connection exConn = null; SimpleString durableQueue = new SimpleString("myqueue"); - this.server.createQueue(durableQueue, RoutingType.ANYCAST, durableQueue, null, true, false, -1, false, true); + this.server.createQueue(new QueueConfiguration(durableQueue).setRoutingType(RoutingType.ANYCAST)); try { ActiveMQConnectionFactory exFact = new ActiveMQConnectionFactory(); @@ -325,7 +326,7 @@ public class FQQNOpenWireTest extends OpenWireTestBase { SimpleString subscriptionQ = new SimpleString("Consumer.A"); this.server.addAddressInfo(new AddressInfo(topic, RoutingType.MULTICAST)); - this.server.createQueue(topic, RoutingType.MULTICAST, subscriptionQ, null, true, false, -1, false, true); + this.server.createQueue(new QueueConfiguration(subscriptionQ).setAddress(topic)); try { ActiveMQConnectionFactory exFact = new ActiveMQConnectionFactory(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireDivertExclusiveTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireDivertExclusiveTest.java index dc55915832..1248544e78 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireDivertExclusiveTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireDivertExclusiveTest.java @@ -24,6 +24,7 @@ import javax.jms.Queue; import javax.jms.Session; import org.apache.activemq.ActiveMQConnectionFactory; +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.api.core.client.ClientMessage; @@ -57,10 +58,10 @@ public class OpenWireDivertExclusiveTest extends OpenWireDivertTestBase { final SimpleString queueName4 = new SimpleString("queue4"); - coreSession.createQueue(new SimpleString(forwardAddress), RoutingType.MULTICAST, queueName1, null, false); - coreSession.createQueue(new SimpleString(testAddress), RoutingType.MULTICAST, queueName2, null, false); - coreSession.createQueue(new SimpleString(testAddress), RoutingType.MULTICAST, queueName3, null, false); - coreSession.createQueue(new SimpleString(testAddress), RoutingType.MULTICAST, queueName4, null, false); + coreSession.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress).setDurable(false)); + coreSession.createQueue(new QueueConfiguration(queueName2).setAddress(testAddress).setDurable(false)); + coreSession.createQueue(new QueueConfiguration(queueName3).setAddress(testAddress).setDurable(false)); + coreSession.createQueue(new QueueConfiguration(queueName4).setAddress(testAddress).setDurable(false)); ClientProducer producer = coreSession.createProducer(new SimpleString(testAddress)); @@ -124,8 +125,8 @@ public class OpenWireDivertExclusiveTest extends OpenWireDivertTestBase { final SimpleString queueName1 = new SimpleString("queue1"); final SimpleString queueName2 = new SimpleString("queue2"); - coreSession.createQueue(new SimpleString(forwardAddress), RoutingType.ANYCAST, queueName1, null, false); - coreSession.createQueue(new SimpleString(testAddress), RoutingType.ANYCAST, queueName2, null, false); + coreSession.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress).setRoutingType(RoutingType.ANYCAST).setDurable(false)); + coreSession.createQueue(new QueueConfiguration(queueName2).setAddress(testAddress).setRoutingType(RoutingType.ANYCAST).setDurable(false)); coreSession.close(); factory = new ActiveMQConnectionFactory(urlString); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireDivertNonExclusiveTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireDivertNonExclusiveTest.java index 8665d11387..3d4cee9dd3 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireDivertNonExclusiveTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireDivertNonExclusiveTest.java @@ -17,6 +17,7 @@ package org.apache.activemq.artemis.tests.integration.openwire; import org.apache.activemq.ActiveMQConnectionFactory; +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.api.core.client.ClientMessage; @@ -55,9 +56,9 @@ public class OpenWireDivertNonExclusiveTest extends OpenWireDivertTestBase { final SimpleString queueName2 = new SimpleString("queue2"); - coreSession.createQueue(new SimpleString(forwardAddress), RoutingType.MULTICAST, queueName1, null, false); + coreSession.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress).setDurable(false)); - coreSession.createQueue(new SimpleString(testAddress), RoutingType.MULTICAST, queueName2, null, false); + coreSession.createQueue(new QueueConfiguration(queueName2).setAddress(testAddress).setDurable(false)); ClientProducer producer = coreSession.createProducer(new SimpleString(testAddress)); final int numMessages = 1; @@ -130,8 +131,8 @@ public class OpenWireDivertNonExclusiveTest extends OpenWireDivertTestBase { final SimpleString queueName1 = new SimpleString("queue1"); final SimpleString queueName2 = new SimpleString("queue2"); - coreSession.createQueue(new SimpleString(forwardAddress), RoutingType.ANYCAST, queueName1, null, false); - coreSession.createQueue(new SimpleString(testAddress), RoutingType.ANYCAST, queueName2, null, false); + coreSession.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress).setRoutingType(RoutingType.ANYCAST).setDurable(false)); + coreSession.createQueue(new QueueConfiguration(queueName2).setAddress(testAddress).setRoutingType(RoutingType.ANYCAST).setDurable(false)); coreSession.close(); //use openwire to receive diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireFlowControlFailTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireFlowControlFailTest.java index a2685b03a1..2c66366428 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireFlowControlFailTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireFlowControlFailTest.java @@ -26,6 +26,7 @@ import javax.jms.TextMessage; import java.util.Map; import org.apache.activemq.ActiveMQConnectionFactory; +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.server.impl.AddressInfo; @@ -52,7 +53,7 @@ public class OpenWireFlowControlFailTest extends OpenWireTestBase { AddressInfo addressInfo = new AddressInfo(SimpleString.toSimpleString("Test"), RoutingType.ANYCAST); server.addAddressInfo(addressInfo); - server.createQueue(addressInfo.getName(), RoutingType.ANYCAST, addressInfo.getName(), null, true, false); + server.createQueue(new QueueConfiguration(addressInfo.getName()).setRoutingType(RoutingType.ANYCAST)); StringBuffer textBody = new StringBuffer(); for (int i = 0; i < 10; i++) { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireLargeMessageTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireLargeMessageTest.java index 6ccd07d297..014bd7b260 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireLargeMessageTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireLargeMessageTest.java @@ -25,6 +25,7 @@ import javax.jms.Queue; import javax.jms.Session; import java.util.Map; +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.paging.PagingStore; @@ -49,8 +50,8 @@ public class OpenWireLargeMessageTest extends BasicOpenWireTest { public void setUp() throws Exception { this.realStore = true; super.setUp(); - server.createQueue(lmAddress, RoutingType.ANYCAST, lmAddress, null, true, false); - server.createQueue(lmDropAddress, RoutingType.ANYCAST, lmDropAddress, null, true, false); + server.createQueue(new QueueConfiguration(lmAddress).setRoutingType(RoutingType.ANYCAST)); + server.createQueue(new QueueConfiguration(lmDropAddress).setRoutingType(RoutingType.ANYCAST)); } @Test diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SecurityOpenWireTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SecurityOpenWireTest.java index 3c7e50f6ac..7746fc766f 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SecurityOpenWireTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SecurityOpenWireTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.openwire; +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.config.Configuration; @@ -64,7 +65,7 @@ public class SecurityOpenWireTest extends BasicOpenWireTest { server.getSecurityRepository().addMatch("denyQ", roles); SimpleString denyQ = new SimpleString("denyQ"); - server.createQueue(denyQ, RoutingType.ANYCAST, denyQ, null, true, false); + server.createQueue(new QueueConfiguration(denyQ).setRoutingType(RoutingType.ANYCAST)); try (Connection connection = factory.createConnection("denyQ", "denyQ")) { Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = session.createQueue("denyQ"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java index d2d1d0ce60..6e7cf81b14 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SimpleOpenWireTest.java @@ -60,6 +60,7 @@ import java.util.concurrent.TimeoutException; import org.apache.activemq.ActiveMQConnection; import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.ActiveMQSession; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient; import org.apache.activemq.artemis.core.postoffice.PostOffice; @@ -1063,7 +1064,7 @@ public class SimpleOpenWireTest extends BasicOpenWireTest { Connection exConn = null; SimpleString durableQueue = new SimpleString("exampleQueue"); - this.server.createQueue(durableQueue, RoutingType.ANYCAST, durableQueue, null, true, false, -1, false, true); + this.server.createQueue(new QueueConfiguration(durableQueue).setRoutingType(RoutingType.ANYCAST)); try { ActiveMQConnectionFactory exFact = new ActiveMQConnectionFactory(); @@ -1105,7 +1106,7 @@ public class SimpleOpenWireTest extends BasicOpenWireTest { Connection exConn = null; SimpleString durableQueue = new SimpleString("exampleQueue"); - this.server.createQueue(durableQueue, RoutingType.ANYCAST, durableQueue, null, true, false, -1, false, true); + this.server.createQueue(new QueueConfiguration(durableQueue).setRoutingType(RoutingType.ANYCAST)); try { ActiveMQConnectionFactory exFact = new ActiveMQConnectionFactory(); @@ -1142,7 +1143,7 @@ public class SimpleOpenWireTest extends BasicOpenWireTest { Connection openConn = null; SimpleString durableQueue = new SimpleString("exampleQueue"); - this.server.createQueue(durableQueue, RoutingType.ANYCAST, durableQueue, null, true, false, -1, false, true); + this.server.createQueue(new QueueConfiguration(durableQueue).setRoutingType(RoutingType.ANYCAST)); ActiveMQConnectionFactory openCF = new ActiveMQConnectionFactory(); @@ -1182,7 +1183,7 @@ public class SimpleOpenWireTest extends BasicOpenWireTest { Connection conn1 = null; SimpleString durableQueue = new SimpleString("exampleQueue"); - this.server.createQueue(durableQueue, RoutingType.ANYCAST, durableQueue, null, true, false, -1, false, true); + this.server.createQueue(new QueueConfiguration(durableQueue).setRoutingType(RoutingType.ANYCAST)); Queue queue = ActiveMQJMSClient.createQueue("exampleQueue"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/VerySimpleOenwireTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/VerySimpleOenwireTest.java index 1054eeca91..e3598a77ab 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/VerySimpleOenwireTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/VerySimpleOenwireTest.java @@ -25,6 +25,7 @@ import javax.jms.Session; import javax.jms.TextMessage; import org.apache.activemq.ActiveMQConnectionFactory; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.command.ActiveMQQueue; @@ -43,7 +44,7 @@ public class VerySimpleOenwireTest extends OpenWireTestBase { Connection exConn = null; SimpleString durableQueue = new SimpleString("exampleQueue"); - this.server.createQueue(durableQueue, RoutingType.ANYCAST, durableQueue, null, true, false, -1, false, true); + this.server.createQueue(new QueueConfiguration(durableQueue).setRoutingType(RoutingType.ANYCAST)); try { ActiveMQConnectionFactory exFact = new ActiveMQConnectionFactory(); @@ -80,7 +81,7 @@ public class VerySimpleOenwireTest extends OpenWireTestBase { Connection openConn = null; SimpleString durableQueue = new SimpleString("exampleQueue"); - this.server.createQueue(durableQueue, RoutingType.ANYCAST, durableQueue, null, true, false, -1, false, true); + this.server.createQueue(new QueueConfiguration(durableQueue).setRoutingType(RoutingType.ANYCAST)); ActiveMQConnectionFactory openCF = new ActiveMQConnectionFactory(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/management/OpenWireManagementTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/management/OpenWireManagementTest.java index 3f930c9df6..858b0890d3 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/management/OpenWireManagementTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/management/OpenWireManagementTest.java @@ -16,11 +16,21 @@ */ package org.apache.activemq.artemis.tests.integration.openwire.management; +import javax.jms.Connection; +import javax.jms.ConnectionFactory; +import javax.jms.Destination; +import javax.jms.JMSException; +import javax.jms.Session; +import java.util.Arrays; +import java.util.Map; +import java.util.Set; + import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.advisory.AdvisorySupport; import org.apache.activemq.advisory.ConsumerEventSource; import org.apache.activemq.advisory.ProducerEventSource; import org.apache.activemq.artemis.api.core.ActiveMQException; +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.api.core.TransportConfiguration; @@ -36,15 +46,6 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -import javax.jms.Connection; -import javax.jms.ConnectionFactory; -import javax.jms.Destination; -import javax.jms.JMSException; -import javax.jms.Session; -import java.util.Arrays; -import java.util.Map; -import java.util.Set; - @RunWith(Parameterized.class) public class OpenWireManagementTest extends OpenWireTestBase { @@ -104,10 +105,9 @@ public class OpenWireManagementTest extends OpenWireTestBase { @Test public void testHiddenInternalAddress() throws Exception { - server.createQueue(queueName1, RoutingType.ANYCAST, queueName1, null, true, false, -1, false, true); - server.createQueue(queueName2, RoutingType.ANYCAST, queueName2, null, true, false, -1, false, true); - server.createQueue(queueName3, RoutingType.ANYCAST, queueName3, null, true, false, -1, false, true); - + server.createQueue(new QueueConfiguration(queueName1).setRoutingType(RoutingType.ANYCAST).setAutoCreateAddress(true)); + server.createQueue(new QueueConfiguration(queueName2).setRoutingType(RoutingType.ANYCAST).setAutoCreateAddress(true)); + server.createQueue(new QueueConfiguration(queueName3).setRoutingType(RoutingType.ANYCAST).setAutoCreateAddress(true)); String[] addresses = serverControl.getAddressNames(); assertEquals(4, addresses.length); @@ -149,8 +149,7 @@ public class OpenWireManagementTest extends OpenWireTestBase { @Test public void testHiddenInternalQueue() throws Exception { - - server.createQueue(queueName1, RoutingType.ANYCAST, queueName1, null, true, false, -1, false, true); + server.createQueue(new QueueConfiguration(queueName1).setRoutingType(RoutingType.ANYCAST)); String[] queues = serverControl.getQueueNames(); assertEquals(1, queues.length); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/AddressFullLoggingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/AddressFullLoggingTest.java index fa57764eba..28998e2d1b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/AddressFullLoggingTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/AddressFullLoggingTest.java @@ -24,6 +24,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import org.apache.activemq.artemis.api.core.ActiveMQException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientProducer; @@ -90,7 +91,7 @@ public class AddressFullLoggingTest extends ActiveMQTestBase { ClientSessionFactory factory = createSessionFactory(locator); ClientSession session = factory.createSession(false, true, true); - session.createQueue(MY_ADDRESS, MY_QUEUE, true); + session.createQueue(new QueueConfiguration(MY_QUEUE).setAddress(MY_ADDRESS)); final ClientProducer producer = session.createProducer(MY_ADDRESS); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/GlobalPagingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/GlobalPagingTest.java index 698d39296f..3dee2b295e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/GlobalPagingTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/GlobalPagingTest.java @@ -26,6 +26,7 @@ import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; import org.apache.activemq.artemis.api.core.ActiveMQAddressFullException; import org.apache.activemq.artemis.api.core.ActiveMQBuffer; import org.apache.activemq.artemis.api.core.ActiveMQException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -119,7 +120,7 @@ public class GlobalPagingTest extends PagingTest { final ClientSession session = sf.createSession(false, false, false); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS)); final ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -231,7 +232,7 @@ public class GlobalPagingTest extends PagingTest { if (server.locateQueue(managementAddress) == null) { - session.createQueue(managementAddress, managementAddress, null, true); + session.createQueue(new QueueConfiguration(managementAddress)); } final Queue managementQueue = server.locateQueue(managementAddress); @@ -244,7 +245,7 @@ public class GlobalPagingTest extends PagingTest { if (server.locateQueue(address) == null) { - session.createQueue(address, address, null, true); + session.createQueue(new QueueConfiguration(address)); } final CountDownLatch startSendMessages = new CountDownLatch(1); @@ -317,19 +318,19 @@ public class GlobalPagingTest extends PagingTest { if (server.locateQueue(managementAddress) == null) { - session.createQueue(managementAddress, managementAddress, null, true); + session.createQueue(new QueueConfiguration(managementAddress)); } final SimpleString address = SimpleString.toSimpleString("queue"); if (server.locateQueue(address) == null) { - session.createQueue(address, address, null, true); + session.createQueue(new QueueConfiguration(address)); } try (ClientProducer requestProducer = session.createProducer(managementAddress)) { final SimpleString replyQueue = new SimpleString(managementAddress + "." + UUID.randomUUID().toString()); - session.createTemporaryQueue(replyQueue, ActiveMQDefaultConfiguration.getDefaultRoutingType(), replyQueue); + session.createQueue(new QueueConfiguration(replyQueue).setRoutingType(ActiveMQDefaultConfiguration.getDefaultRoutingType()).setDurable(false).setTemporary(true)); int id = 1000; try (ClientConsumer consumer = session.createConsumer(replyQueue)) { final Queue queue = server.locateQueue(replyQueue); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PageCountSyncOnNonTXTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PageCountSyncOnNonTXTest.java index b62bc917f8..c5d4403acc 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PageCountSyncOnNonTXTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PageCountSyncOnNonTXTest.java @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.integration.paging; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -92,7 +93,7 @@ public class PageCountSyncOnNonTXTest extends SpawnedTestBase { ClientSessionFactory factory = locator.createSessionFactory(); ClientSession session = factory.createSession(true, true); - session.createQueue(QUEUE_NAME, QUEUE_NAME, true); + session.createQueue(new QueueConfiguration(QUEUE_NAME)); ClientProducer producer = session.createProducer(QUEUE_NAME); ClientConsumer consumer = session.createConsumer(QUEUE_NAME); session.start(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingCounterTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingCounterTest.java index 471458033f..b25f6705ed 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingCounterTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingCounterTest.java @@ -18,6 +18,7 @@ package org.apache.activemq.artemis.tests.integration.paging; import javax.transaction.xa.Xid; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientSession; import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; @@ -81,7 +82,7 @@ public class PagingCounterTest extends ActiveMQTestBase { try { server.addAddressInfo(new AddressInfo(new SimpleString("A1"), RoutingType.ANYCAST)); - Queue queue = server.createQueue(new SimpleString("A1"), RoutingType.ANYCAST, new SimpleString("A1"), null, true, false); + Queue queue = server.createQueue(new QueueConfiguration(new SimpleString("A1")).setRoutingType(RoutingType.ANYCAST)); PageSubscriptionCounter counter = locateCounter(queue); @@ -113,7 +114,7 @@ public class PagingCounterTest extends ActiveMQTestBase { try { server.addAddressInfo(new AddressInfo(new SimpleString("A1"), RoutingType.ANYCAST)); - Queue queue = server.createQueue(new SimpleString("A1"), RoutingType.ANYCAST, new SimpleString("A1"), null, true, false); + Queue queue = server.createQueue(new QueueConfiguration(new SimpleString("A1")).setRoutingType(RoutingType.ANYCAST)); PageSubscriptionCounter counter = locateCounter(queue); @@ -173,7 +174,7 @@ public class PagingCounterTest extends ActiveMQTestBase { try { server.addAddressInfo(new AddressInfo(new SimpleString("A1"), RoutingType.ANYCAST)); - Queue queue = server.createQueue(new SimpleString("A1"), RoutingType.ANYCAST, new SimpleString("A1"), null, true, false); + Queue queue = server.createQueue(new QueueConfiguration(new SimpleString("A1")).setRoutingType(RoutingType.ANYCAST)); PageSubscriptionCounter counter = locateCounter(queue); @@ -230,7 +231,7 @@ public class PagingCounterTest extends ActiveMQTestBase { @Test public void testRestartCounter() throws Exception { server.addAddressInfo(new AddressInfo(new SimpleString("A1"), RoutingType.ANYCAST)); - Queue queue = server.createQueue(new SimpleString("A1"), RoutingType.ANYCAST, new SimpleString("A1"), null, true, false); + Queue queue = server.createQueue(new QueueConfiguration(new SimpleString("A1")).setRoutingType(RoutingType.ANYCAST)); PageSubscriptionCounter counter = locateCounter(queue); @@ -285,7 +286,7 @@ public class PagingCounterTest extends ActiveMQTestBase { public void testPrepareCounter() throws Exception { Xid xid = newXID(); - Queue queue = server.createQueue(new SimpleString("A1"), RoutingType.ANYCAST, new SimpleString("A1"), null, true, false); + Queue queue = server.createQueue(new QueueConfiguration(new SimpleString("A1")).setRoutingType(RoutingType.ANYCAST)); PageSubscriptionCounter counter = locateCounter(queue); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingOrderTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingOrderTest.java index bffcd911d8..886a029c71 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingOrderTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingOrderTest.java @@ -28,6 +28,7 @@ import java.util.HashMap; import java.util.concurrent.atomic.AtomicInteger; import org.apache.activemq.artemis.api.core.ActiveMQBuffer; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; @@ -96,7 +97,7 @@ public class PagingOrderTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, false, false); server.addAddressInfo(new AddressInfo(ADDRESS, RoutingType.ANYCAST)); - server.createQueue(ADDRESS, RoutingType.ANYCAST, ADDRESS, null, true, false); + server.createQueue(new QueueConfiguration(ADDRESS).setRoutingType(RoutingType.ANYCAST)); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -186,9 +187,9 @@ public class PagingOrderTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, false, false); server.addAddressInfo(new AddressInfo(ADDRESS, RoutingType.ANYCAST)); - Queue q1 = server.createQueue(ADDRESS, RoutingType.MULTICAST, ADDRESS, null, true, false); + Queue q1 = server.createQueue(new QueueConfiguration(ADDRESS)); - Queue q2 = server.createQueue(ADDRESS, RoutingType.MULTICAST, new SimpleString("inactive"), null, true, false); + Queue q2 = server.createQueue(new QueueConfiguration(new SimpleString("inactive")).setAddress(ADDRESS).setRoutingType(RoutingType.MULTICAST)); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -316,9 +317,9 @@ public class PagingOrderTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, false, false); server.addAddressInfo(new AddressInfo(ADDRESS, RoutingType.ANYCAST)); - Queue q1 = server.createQueue(ADDRESS, RoutingType.MULTICAST, ADDRESS, null, true, false); + Queue q1 = server.createQueue(new QueueConfiguration(ADDRESS)); - Queue q2 = server.createQueue(ADDRESS, RoutingType.MULTICAST, new SimpleString("inactive"), null, true, false); + Queue q2 = server.createQueue(new QueueConfiguration(new SimpleString("inactive")).setAddress(ADDRESS).setRoutingType(RoutingType.MULTICAST)); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -410,7 +411,7 @@ public class PagingOrderTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, false, false); server.addAddressInfo(new AddressInfo(ADDRESS, RoutingType.ANYCAST)); - server.createQueue(ADDRESS, RoutingType.ANYCAST, ADDRESS, null, true, false); + server.createQueue(new QueueConfiguration(ADDRESS).setRoutingType(RoutingType.ANYCAST)); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -495,7 +496,7 @@ public class PagingOrderTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, false, false); server.addAddressInfo(new AddressInfo(ADDRESS, RoutingType.ANYCAST)); - QueueImpl queue = (QueueImpl) server.createQueue(ADDRESS, RoutingType.ANYCAST, ADDRESS, null, true, false); + QueueImpl queue = (QueueImpl) server.createQueue(new QueueConfiguration(ADDRESS).setRoutingType(RoutingType.ANYCAST)); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingReceiveTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingReceiveTest.java index f8deac5f0d..7c0c4c8eae 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingReceiveTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingReceiveTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.paging; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -105,7 +106,7 @@ public class PagingReceiveTest extends ActiveMQTestBase { server = internalCreateServer(); server.addAddressInfo(new AddressInfo(ADDRESS, RoutingType.ANYCAST)); - Queue queue = server.createQueue(ADDRESS, RoutingType.ANYCAST, ADDRESS, null, true, false); + Queue queue = server.createQueue(new QueueConfiguration(ADDRESS).setRoutingType(RoutingType.ANYCAST)); queue.getPageSubscription().getPagingStore().startPaging(); for (int i = 0; i < 10; i++) { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingSendTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingSendTest.java index 530877bfb4..2371e9bbd7 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingSendTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingSendTest.java @@ -26,6 +26,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import org.apache.activemq.artemis.api.core.ActiveMQException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -99,7 +100,7 @@ public class PagingSendTest extends ActiveMQTestBase { ClientSessionFactory sf = createSessionFactory(locator); ClientSession session = sf.createSession(null, null, false, true, true, false, 0); - session.createQueue(PagingSendTest.ADDRESS, PagingSendTest.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(PagingSendTest.ADDRESS)); ClientProducer producer = session.createProducer(PagingSendTest.ADDRESS); @@ -143,7 +144,7 @@ public class PagingSendTest extends ActiveMQTestBase { ClientSession sessionConsumer = sf.createSession(true, true, 0); - sessionConsumer.createQueue(PagingSendTest.ADDRESS, PagingSendTest.ADDRESS, null, true); + sessionConsumer.createQueue(new QueueConfiguration(PagingSendTest.ADDRESS)); final ClientSession sessionProducer = sf.createSession(false, false); final ClientProducer producer = sessionProducer.createProducer(PagingSendTest.ADDRESS); @@ -219,7 +220,7 @@ public class PagingSendTest extends ActiveMQTestBase { // Create a queue SimpleString queueAddr = new SimpleString("testQueue"); - session.createQueue(queueAddr, queueAddr, null, true); + session.createQueue(new QueueConfiguration(queueAddr)); // Set up paging on the queue address AddressSettings addressSettings = new AddressSettings().setPageSizeBytes(10 * 1024) @@ -253,7 +254,7 @@ public class PagingSendTest extends ActiveMQTestBase { // Create a queue SimpleString queueAddr = new SimpleString("testQueue"); - session.createQueue(queueAddr, queueAddr, null, true); + session.createQueue(new QueueConfiguration(queueAddr)); // Set up paging on the queue address AddressSettings addressSettings = new AddressSettings().setPageSizeBytes(10 * 1024) diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingSyncTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingSyncTest.java index 00e1a24ce0..8ea2757d72 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingSyncTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingSyncTest.java @@ -20,6 +20,7 @@ import java.nio.ByteBuffer; import java.util.HashMap; import org.apache.activemq.artemis.api.core.ActiveMQBuffer; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientProducer; @@ -72,7 +73,7 @@ public class PagingSyncTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, false, false); server.addAddressInfo(new AddressInfo(ADDRESS, RoutingType.ANYCAST)); - server.createQueue(ADDRESS, RoutingType.ANYCAST, ADDRESS, null, true, false); + server.createQueue(new QueueConfiguration(ADDRESS).setRoutingType(RoutingType.ANYCAST)); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingTest.java index 496b1628ae..01a783392f 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingTest.java @@ -48,6 +48,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQExceptionType; import org.apache.activemq.artemis.api.core.Message; import org.apache.activemq.artemis.api.core.Pair; +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.api.core.client.ClientConsumer; @@ -223,8 +224,8 @@ public class PagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(null, null, false, true, true, false, 0); - session.createQueue(ADDRESS, ADDRESS.concat("-0"), null, true); - session.createQueue(ADDRESS, ADDRESS.concat("-1"), null, true); + session.createQueue(new QueueConfiguration(ADDRESS.concat("-0")).setAddress(ADDRESS)); + session.createQueue(new QueueConfiguration(ADDRESS.concat("-1")).setAddress(ADDRESS)); ClientProducer producer = session.createProducer(ADDRESS); @@ -308,7 +309,7 @@ public class PagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(null, null, false, false, false, false, 0); - session.createQueue(ADDRESS, ADDRESS.concat("-0"), null, true); + session.createQueue(new QueueConfiguration(ADDRESS.concat("-0")).setAddress(ADDRESS)); server.getPagingManager().getPageStore(ADDRESS).forceAnotherPage(); server.getPagingManager().getPageStore(ADDRESS).disableCleanup(); @@ -394,7 +395,7 @@ public class PagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, false, false); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS)); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -513,7 +514,7 @@ public class PagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, false, false); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS)); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -597,8 +598,8 @@ public class PagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, false, false); - session.createQueue(PagingTest.ADDRESS, new SimpleString(PagingTest.ADDRESS + "Queue"), null, true); - session.createQueue(PagingTest.ADDRESS + "Original", PagingTest.ADDRESS + "QueueOriginal", null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS + "Queue").setAddress(PagingTest.ADDRESS)); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS + "QueueOriginal").setAddress(PagingTest.ADDRESS + "Original")); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -701,7 +702,7 @@ public class PagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, false, false); - session.createQueue(PagingTest.ADDRESS, RoutingType.ANYCAST, PagingTest.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS).setRoutingType(RoutingType.ANYCAST)); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -759,7 +760,7 @@ public class PagingTest extends ActiveMQTestBase { String queue = "purgeQueue"; SimpleString ssQueue = new SimpleString(queue); server.addAddressInfo(new AddressInfo(ssQueue, RoutingType.ANYCAST)); - QueueImpl purgeQueue = (QueueImpl) server.createQueue(ssQueue, RoutingType.ANYCAST, ssQueue, null, true, false, 1, true, false); + QueueImpl purgeQueue = (QueueImpl) server.createQueue(new QueueConfiguration(ssQueue).setRoutingType(RoutingType.ANYCAST).setMaxConsumers(1).setPurgeOnNoConsumers(true).setAutoCreateAddress(false)); ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory(); Connection connection = cf.createConnection(); @@ -857,7 +858,7 @@ public class PagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); server.addAddressInfo(new AddressInfo(PagingTest.ADDRESS, RoutingType.ANYCAST)); - Queue queue = server.createQueue(ADDRESS, RoutingType.ANYCAST, ADDRESS, null, true, false); + Queue queue = server.createQueue(new QueueConfiguration(ADDRESS).setRoutingType(RoutingType.ANYCAST)); queue.getPageSubscription().getPagingStore().startPaging(); @@ -962,7 +963,7 @@ public class PagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS)); Queue queue = server.locateQueue(PagingTest.ADDRESS); @@ -1162,9 +1163,9 @@ public class PagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, false, false); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS)); - session.createQueue("EXP", "EXP", null, true); + session.createQueue(new QueueConfiguration("EXP")); Queue queue1 = server.locateQueue(ADDRESS); Queue qEXP = server.locateQueue(new SimpleString("EXP")); @@ -1264,9 +1265,9 @@ public class PagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, false, false); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS)); - session.createQueue(PagingTest.ADDRESS, QUEUE2, null, true); + session.createQueue(new QueueConfiguration(QUEUE2).setAddress(PagingTest.ADDRESS)); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -1420,7 +1421,7 @@ public class PagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, false, false); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS)); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -1596,7 +1597,7 @@ public class PagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, false, false); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS)); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -1663,7 +1664,7 @@ public class PagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, false, false); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS)); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -1771,7 +1772,7 @@ public class PagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - session.createQueue(PagingTest.ADDRESS, RoutingType.MULTICAST, PagingTest.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS)); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -1829,7 +1830,7 @@ public class PagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, false, false); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS)); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -2048,7 +2049,7 @@ public class PagingTest extends ActiveMQTestBase { sf = createSessionFactory(locator); ClientSession session = sf.createSession(true, true, 0); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS)); Queue queue = server.locateQueue(ADDRESS); @@ -2153,9 +2154,9 @@ public class PagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, false, false); - session.createQueue(ADDRESS.toString(), "q1", true); + session.createQueue(new QueueConfiguration("q1").setAddress(ADDRESS.toString())); - session.createQueue(ADDRESS.toString(), "q2", true); + session.createQueue(new QueueConfiguration("q2").setAddress(ADDRESS.toString())); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -2266,9 +2267,9 @@ public class PagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, false, false); - session.createQueue(ADDRESS.toString(), "q1", true); + session.createQueue(new QueueConfiguration("q1").setAddress(ADDRESS.toString())); - session.createQueue(ADDRESS.toString(), "q2", true); + session.createQueue(new QueueConfiguration("q2").setAddress(ADDRESS.toString())); server.getPagingManager().getPageStore(ADDRESS).startPaging(); @@ -2389,8 +2390,8 @@ public class PagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, false, false); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS.concat("-invalid"), new SimpleString(Filter.GENERIC_IGNORED_FILTER), true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS)); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS.concat("-invalid")).setAddress(PagingTest.ADDRESS).setFilterString(new SimpleString(Filter.GENERIC_IGNORED_FILTER))); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -2534,13 +2535,11 @@ public class PagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, false, false); if (divert) { - session.createQueue(PagingTest.ADDRESS + "-1", PagingTest.ADDRESS + "-1", null, true); - - session.createQueue(PagingTest.ADDRESS + "-2", PagingTest.ADDRESS + "-2", null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS + "-1")); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS + "-2")); } else { - session.createQueue(PagingTest.ADDRESS.toString(), PagingTest.ADDRESS + "-1", null, true); - - session.createQueue(PagingTest.ADDRESS.toString(), PagingTest.ADDRESS + "-2", null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS + "-1").setAddress(PagingTest.ADDRESS)); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS + "-2").setAddress(PagingTest.ADDRESS)); } ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -2727,9 +2726,8 @@ public class PagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, false, false); - session.createQueue(PagingTest.ADDRESS.toString(), PagingTest.ADDRESS + "-1", null, true); - - session.createQueue(PagingTest.ADDRESS.toString(), PagingTest.ADDRESS + "-2", null, false); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS + "-1").setAddress(PagingTest.ADDRESS)); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS + "-2").setAddress(PagingTest.ADDRESS).setDurable(false)); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -2855,7 +2853,7 @@ public class PagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(null, null, false, true, true, false, 0); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS)); Queue queue = server.locateQueue(ADDRESS); queue.getPageSubscription().getPagingStore().startPaging(); @@ -2964,7 +2962,7 @@ public class PagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(null, null, false, true, true, false, 0); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS)); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -3080,7 +3078,7 @@ public class PagingTest extends ActiveMQTestBase { ClientProducer producerTransacted = sessionTransacted.createProducer(PagingTest.ADDRESS); ClientSession session = sf.createSession(null, null, false, true, true, false, 0); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS)); ClientMessage firstMessage = sessionTransacted.createMessage(IS_DURABLE_MESSAGE); firstMessage.getBodyBuffer().writeBytes(body); @@ -3192,7 +3190,7 @@ public class PagingTest extends ActiveMQTestBase { ClientProducer producerTransacted = sessionTransacted.createProducer(PagingTest.ADDRESS); ClientSession sessionNonTX = sf.createSession(true, true, 0); - sessionNonTX.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true); + sessionNonTX.createQueue(new QueueConfiguration(PagingTest.ADDRESS)); ClientProducer producerNonTransacted = sessionNonTX.createProducer(PagingTest.ADDRESS); @@ -3323,7 +3321,7 @@ public class PagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(true, true, 0); session.start(); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS)); producerThread.start(); @@ -3422,7 +3420,7 @@ public class PagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(true, true, 0); session.start(); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS)); producerThread.start(); @@ -3476,7 +3474,7 @@ public class PagingTest extends ActiveMQTestBase { sf = createSessionFactory(locator); ClientSession session = sf.createSession(null, null, false, true, true, false, 0); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS)); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -3571,7 +3569,7 @@ public class PagingTest extends ActiveMQTestBase { sf = createSessionFactory(locator); ClientSession session = sf.createSession(null, null, false, false, true, false, 0); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS)); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -3617,7 +3615,7 @@ public class PagingTest extends ActiveMQTestBase { sf = createSessionFactory(locator); ClientSession session = sf.createSession(null, null, false, false, true, false, 0); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS)); Queue queue = server.locateQueue(ADDRESS); @@ -3744,7 +3742,7 @@ public class PagingTest extends ActiveMQTestBase { sf = createSessionFactory(locator); ClientSession session = sf.createSession(true, true, 0); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS)); final Queue queue1 = server.locateQueue(ADDRESS); @@ -3856,7 +3854,7 @@ public class PagingTest extends ActiveMQTestBase { sf = createSessionFactory(locator); ClientSession session = sf.createSession(null, null, false, false, false, false, 0); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS)); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -3927,7 +3925,7 @@ public class PagingTest extends ActiveMQTestBase { sf = createSessionFactory(locator); ClientSession session = sf.createSession(null, null, false, false, false, false, 0); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS)); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -4046,7 +4044,7 @@ public class PagingTest extends ActiveMQTestBase { sf = createSessionFactory(locator); ClientSession session = sf.createSession(null, null, false, true, true, false, 0); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS)); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -4156,7 +4154,7 @@ public class PagingTest extends ActiveMQTestBase { sf = createSessionFactory(locator); ClientSession sessionProducer = sf.createSession(); - sessionProducer.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true); + sessionProducer.createQueue(new QueueConfiguration(PagingTest.ADDRESS)); ClientProducer producer = sessionProducer.createProducer(PagingTest.ADDRESS); @@ -4228,7 +4226,7 @@ public class PagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(null, null, false, !transacted, true, false, 0); for (int i = 0; i < NUMBER_OF_BINDINGS; i++) { - session.createQueue(PagingTest.ADDRESS, new SimpleString("someQueue" + i), null, true); + session.createQueue(new QueueConfiguration(new SimpleString("someQueue" + i)).setAddress(PagingTest.ADDRESS).setDurable(true)); } ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -4299,7 +4297,7 @@ public class PagingTest extends ActiveMQTestBase { try { server.addAddressInfo(new AddressInfo(PagingTest.ADDRESS, RoutingType.ANYCAST)); - server.createQueue(PagingTest.ADDRESS, RoutingType.ANYCAST, PagingTest.ADDRESS, null, true, false); + server.createQueue(new QueueConfiguration(PagingTest.ADDRESS).setRoutingType(RoutingType.ANYCAST)); final CountDownLatch pageUp = new CountDownLatch(0); final CountDownLatch pageDone = new CountDownLatch(1); @@ -4338,7 +4336,7 @@ public class PagingTest extends ActiveMQTestBase { server = createServer(true, config, PagingTest.PAGE_SIZE, PagingTest.PAGE_MAX); server.start(); - server.createQueue(PagingTest.ADDRESS, RoutingType.ANYCAST, PagingTest.ADDRESS, null, true, false); + server.createQueue(new QueueConfiguration(PagingTest.ADDRESS).setRoutingType(RoutingType.ANYCAST)); final CountDownLatch pageUp = new CountDownLatch(0); final CountDownLatch pageDone = new CountDownLatch(1); @@ -4380,9 +4378,9 @@ public class PagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, false); - session.createQueue(PAGED_ADDRESS, PAGED_ADDRESS, true); + session.createQueue(new QueueConfiguration(PAGED_ADDRESS)); - session.createQueue(NON_PAGED_ADDRESS, NON_PAGED_ADDRESS, true); + session.createQueue(new QueueConfiguration(NON_PAGED_ADDRESS)); ClientProducer producerPaged = session.createProducer(PAGED_ADDRESS); ClientProducer producerNonPaged = session.createProducer(NON_PAGED_ADDRESS); @@ -4469,9 +4467,9 @@ public class PagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, false); - session.createQueue(PAGED_ADDRESS_A, PAGED_ADDRESS_A, true); + session.createQueue(new QueueConfiguration(PAGED_ADDRESS_A)); - session.createQueue(PAGED_ADDRESS_B, PAGED_ADDRESS_B, true); + session.createQueue(new QueueConfiguration(PAGED_ADDRESS_B)); ClientProducer producerA = session.createProducer(PAGED_ADDRESS_A); ClientProducer producerB = session.createProducer(PAGED_ADDRESS_B); @@ -4573,7 +4571,7 @@ public class PagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(true, true); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS)); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -4673,7 +4671,7 @@ public class PagingTest extends ActiveMQTestBase { int NQUEUES = 2; for (int i = 0; i < NQUEUES; i++) { - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS.concat("=" + i), new SimpleString("propTest=" + i), true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS.concat("=" + i)).setAddress(PagingTest.ADDRESS).setFilterString(new SimpleString("propTest=" + i)).setDurable(true)); } ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -4755,8 +4753,8 @@ public class PagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, false, false); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS.concat("=1"), null, true); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS.concat("=2"), null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS.concat("=1")).setAddress(PagingTest.ADDRESS)); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS.concat("=2")).setAddress(PagingTest.ADDRESS)); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -4843,11 +4841,11 @@ public class PagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, false, false); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS.concat("=1"), null, true); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS.concat("=2"), null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS.concat("=1")).setAddress(PagingTest.ADDRESS)); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS.concat("=2")).setAddress(PagingTest.ADDRESS)); // A queue with an impossible filter - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS.concat("-3"), new SimpleString("nothing='something'"), true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS.concat("-3")).setAddress(PagingTest.ADDRESS).setFilterString(new SimpleString("nothing='something'"))); PagingStore store = server.getPagingManager().getPageStore(ADDRESS); @@ -4922,8 +4920,8 @@ public class PagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, false, false); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS.concat("=1"), null, true); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS.concat("=2"), null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS.concat("=1")).setAddress(PagingTest.ADDRESS)); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS.concat("=2")).setAddress(PagingTest.ADDRESS)); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -5030,8 +5028,8 @@ public class PagingTest extends ActiveMQTestBase { session = sf.createSession(false, false, false); - session.createQueue(ADDRESS, ADDRESS, true); - session.createQueue("DLA", "DLA", true); + session.createQueue(new QueueConfiguration(ADDRESS)); + session.createQueue(new QueueConfiguration("DLA")); Queue serverQueue = server.locateQueue(ADDRESS); Queue serverQueueDLA = server.locateQueue(SimpleString.toSimpleString("DLA")); @@ -5235,9 +5233,9 @@ public class PagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, false, false); - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); - session.createQueue("DLA", "DLA", true); + session.createQueue(new QueueConfiguration("DLA")); PagingStore pgStoreAddress = server.getPagingManager().getPageStore(ADDRESS); pgStoreAddress.startPaging(); @@ -5373,7 +5371,7 @@ public class PagingTest extends ActiveMQTestBase { sf = createSessionFactory(locator); ClientSession session = sf.createSession(true, true, 0); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS)); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -5453,7 +5451,7 @@ public class PagingTest extends ActiveMQTestBase { sf = createSessionFactory(locator); ClientSession session = sf.createSession(true, true, 0); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS)); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -5525,7 +5523,7 @@ public class PagingTest extends ActiveMQTestBase { sf = createSessionFactory(locator); ClientSession session = addClientSession(sf.createSession(true, true, 0)); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS)); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -5624,9 +5622,9 @@ public class PagingTest extends ActiveMQTestBase { ClientSessionFactory sf = createSessionFactory(locator); ClientSession session = sf.createSession(false, true, 0); - session.createQueue("Q", "Q1", "dest=1", true); - session.createQueue("Q", "Q2", "dest=2", true); - session.createQueue("Q", "Q3", "dest=3", true); + session.createQueue(new QueueConfiguration("Q1").setAddress("Q").setFilterString("dest=1")); + session.createQueue(new QueueConfiguration("Q2").setAddress("Q").setFilterString("dest=2")); + session.createQueue(new QueueConfiguration("Q3").setAddress("Q").setFilterString("dest=3")); Queue queue = server.locateQueue(new SimpleString("Q1")); queue.getPageSubscription().getPagingStore().startPaging(); @@ -5687,15 +5685,15 @@ public class PagingTest extends ActiveMQTestBase { ClientSessionFactory sf = locator.createSessionFactory(); ClientSession session = sf.createSession(true, false); - session.createQueue(ADDRESS.toString(), "Q1", "destQ=1 or both=true", true); - session.createQueue(ADDRESS.toString(), "Q2", "destQ=2 or both=true", true); + session.createQueue(new QueueConfiguration("Q1").setAddress(PagingTest.ADDRESS).setFilterString("destQ=1 or both=true")); + session.createQueue(new QueueConfiguration("Q2").setAddress(PagingTest.ADDRESS).setFilterString("destQ=2 or both=true")); if (deadConsumer) { // This queue won't receive any messages - session.createQueue(ADDRESS.toString(), "Q3", "destQ=3", true); + session.createQueue(new QueueConfiguration("Q3").setAddress(ADDRESS.toString()).setFilterString("destQ=3")); } - session.createQueue(ADDRESS.toString(), "Q_initial", "initialBurst=true", true); + session.createQueue(new QueueConfiguration("Q_initial").setAddress(ADDRESS.toString()).setFilterString("initialBurst=true")); ClientSession sessionConsumerQ3 = null; @@ -5863,8 +5861,8 @@ public class PagingTest extends ActiveMQTestBase { ClientSessionFactory sf = locator.createSessionFactory(); ClientSession session = sf.createSession(true, true, 0); - session.createQueue(ADDRESS.toString(), "Q1", "dest=1", true); - session.createQueue(ADDRESS.toString(), "Q2", "dest=2", true); + session.createQueue(new QueueConfiguration("Q1").setAddress(ADDRESS.toString()).setFilterString("dest=1")); + session.createQueue(new QueueConfiguration("Q2").setAddress(ADDRESS.toString()).setFilterString("dest=2")); PagingStore store = server.getPagingManager().getPageStore(ADDRESS); @@ -5965,7 +5963,7 @@ public class PagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, false, false); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS)); PagingStore store = server.getPagingManager().getPageStore(ADDRESS); store.forceAnotherPage(); @@ -6049,7 +6047,7 @@ public class PagingTest extends ActiveMQTestBase { ClientSessionFactory sf = locator.createSessionFactory(); ClientSession session = sf.createSession(true, true, 0); - session.createQueue(ADDRESS.toString(), "Q1", null, true); + session.createQueue(new QueueConfiguration("Q1").setAddress(ADDRESS.toString())); PagingStore store = server.getPagingManager().getPageStore(ADDRESS); @@ -6132,7 +6130,7 @@ public class PagingTest extends ActiveMQTestBase { ClientSessionFactory sf = locator.createSessionFactory(); ClientSession session = sf.createSession(true, true, 0); - session.createQueue(ADDRESS.toString(), "Q1", true); + session.createQueue(new QueueConfiguration("Q1").setAddress(ADDRESS.toString())); PagingStore store = server.getPagingManager().getPageStore(ADDRESS); @@ -6215,8 +6213,8 @@ public class PagingTest extends ActiveMQTestBase { ClientSessionFactory sf = locator.createSessionFactory(); ClientSession session = sf.createSession(true, true, 0); - session.createQueue(ADDRESS.toString(), "Q1", "dest=1", true); - session.createQueue(ADDRESS.toString(), "Q2", "dest=2", true); + session.createQueue(new QueueConfiguration("Q1").setAddress(ADDRESS.toString()).setFilterString("dest=1")); + session.createQueue(new QueueConfiguration("Q2").setAddress(ADDRESS.toString()).setFilterString("dest=2")); PagingStore store = server.getPagingManager().getPageStore(ADDRESS); @@ -6285,7 +6283,7 @@ public class PagingTest extends ActiveMQTestBase { ClientSessionFactory sf = locator.createSessionFactory(); ClientSession session = sf.createSession(); - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); ClientProducer prod = session.createProducer(ADDRESS); for (int i = 0; i < 100; i++) { @@ -6326,8 +6324,8 @@ public class PagingTest extends ActiveMQTestBase { ClientSessionFactory sf = locator.createSessionFactory(); ClientSession session = sf.createSession(true, true, 0); - session.createQueue("Q1", "Q1", true); - session.createQueue("Q2", "Q2", true); + session.createQueue(new QueueConfiguration("Q1")); + session.createQueue(new QueueConfiguration("Q2")); PagingStore store = server.getPagingManager().getPageStore(new SimpleString("Q1")); @@ -6482,7 +6480,7 @@ public class PagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, false); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS)); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -6564,7 +6562,7 @@ public class PagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, false, false); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS)); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -6641,8 +6639,8 @@ public class PagingTest extends ActiveMQTestBase { ClientSessionFactory sf = locator.createSessionFactory(); ClientSession session = sf.createSession(false, false, false); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS.concat("=1"), SimpleString.toSimpleString("destQ=1 or both=true"), true); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS.concat("=2"), SimpleString.toSimpleString("destQ=2 or both=true"), true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS.concat("=1")).setAddress(PagingTest.ADDRESS).setFilterString(SimpleString.toSimpleString("destQ=1 or both=true"))); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS.concat("=2")).setAddress(PagingTest.ADDRESS).setFilterString(SimpleString.toSimpleString("destQ=2 or both=true"))); PagingStore store = server.getPagingManager().getPageStore(ADDRESS); Queue queue = server.locateQueue(PagingTest.ADDRESS.concat("=1")); queue.getPageSubscription().getPagingStore().startPaging(); @@ -6715,8 +6713,8 @@ public class PagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, false, false); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS.concat("=1"), SimpleString.toSimpleString("destQ=1"), true); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS.concat("=2"), SimpleString.toSimpleString("destQ=2"), true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS.concat("=1")).setAddress(PagingTest.ADDRESS).setFilterString(SimpleString.toSimpleString("destQ=1"))); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS.concat("=2")).setAddress(PagingTest.ADDRESS).setFilterString(SimpleString.toSimpleString("destQ=2"))); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); ClientConsumer consumer1 = session.createConsumer(PagingTest.ADDRESS.concat("=1")); @@ -6792,7 +6790,7 @@ public class PagingTest extends ActiveMQTestBase { ClientSessionFactory sf = locator.createSessionFactory(); ClientSession session = sf.createSession(true, true, 0); - session.createQueue(ADDRESS, ADDRESS, null, true); + session.createQueue(new QueueConfiguration(ADDRESS)); PagingStore store = server.getPagingManager().getPageStore(ADDRESS); store.startPaging(); @@ -6867,7 +6865,7 @@ public class PagingTest extends ActiveMQTestBase { sf = createSessionFactory(locator); ClientSession session = sf.createSession(null, null, false, false, true, false, 0); - session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS)); Queue queue = server.locateQueue(PagingTest.ADDRESS); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingWithFailoverAndCountersTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingWithFailoverAndCountersTest.java index a919bab9fa..489c16eb27 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingWithFailoverAndCountersTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingWithFailoverAndCountersTest.java @@ -18,6 +18,7 @@ package org.apache.activemq.artemis.tests.integration.paging; import java.util.concurrent.atomic.AtomicInteger; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -242,7 +243,7 @@ public class PagingWithFailoverAndCountersTest extends ActiveMQTestBase { ClientSessionFactory factory = locator.createSessionFactory(); ClientSession session = factory.createSession(); - session.createQueue("new-queue", RoutingType.ANYCAST, "new-queue"); + session.createQueue(new QueueConfiguration("new-queue").setRoutingType(RoutingType.ANYCAST)); System.out.println("created queue"); @@ -286,8 +287,8 @@ public class PagingWithFailoverAndCountersTest extends ActiveMQTestBase { ClientSession session = factory.createSession(); - session.createQueue("myAddress", "DeadConsumer", true); - session.createQueue("myAddress", "cons2", true); + session.createQueue(new QueueConfiguration("DeadConsumer").setAddress("myAddress")); + session.createQueue(new QueueConfiguration("cons2").setAddress("myAddress")); startBackupInProcess(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/TestDeadlockOnPurgePagingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/TestDeadlockOnPurgePagingTest.java index 425a2ad00a..be530e63fb 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/TestDeadlockOnPurgePagingTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/TestDeadlockOnPurgePagingTest.java @@ -22,6 +22,7 @@ import javax.jms.MessageConsumer; import javax.jms.MessageProducer; import javax.jms.Session; +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.api.core.client.ClientSessionFactory; @@ -81,7 +82,7 @@ public class TestDeadlockOnPurgePagingTest extends ActiveMQTestBase { String queue = "purgeQueue"; SimpleString ssQueue = new SimpleString(queue); server.addAddressInfo(new AddressInfo(ssQueue, RoutingType.ANYCAST)); - QueueImpl purgeQueue = (QueueImpl) server.createQueue(ssQueue, RoutingType.ANYCAST, ssQueue, null, true, false, 1, true, false); + QueueImpl purgeQueue = (QueueImpl) server.createQueue(new QueueConfiguration(ssQueue).setRoutingType(RoutingType.ANYCAST).setMaxConsumers(1).setPurgeOnNoConsumers(true).setAutoCreateAddress(false)); ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory(); Connection connection = cf.createConnection(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/ConfigChangeTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/ConfigChangeTest.java index cc6a6f6484..d098e2aad2 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/ConfigChangeTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/ConfigChangeTest.java @@ -17,18 +17,18 @@ package org.apache.activemq.artemis.tests.integration.persistence; -import java.util.ArrayList; -import java.util.List; - import javax.jms.ConnectionFactory; import javax.jms.JMSContext; import javax.jms.Message; import javax.jms.TextMessage; +import java.util.ArrayList; +import java.util.List; + +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.config.Configuration; import org.apache.activemq.artemis.core.config.CoreAddressConfiguration; -import org.apache.activemq.artemis.core.config.CoreQueueConfiguration; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; @@ -48,8 +48,7 @@ public class ConfigChangeTest extends ActiveMQTestBase { CoreAddressConfiguration addressConfiguration = new CoreAddressConfiguration() .setName("myAddress") .addRoutingType(RoutingType.ANYCAST) - .addQueueConfiguration(new CoreQueueConfiguration() - .setName("myQueue") + .addQueueConfiguration(new QueueConfiguration("myQueue") .setAddress("myAddress") .setRoutingType(RoutingType.ANYCAST)); addressConfigurations.add(addressConfiguration); @@ -69,8 +68,7 @@ public class ConfigChangeTest extends ActiveMQTestBase { addressConfiguration = new CoreAddressConfiguration() .setName("myAddress") .addRoutingType(RoutingType.MULTICAST) - .addQueueConfiguration(new CoreQueueConfiguration() - .setName("myQueue") + .addQueueConfiguration(new QueueConfiguration("myQueue") .setAddress("myAddress") .setRoutingType(RoutingType.MULTICAST)); addressConfigurations.clear(); @@ -101,8 +99,7 @@ public class ConfigChangeTest extends ActiveMQTestBase { CoreAddressConfiguration addressConfiguration = new CoreAddressConfiguration() .setName("myAddress") .addRoutingType(RoutingType.ANYCAST) - .addQueueConfiguration(new CoreQueueConfiguration() - .setName("myQueue") + .addQueueConfiguration(new QueueConfiguration("myQueue") .setAddress("myAddress") .setFilterString(filter1) .setRoutingType(RoutingType.ANYCAST)); @@ -123,8 +120,7 @@ public class ConfigChangeTest extends ActiveMQTestBase { addressConfiguration = new CoreAddressConfiguration() .setName("myAddress") .addRoutingType(RoutingType.ANYCAST) - .addQueueConfiguration(new CoreQueueConfiguration() - .setName("myQueue") + .addQueueConfiguration(new QueueConfiguration("myQueue") .setAddress("myAddress") .setFilterString(filter2) .setRoutingType(RoutingType.ANYCAST)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/DeleteQueueRestartTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/DeleteQueueRestartTest.java index 8c68504dec..2fa004b113 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/DeleteQueueRestartTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/DeleteQueueRestartTest.java @@ -20,6 +20,7 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import org.apache.activemq.artemis.api.core.ActiveMQException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientProducer; import org.apache.activemq.artemis.api.core.client.ClientSession; @@ -67,7 +68,7 @@ public class DeleteQueueRestartTest extends ActiveMQTestBase { final ClientSession session = factory.createSession(false, true, true); - session.createQueue(DeleteQueueRestartTest.ADDRESS, DeleteQueueRestartTest.ADDRESS, true); + session.createQueue(new QueueConfiguration(DeleteQueueRestartTest.ADDRESS)); ClientProducer prod = session.createProducer(DeleteQueueRestartTest.ADDRESS); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/ExportFormatTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/ExportFormatTest.java index c09218b8c3..f5b5cd095a 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/ExportFormatTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/ExportFormatTest.java @@ -18,6 +18,7 @@ package org.apache.activemq.artemis.tests.integration.persistence; import java.io.StringReader; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientProducer; @@ -81,7 +82,7 @@ public class ExportFormatTest extends ActiveMQTestBase { ClientSessionFactory factory = createSessionFactory(locator); ClientSession session = factory.createSession(false, false, false); - session.createQueue("A1", "A1", true); + session.createQueue(new QueueConfiguration("A1")); ClientProducer producer = session.createProducer("A1"); for (int i = 0; i < 5; i++) { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/QueueConfigRestartTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/QueueConfigRestartTest.java index fffa66d343..939071bb3f 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/QueueConfigRestartTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/QueueConfigRestartTest.java @@ -16,7 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.persistence; -import org.apache.activemq.artemis.api.core.RoutingType; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.core.postoffice.QueueBinding; import org.apache.activemq.artemis.core.server.ActiveMQServer; @@ -48,7 +48,7 @@ public class QueueConfigRestartTest extends ActiveMQTestBase { SimpleString address = new SimpleString("test.address"); SimpleString queue = new SimpleString("test.queue"); - server.createQueue(address, RoutingType.MULTICAST, queue, null, null, true, false, false, 10, true, true); + server.createQueue(new QueueConfiguration(queue).setAddress(address).setMaxConsumers(10).setPurgeOnNoConsumers(true)); QueueBinding queueBinding1 = (QueueBinding)server.getPostOffice().getBinding(queue); Assert.assertTrue(queueBinding1.getQueue().isPurgeOnNoConsumers()); @@ -70,7 +70,7 @@ public class QueueConfigRestartTest extends ActiveMQTestBase { SimpleString address = new SimpleString("test.address"); SimpleString queue = new SimpleString("test.queue"); - server.createQueue(address, RoutingType.MULTICAST, queue, null, null, true, false, false, false,false, 10, true, false, true, true); + server.createQueue(new QueueConfiguration(queue).setAddress(address).setMaxConsumers(10).setPurgeOnNoConsumers(true).setExclusive(true).setLastValue(true)); QueueBinding queueBinding1 = (QueueBinding)server.getPostOffice().getBinding(queue); Assert.assertTrue(queueBinding1.getQueue().isLastValue()); @@ -92,7 +92,7 @@ public class QueueConfigRestartTest extends ActiveMQTestBase { SimpleString address = new SimpleString("test.address"); SimpleString queue = new SimpleString("test.queue"); - server.createQueue(address, RoutingType.MULTICAST, queue, null, null, true, false, false, false,false, 10, true, true, true, true); + server.createQueue(new QueueConfiguration(queue).setAddress(address).setMaxConsumers(10).setPurgeOnNoConsumers(true).setExclusive(true).setLastValue(true)); QueueBinding queueBinding1 = (QueueBinding)server.getPostOffice().getBinding(queue); Assert.assertTrue(queueBinding1.getQueue().isExclusive()); @@ -115,7 +115,7 @@ public class QueueConfigRestartTest extends ActiveMQTestBase { SimpleString address = new SimpleString("test.address"); SimpleString queue = new SimpleString("test.queue"); - server.createQueue(address, RoutingType.MULTICAST, queue, null, null, true, false, false, false,false, 10, true, true, false, -1, true, null, false, consumersBeforeDispatch, -1, false, 0, 0, true); + server.createQueue(new QueueConfiguration(queue).setAddress(address).setMaxConsumers(10).setPurgeOnNoConsumers(true).setExclusive(true).setConsumersBeforeDispatch(consumersBeforeDispatch)); QueueBinding queueBinding1 = (QueueBinding)server.getPostOffice().getBinding(queue); Assert.assertEquals(consumersBeforeDispatch, queueBinding1.getQueue().getConsumersBeforeDispatch()); @@ -138,7 +138,7 @@ public class QueueConfigRestartTest extends ActiveMQTestBase { SimpleString address = new SimpleString("test.address"); SimpleString queue = new SimpleString("test.queue"); - server.createQueue(address, RoutingType.MULTICAST, queue, null, null, true, false, false, false,false, 10, true, true, false, -1, true, null, false,0, delayBeforeDispatch, false, 0, 0, true); + server.createQueue(new QueueConfiguration(queue).setAddress(address).setMaxConsumers(10).setPurgeOnNoConsumers(true).setExclusive(true).setDelayBeforeDispatch(delayBeforeDispatch)); QueueBinding queueBinding1 = (QueueBinding)server.getPostOffice().getBinding(queue); Assert.assertEquals(delayBeforeDispatch, queueBinding1.getQueue().getDelayBeforeDispatch()); @@ -161,7 +161,7 @@ public class QueueConfigRestartTest extends ActiveMQTestBase { SimpleString address = new SimpleString("test.address"); SimpleString queue = new SimpleString("test.queue"); - server.createQueue(address, RoutingType.MULTICAST, queue, null, SimpleString.toSimpleString("bob"), true, false, false, 10, true, true); + server.createQueue(new QueueConfiguration(queue).setAddress(address).setUser("bob").setMaxConsumers(10).setPurgeOnNoConsumers(true)); QueueBinding queueBinding1 = (QueueBinding)server.getPostOffice().getBinding(queue); Assert.assertEquals(SimpleString.toSimpleString("bob"), queueBinding1.getQueue().getUser()); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/SyncSendTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/SyncSendTest.java index 3729683c39..63f88a7d12 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/SyncSendTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/SyncSendTest.java @@ -32,12 +32,12 @@ import java.util.ArrayList; import java.util.Collection; import java.util.concurrent.TimeUnit; +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.config.impl.ConfigurationImpl; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.JournalType; -import org.apache.activemq.artemis.core.server.impl.AddressInfo; import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; import org.apache.activemq.artemis.nativo.jlibaio.LibaioContext; @@ -166,9 +166,7 @@ public class SyncSendTest extends ActiveMQTestBase { long recordTime = getTimePerSync(); - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("queue"), RoutingType.ANYCAST)); - - server.createQueue(SimpleString.toSimpleString("queue"), RoutingType.ANYCAST, SimpleString.toSimpleString("queue"), null, true, false); + server.createQueue(new QueueConfiguration("queue").setRoutingType(RoutingType.ANYCAST).setAutoCreateAddress(true)); ConnectionFactory factory = newCF(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/XmlImportExportTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/XmlImportExportTest.java index 94b9131b1f..f2d69d58db 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/XmlImportExportTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/XmlImportExportTest.java @@ -32,6 +32,7 @@ import java.util.EnumSet; import java.util.UUID; import org.apache.activemq.artemis.api.core.Message; +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.api.core.TransportConfiguration; @@ -99,7 +100,7 @@ public class XmlImportExportTest extends ActiveMQTestBase { public void testMessageProperties() throws Exception { ClientSession session = basicSetUp(); - session.createQueue(QUEUE_NAME, RoutingType.MULTICAST, QUEUE_NAME, true); + session.createQueue(new QueueConfiguration(QUEUE_NAME)); ClientProducer producer = session.createProducer(QUEUE_NAME); @@ -210,7 +211,7 @@ public class XmlImportExportTest extends ActiveMQTestBase { ClientSession session = basicSetUp(); - session.createQueue(QUEUE_NAME, RoutingType.MULTICAST, QUEUE_NAME, true); + session.createQueue(new QueueConfiguration(QUEUE_NAME)); ClientProducer producer = session.createProducer(QUEUE_NAME); @@ -278,7 +279,7 @@ public class XmlImportExportTest extends ActiveMQTestBase { ClientSession session = basicSetUp(); - session.createQueue(QUEUE_NAME, RoutingType.MULTICAST, QUEUE_NAME, true); + session.createQueue(new QueueConfiguration(QUEUE_NAME)); ClientProducer producer = session.createProducer(QUEUE_NAME); ClientMessage msg = session.createMessage(Message.TEXT_TYPE, true); @@ -323,7 +324,7 @@ public class XmlImportExportTest extends ActiveMQTestBase { ClientSession session = basicSetUp(); - session.createQueue(QUEUE_NAME, RoutingType.MULTICAST, QUEUE_NAME, true); + session.createQueue(new QueueConfiguration(QUEUE_NAME)); ClientProducer producer = session.createProducer(QUEUE_NAME); ClientMessage msg = session.createMessage(Message.BYTES_TYPE, true); @@ -366,7 +367,7 @@ public class XmlImportExportTest extends ActiveMQTestBase { ClientSession session = basicSetUp(); - session.createQueue(QUEUE_NAME, RoutingType.MULTICAST, QUEUE_NAME, true); + session.createQueue(new QueueConfiguration(QUEUE_NAME)); ClientProducer producer = session.createProducer(QUEUE_NAME); @@ -412,8 +413,8 @@ public class XmlImportExportTest extends ActiveMQTestBase { public void testBindingAttributes() throws Exception { ClientSession session = basicSetUp(); - session.createQueue("addressName1", RoutingType.MULTICAST, "queueName1", true); - session.createQueue("addressName1", RoutingType.MULTICAST, "queueName2", "bob", true); + session.createQueue(new QueueConfiguration("queueName1").setAddress("addressName1")); + session.createQueue(new QueueConfiguration("queueName2").setAddress("addressName1").setFilterString("bob")); session.close(); locator.close(); @@ -470,7 +471,7 @@ public class XmlImportExportTest extends ActiveMQTestBase { fileMessage.releaseResources(false); - session.createQueue("A", RoutingType.MULTICAST, "A", true); + session.createQueue(new QueueConfiguration("A")); ClientProducer prod = session.createProducer("A"); @@ -542,7 +543,7 @@ public class XmlImportExportTest extends ActiveMQTestBase { fileMessage.releaseResources(false); - session.createQueue("A", RoutingType.MULTICAST, "A", true); + session.createQueue(new QueueConfiguration("A")); ClientProducer prod = session.createProducer("A"); @@ -613,7 +614,7 @@ public class XmlImportExportTest extends ActiveMQTestBase { ConnectionFactory cf = ActiveMQJMSClient.createConnectionFactory("vm://0", "test"); Connection c = cf.createConnection(); Session s = c.createSession(false, Session.AUTO_ACKNOWLEDGE); - server.createQueue(SimpleString.toSimpleString("A"), RoutingType.ANYCAST, SimpleString.toSimpleString("A"), null, true, false); + server.createQueue(new QueueConfiguration("A").setRoutingType(RoutingType.ANYCAST)); MessageProducer p = s.createProducer(ActiveMQJMSClient.createQueue("A")); p.setDeliveryMode(DeliveryMode.PERSISTENT); StringBuilder stringBuilder = new StringBuilder(); @@ -662,8 +663,8 @@ public class XmlImportExportTest extends ActiveMQTestBase { public void testPartialQueue() throws Exception { ClientSession session = basicSetUp(); - session.createQueue("myAddress", RoutingType.MULTICAST, "myQueue1", true); - session.createQueue("myAddress", RoutingType.MULTICAST, "myQueue2", true); + session.createQueue(new QueueConfiguration("myQueue1").setAddress("myAddress")); + session.createQueue(new QueueConfiguration("myQueue2").setAddress("myAddress")); ClientProducer producer = session.createProducer("myAddress"); @@ -729,8 +730,8 @@ public class XmlImportExportTest extends ActiveMQTestBase { ClientSessionFactory factory = locator.createSessionFactory(); ClientSession session = factory.createSession(false, true, true); - session.createQueue(MY_ADDRESS, RoutingType.MULTICAST, MY_QUEUE, true); - session.createQueue(MY_ADDRESS, RoutingType.MULTICAST, MY_QUEUE2, true); + session.createQueue(new QueueConfiguration(MY_QUEUE).setAddress(MY_ADDRESS)); + session.createQueue(new QueueConfiguration(MY_QUEUE2).setAddress(MY_ADDRESS)); ClientProducer producer = session.createProducer(MY_ADDRESS); @@ -799,7 +800,7 @@ public class XmlImportExportTest extends ActiveMQTestBase { factory = createSessionFactory(locator); ClientSession session = factory.createSession(false, true, true); - session.createQueue(MY_ADDRESS, RoutingType.MULTICAST, MY_QUEUE, true); + session.createQueue(new QueueConfiguration(MY_QUEUE).setAddress(MY_ADDRESS)); ClientProducer producer = session.createProducer(MY_ADDRESS); @@ -862,7 +863,7 @@ public class XmlImportExportTest extends ActiveMQTestBase { ClientSessionFactory factory = locator.createSessionFactory(); ClientSession session = factory.createSession(false, true, true); - session.createQueue(MY_ADDRESS, RoutingType.MULTICAST, MY_QUEUE, true); + session.createQueue(new QueueConfiguration(MY_QUEUE).setAddress(MY_ADDRESS)); ClientProducer producer = session.createProducer(MY_ADDRESS); @@ -941,7 +942,7 @@ public class XmlImportExportTest extends ActiveMQTestBase { public void testTransactional() throws Exception { ClientSession session = basicSetUp(); - session.createQueue(QUEUE_NAME, RoutingType.MULTICAST, QUEUE_NAME, true); + session.createQueue(new QueueConfiguration(QUEUE_NAME)); ClientProducer producer = session.createProducer(QUEUE_NAME); @@ -986,7 +987,7 @@ public class XmlImportExportTest extends ActiveMQTestBase { ClientSessionFactory factory = locator.createSessionFactory(); ClientSession session = factory.createSession(false, true, true); - session.createQueue(QUEUE_NAME, RoutingType.MULTICAST, QUEUE_NAME, true); + session.createQueue(new QueueConfiguration(QUEUE_NAME)); ClientProducer producer = session.createProducer(QUEUE_NAME); @@ -1037,7 +1038,7 @@ public class XmlImportExportTest extends ActiveMQTestBase { ClientSessionFactory factory = locator.createSessionFactory(); ClientSession session = factory.createSession(false, true, true); - session.createQueue(QUEUE_NAME, RoutingType.MULTICAST, QUEUE_NAME, true); + session.createQueue(new QueueConfiguration(QUEUE_NAME)); ClientProducer producer = session.createProducer(QUEUE_NAME); @@ -1096,8 +1097,8 @@ public class XmlImportExportTest extends ActiveMQTestBase { session.createAddress(myAddress, routingTypes, false); - session.createQueue(myAddress.toString(), RoutingType.MULTICAST, "myQueue1", true); - session.createQueue(myAddress.toString(), RoutingType.MULTICAST, "myQueue2", true); + session.createQueue(new QueueConfiguration("myQueue1").setAddress(myAddress)); + session.createQueue(new QueueConfiguration("myQueue2").setAddress(myAddress)); locator.close(); server.stop(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/metrics/JournalPendingMessageTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/metrics/JournalPendingMessageTest.java index e423856e77..885b428fb1 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/metrics/JournalPendingMessageTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/metrics/JournalPendingMessageTest.java @@ -30,6 +30,7 @@ import javax.jms.Session; import javax.jms.Topic; import javax.jms.TopicSession; +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.config.Configuration; @@ -62,9 +63,7 @@ public class JournalPendingMessageTest extends AbstractPersistentStatTestSupport server.getPostOffice() .addAddressInfo(new AddressInfo(SimpleString.toSimpleString(defaultQueueName), RoutingType.ANYCAST)); - server.createQueue(SimpleString.toSimpleString(defaultQueueName), RoutingType.ANYCAST, - SimpleString.toSimpleString(defaultQueueName), null, true, false); - + server.createQueue(new QueueConfiguration(defaultQueueName).setRoutingType(RoutingType.ANYCAST)); } @Override diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/CorePluginTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/CorePluginTest.java index a236b8e3d8..eba9eb043e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/CorePluginTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/CorePluginTest.java @@ -16,6 +16,46 @@ */ package org.apache.activemq.artemis.tests.integration.plugin; +import javax.jms.MessageConsumer; +import javax.jms.MessageProducer; +import javax.jms.Queue; +import javax.jms.Session; +import javax.jms.TextMessage; +import javax.jms.Topic; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.BiConsumer; + +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.api.core.TransportConfiguration; +import org.apache.activemq.artemis.api.core.client.ActiveMQClient; +import org.apache.activemq.artemis.api.core.client.ClientConsumer; +import org.apache.activemq.artemis.api.core.client.ClientMessage; +import org.apache.activemq.artemis.api.core.client.ClientProducer; +import org.apache.activemq.artemis.api.core.client.ClientSession; +import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; +import org.apache.activemq.artemis.api.core.client.ServerLocator; +import org.apache.activemq.artemis.core.config.BridgeConfiguration; +import org.apache.activemq.artemis.core.config.Configuration; +import org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory; +import org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants; +import org.apache.activemq.artemis.core.server.ActiveMQServer; +import org.apache.activemq.artemis.core.server.MessageReference; +import org.apache.activemq.artemis.core.server.ServerConsumer; +import org.apache.activemq.artemis.core.server.cluster.impl.BridgeMetrics; +import org.apache.activemq.artemis.core.server.impl.AckReason; +import org.apache.activemq.artemis.core.server.impl.AddressInfo; +import org.apache.activemq.artemis.core.server.plugin.ActiveMQServerPlugin; +import org.apache.activemq.artemis.tests.util.JMSTestBase; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_ACKNOWLEDGE_BRIDGE; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_ADD_ADDRESS; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.AFTER_ADD_BINDING; @@ -56,47 +96,6 @@ import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledV import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.MESSAGE_ACKED; import static org.apache.activemq.artemis.tests.integration.plugin.MethodCalledVerifier.MESSAGE_EXPIRED; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.function.BiConsumer; - -import javax.jms.MessageConsumer; -import javax.jms.MessageProducer; -import javax.jms.Queue; -import javax.jms.Session; -import javax.jms.TextMessage; -import javax.jms.Topic; - -import org.apache.activemq.artemis.api.core.RoutingType; -import org.apache.activemq.artemis.api.core.SimpleString; -import org.apache.activemq.artemis.api.core.TransportConfiguration; -import org.apache.activemq.artemis.api.core.client.ActiveMQClient; -import org.apache.activemq.artemis.api.core.client.ClientConsumer; -import org.apache.activemq.artemis.api.core.client.ClientMessage; -import org.apache.activemq.artemis.api.core.client.ClientProducer; -import org.apache.activemq.artemis.api.core.client.ClientSession; -import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; -import org.apache.activemq.artemis.api.core.client.ServerLocator; -import org.apache.activemq.artemis.core.config.BridgeConfiguration; -import org.apache.activemq.artemis.core.config.Configuration; -import org.apache.activemq.artemis.core.config.CoreQueueConfiguration; -import org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory; -import org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants; -import org.apache.activemq.artemis.core.server.ActiveMQServer; -import org.apache.activemq.artemis.core.server.MessageReference; -import org.apache.activemq.artemis.core.server.ServerConsumer; -import org.apache.activemq.artemis.core.server.cluster.impl.BridgeMetrics; -import org.apache.activemq.artemis.core.server.impl.AckReason; -import org.apache.activemq.artemis.core.server.impl.AddressInfo; -import org.apache.activemq.artemis.core.server.plugin.ActiveMQServerPlugin; -import org.apache.activemq.artemis.tests.util.JMSTestBase; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - public class CorePluginTest extends JMSTestBase { private Queue queue; @@ -326,15 +325,15 @@ public class CorePluginTest extends JMSTestBase { bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); - CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0); - List queueConfigs0 = new ArrayList<>(); + QueueConfiguration queueConfig0 = new QueueConfiguration(queueName0).setAddress(testAddress); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); - server0.getConfiguration().setQueueConfigurations(queueConfigs0); + server0.getConfiguration().setQueueConfigs(queueConfigs0); - CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName1); - List queueConfigs1 = new ArrayList<>(); + QueueConfiguration queueConfig1 = new QueueConfiguration(queueName1).setAddress(forwardAddress); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); - server1.getConfiguration().setQueueConfigurations(queueConfigs1); + server1.getConfiguration().setQueueConfigs(queueConfigs1); server1.start(); server0.start(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/MetricsPluginTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/MetricsPluginTest.java index 91e0ee2d59..cab34b22e4 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/MetricsPluginTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/MetricsPluginTest.java @@ -27,6 +27,7 @@ import java.util.stream.Collectors; import io.micrometer.core.instrument.Measurement; import io.micrometer.core.instrument.Meter; +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.api.core.client.ClientConsumer; @@ -99,7 +100,7 @@ public class MetricsPluginTest extends ActiveMQTestBase { final String queueName = "simpleQueue"; final String addressName = "simpleAddress"; - session.createQueue(addressName, RoutingType.ANYCAST, queueName, null, true); + session.createQueue(new QueueConfiguration(queueName).setAddress(addressName).setRoutingType(RoutingType.ANYCAST)); Map metrics = getMetrics(); List artemisMetrics = metrics.entrySet().stream() @@ -150,7 +151,7 @@ public class MetricsPluginTest extends ActiveMQTestBase { final String queueName = "simpleQueue"; final String addressName = "simpleAddress"; - session.createQueue(addressName, RoutingType.ANYCAST, queueName, null, true); + session.createQueue(new QueueConfiguration(queueName).setAddress(addressName).setRoutingType(RoutingType.ANYCAST)); ClientProducer producer = session.createProducer(addressName); ClientMessage message = session.createMessage(true); message.getBodyBuffer().writeString(data); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/ResourceAdapterTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/ResourceAdapterTest.java index fa7d0c8b5a..b9ba54e9d9 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/ResourceAdapterTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/ResourceAdapterTest.java @@ -26,6 +26,7 @@ import java.util.Set; import java.util.concurrent.CountDownLatch; import org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration; +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.api.core.UDPBroadcastEndpointFactory; @@ -57,7 +58,7 @@ public class ResourceAdapterTest extends ActiveMQRATestBase { ClientSessionFactory factory = locator.createSessionFactory(); ClientSession session = factory.createSession(false, false, false); ActiveMQDestination queue = (ActiveMQDestination) ActiveMQJMSClient.createQueue("test"); - session.createQueue(queue.getSimpleAddress(), queue.getSimpleAddress(), true); + session.createQueue(new QueueConfiguration(queue.getSimpleAddress())); session.close(); ActiveMQResourceAdapter ra = new ActiveMQResourceAdapter(); @@ -110,7 +111,7 @@ public class ResourceAdapterTest extends ActiveMQRATestBase { final String prefix = "jms.queue."; final String destinationName = "test"; final SimpleString prefixedDestinationName = SimpleString.toSimpleString(prefix + destinationName); - server.createQueue(prefixedDestinationName, RoutingType.ANYCAST, prefixedDestinationName, null, false, false); + server.createQueue(new QueueConfiguration(prefixedDestinationName).setRoutingType(RoutingType.ANYCAST).setDurable(false)); ActiveMQResourceAdapter ra = new ActiveMQResourceAdapter(); ra.setConnectorClassName(INVM_CONNECTOR_FACTORY); ra.start(new BootstrapContext()); @@ -803,7 +804,7 @@ public class ResourceAdapterTest extends ActiveMQRATestBase { ClientSessionFactory factory = locator.createSessionFactory(); ClientSession session = factory.createSession(false, false, false); ActiveMQDestination queue = (ActiveMQDestination) ActiveMQJMSClient.createQueue("test"); - session.createQueue(queue.getSimpleAddress(), queue.getSimpleAddress(), true); + session.createQueue(new QueueConfiguration(queue.getSimpleAddress())); session.close(); ActiveMQResourceAdapter ra = new ActiveMQResourceAdapter(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/BatchDelayTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/BatchDelayTest.java index 71d9868c65..c1c877b2c9 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/BatchDelayTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/BatchDelayTest.java @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.integration.remoting; import java.util.HashMap; import java.util.Map; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; import org.apache.activemq.artemis.api.core.client.ClientConsumer; @@ -74,7 +75,7 @@ public class BatchDelayTest extends ActiveMQTestBase { final String foo = "foo"; - session.createQueue(foo, RoutingType.ANYCAST, foo); + session.createQueue(new QueueConfiguration(foo).setRoutingType(RoutingType.ANYCAST)); ClientProducer prod = session.createProducer(foo); @@ -94,7 +95,7 @@ public class BatchDelayTest extends ActiveMQTestBase { final String foo = "foo"; - session.createQueue(foo, RoutingType.ANYCAST, foo); + session.createQueue(new QueueConfiguration(foo).setRoutingType(RoutingType.ANYCAST)); ClientProducer prod = session.createProducer(foo); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/DirectDeliverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/DirectDeliverTest.java index deb862acc8..8a4a0a4c10 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/DirectDeliverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/DirectDeliverTest.java @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.integration.remoting; import java.util.HashMap; import java.util.Map; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; @@ -93,7 +94,7 @@ public class DirectDeliverTest extends ActiveMQTestBase { ClientSession session = sf.createSession(); - session.createQueue(foo, RoutingType.ANYCAST, foo); + session.createQueue(new QueueConfiguration(foo).setRoutingType(RoutingType.ANYCAST)); Binding binding = server.getPostOffice().getBinding(new SimpleString(foo)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/ReconnectTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/ReconnectTest.java index 14fd107334..13ddd11af5 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/ReconnectTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/ReconnectTest.java @@ -27,6 +27,7 @@ import java.util.concurrent.atomic.AtomicInteger; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException; import org.apache.activemq.artemis.api.core.Interceptor; +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.api.core.client.ClientConsumer; @@ -410,7 +411,7 @@ public class ReconnectTest extends ActiveMQTestBase { SimpleString addressName1 = new SimpleString("my_address_one"); server.addAddressInfo(new AddressInfo(addressName1, RoutingType.ANYCAST)); - server.createQueue(addressName1, RoutingType.ANYCAST, queueName1, null, true, false); + server.createQueue(new QueueConfiguration(queueName1).setAddress(addressName1).setRoutingType(RoutingType.ANYCAST)); ClientConsumer clientConsumer1 = session.createConsumer(queueName1); ClientConsumer clientConsumer2 = session.createConsumer(queueName1); clientConsumer1.close(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/ReplicationOrderTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/ReplicationOrderTest.java index ab4257d224..f039b19c2c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/ReplicationOrderTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/ReplicationOrderTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.replication; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; import org.apache.activemq.artemis.api.core.client.ClientConsumer; @@ -58,7 +59,7 @@ public class ReplicationOrderTest extends FailoverTestBase { session = csf.createSession(true, true); } addClientSession(session); - session.createQueue(address, queue, true); + session.createQueue(new QueueConfiguration(queue).setAddress(address)); ClientProducer producer = session.createProducer(address); boolean durable = false; for (int i = 0; i < ReplicationOrderTest.NUM; i++) { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/ReplicationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/ReplicationTest.java index ce56b9beed..da64521aa2 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/ReplicationTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/ReplicationTest.java @@ -37,6 +37,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQExceptionType; import org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException; import org.apache.activemq.artemis.api.core.Interceptor; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; @@ -293,7 +294,7 @@ public final class ReplicationTest extends ActiveMQTestBase { ClientSessionFactory sf = createSessionFactory(locator); final ClientSession session = sf.createSession(); final ClientSession session2 = sf.createSession(); - session.createQueue(ADDRESS, ADDRESS, null, true); + session.createQueue(new QueueConfiguration(ADDRESS)); final ClientProducer producer = session.createProducer(ADDRESS); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/SharedNothingReplicationFlowControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/SharedNothingReplicationFlowControlTest.java index e9796645fc..568e782f86 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/SharedNothingReplicationFlowControlTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/SharedNothingReplicationFlowControlTest.java @@ -36,6 +36,7 @@ import java.util.concurrent.atomic.AtomicInteger; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.Interceptor; +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.api.core.client.ClientMessage; @@ -119,7 +120,7 @@ public class SharedNothingReplicationFlowControlTest extends ActiveMQTestBase { final ClientSessionFactory csf = locator.createSessionFactory(); ClientSession sess = csf.createSession(); - sess.createQueue("flowcontrol", RoutingType.ANYCAST, "flowcontrol", true); + sess.createQueue(new QueueConfiguration("flowcontrol").setRoutingType(RoutingType.ANYCAST)); sess.close(); int i = 0; @@ -231,7 +232,7 @@ public class SharedNothingReplicationFlowControlTest extends ActiveMQTestBase { final ClientSessionFactory csf = locator.createSessionFactory(); ClientSession sess = csf.createSession(); - sess.createQueue("flowcontrol", RoutingType.ANYCAST, "flowcontrol", true); + sess.createQueue(new QueueConfiguration("flowcontrol").setRoutingType(RoutingType.ANYCAST)); PagingStore store = liveServer.getPagingManager().getPageStore(SimpleString.toSimpleString("flowcontrol")); store.startPaging(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/SharedNothingReplicationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/SharedNothingReplicationTest.java index d6fa59dbf6..cb4f8afa91 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/SharedNothingReplicationTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/SharedNothingReplicationTest.java @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.integration.replication; import org.apache.activemq.artemis.api.core.ActiveMQBuffer; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.Message; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientProducer; @@ -122,7 +123,7 @@ public class SharedNothingReplicationTest extends ActiveMQTestBase { final ClientSessionFactory csf = locator.createSessionFactory(); ClientSession sess = csf.createSession(); - sess.createQueue("slow", RoutingType.ANYCAST, "slow", true); + sess.createQueue(new QueueConfiguration("slow").setRoutingType(RoutingType.ANYCAST)); sess.close(); // let's write some messages diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/scheduling/DelayedMessageTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/scheduling/DelayedMessageTest.java index 007d85086d..052772ae37 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/scheduling/DelayedMessageTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/scheduling/DelayedMessageTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.scheduling; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientProducer; @@ -69,7 +70,7 @@ public class DelayedMessageTest extends ActiveMQTestBase { ClientSessionFactory sessionFactory = createSessionFactory(locator); ClientSession session = sessionFactory.createSession(false, false, false); - session.createQueue(qName, qName, null, true); + session.createQueue(new QueueConfiguration(qName)); session.close(); ClientSession session1 = sessionFactory.createSession(false, true, true); @@ -137,7 +138,7 @@ public class DelayedMessageTest extends ActiveMQTestBase { ClientSessionFactory sessionFactory = createSessionFactory(locator); ClientSession session = sessionFactory.createSession(false, false, false); - session.createQueue(qName, qName, null, true); + session.createQueue(new QueueConfiguration(qName)); session.close(); ClientSession session1 = sessionFactory.createSession(false, true, true); @@ -191,7 +192,7 @@ public class DelayedMessageTest extends ActiveMQTestBase { ClientSessionFactory sessionFactory = createSessionFactory(locator); ClientSession session = sessionFactory.createSession(false, false, false); - session.createQueue(qName, qName, null, true); + session.createQueue(new QueueConfiguration(qName)); session.close(); ClientSession session1 = sessionFactory.createSession(false, true, true); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/scheduling/MultipliedDelayedMessageTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/scheduling/MultipliedDelayedMessageTest.java index aae13c2ae1..4052db46b3 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/scheduling/MultipliedDelayedMessageTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/scheduling/MultipliedDelayedMessageTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.scheduling; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientProducer; @@ -75,7 +76,7 @@ public class MultipliedDelayedMessageTest extends ActiveMQTestBase { // Session for creating the queue ClientSession session = sessionFactory.createSession(false, false, false); - session.createQueue(queueName, queueName, null, true); + session.createQueue(new QueueConfiguration(queueName)); session.close(); // Session for sending the message diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/scheduling/ScheduledMessageTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/scheduling/ScheduledMessageTest.java index d4016c26a1..5bd7d3faae 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/scheduling/ScheduledMessageTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/scheduling/ScheduledMessageTest.java @@ -22,6 +22,7 @@ import java.util.ArrayList; import java.util.concurrent.atomic.AtomicInteger; import org.apache.activemq.artemis.api.core.Message; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -127,7 +128,7 @@ public class ScheduledMessageTest extends ActiveMQTestBase { // then we create a client as normal ClientSessionFactory sessionFactory = createSessionFactory(locator); ClientSession session = sessionFactory.createSession(false, true, false); - session.createQueue(atestq, atestq, null, true); + session.createQueue(new QueueConfiguration(atestq)); ClientProducer producer = session.createProducer(atestq); ClientMessage message = createDurableMessage(session, "m1"); long time = System.currentTimeMillis(); @@ -162,8 +163,8 @@ public class ScheduledMessageTest extends ActiveMQTestBase { // then we create a client as normal ClientSessionFactory sessionFactory = createSessionFactory(locator); ClientSession session = sessionFactory.createSession(false, true, false); - session.createQueue(atestq, atestq, null, true); - session.createQueue(atestq, atestq2, null, true); + session.createQueue(new QueueConfiguration(atestq)); + session.createQueue(new QueueConfiguration(atestq2).setAddress(atestq)); ClientProducer producer = session.createProducer(atestq); ClientMessage message = createDurableMessage(session, "m1"); producer.send(message); @@ -214,8 +215,8 @@ public class ScheduledMessageTest extends ActiveMQTestBase { // then we create a client as normal ClientSessionFactory sessionFactory = createSessionFactory(locator); ClientSession session = sessionFactory.createSession(false, true, false); - session.createQueue(atestq, atestq, null, true); - session.createQueue(atestq, atestq2, null, true); + session.createQueue(new QueueConfiguration(atestq)); + session.createQueue(new QueueConfiguration(atestq2).setAddress(atestq)); ClientProducer producer = session.createProducer(atestq); ClientMessage message = createDurableMessage(session, "m1"); producer.send(message); @@ -275,7 +276,7 @@ public class ScheduledMessageTest extends ActiveMQTestBase { // then we create a client as normal ClientSessionFactory sessionFactory = createSessionFactory(locator); ClientSession session = sessionFactory.createSession(false, true, false); - session.createQueue(atestq, atestq, null, true); + session.createQueue(new QueueConfiguration(atestq)); ClientProducer producer = session.createProducer(atestq); ClientMessage message = session.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); message.getBodyBuffer().writeString("testINVMCoreClient"); @@ -318,7 +319,7 @@ public class ScheduledMessageTest extends ActiveMQTestBase { ClientSessionFactory sessionFactory = createSessionFactory(locator); ClientSession session = sessionFactory.createSession(false, true, false); - session.createQueue(atestq, atestq, null, true); + session.createQueue(new QueueConfiguration(atestq)); ClientProducer producer = session.createProducer(atestq); ClientMessage m1 = createDurableMessage(session, "m1"); ClientMessage m2 = createDurableMessage(session, "m2"); @@ -396,7 +397,7 @@ public class ScheduledMessageTest extends ActiveMQTestBase { ClientSessionFactory sessionFactory = createSessionFactory(locator); ClientSession session = sessionFactory.createSession(false, true, false); - session.createQueue(atestq, atestq, null, true); + session.createQueue(new QueueConfiguration(atestq)); ClientProducer producer = session.createProducer(atestq); ClientMessage m1 = createDurableMessage(session, "m1"); ClientMessage m2 = createDurableMessage(session, "m2"); @@ -476,7 +477,7 @@ public class ScheduledMessageTest extends ActiveMQTestBase { ClientSessionFactory sessionFactory = createSessionFactory(locator); ClientSession session = sessionFactory.createSession(false, false, false); - session.createQueue(atestq, atestq, null, true); + session.createQueue(new QueueConfiguration(atestq)); ClientProducer producer = session.createProducer(atestq); long time = System.currentTimeMillis(); time += 1000; @@ -512,7 +513,7 @@ public class ScheduledMessageTest extends ActiveMQTestBase { ClientSessionFactory sessionFactory = createSessionFactory(locator); ClientSession session = sessionFactory.createSession(false, true, false); - session.createQueue(atestq, atestq, null, true); + session.createQueue(new QueueConfiguration(atestq)); ClientProducer producer = session.createProducer(atestq); ClientMessage m1 = createDurableMessage(session, "m1"); ClientMessage m2 = createDurableMessage(session, "m2"); @@ -584,7 +585,7 @@ public class ScheduledMessageTest extends ActiveMQTestBase { ClientSessionFactory sessionFactory = createSessionFactory(locator); ClientSession session = sessionFactory.createSession(true, false, false); - session.createQueue(atestq, atestq, null, true); + session.createQueue(new QueueConfiguration(atestq)); session.start(xid, XAResource.TMNOFLAGS); ClientProducer producer = session.createProducer(atestq); ClientMessage message = createDurableMessage(session, "testINVMCoreClient"); @@ -635,7 +636,7 @@ public class ScheduledMessageTest extends ActiveMQTestBase { ClientSessionFactory sessionFactory = createSessionFactory(locator); ClientSession session = sessionFactory.createSession(true, false, false); - session.createQueue(atestq, atestq, null, true); + session.createQueue(new QueueConfiguration(atestq)); ClientProducer producer = session.createProducer(atestq); @@ -711,7 +712,7 @@ public class ScheduledMessageTest extends ActiveMQTestBase { ClientSessionFactory sessionFactory = createSessionFactory(locator); ClientSession session = sessionFactory.createSession(false, false, false); - session.createQueue(atestq, atestq, true); + session.createQueue(new QueueConfiguration(atestq)); ClientProducer producer = session.createProducer(atestq); for (int i = 0; i < 100; i++) { @@ -808,7 +809,7 @@ public class ScheduledMessageTest extends ActiveMQTestBase { ClientSessionFactory sessionFactory = createSessionFactory(locator); ClientSession session = sessionFactory.createSession(tx, false, false); - session.createQueue(atestq, atestq, null, true); + session.createQueue(new QueueConfiguration(atestq)); ClientProducer producer = session.createProducer(atestq); ClientConsumer consumer = session.createConsumer(atestq); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/JMSXUserIDPluginTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/JMSXUserIDPluginTest.java index fef28748de..10399270a3 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/JMSXUserIDPluginTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/JMSXUserIDPluginTest.java @@ -18,6 +18,7 @@ package org.apache.activemq.artemis.tests.integration.security; import org.apache.activemq.artemis.api.core.ActiveMQException; +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.api.core.client.ClientConsumer; @@ -61,7 +62,7 @@ public class JMSXUserIDPluginTest extends ActiveMQTestBase { server.registerBrokerPlugin(plugin); server.start(); - server.createQueue(ADDRESS, RoutingType.ANYCAST, ADDRESS, null, true, false); + server.createQueue(new QueueConfiguration(ADDRESS).setRoutingType(RoutingType.ANYCAST)); } @Test diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/LDAPSecurityTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/LDAPSecurityTest.java index d0cfcbec57..77f230258c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/LDAPSecurityTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/LDAPSecurityTest.java @@ -29,6 +29,7 @@ import java.util.Hashtable; import java.util.Set; import org.apache.activemq.artemis.api.core.ActiveMQException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; @@ -44,7 +45,6 @@ import org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory; import org.apache.activemq.artemis.core.security.Role; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServers; -import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.directory.server.annotations.CreateLdapServer; @@ -178,15 +178,15 @@ public class LDAPSecurityTest extends AbstractLdapTestUnit { roles.add(new Role("programmers", false, false, false, false, false, false, false, false, false, false)); server.getConfiguration().putSecurityRoles("#", roles); server.start(); - server.createQueue(ADDRESS, RoutingType.MULTICAST, DURABLE_QUEUE, null, true, false); - server.createQueue(ADDRESS, RoutingType.MULTICAST, NON_DURABLE_QUEUE, null, false, false); + server.createQueue(new QueueConfiguration(DURABLE_QUEUE).setAddress(ADDRESS)); + server.createQueue(new QueueConfiguration(NON_DURABLE_QUEUE).setAddress(ADDRESS).setDurable(false)); ClientSessionFactory cf = locator.createSessionFactory(); ClientSession session = cf.createSession("first", "secret", false, true, true, false, 0); // CREATE_DURABLE_QUEUE try { - session.createQueue(ADDRESS, DURABLE_QUEUE, true); + session.createQueue(new QueueConfiguration(DURABLE_QUEUE).setAddress(ADDRESS)); Assert.fail("should throw exception here"); } catch (ActiveMQException e) { // ignore @@ -202,7 +202,7 @@ public class LDAPSecurityTest extends AbstractLdapTestUnit { // CREATE_NON_DURABLE_QUEUE try { - session.createQueue(ADDRESS, NON_DURABLE_QUEUE, false); + session.createQueue(new QueueConfiguration(NON_DURABLE_QUEUE).setAddress(ADDRESS).setDurable(false)); Assert.fail("should throw exception here"); } catch (ActiveMQException e) { // ignore @@ -270,7 +270,7 @@ public class LDAPSecurityTest extends AbstractLdapTestUnit { // CREATE_DURABLE_QUEUE try { - session.createQueue(ADDRESS, DURABLE_QUEUE, true); + session.createQueue(new QueueConfiguration(DURABLE_QUEUE).setAddress(ADDRESS)); } catch (ActiveMQException e) { e.printStackTrace(); Assert.fail("should not throw exception here"); @@ -286,7 +286,7 @@ public class LDAPSecurityTest extends AbstractLdapTestUnit { // CREATE_NON_DURABLE_QUEUE try { - session.createQueue(ADDRESS, NON_DURABLE_QUEUE, false); + session.createQueue(new QueueConfiguration(NON_DURABLE_QUEUE).setAddress(ADDRESS).setDurable(false)); } catch (ActiveMQException e) { Assert.fail("should not throw exception here"); } @@ -298,7 +298,7 @@ public class LDAPSecurityTest extends AbstractLdapTestUnit { Assert.fail("should not throw exception here"); } - session.createQueue(ADDRESS, DURABLE_QUEUE, true); + session.createQueue(new QueueConfiguration(DURABLE_QUEUE).setAddress(ADDRESS)); // PRODUCE try { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/LegacyLDAPSecuritySettingPluginListenerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/LegacyLDAPSecuritySettingPluginListenerTest.java index 74ef8a34fc..d7b227b283 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/LegacyLDAPSecuritySettingPluginListenerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/LegacyLDAPSecuritySettingPluginListenerTest.java @@ -34,6 +34,7 @@ import java.util.Hashtable; import java.util.Map; import org.apache.activemq.artemis.api.core.ActiveMQException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; @@ -164,7 +165,7 @@ public class LegacyLDAPSecuritySettingPluginListenerTest extends AbstractLdapTes String name = "queue1"; ClientSession session = cf.createSession("first", "secret", false, true, true, false, 0); ClientSession session2 = cf.createSession("second", "secret", false, true, true, false, 0); - session.createQueue(SimpleString.toSimpleString(name), SimpleString.toSimpleString(name)); + session.createQueue(new QueueConfiguration(name)); ClientProducer producer = session.createProducer(); ClientProducer producer2 = session2.createProducer(); producer.send(name, session.createMessage(true)); @@ -202,7 +203,7 @@ public class LegacyLDAPSecuritySettingPluginListenerTest extends AbstractLdapTes String queue = "queue1"; ClientSession session = cf.createSession("first", "secret", false, true, true, false, 0); ClientSession session2 = cf.createSession("second", "secret", false, true, true, false, 0); - session.createQueue(SimpleString.toSimpleString(queue), SimpleString.toSimpleString(queue)); + session.createQueue(new QueueConfiguration(queue)); ClientConsumer consumer = session.createConsumer(queue); consumer.receiveImmediate(); consumer.close(); @@ -240,7 +241,7 @@ public class LegacyLDAPSecuritySettingPluginListenerTest extends AbstractLdapTes server.getConfiguration().setSecurityInvalidationInterval(0); server.start(); String queue = "queue2"; - server.createQueue(SimpleString.toSimpleString(queue), RoutingType.ANYCAST, SimpleString.toSimpleString(queue), null, false, false); + server.createQueue(new QueueConfiguration(queue).setRoutingType(RoutingType.ANYCAST).setDurable(false)); ClientSessionFactory cf = locator.createSessionFactory(); ClientSession session = cf.createSession("first", "secret", false, true, true, false, 0); ClientConsumer consumer; @@ -282,7 +283,7 @@ public class LegacyLDAPSecuritySettingPluginListenerTest extends AbstractLdapTes server.getConfiguration().setSecurityInvalidationInterval(0); server.start(); String queue = "queue2"; - server.createQueue(SimpleString.toSimpleString(queue), RoutingType.ANYCAST, SimpleString.toSimpleString(queue), null, false, false); + server.createQueue(new QueueConfiguration(queue).setRoutingType(RoutingType.ANYCAST).setDurable(false)); ClientSessionFactory cf = locator.createSessionFactory(); ClientSession session = cf.createSession("first", "secret", false, true, true, false, 0); ClientProducer producer = session.createProducer(SimpleString.toSimpleString(queue)); @@ -323,7 +324,7 @@ public class LegacyLDAPSecuritySettingPluginListenerTest extends AbstractLdapTes server.getConfiguration().setSecurityInvalidationInterval(0); server.start(); String queue = "queue1"; - server.createQueue(SimpleString.toSimpleString(queue), RoutingType.ANYCAST, SimpleString.toSimpleString(queue), null, false, false); + server.createQueue(new QueueConfiguration(queue).setRoutingType(RoutingType.ANYCAST).setDurable(false)); ClientSessionFactory cf = locator.createSessionFactory(); // authentication should fail diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/LegacyLDAPSecuritySettingPluginTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/LegacyLDAPSecuritySettingPluginTest.java index a4cbdc17ca..0401c93cde 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/LegacyLDAPSecuritySettingPluginTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/LegacyLDAPSecuritySettingPluginTest.java @@ -28,6 +28,7 @@ import java.util.HashSet; import java.util.Hashtable; import org.apache.activemq.artemis.api.core.ActiveMQException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; @@ -145,7 +146,7 @@ public class LegacyLDAPSecuritySettingPluginTest extends AbstractLdapTestUnit { try { ClientSession session = cf.createSession("first", "secret", false, true, true, false, 0); - session.createQueue(SimpleString.toSimpleString(name), SimpleString.toSimpleString(name)); + session.createQueue(new QueueConfiguration(name)); ClientProducer producer = session.createProducer(); producer.send(name, session.createMessage(false)); session.close(); @@ -163,14 +164,14 @@ public class LegacyLDAPSecuritySettingPluginTest extends AbstractLdapTestUnit { final SimpleString QUEUE = new SimpleString("queue2"); server.start(); - server.createQueue(ADDRESS, RoutingType.ANYCAST, QUEUE, null, true, false); + server.createQueue(new QueueConfiguration(QUEUE).setAddress(ADDRESS).setRoutingType(RoutingType.ANYCAST)); ClientSessionFactory cf = locator.createSessionFactory(); ClientSession session = cf.createSession("second", "secret", false, true, true, false, 0); // CREATE_DURABLE_QUEUE try { - session.createQueue(ADDRESS, QUEUE, true); + session.createQueue(new QueueConfiguration(QUEUE).setAddress(ADDRESS)); Assert.fail("should throw exception here"); } catch (ActiveMQException e) { // ignore @@ -186,7 +187,7 @@ public class LegacyLDAPSecuritySettingPluginTest extends AbstractLdapTestUnit { // CREATE_NON_DURABLE_QUEUE try { - session.createQueue(ADDRESS, QUEUE, false); + session.createQueue(new QueueConfiguration(QUEUE).setAddress(ADDRESS).setDurable(false)); Assert.fail("should throw exception here"); } catch (ActiveMQException e) { // ignore @@ -241,7 +242,7 @@ public class LegacyLDAPSecuritySettingPluginTest extends AbstractLdapTestUnit { // CREATE_DURABLE_QUEUE try { - session.createQueue(ADDRESS, QUEUE, true); + session.createQueue(new QueueConfiguration(QUEUE).setAddress(ADDRESS)); } catch (ActiveMQException e) { e.printStackTrace(); Assert.fail("should not throw exception here"); @@ -257,7 +258,7 @@ public class LegacyLDAPSecuritySettingPluginTest extends AbstractLdapTestUnit { // CREATE_NON_DURABLE_QUEUE try { - session.createQueue(ADDRESS, QUEUE, false); + session.createQueue(new QueueConfiguration(QUEUE).setAddress(ADDRESS).setDurable(false)); } catch (ActiveMQException e) { Assert.fail("should not throw exception here"); } @@ -269,7 +270,7 @@ public class LegacyLDAPSecuritySettingPluginTest extends AbstractLdapTestUnit { Assert.fail("should not throw exception here"); } - session.createQueue(ADDRESS, QUEUE, true); + session.createQueue(new QueueConfiguration(QUEUE).setAddress(ADDRESS)); // PRODUCE try { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/LegacyLDAPSecuritySettingPluginTest2.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/LegacyLDAPSecuritySettingPluginTest2.java index 25a5adf442..6376819801 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/LegacyLDAPSecuritySettingPluginTest2.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/LegacyLDAPSecuritySettingPluginTest2.java @@ -30,7 +30,7 @@ import java.util.Hashtable; import java.util.Map; import org.apache.activemq.artemis.api.core.ActiveMQException; -import org.apache.activemq.artemis.api.core.SimpleString; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; import org.apache.activemq.artemis.api.core.client.ClientProducer; @@ -167,7 +167,7 @@ public class LegacyLDAPSecuritySettingPluginTest2 extends AbstractLdapTestUnit { try { ClientSession session = cf.createSession("admin", "secret", false, true, true, false, 0); - session.createQueue(SimpleString.toSimpleString(name), SimpleString.toSimpleString(name)); + session.createQueue(new QueueConfiguration(name)); ClientProducer producer = session.createProducer(); producer.send(name, session.createMessage(false)); session.close(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/SecurityTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/SecurityTest.java index 3bc924a25e..135c901060 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/SecurityTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/SecurityTest.java @@ -35,6 +35,7 @@ import org.apache.activemq.ActiveMQSslConnectionFactory; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQExceptionType; import org.apache.activemq.artemis.api.core.ActiveMQSecurityException; +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.api.core.TransportConfiguration; @@ -131,7 +132,7 @@ public class SecurityTest extends ActiveMQTestBase { try { ClientSession session = cf.createSession("first", "secret", false, true, true, false, 0); - server.createQueue(SimpleString.toSimpleString("address"), RoutingType.ANYCAST, SimpleString.toSimpleString("queue"), null, true, false); + server.createQueue(new QueueConfiguration("queue").setAddress("address").setRoutingType(RoutingType.ANYCAST)); ClientProducer producer = session.createProducer("address"); producer.send(session.createMessage(true)); session.commit(); @@ -288,7 +289,7 @@ public class SecurityTest extends ActiveMQTestBase { //Add a test queue and topic to the server SimpleString address = SimpleString.toSimpleString("test.queue"); server.addAddressInfo(new AddressInfo(address, RoutingType.ANYCAST)); - server.createQueue(address, RoutingType.ANYCAST, address, null, true, false); + server.createQueue(new QueueConfiguration(address).setRoutingType(RoutingType.ANYCAST)); SimpleString address2 = SimpleString.toSimpleString("test.topic"); server.addAddressInfo(new AddressInfo(address2, RoutingType.MULTICAST)); @@ -433,15 +434,15 @@ public class SecurityTest extends ActiveMQTestBase { server.getConfiguration().putSecurityRoles("#", roles); server.start(); server.addAddressInfo(new AddressInfo(ADDRESS, RoutingType.ANYCAST)); - server.createQueue(ADDRESS, RoutingType.ANYCAST, DURABLE_QUEUE, null, true, false); - server.createQueue(ADDRESS, RoutingType.ANYCAST, NON_DURABLE_QUEUE, null, false, false); + server.createQueue(new QueueConfiguration(DURABLE_QUEUE).setAddress(ADDRESS).setRoutingType(RoutingType.ANYCAST)); + server.createQueue(new QueueConfiguration(NON_DURABLE_QUEUE).setAddress(ADDRESS).setRoutingType(RoutingType.ANYCAST).setDurable(false)); ClientSessionFactory cf = createSessionFactory(locator); ClientSession session = addClientSession(cf.createSession("first", "secret", false, true, true, false, 0)); // CREATE_DURABLE_QUEUE try { - session.createQueue(ADDRESS, DURABLE_QUEUE, true); + session.createQueue(new QueueConfiguration(DURABLE_QUEUE).setAddress(ADDRESS)); Assert.fail("should throw exception here"); } catch (ActiveMQException e) { assertTrue(e.getMessage().contains("User: first does not have permission='CREATE_DURABLE_QUEUE' for queue durableQueue on address address")); @@ -457,7 +458,7 @@ public class SecurityTest extends ActiveMQTestBase { // CREATE_NON_DURABLE_QUEUE try { - session.createQueue(ADDRESS, NON_DURABLE_QUEUE, false); + session.createQueue(new QueueConfiguration(NON_DURABLE_QUEUE).setAddress(ADDRESS).setDurable(false)); Assert.fail("should throw exception here"); } catch (ActiveMQException e) { assertTrue(e.getMessage().contains("User: first does not have permission='CREATE_NON_DURABLE_QUEUE' for queue nonDurableQueue on address address")); @@ -522,8 +523,8 @@ public class SecurityTest extends ActiveMQTestBase { server.getConfiguration().putSecurityRoles(ADDRESS.concat(".").concat(QUEUE_B).toString(), bRoles); server.start(); server.addAddressInfo(new AddressInfo(ADDRESS, RoutingType.ANYCAST)); - server.createQueue(ADDRESS, RoutingType.ANYCAST, QUEUE_A, null, true, false); - server.createQueue(ADDRESS, RoutingType.ANYCAST, QUEUE_B, null, true, false); + server.createQueue(new QueueConfiguration(QUEUE_A).setAddress(ADDRESS).setRoutingType(RoutingType.ANYCAST)); + server.createQueue(new QueueConfiguration(QUEUE_B).setAddress(ADDRESS).setRoutingType(RoutingType.ANYCAST)); ClientSessionFactory cf = createSessionFactory(locator); ClientSession aSession = addClientSession(cf.createSession("a", "a", false, true, true, false, 0)); @@ -597,14 +598,14 @@ public class SecurityTest extends ActiveMQTestBase { ClientSessionFactory cf = createSessionFactory(locator); server.addAddressInfo(new AddressInfo(ADDRESS, RoutingType.ANYCAST)); - server.createQueue(ADDRESS, RoutingType.ANYCAST, DURABLE_QUEUE, null, true, false); - server.createQueue(ADDRESS, RoutingType.ANYCAST, NON_DURABLE_QUEUE, null, false, false); + server.createQueue(new QueueConfiguration(DURABLE_QUEUE).setAddress(ADDRESS).setRoutingType(RoutingType.ANYCAST)); + server.createQueue(new QueueConfiguration(NON_DURABLE_QUEUE).setAddress(ADDRESS).setRoutingType(RoutingType.ANYCAST).setDurable(false)); ClientSession session = addClientSession(cf.createSession()); // CREATE_DURABLE_QUEUE try { - session.createQueue(ADDRESS, DURABLE_QUEUE, true); + session.createQueue(new QueueConfiguration(DURABLE_QUEUE).setAddress(ADDRESS)); Assert.fail("should throw exception here"); } catch (ActiveMQException e) { // ignore @@ -620,7 +621,7 @@ public class SecurityTest extends ActiveMQTestBase { // CREATE_NON_DURABLE_QUEUE try { - session.createQueue(ADDRESS, NON_DURABLE_QUEUE, false); + session.createQueue(new QueueConfiguration(NON_DURABLE_QUEUE).setAddress(ADDRESS).setDurable(false)); Assert.fail("should throw exception here"); } catch (ActiveMQException e) { // ignore @@ -687,7 +688,7 @@ public class SecurityTest extends ActiveMQTestBase { // CREATE_DURABLE_QUEUE try { - session.createQueue(ADDRESS, DURABLE_QUEUE, true); + session.createQueue(new QueueConfiguration(DURABLE_QUEUE).setAddress(ADDRESS)); } catch (ActiveMQException e) { Assert.fail("should not throw exception here"); } @@ -701,7 +702,7 @@ public class SecurityTest extends ActiveMQTestBase { // CREATE_NON_DURABLE_QUEUE try { - session.createQueue(ADDRESS, NON_DURABLE_QUEUE, false); + session.createQueue(new QueueConfiguration(NON_DURABLE_QUEUE).setAddress(ADDRESS).setDurable(false)); } catch (ActiveMQException e) { Assert.fail("should not throw exception here"); } @@ -713,7 +714,7 @@ public class SecurityTest extends ActiveMQTestBase { Assert.fail("should not throw exception here"); } - session.createQueue(ADDRESS, DURABLE_QUEUE, true); + session.createQueue(new QueueConfiguration(DURABLE_QUEUE).setAddress(ADDRESS)); // PRODUCE try { @@ -791,7 +792,7 @@ public class SecurityTest extends ActiveMQTestBase { // CREATE_DURABLE_QUEUE try { - session.createQueue(ADDRESS, DURABLE_QUEUE, true); + session.createQueue(new QueueConfiguration(DURABLE_QUEUE).setAddress(ADDRESS)); } catch (ActiveMQException e) { Assert.fail("should not throw exception here"); } @@ -805,7 +806,7 @@ public class SecurityTest extends ActiveMQTestBase { // CREATE_NON_DURABLE_QUEUE try { - session.createQueue(ADDRESS, NON_DURABLE_QUEUE, false); + session.createQueue(new QueueConfiguration(NON_DURABLE_QUEUE).setAddress(ADDRESS).setDurable(false)); } catch (ActiveMQException e) { Assert.fail("should not throw exception here"); } @@ -817,7 +818,7 @@ public class SecurityTest extends ActiveMQTestBase { Assert.fail("should not throw exception here"); } - session.createQueue(ADDRESS, DURABLE_QUEUE, true); + session.createQueue(new QueueConfiguration(DURABLE_QUEUE).setAddress(ADDRESS)); // PRODUCE try { @@ -868,7 +869,7 @@ public class SecurityTest extends ActiveMQTestBase { // CREATE_DURABLE_QUEUE try { - session.createQueue(ADDRESS, DURABLE_QUEUE, true); + session.createQueue(new QueueConfiguration(DURABLE_QUEUE).setAddress(ADDRESS)); } catch (ActiveMQException e) { e.printStackTrace(); Assert.fail("should not throw exception here"); @@ -883,7 +884,7 @@ public class SecurityTest extends ActiveMQTestBase { // CREATE_NON_DURABLE_QUEUE try { - session.createQueue(ADDRESS, NON_DURABLE_QUEUE, false); + session.createQueue(new QueueConfiguration(NON_DURABLE_QUEUE).setAddress(ADDRESS).setDurable(false)); } catch (ActiveMQException e) { Assert.fail("should not throw exception here"); } @@ -895,7 +896,7 @@ public class SecurityTest extends ActiveMQTestBase { Assert.fail("should not throw exception here"); } - session.createQueue(ADDRESS, DURABLE_QUEUE, true); + session.createQueue(new QueueConfiguration(DURABLE_QUEUE).setAddress(ADDRESS)); // PRODUCE try { @@ -1013,7 +1014,7 @@ public class SecurityTest extends ActiveMQTestBase { securityManager.getConfiguration().addRole("auser", "arole"); ClientSessionFactory cf = createSessionFactory(locator); ClientSession session = cf.createSession("auser", "pass", false, true, true, false, -1); - session.createQueue(SecurityTest.addressA, SecurityTest.queueA, true); + session.createQueue(new QueueConfiguration(SecurityTest.queueA).setAddress(SecurityTest.addressA)); session.close(); } @@ -1033,7 +1034,7 @@ public class SecurityTest extends ActiveMQTestBase { ClientSessionFactory cf = createSessionFactory(locator); ClientSession session = cf.createSession("auser", "pass", false, true, true, false, -1); try { - session.createQueue(SecurityTest.addressA, SecurityTest.queueA, true); + session.createQueue(new QueueConfiguration(SecurityTest.queueA).setAddress(SecurityTest.addressA)); Assert.fail("should throw exception"); } catch (ActiveMQSecurityException se) { //ok @@ -1057,7 +1058,7 @@ public class SecurityTest extends ActiveMQTestBase { securityManager.getConfiguration().addRole("auser", "arole"); ClientSessionFactory cf = createSessionFactory(locator); ClientSession session = cf.createSession("auser", "pass", false, true, true, false, -1); - session.createQueue(SecurityTest.addressA, SecurityTest.queueA, true); + session.createQueue(new QueueConfiguration(SecurityTest.queueA).setAddress(SecurityTest.addressA)); session.deleteQueue(SecurityTest.queueA); session.close(); } @@ -1076,7 +1077,7 @@ public class SecurityTest extends ActiveMQTestBase { securityManager.getConfiguration().addRole("auser", "arole"); ClientSessionFactory cf = createSessionFactory(locator); ClientSession session = cf.createSession("auser", "pass", false, true, true, false, -1); - session.createQueue(SecurityTest.addressA, SecurityTest.queueA, true); + session.createQueue(new QueueConfiguration(SecurityTest.queueA).setAddress(SecurityTest.addressA)); try { session.deleteQueue(SecurityTest.queueA); Assert.fail("should throw exception"); @@ -1103,7 +1104,7 @@ public class SecurityTest extends ActiveMQTestBase { securityManager.getConfiguration().addRole("auser", "arole"); ClientSessionFactory cf = createSessionFactory(locator); ClientSession session = cf.createSession("auser", "pass", false, true, true, false, -1); - session.createQueue(SecurityTest.addressA, SecurityTest.queueA, false); + session.createQueue(new QueueConfiguration(SecurityTest.queueA).setAddress(SecurityTest.addressA).setDurable(false)); session.close(); } @@ -1123,7 +1124,7 @@ public class SecurityTest extends ActiveMQTestBase { ClientSessionFactory cf = createSessionFactory(locator); ClientSession session = cf.createSession("auser", "pass", false, true, true, false, -1); try { - session.createQueue(SecurityTest.addressA, SecurityTest.queueA, false); + session.createQueue(new QueueConfiguration(SecurityTest.queueA).setAddress(SecurityTest.addressA).setDurable(false)); Assert.fail("should throw exception"); } catch (ActiveMQSecurityException se) { //ok @@ -1147,7 +1148,7 @@ public class SecurityTest extends ActiveMQTestBase { securityManager.getConfiguration().addRole("auser", "arole"); ClientSessionFactory cf = createSessionFactory(locator); ClientSession session = cf.createSession("auser", "pass", false, true, true, false, -1); - session.createQueue(SecurityTest.addressA, SecurityTest.queueA, false); + session.createQueue(new QueueConfiguration(SecurityTest.queueA).setAddress(SecurityTest.addressA).setDurable(false)); session.deleteQueue(SecurityTest.queueA); session.close(); } @@ -1166,7 +1167,7 @@ public class SecurityTest extends ActiveMQTestBase { securityManager.getConfiguration().addRole("auser", "arole"); ClientSessionFactory cf = createSessionFactory(locator); ClientSession session = cf.createSession("auser", "pass", false, true, true, false, -1); - session.createQueue(SecurityTest.addressA, SecurityTest.queueA, false); + session.createQueue(new QueueConfiguration(SecurityTest.queueA).setAddress(SecurityTest.addressA).setDurable(false)); try { session.deleteQueue(SecurityTest.queueA); Assert.fail("should throw exception"); @@ -1206,7 +1207,7 @@ public class SecurityTest extends ActiveMQTestBase { ClientSession session = cf.createSession("auser", "pass", false, true, true, false, -1); - session.createQueue(SecurityTest.addressA, SecurityTest.queueA, true); + session.createQueue(new QueueConfiguration(SecurityTest.queueA).setAddress(SecurityTest.addressA)); ClientProducer cp = session.createProducer(SecurityTest.addressA); @@ -1257,7 +1258,7 @@ public class SecurityTest extends ActiveMQTestBase { locator.setBlockOnNonDurableSend(true); ClientSessionFactory cf = createSessionFactory(locator); ClientSession session = cf.createSession("auser", "pass", false, true, true, false, -1); - session.createQueue(SecurityTest.addressA, SecurityTest.queueA, true); + session.createQueue(new QueueConfiguration(SecurityTest.queueA).setAddress(SecurityTest.addressA)); ClientProducer cp = session.createProducer(SecurityTest.addressA); try { cp.send(session.createMessage(false)); @@ -1284,7 +1285,7 @@ public class SecurityTest extends ActiveMQTestBase { securityManager.getConfiguration().addRole("auser", "arole"); ClientSessionFactory cf = createSessionFactory(locator); ClientSession session = cf.createSession("auser", "pass", false, true, true, false, -1); - session.createQueue(SecurityTest.addressA, SecurityTest.queueA, true); + session.createQueue(new QueueConfiguration(SecurityTest.queueA).setAddress(SecurityTest.addressA)); ClientProducer cp = session.createProducer(SecurityTest.addressA); cp.send(session.createMessage(false)); session.close(); @@ -1313,7 +1314,7 @@ public class SecurityTest extends ActiveMQTestBase { ClientSessionFactory cf = createSessionFactory(locator); ClientSession senSession = cf.createSession(false, true, true); ClientSession session = cf.createSession("auser", "pass", false, true, true, false, -1); - senSession.createQueue(SecurityTest.addressA, SecurityTest.queueA, true); + senSession.createQueue(new QueueConfiguration(SecurityTest.queueA).setAddress(SecurityTest.addressA)); ClientProducer cp = senSession.createProducer(SecurityTest.addressA); cp.send(session.createMessage(false)); session.createConsumer(SecurityTest.queueA); @@ -1341,7 +1342,7 @@ public class SecurityTest extends ActiveMQTestBase { ClientSessionFactory cf = createSessionFactory(locator); ClientSession senSession = cf.createSession(false, true, true); ClientSession session = cf.createSession("auser", "pass", false, true, true, false, -1); - senSession.createQueue(SecurityTest.addressA, SecurityTest.queueA, true); + senSession.createQueue(new QueueConfiguration(SecurityTest.queueA).setAddress(SecurityTest.addressA)); ClientProducer cp = senSession.createProducer(SecurityTest.addressA); cp.send(session.createMessage(false)); try { @@ -1378,7 +1379,7 @@ public class SecurityTest extends ActiveMQTestBase { ClientSessionFactory cf = createSessionFactory(locator); ClientSession senSession = cf.createSession(false, true, true); ClientSession session = cf.createSession("auser", "pass", false, true, true, false, -1); - senSession.createQueue(SecurityTest.addressA, SecurityTest.queueA, true); + senSession.createQueue(new QueueConfiguration(SecurityTest.queueA).setAddress(SecurityTest.addressA)); ClientProducer cp = senSession.createProducer(SecurityTest.addressA); cp.send(session.createMessage(false)); try { @@ -1427,7 +1428,7 @@ public class SecurityTest extends ActiveMQTestBase { ClientSessionFactory cf = createSessionFactory(locator); ClientSession senSession = cf.createSession(false, true, true); ClientSession session = cf.createSession("auser", "pass", false, true, true, false, -1); - senSession.createQueue(SecurityTest.addressA, SecurityTest.queueA, true); + senSession.createQueue(new QueueConfiguration(SecurityTest.queueA).setAddress(SecurityTest.addressA)); ClientProducer cp = senSession.createProducer(SecurityTest.addressA); cp.send(session.createMessage(false)); try { @@ -1487,7 +1488,7 @@ public class SecurityTest extends ActiveMQTestBase { ClientSession senSession = cf.createSession(false, true, true); ClientSession session = cf.createSession("auser", "pass", false, true, true, false, -1); - senSession.createQueue(SecurityTest.addressA, SecurityTest.queueA, true); + senSession.createQueue(new QueueConfiguration(SecurityTest.queueA).setAddress(SecurityTest.addressA)); ClientProducer cp = senSession.createProducer(SecurityTest.addressA); cp.send(session.createMessage(false)); try { @@ -1584,7 +1585,7 @@ public class SecurityTest extends ActiveMQTestBase { securityManager.getConfiguration().addRole("auser", "arole"); ClientSessionFactory cf = createSessionFactory(locator); ClientSession session = cf.createSession("auser", "pass", false, true, true, false, -1); - session.createQueue(configuration.getManagementAddress().toString(), SecurityTest.queueA, true); + session.createQueue(new QueueConfiguration(SecurityTest.queueA).setAddress(configuration.getManagementAddress().toString())); ClientProducer cp = session.createProducer(configuration.getManagementAddress()); cp.send(session.createMessage(false)); try { @@ -1613,7 +1614,7 @@ public class SecurityTest extends ActiveMQTestBase { securityManager.getConfiguration().addRole("auser", "arole"); ClientSessionFactory cf = createSessionFactory(locator); ClientSession session = cf.createSession("auser", "pass", false, true, true, false, -1); - session.createQueue(configuration.getManagementAddress().toString(), SecurityTest.queueA, true); + session.createQueue(new QueueConfiguration(SecurityTest.queueA).setAddress(configuration.getManagementAddress().toString())); ClientProducer cp = session.createProducer(configuration.getManagementAddress()); cp.send(session.createMessage(false)); session.close(); @@ -1669,11 +1670,11 @@ public class SecurityTest extends ActiveMQTestBase { ClientSession adminSession = factory.createSession("all", "all", false, true, true, false, -1); String genericQueueName = "genericQueue"; - adminSession.createQueue(genericQueueName, genericQueueName, false); + adminSession.createQueue(new QueueConfiguration(genericQueueName).setDurable(false)); String eurQueueName = "news.europe.europeQueue"; - adminSession.createQueue(eurQueueName, eurQueueName, false); + adminSession.createQueue(new QueueConfiguration(eurQueueName).setDurable(false)); String usQueueName = "news.us.usQueue"; - adminSession.createQueue(usQueueName, usQueueName, false); + adminSession.createQueue(new QueueConfiguration(usQueueName).setDurable(false)); // Step 4. Try to create a JMS Connection without user/password. It will fail. try { factory.createSession(false, true, true); @@ -1798,11 +1799,11 @@ public class SecurityTest extends ActiveMQTestBase { ClientSession adminSession = factory.createSession("all", "all", false, true, true, false, -1); String genericQueueName = "genericQueue"; - adminSession.createQueue(genericQueueName, genericQueueName, false); + adminSession.createQueue(new QueueConfiguration(genericQueueName).setDurable(false)); String eurQueueName = "news.europe.europeQueue"; - adminSession.createQueue(eurQueueName, eurQueueName, false); + adminSession.createQueue(new QueueConfiguration(eurQueueName).setDurable(false)); String usQueueName = "news.us.usQueue"; - adminSession.createQueue(usQueueName, usQueueName, false); + adminSession.createQueue(new QueueConfiguration(usQueueName).setDurable(false)); // Step 4. Try to create a JMS Connection without user/password. It will fail. try { factory.createSession(false, true, true); @@ -1910,7 +1911,7 @@ public class SecurityTest extends ActiveMQTestBase { ClientSession adminSession = factory.createSession("all", "frobnicate", false, true, true, false, -1); final String queueName = "test.queue"; - adminSession.createQueue(queueName, queueName, false); + adminSession.createQueue(new QueueConfiguration(queueName).setDurable(false)); // Wrong user name try { @@ -2010,10 +2011,10 @@ public class SecurityTest extends ActiveMQTestBase { ClientSession adminSession = factory.createSession("all", "frobnicate", false, true, true, false, -1); final String queueName = "test.queue"; - adminSession.createQueue(queueName, queueName, false); + adminSession.createQueue(new QueueConfiguration(queueName).setDurable(false)); final String otherQueueName = "other.queue"; - adminSession.createQueue(otherQueueName, otherQueueName, false); + adminSession.createQueue(new QueueConfiguration(otherQueueName).setDurable(false)); // Wrong user name try { @@ -2144,10 +2145,10 @@ public class SecurityTest extends ActiveMQTestBase { ClientSession adminSession = factory.createSession("all", "frobnicate", false, true, true, false, -1); final String queueName = "test.queue"; - adminSession.createQueue(queueName, queueName, false); + adminSession.createQueue(new QueueConfiguration(queueName).setDurable(false)); final String otherQueueName = "other.queue"; - adminSession.createQueue(otherQueueName, otherQueueName, false); + adminSession.createQueue(new QueueConfiguration(otherQueueName).setDurable(false)); // Wrong user name try { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/SimpleClient.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/SimpleClient.java index 65c980b534..b88dd1b3f8 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/SimpleClient.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/SimpleClient.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.security; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; import org.apache.activemq.artemis.api.core.client.ClientConsumer; @@ -49,7 +50,7 @@ final class SimpleClient { ClientSessionFactory sf = locator.createSessionFactory(); ClientSession session = sf.createSession(false, true, true); - session.createQueue(queueName, queueName, null, false); + session.createQueue(new QueueConfiguration(queueName).setDurable(false)); ClientProducer producer = session.createProducer(queueName); ClientConsumer consumer = session.createConsumer(queueName); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/AddressQueueDeleteDelayTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/AddressQueueDeleteDelayTest.java index 8b894b0454..d4111cf708 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/AddressQueueDeleteDelayTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/AddressQueueDeleteDelayTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.server; +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.api.core.client.ClientConsumer; @@ -58,7 +59,7 @@ public class AddressQueueDeleteDelayTest extends ActiveMQTestBase { AddressSettings addressSettings = new AddressSettings().setAutoDeleteQueuesDelay(deleteQueuesDelay).setAutoDeleteAddressesDelay(deleteAddressesDelay); server.getAddressSettingsRepository().addMatch(address.toString(), addressSettings); - session.createQueue(address, RoutingType.MULTICAST, queue, null, true, true); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setAutoCreated(true)); assertTrue(Wait.waitFor(() -> server.locateQueue(queue) != null, DURATION_MILLIS, SLEEP_MILLIS)); @@ -102,7 +103,7 @@ public class AddressQueueDeleteDelayTest extends ActiveMQTestBase { AddressSettings addressSettings = new AddressSettings().setAutoDeleteQueuesDelay(deleteQueuesDelay).setAutoDeleteAddressesDelay(deleteAddressesDelay); server.getAddressSettingsRepository().addMatch(address.toString(), addressSettings); - session.createQueue(address, RoutingType.MULTICAST, queue, null, true, true); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setAutoCreated(true)); assertTrue(Wait.waitFor(() -> server.locateQueue(queue) != null, DURATION_MILLIS, SLEEP_MILLIS)); @@ -120,7 +121,7 @@ public class AddressQueueDeleteDelayTest extends ActiveMQTestBase { assertTrue(Wait.waitFor(() -> server.getAddressInfo(address) != null, DURATION_MILLIS, SLEEP_MILLIS)); assertTrue(Wait.waitFor(() -> server.locateQueue(queue) == null, DURATION_MILLIS, SLEEP_MILLIS)); - session.createQueue(address, RoutingType.MULTICAST, queue, null, true, true); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setAutoCreated(true)); consumer = session.createConsumer(queue); assertTrue(Wait.waitFor(() -> server.getAddressInfo(address) != null, DURATION_MILLIS, SLEEP_MILLIS)); @@ -132,7 +133,7 @@ public class AddressQueueDeleteDelayTest extends ActiveMQTestBase { assertTrue(Wait.waitFor(() -> server.getAddressInfo(address) == null, DURATION_MILLIS, SLEEP_MILLIS)); assertTrue(System.currentTimeMillis() - start >= (deleteQueuesDelay)); - session.createQueue(address, RoutingType.MULTICAST, queue, null, true, true); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setAutoCreated(true)); session.deleteQueue(queue); start = System.currentTimeMillis(); @@ -145,7 +146,7 @@ public class AddressQueueDeleteDelayTest extends ActiveMQTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, true, true); + session.createQueue(new QueueConfiguration(queue).setAddress(address).setAutoCreated(true)); assertTrue(Wait.waitFor(() -> server.locateQueue(queue) != null, DURATION_MILLIS, SLEEP_MILLIS)); @@ -173,7 +174,7 @@ public class AddressQueueDeleteDelayTest extends ActiveMQTestBase { server.getAddressSettingsRepository().addMatch(address.toString(), addressSettings); session.createAddress(address, RoutingType.MULTICAST, true); - session.createQueue(address, RoutingType.MULTICAST, queue); + session.createQueue(new QueueConfiguration(queue).setAddress(address)); session.deleteQueue(queue); assertTrue(Wait.waitFor(() -> server.getAddressInfo(address) == null, DURATION_MILLIS, SLEEP_MILLIS)); @@ -190,7 +191,7 @@ public class AddressQueueDeleteDelayTest extends ActiveMQTestBase { // the address should not be deleted since it is not auto-created session.createAddress(address, RoutingType.MULTICAST, false); - session.createQueue(address, RoutingType.MULTICAST, queue); + session.createQueue(new QueueConfiguration(queue).setAddress(address)); session.deleteQueue(queue); assertFalse(Wait.waitFor(() -> server.getAddressInfo(address) == null, DURATION_MILLIS, SLEEP_MILLIS)); @@ -207,7 +208,7 @@ public class AddressQueueDeleteDelayTest extends ActiveMQTestBase { server.getAddressSettingsRepository().addMatch(address.toString(), addressSettings); session.createAddress(address, RoutingType.MULTICAST, true); - session.createQueue(address, RoutingType.MULTICAST, queue); + session.createQueue(new QueueConfiguration(queue).setAddress(address)); session.deleteQueue(queue); assertFalse(Wait.waitFor(() -> server.getAddressInfo(address) == null, DURATION_MILLIS, SLEEP_MILLIS)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/AutoCreateDeadLetterResourcesTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/AutoCreateDeadLetterResourcesTest.java index d4009d4d14..80df9017c1 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/AutoCreateDeadLetterResourcesTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/AutoCreateDeadLetterResourcesTest.java @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.integration.server; import javax.jms.JMSContext; +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.api.core.client.ClientConsumer; @@ -129,7 +130,7 @@ public class AutoCreateDeadLetterResourcesTest extends ActiveMQTestBase { for (int i = 0; i < ITERATIONS; i++) { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - server.createQueue(address, routingType, queue, null, true, false); + server.createQueue(new QueueConfiguration(queue).setAddress(address).setRoutingType(routingType)); ServerLocator locator = createInVMNonHALocator(); ClientSessionFactory cf = createSessionFactory(locator); ClientSession s = addClientSession(cf.createSession(true, false)); @@ -196,7 +197,7 @@ public class AutoCreateDeadLetterResourcesTest extends ActiveMQTestBase { } private void triggerDlaDelivery() throws Exception { - server.createQueue(addressA, RoutingType.ANYCAST, queueA, null, true, false); + server.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setRoutingType(RoutingType.ANYCAST)); ServerLocator locator = createInVMNonHALocator(); ClientSessionFactory sessionFactory = createSessionFactory(locator); ClientSession session = addClientSession(sessionFactory.createSession(true, false)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/AutoCreateExpiryResourcesTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/AutoCreateExpiryResourcesTest.java index 68004351d7..c3ac2813b5 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/AutoCreateExpiryResourcesTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/AutoCreateExpiryResourcesTest.java @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.integration.server; import javax.jms.JMSContext; +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.api.core.client.ClientConsumer; @@ -130,7 +131,7 @@ public class AutoCreateExpiryResourcesTest extends ActiveMQTestBase { for (int i = 0; i < ITERATIONS; i++) { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - server.createQueue(address, routingType, queue, null, true, false); + server.createQueue(new QueueConfiguration(queue).setAddress(address).setRoutingType(routingType)); ServerLocator locator = createInVMNonHALocator(); ClientSessionFactory cf = createSessionFactory(locator); ClientSession s = addClientSession(cf.createSession(true, false)); @@ -197,7 +198,7 @@ public class AutoCreateExpiryResourcesTest extends ActiveMQTestBase { } private void triggerExpiration() throws Exception { - server.createQueue(addressA, RoutingType.ANYCAST, queueA, null, true, false); + server.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setRoutingType(RoutingType.ANYCAST)); ServerLocator locator = createInVMNonHALocator(); ClientSessionFactory sessionFactory = createSessionFactory(locator); ClientSession session = addClientSession(sessionFactory.createSession(true, false)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ExpiryRunnerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ExpiryRunnerTest.java index 74c9cff8b5..a07108eb21 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ExpiryRunnerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ExpiryRunnerTest.java @@ -21,6 +21,7 @@ import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -32,7 +33,6 @@ import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServers; import org.apache.activemq.artemis.core.server.Queue; -import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.junit.Assert; @@ -72,7 +72,7 @@ public class ExpiryRunnerTest extends ActiveMQTestBase { @Test public void testExpireFromMultipleQueues() throws Exception { ClientProducer producer = clientSession.createProducer(qName); - clientSession.createQueue(qName2, RoutingType.MULTICAST, qName2, null, false); + clientSession.createQueue(new QueueConfiguration(qName2).setDurable(false)); AddressSettings addressSettings = new AddressSettings().setExpiryAddress(expiryAddress); server.getAddressSettingsRepository().addMatch(qName2.toString(), addressSettings); ClientProducer producer2 = clientSession.createProducer(qName2); @@ -137,8 +137,8 @@ public class ExpiryRunnerTest extends ActiveMQTestBase { AddressSettings addressSettings = new AddressSettings().setExpiryAddress(expiryAddress); server.getAddressSettingsRepository().addMatch(qName2.toString(), addressSettings); clientSession.deleteQueue(qName); - clientSession.createQueue(qName, RoutingType.MULTICAST, qName, null, false); - clientSession.createQueue(qName, RoutingType.MULTICAST, qName2, null, false); + clientSession.createQueue(new QueueConfiguration(qName).setDurable(false)); + clientSession.createQueue(new QueueConfiguration(qName2).setAddress(qName).setDurable(false)); ClientProducer producer = clientSession.createProducer(qName); int numMessages = 100; long expiration = System.currentTimeMillis(); @@ -245,13 +245,13 @@ public class ExpiryRunnerTest extends ActiveMQTestBase { ClientSessionFactory sessionFactory = createSessionFactory(locator); clientSession = sessionFactory.createSession(false, true, true); - clientSession.createQueue(qName, RoutingType.MULTICAST, qName, null, false); + clientSession.createQueue(new QueueConfiguration(qName).setDurable(false)); expiryAddress = new SimpleString("EA"); expiryQueue = new SimpleString("expiryQ"); AddressSettings addressSettings = new AddressSettings().setExpiryAddress(expiryAddress); server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings); server.getAddressSettingsRepository().addMatch(qName2.toString(), addressSettings); - clientSession.createQueue(expiryAddress, RoutingType.MULTICAST, expiryQueue, null, false); + clientSession.createQueue(new QueueConfiguration(expiryQueue).setAddress(expiryAddress).setDurable(false)); } private static class DummyMessageHandler implements Runnable { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/GracefulShutdownTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/GracefulShutdownTest.java index 9645fcbdc7..39e76ec08a 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/GracefulShutdownTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/GracefulShutdownTest.java @@ -18,6 +18,7 @@ package org.apache.activemq.artemis.tests.integration.server; import org.apache.activemq.artemis.api.core.ActiveMQExceptionType; import org.apache.activemq.artemis.api.core.ActiveMQSessionCreationException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.client.ClientProducer; import org.apache.activemq.artemis.api.core.client.ClientSession; import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; @@ -65,7 +66,7 @@ public class GracefulShutdownTest extends ActiveMQTestBase { } // confirm we can still do work on the original connection even though the server is stopping - session.createQueue("testAddress", RoutingType.ANYCAST, "testQueue"); + session.createQueue(new QueueConfiguration("testQueue").setAddress("testAddress").setRoutingType(RoutingType.ANYCAST)); ClientProducer producer = session.createProducer("testAddress"); producer.send(session.createMessage(true)); session.start(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/LVQRecoveryTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/LVQRecoveryTest.java index 96c1fd249f..46e27ad9a2 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/LVQRecoveryTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/LVQRecoveryTest.java @@ -20,6 +20,7 @@ import javax.transaction.xa.XAResource; import javax.transaction.xa.Xid; import org.apache.activemq.artemis.api.core.Message; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -177,7 +178,7 @@ public class LVQRecoveryTest extends ActiveMQTestBase { ClientSessionFactory sessionFactory = createSessionFactory(locator); clientSession = sessionFactory.createSession(false, true, true); clientSessionXa = sessionFactory.createSession(true, false, false); - clientSession.createQueue(address, qName1, null, true); + clientSession.createQueue(new QueueConfiguration(qName1).setAddress(address)); } private void restartServer() throws Exception { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/LVQTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/LVQTest.java index f91e479fd0..6950ae87ea 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/LVQTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/LVQTest.java @@ -17,6 +17,7 @@ package org.apache.activemq.artemis.tests.integration.server; import org.apache.activemq.artemis.api.core.Message; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -766,6 +767,6 @@ public class LVQTest extends ActiveMQTestBase { clientSession = addClientSession(sf.createSession(false, true, true)); clientSessionTxReceives = addClientSession(sf.createSession(false, true, false)); clientSessionTxSends = addClientSession(sf.createSession(false, false, true)); - clientSession.createQueue(address, qName1, null, true); + clientSession.createQueue(new QueueConfiguration(qName1).setAddress(address)); } } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/MessageExpirationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/MessageExpirationTest.java index 4570e3c43b..c714844ef8 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/MessageExpirationTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/MessageExpirationTest.java @@ -16,7 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.server; -import org.apache.activemq.artemis.api.core.RoutingType; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientProducer; @@ -53,7 +53,7 @@ public class MessageExpirationTest extends ActiveMQTestBase { AddressSettings addressSettings = new AddressSettings().setExpiryAddress(expiryAddress); server.getAddressSettingsRepository().addMatch(address.toString(), addressSettings); - session.createQueue(address, RoutingType.MULTICAST, queue, null, true); + session.createQueue(new QueueConfiguration(queue).setAddress(address)); Assert.assertEquals(0, server.locateQueue(queue).getMessagesExpired()); @@ -75,7 +75,7 @@ public class MessageExpirationTest extends ActiveMQTestBase { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - session.createQueue(address, RoutingType.MULTICAST, queue, null, true); + session.createQueue(new QueueConfiguration(queue).setAddress(address)); Assert.assertEquals(0, server.locateQueue(queue).getMessagesExpired()); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/PotentialOOMELoggingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/PotentialOOMELoggingTest.java index f03ee5b146..a64c548351 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/PotentialOOMELoggingTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/PotentialOOMELoggingTest.java @@ -18,7 +18,7 @@ package org.apache.activemq.artemis.tests.integration.server; import java.util.UUID; -import org.apache.activemq.artemis.core.config.CoreQueueConfiguration; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.logs.AssertionLoggerHandler; @@ -43,7 +43,7 @@ public class PotentialOOMELoggingTest extends ActiveMQTestBase { */ public void testBlockLogging() throws Exception { ActiveMQServer server = createServer(false, createDefaultInVMConfig()); for (int i = 0; i < 10000; i++) { - server.getConfiguration().addQueueConfiguration(new CoreQueueConfiguration().setAddress(UUID.randomUUID().toString()).setName(UUID.randomUUID().toString())); + server.getConfiguration().addQueueConfiguration(new QueueConfiguration(UUID.randomUUID().toString())); } server.getConfiguration().setGlobalMaxSize(-1); server.getConfiguration().getAddressesSettings().put("#", new AddressSettings().setMaxSizeBytes(10485760 * 10)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/PredefinedQueueTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/PredefinedQueueTest.java index 0df3846aa5..350c04c8cc 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/PredefinedQueueTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/PredefinedQueueTest.java @@ -21,6 +21,7 @@ import java.util.List; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -29,7 +30,6 @@ import org.apache.activemq.artemis.api.core.client.ClientSession; import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.core.config.Configuration; -import org.apache.activemq.artemis.core.config.CoreQueueConfiguration; import org.apache.activemq.artemis.core.postoffice.Bindings; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServers; @@ -62,19 +62,19 @@ public class PredefinedQueueTest extends ActiveMQTestBase { final String queueName3 = "queue3"; - CoreQueueConfiguration queue1 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName1); + QueueConfiguration queue1 = new QueueConfiguration(queueName1).setAddress(testAddress); - CoreQueueConfiguration queue2 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName2); + QueueConfiguration queue2 = new QueueConfiguration(queueName2).setAddress(testAddress); - CoreQueueConfiguration queue3 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName3); + QueueConfiguration queue3 = new QueueConfiguration(queueName3).setAddress(testAddress); - List queueConfs = new ArrayList<>(); + List queueConfs = new ArrayList<>(); queueConfs.add(queue1); queueConfs.add(queue2); queueConfs.add(queue3); - configuration.setQueueConfigurations(queueConfs); + configuration.setQueueConfigs(queueConfs); ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(configuration, false)); @@ -87,7 +87,7 @@ public class PredefinedQueueTest extends ActiveMQTestBase { ClientSession session = addClientSession(sf.createSession(false, true, true)); try { - session.createQueue(testAddress, queueName1, "", false); + session.createQueue(new QueueConfiguration(queueName1).setAddress(testAddress).setFilterString("").setDurable(false)); Assert.fail("Should throw exception"); } catch (ActiveMQQueueExistsException se) { @@ -96,7 +96,7 @@ public class PredefinedQueueTest extends ActiveMQTestBase { fail("Invalid Exception type:" + e.getType()); } try { - session.createQueue(testAddress, queueName2, null, false); + session.createQueue(new QueueConfiguration(queueName2).setAddress(testAddress).setDurable(false)); Assert.fail("Should throw exception"); } catch (ActiveMQQueueExistsException se) { @@ -105,7 +105,7 @@ public class PredefinedQueueTest extends ActiveMQTestBase { fail("Invalid Exception type:" + e.getType()); } try { - session.createQueue(testAddress, queueName3, null, false); + session.createQueue(new QueueConfiguration(queueName3).setAddress(testAddress).setDurable(false)); Assert.fail("Should throw exception"); } catch (ActiveMQQueueExistsException se) { @@ -123,9 +123,9 @@ public class PredefinedQueueTest extends ActiveMQTestBase { final String queueName2 = "queue2"; - CoreQueueConfiguration queue1 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName1); + QueueConfiguration queue1 = new QueueConfiguration(queueName1).setAddress(testAddress); - CoreQueueConfiguration queue2 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName2); + QueueConfiguration queue2 = new QueueConfiguration(queueName2).setAddress(testAddress); configuration.addQueueConfiguration(queue1).addQueueConfiguration(queue2); @@ -199,11 +199,11 @@ public class PredefinedQueueTest extends ActiveMQTestBase { ClientSession session = addClientSession(sf.createSession(false, true, true)); - session.createQueue(testAddress, queueName1, null, true); + session.createQueue(new QueueConfiguration(queueName1).setAddress(testAddress)); - session.createQueue(testAddress, queueName2, null, true); + session.createQueue(new QueueConfiguration(queueName2).setAddress(testAddress)); - session.createQueue(testAddress, queueName3, null, true); + session.createQueue(new QueueConfiguration(queueName3).setAddress(testAddress)); session.close(); @@ -211,11 +211,11 @@ public class PredefinedQueueTest extends ActiveMQTestBase { server.stop(); - CoreQueueConfiguration queue1 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName1); + QueueConfiguration queue1 = new QueueConfiguration(queueName1).setAddress(testAddress); - CoreQueueConfiguration queue2 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName2); + QueueConfiguration queue2 = new QueueConfiguration(queueName2).setAddress(testAddress); - CoreQueueConfiguration queue3 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName3); + QueueConfiguration queue3 = new QueueConfiguration(queueName3).setAddress(testAddress); configuration.addQueueConfiguration(queue1).addQueueConfiguration(queue2).addQueueConfiguration(queue3); @@ -277,11 +277,11 @@ public class PredefinedQueueTest extends ActiveMQTestBase { final String queueName2 = "queue2"; - CoreQueueConfiguration queue1 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName1).setDurable(false); + QueueConfiguration queue1 = new QueueConfiguration(queueName1).setAddress(testAddress).setDurable(false); - CoreQueueConfiguration queue2 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName2); + QueueConfiguration queue2 = new QueueConfiguration(queueName2).setAddress(testAddress); - List queueConfs = new ArrayList<>(); + List queueConfs = new ArrayList<>(); queueConfs.add(queue1); queueConfs.add(queue2); @@ -357,7 +357,7 @@ public class PredefinedQueueTest extends ActiveMQTestBase { final String filter = "cheese='camembert'"; - CoreQueueConfiguration queue1 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName1).setFilterString(filter).setDurable(false); + QueueConfiguration queue1 = new QueueConfiguration(queueName1).setAddress(testAddress).setFilterString(filter).setDurable(false); configuration.addQueueConfiguration(queue1); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/QueuePeristPauseTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/QueuePeristPauseTest.java index e80ee14667..27e54457b5 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/QueuePeristPauseTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/QueuePeristPauseTest.java @@ -17,6 +17,7 @@ package org.apache.activemq.artemis.tests.integration.server; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.Queue; @@ -32,10 +33,7 @@ public class QueuePeristPauseTest extends ActiveMQTestBase { ActiveMQServer server = createServer(true, false); server.start(); - Queue queue = server.createQueue(SimpleString.toSimpleString("q1"), - RoutingType.ANYCAST, - SimpleString.toSimpleString("q1"), - null, true, false); + Queue queue = server.createQueue(new QueueConfiguration("q1").setRoutingType(RoutingType.ANYCAST)); queue.pause(true); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/QueueQueryTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/QueueQueryTest.java index 6de91a46d1..2d6ee57e63 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/QueueQueryTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/QueueQueryTest.java @@ -20,6 +20,7 @@ import javax.jms.JMSContext; import java.util.UUID; 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.api.core.client.ActiveMQClient; @@ -48,7 +49,7 @@ public class QueueQueryTest extends ActiveMQTestBase { public void testQueueQueryDefaultsOnStaticQueue() throws Exception { SimpleString addressName = SimpleString.toSimpleString(UUID.randomUUID().toString()); SimpleString queueName = SimpleString.toSimpleString(UUID.randomUUID().toString()); - server.createQueue(addressName, RoutingType.MULTICAST, queueName, null, true, false); + server.createQueue(new QueueConfiguration(queueName).setAddress(addressName)); QueueQueryResult queueQueryResult = server.queueQuery(queueName); assertTrue(queueQueryResult.isExists()); assertEquals(RoutingType.MULTICAST, queueQueryResult.getRoutingType()); @@ -73,10 +74,13 @@ public class QueueQueryTest extends ActiveMQTestBase { @Test public void testQueueQueryOnStaticQueueWithFQQN() throws Exception { - SimpleString addressName = SimpleString.toSimpleString(UUID.randomUUID().toString()); - SimpleString queueName = SimpleString.toSimpleString(UUID.randomUUID().toString()); +// SimpleString addressName = SimpleString.toSimpleString(UUID.randomUUID().toString()); +// SimpleString queueName = SimpleString.toSimpleString(UUID.randomUUID().toString()); + SimpleString addressName = SimpleString.toSimpleString("myAddress"); + SimpleString queueName = SimpleString.toSimpleString("myQueue"); SimpleString fqqn = addressName.concat("::").concat(queueName); - server.createQueue(fqqn, RoutingType.MULTICAST, fqqn, null, true, false); +// server.createQueue(fqqn, RoutingType.MULTICAST, fqqn, null, true, false); + server.createQueue(new QueueConfiguration(fqqn)); QueueQueryResult queueQueryResult = server.queueQuery(fqqn); assertEquals(queueName, queueQueryResult.getName()); assertEquals(addressName, queueQueryResult.getAddress()); @@ -102,7 +106,7 @@ public class QueueQueryTest extends ActiveMQTestBase { .setDefaultLastValueKey(lastValueKey) .setDefaultExclusiveQueue(true) .setDefaultNonDestructive(true)); - server.createQueue(addressName, RoutingType.ANYCAST, queueName, filter, false, true); + server.createQueue(new QueueConfiguration(queueName).setAddress(addressName).setRoutingType(RoutingType.ANYCAST).setFilterString(filter).setDurable(false).setTemporary(true)); QueueQueryResult queueQueryResult = server.queueQuery(queueName); assertTrue(queueQueryResult.isExists()); assertEquals(RoutingType.ANYCAST, queueQueryResult.getRoutingType()); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ResourceLimitTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ResourceLimitTest.java index b178525083..e506fadff1 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ResourceLimitTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ResourceLimitTest.java @@ -20,6 +20,8 @@ import java.util.HashSet; import java.util.Set; import org.apache.activemq.artemis.api.core.ActiveMQSessionCreationException; +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.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ClientSession; @@ -29,7 +31,6 @@ import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.security.Role; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServers; -import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.core.settings.impl.ResourceLimitSettings; import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; @@ -98,26 +99,26 @@ public class ResourceLimitTest extends ActiveMQTestBase { ServerLocator locator = addServerLocator(createNonHALocator(false)); ClientSessionFactory clientSessionFactory = locator.createSessionFactory(); ClientSession clientSession = clientSessionFactory.createSession("myUser", "password", false, true, true, false, 0); - clientSession.createQueue("address", RoutingType.ANYCAST, "queue"); + clientSession.createQueue(new QueueConfiguration("queue").setAddress("address").setRoutingType(RoutingType.ANYCAST).setDurable(false)); try { - clientSession.createQueue("address", RoutingType.ANYCAST, "anotherQueue"); + clientSession.createQueue(new QueueConfiguration("anotherQueue").setAddress("address").setRoutingType(RoutingType.ANYCAST).setDurable(false)); } catch (Exception e) { assertTrue(e instanceof ActiveMQSessionCreationException); } clientSession.deleteQueue("queue"); - clientSession.createQueue("address", RoutingType.ANYCAST, "queue"); + clientSession.createQueue(new QueueConfiguration("queue").setAddress("address").setRoutingType(RoutingType.ANYCAST).setDurable(false)); try { - clientSession.createQueue("address", RoutingType.ANYCAST, "anotherQueue"); + clientSession.createQueue(new QueueConfiguration("anotherQueue").setAddress("address").setRoutingType(RoutingType.ANYCAST).setDurable(false)); } catch (Exception e) { assertTrue(e instanceof ActiveMQSessionCreationException); } try { - clientSession.createSharedQueue(SimpleString.toSimpleString("address"), SimpleString.toSimpleString("anotherQueue"), false); + clientSession.createSharedQueue(new QueueConfiguration("anotherQueue").setAddress("address").setDurable(false)); } catch (Exception e) { assertTrue(e instanceof ActiveMQSessionCreationException); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/RetroactiveAddressFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/RetroactiveAddressFailoverTest.java index 4198ca75e6..a3909bd440 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/RetroactiveAddressFailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/RetroactiveAddressFailoverTest.java @@ -17,6 +17,7 @@ package org.apache.activemq.artemis.tests.integration.server; 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.api.core.TransportConfiguration; @@ -91,7 +92,7 @@ public class RetroactiveAddressFailoverTest extends FailoverTestBase { org.apache.activemq.artemis.tests.util.Wait.assertTrue(() -> backup.locateQueue(divertQueue).getMessageCount() == MESSAGE_COUNT, 3000, 50); - session.createQueue(addressName.toString(), RoutingType.ANYCAST, queueName.toString()); + session.createQueue(new QueueConfiguration(queueName).setAddress(addressName).setRoutingType(RoutingType.ANYCAST)); org.apache.activemq.artemis.tests.util.Wait.assertTrue(() -> backup.locateQueue(queueName) != null); org.apache.activemq.artemis.tests.util.Wait.assertTrue(() -> backup.locateQueue(queueName).getMessageCount() == MESSAGE_COUNT, 500, 50); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/RetroactiveAddressTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/RetroactiveAddressTest.java index 76d85c4007..b79d73bbd0 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/RetroactiveAddressTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/RetroactiveAddressTest.java @@ -30,6 +30,7 @@ import java.util.Collection; import java.util.UUID; 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.api.core.client.ClientConsumer; @@ -155,7 +156,7 @@ public class RetroactiveAddressTest extends ActiveMQTestBase { Wait.assertTrue(() -> server.locateQueue(divertQueue).getMessagesReplaced() == (COUNT * finalI), 3000, 50); Wait.assertTrue(() -> server.locateQueue(divertQueue).getMessageCount() == COUNT, 3000, 50); - session.createQueue(addressName.toString(), RoutingType.ANYCAST, queueName.toString()); + session.createQueue(new QueueConfiguration(queueName).setAddress(addressName).setRoutingType(RoutingType.ANYCAST)); Wait.assertTrue(() -> server.locateQueue(queueName) != null); Wait.assertTrue(() -> server.locateQueue(queueName).getMessageCount() == COUNT, 500, 50); ClientConsumer consumer = session.createConsumer(queueName); @@ -202,7 +203,7 @@ public class RetroactiveAddressTest extends ActiveMQTestBase { producer.send(message); producer.close(); - session.createQueue(addressName.toString(), RoutingType.ANYCAST, queueName1.toString()); + session.createQueue(new QueueConfiguration(queueName1).setAddress(addressName).setRoutingType(RoutingType.ANYCAST)); Wait.assertTrue(() -> server.locateQueue(queueName1) != null); Wait.assertTrue(() -> server.locateQueue(queueName1).getMessageCount() == 2, 500, 50); @@ -259,7 +260,7 @@ public class RetroactiveAddressTest extends ActiveMQTestBase { producer.close(); Wait.assertTrue(() -> server.locateQueue(divertQueue).getMessageCount() == 1, 500, 50); - session.createQueue(addressName.toString(), RoutingType.MULTICAST, queueName1.toString()); + session.createQueue(new QueueConfiguration(queueName1).setAddress(addressName)); Wait.assertTrue(() -> server.locateQueue(queueName1) != null); Wait.assertTrue(() -> server.locateQueue(queueName1).getMessageCount() == 1, 500, 50); @@ -351,11 +352,11 @@ public class RetroactiveAddressTest extends ActiveMQTestBase { producer.close(); - session.createQueue(addressName.toString(), RoutingType.MULTICAST, multicastQueue.toString()); + session.createQueue(new QueueConfiguration(multicastQueue).setAddress(addressName)); Wait.assertTrue(() -> server.locateQueue(multicastQueue) != null); Wait.assertTrue(() -> server.locateQueue(multicastQueue).getMessageCount() == 1, 500, 50); - session.createQueue(addressName.toString(), RoutingType.ANYCAST, anycastQueue.toString()); + session.createQueue(new QueueConfiguration(anycastQueue).setAddress(addressName).setRoutingType(RoutingType.ANYCAST)); Wait.assertTrue(() -> server.locateQueue(anycastQueue) != null); Wait.assertTrue(() -> server.locateQueue(anycastQueue).getMessageCount() == 1, 500, 50); @@ -400,7 +401,7 @@ public class RetroactiveAddressTest extends ActiveMQTestBase { producer.close(); Wait.assertTrue(() -> server.locateQueue(divertQueue).getMessageCount() == 2, 500, 50); - session.createQueue(addressName.toString(), RoutingType.MULTICAST, queueName1.toString(), "xxx > 10", false); + server.createQueue(new QueueConfiguration(queueName1).setAddress(addressName).setFilterString("xxx > 10").setDurable(false)); Wait.assertTrue(() -> server.locateQueue(queueName1) != null); Wait.assertTrue(() -> server.locateQueue(queueName1).getMessageCount() == 1, 500, 50); @@ -437,7 +438,7 @@ public class RetroactiveAddressTest extends ActiveMQTestBase { server.getAddressSettingsRepository().addMatch(addressName.toString(), new AddressSettings().setRetroactiveMessageCount(MESSAGE_COUNT).setMaxSizeBytes(1024 * 20).setPageSizeBytes(1024 * 10).setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE)); server.addAddressInfo(new AddressInfo(addressName)); - server.createQueue(addressName, RoutingType.MULTICAST, randomQueueName, null, true, false); + server.createQueue(new QueueConfiguration(randomQueueName).setAddress(addressName)); ClientProducer producer = session.createProducer(addressName); @@ -457,7 +458,7 @@ public class RetroactiveAddressTest extends ActiveMQTestBase { Wait.assertTrue(() -> server.locateQueue(divertQueue).getMessageCount() == MESSAGE_COUNT, 500, 50); - session.createQueue(addressName.toString(), RoutingType.MULTICAST, queueName.toString()); + session.createQueue(new QueueConfiguration(queueName).setAddress(addressName)); Wait.assertTrue(() -> server.locateQueue(queueName) != null); Wait.assertTrue(() -> server.locateQueue(queueName).getMessageCount() == MESSAGE_COUNT, 500, 50); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/RingQueueTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/RingQueueTest.java index 9b06a8473b..247cfc6040 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/RingQueueTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/RingQueueTest.java @@ -19,12 +19,11 @@ package org.apache.activemq.artemis.tests.integration.server; import javax.jms.Connection; import javax.jms.MessageProducer; import javax.jms.Session; - import java.util.concurrent.atomic.AtomicInteger; import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; import org.apache.activemq.artemis.api.core.Message; -import org.apache.activemq.artemis.api.core.QueueAttributes; +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.api.core.client.ClientConsumer; @@ -58,7 +57,7 @@ public class RingQueueTest extends ActiveMQTestBase { ServerLocator locator = createNettyNonHALocator().setBlockOnAcknowledge(true).setAckBatchSize(0); ClientSessionFactory sf = createSessionFactory(locator); ClientSession clientSession = addClientSession(sf.createSession(false, true, true)); - clientSession.createQueue(address, qName, false, new QueueAttributes().setDurable(true).setRingSize(1L).setMaxConsumers(-1).setPurgeOnNoConsumers(false)); + clientSession.createQueue(new QueueConfiguration(qName).setAddress(address).setRingSize(1L)); clientSession.start(); final Queue queue = server.locateQueue(qName); assertEquals(1, queue.getRingSize()); @@ -87,7 +86,7 @@ public class RingQueueTest extends ActiveMQTestBase { ServerLocator locator = createNettyNonHALocator().setBlockOnAcknowledge(true).setAckBatchSize(0); ClientSessionFactory sf = createSessionFactory(locator); ClientSession clientSession = addClientSession(sf.createSession(false, true, false)); - clientSession.createQueue(address, qName, false, new QueueAttributes().setDurable(true).setRingSize(1L).setMaxConsumers(-1).setPurgeOnNoConsumers(false)); + clientSession.createQueue(new QueueConfiguration(qName).setAddress(address).setRingSize(1L)); clientSession.start(); final Queue queue = server.locateQueue(qName); @@ -138,7 +137,7 @@ public class RingQueueTest extends ActiveMQTestBase { ServerLocator locator = createNettyNonHALocator().setBlockOnAcknowledge(true).setAckBatchSize(0); ClientSessionFactory sf = createSessionFactory(locator); ClientSession clientSession = addClientSession(sf.createSession(false, true, false)); - clientSession.createQueue(address, qName, false, new QueueAttributes().setDurable(true).setRingSize(1L).setMaxConsumers(-1).setPurgeOnNoConsumers(false)); + clientSession.createQueue(new QueueConfiguration(qName).setAddress(address).setRingSize(1L)); clientSession.start(); final Queue queue = server.locateQueue(qName); assertEquals(1, queue.getRingSize()); @@ -175,7 +174,7 @@ public class RingQueueTest extends ActiveMQTestBase { ServerLocator locator = createNettyNonHALocator().setBlockOnAcknowledge(true).setAckBatchSize(0); ClientSessionFactory sf = createSessionFactory(locator); ClientSession clientSession = addClientSession(sf.createSession(false, true, false)); - clientSession.createQueue(address, qName, false, new QueueAttributes().setDurable(true).setRingSize(1L).setMaxConsumers(-1).setPurgeOnNoConsumers(false)); + clientSession.createQueue(new QueueConfiguration(qName).setAddress(address).setRingSize(1L)); clientSession.start(); final Queue queue = server.locateQueue(qName); assertEquals(1, queue.getRingSize()); @@ -223,7 +222,7 @@ public class RingQueueTest extends ActiveMQTestBase { ServerLocator locator = createNettyNonHALocator().setBlockOnAcknowledge(true).setAckBatchSize(0); ClientSessionFactory sf = createSessionFactory(locator); ClientSession clientSession = addClientSession(sf.createSession(false, true, true)); - clientSession.createQueue(address, RoutingType.ANYCAST, qName); + clientSession.createQueue(new QueueConfiguration(qName).setAddress(address).setRoutingType(RoutingType.ANYCAST)); clientSession.start(); final Queue queue = server.locateQueue(qName); assertEquals(-1, queue.getRingSize()); @@ -285,7 +284,7 @@ public class RingQueueTest extends ActiveMQTestBase { ServerLocator locator = createNettyNonHALocator().setBlockOnAcknowledge(true).setAckBatchSize(0); ClientSessionFactory sf = createSessionFactory(locator); ClientSession clientSession = addClientSession(sf.createSession(false, true, true)); - clientSession.createQueue(address, qName, false, new QueueAttributes().setDurable(true).setNonDestructive(true).setRingSize(1L).setMaxConsumers(-1).setPurgeOnNoConsumers(false)); + clientSession.createQueue(new QueueConfiguration(qName).setAddress(address).setRingSize(1L).setNonDestructive(true)); clientSession.start(); final Queue queue = server.locateQueue(qName); assertEquals(1, queue.getRingSize()); @@ -315,7 +314,7 @@ public class RingQueueTest extends ActiveMQTestBase { ServerLocator locator = createNettyNonHALocator().setBlockOnAcknowledge(true).setAckBatchSize(0); ClientSessionFactory sf = createSessionFactory(locator); ClientSession clientSession = addClientSession(sf.createSession(false, true, true)); - clientSession.createQueue(address, qName, false, new QueueAttributes().setDurable(true).setNonDestructive(true).setRingSize(1L).setMaxConsumers(-1).setPurgeOnNoConsumers(false)); + clientSession.createQueue(new QueueConfiguration(qName).setAddress(address).setRingSize(1L).setNonDestructive(true)); clientSession.start(); final Queue queue = server.locateQueue(qName); assertEquals(1, queue.getRingSize()); @@ -338,7 +337,7 @@ public class RingQueueTest extends ActiveMQTestBase { ServerLocator locator = createNettyNonHALocator().setBlockOnAcknowledge(true).setAckBatchSize(0); ClientSessionFactory sf = createSessionFactory(locator); ClientSession clientSession = addClientSession(sf.createSession(false, true, true)); - clientSession.createQueue(address, qName, false, new QueueAttributes().setDurable(true).setRingSize(RING_SIZE).setMaxConsumers(-1).setPurgeOnNoConsumers(false)); + clientSession.createQueue(new QueueConfiguration(qName).setAddress(address).setRingSize(RING_SIZE)); clientSession.start(); final Queue queue = server.locateQueue(qName); assertEquals(RING_SIZE, queue.getRingSize()); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ScaleDownDirectTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ScaleDownDirectTest.java index a2f1f9e9ce..4fac38ab7b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ScaleDownDirectTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ScaleDownDirectTest.java @@ -21,6 +21,7 @@ import java.util.Arrays; import java.util.Collection; import org.apache.activemq.artemis.api.core.Message; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; import org.apache.activemq.artemis.api.core.client.ClientConsumer; @@ -84,7 +85,7 @@ public class ScaleDownDirectTest extends ClusterTestBase { ClientSession session = sf.createSession(true, true); - session.createQueue("ad1", "queue1", true); + session.createQueue(new QueueConfiguration("queue1").setAddress("ad1")); ClientProducer producer = session.createProducer("ad1"); @@ -100,7 +101,7 @@ public class ScaleDownDirectTest extends ClusterTestBase { producer.send(message); } - session.createQueue("ad1", "queue2", true); + session.createQueue(new QueueConfiguration("queue2").setAddress("ad1")); for (int i = numberOfMessages; i < (numberOfMessages * 2); i++) { ClientMessage message = session.createMessage(true); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverOneWaySSLKerb5Test.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverOneWaySSLKerb5Test.java index 029b009a23..377d2386dc 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverOneWaySSLKerb5Test.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverOneWaySSLKerb5Test.java @@ -17,6 +17,7 @@ package org.apache.activemq.artemis.tests.integration.ssl; import org.apache.activemq.artemis.api.core.ActiveMQSecurityException; +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.api.core.TransportConfiguration; @@ -95,7 +96,7 @@ public class CoreClientOverOneWaySSLKerb5Test extends ActiveMQTestBase { try { sf = createSessionFactory(locator); ClientSession session = sf.createSession(false, true, true); - session.createQueue(CoreClientOverOneWaySSLKerb5Test.QUEUE, RoutingType.ANYCAST, CoreClientOverOneWaySSLKerb5Test.QUEUE); + session.createQueue(new QueueConfiguration(CoreClientOverOneWaySSLKerb5Test.QUEUE).setRoutingType(RoutingType.ANYCAST)); ClientProducer producer = session.createProducer(CoreClientOverOneWaySSLKerb5Test.QUEUE); final String text = RandomUtil.randomString(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverOneWaySSLTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverOneWaySSLTest.java index dcbebcec6c..f948350f73 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverOneWaySSLTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverOneWaySSLTest.java @@ -27,6 +27,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQConnectionTimedOutException; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException; import org.apache.activemq.artemis.api.core.Message; +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.api.core.TransportConfiguration; @@ -139,7 +140,7 @@ public class CoreClientOverOneWaySSLTest extends ActiveMQTestBase { ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(tc)); ClientSessionFactory sf = addSessionFactory(createSessionFactory(locator)); ClientSession session = addClientSession(sf.createSession(false, true, true)); - session.createQueue(CoreClientOverOneWaySSLTest.QUEUE, CoreClientOverOneWaySSLTest.QUEUE, false); + session.createQueue(new QueueConfiguration(CoreClientOverOneWaySSLTest.QUEUE).setDurable(false)); ClientProducer producer = addClientProducer(session.createProducer(CoreClientOverOneWaySSLTest.QUEUE)); ClientMessage message = createTextMessage(session, text); @@ -167,7 +168,7 @@ public class CoreClientOverOneWaySSLTest extends ActiveMQTestBase { ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(tc)); ClientSessionFactory sf = addSessionFactory(createSessionFactory(locator)); ClientSession session = addClientSession(sf.createSession(false, true, true)); - session.createQueue(CoreClientOverOneWaySSLTest.QUEUE, CoreClientOverOneWaySSLTest.QUEUE, false); + session.createQueue(new QueueConfiguration(CoreClientOverOneWaySSLTest.QUEUE).setDurable(false)); ClientProducer producer = addClientProducer(session.createProducer(CoreClientOverOneWaySSLTest.QUEUE)); ClientMessage message = createTextMessage(session, text); @@ -214,7 +215,7 @@ public class CoreClientOverOneWaySSLTest extends ActiveMQTestBase { ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(tc)); ClientSessionFactory sf = addSessionFactory(createSessionFactory(locator)); ClientSession session = addClientSession(sf.createSession(false, true, true)); - session.createQueue(CoreClientOverOneWaySSLTest.QUEUE, CoreClientOverOneWaySSLTest.QUEUE, false); + session.createQueue(new QueueConfiguration(CoreClientOverOneWaySSLTest.QUEUE).setDurable(false)); ClientProducer producer = addClientProducer(session.createProducer(CoreClientOverOneWaySSLTest.QUEUE)); ClientMessage message = createTextMessage(session, text); @@ -241,7 +242,7 @@ public class CoreClientOverOneWaySSLTest extends ActiveMQTestBase { ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(tc)); ClientSessionFactory sf = addSessionFactory(createSessionFactory(locator)); ClientSession session = addClientSession(sf.createSession(false, true, true)); - session.createQueue(CoreClientOverOneWaySSLTest.QUEUE, CoreClientOverOneWaySSLTest.QUEUE, false); + session.createQueue(new QueueConfiguration(CoreClientOverOneWaySSLTest.QUEUE).setDurable(false)); ClientProducer producer = addClientProducer(session.createProducer(CoreClientOverOneWaySSLTest.QUEUE)); ClientMessage message = createTextMessage(session, text); @@ -271,7 +272,7 @@ public class CoreClientOverOneWaySSLTest extends ActiveMQTestBase { assertTrue(TestTrustManagerFactoryPlugin.triggered.get()); ClientSession session = addClientSession(sf.createSession(false, true, true)); - session.createQueue(CoreClientOverOneWaySSLTest.QUEUE, CoreClientOverOneWaySSLTest.QUEUE, false); + session.createQueue(new QueueConfiguration(CoreClientOverOneWaySSLTest.QUEUE).setDurable(false)); ClientProducer producer = addClientProducer(session.createProducer(CoreClientOverOneWaySSLTest.QUEUE)); ClientMessage message = createTextMessage(session, text); @@ -293,7 +294,7 @@ public class CoreClientOverOneWaySSLTest extends ActiveMQTestBase { ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocator("tcp://127.0.0.1:61616?sslEnabled=true;trustStoreProvider=" + storeType + ";trustStorePath=" + CLIENT_SIDE_TRUSTSTORE + ";trustStorePassword=" + PASSWORD)); ClientSessionFactory sf = addSessionFactory(createSessionFactory(locator)); ClientSession session = addClientSession(sf.createSession(false, true, true)); - session.createQueue(CoreClientOverOneWaySSLTest.QUEUE, CoreClientOverOneWaySSLTest.QUEUE, false); + session.createQueue(new QueueConfiguration(CoreClientOverOneWaySSLTest.QUEUE).setDurable(false)); ClientProducer producer = addClientProducer(session.createProducer(CoreClientOverOneWaySSLTest.QUEUE)); ClientMessage message = createTextMessage(session, text); @@ -321,7 +322,7 @@ public class CoreClientOverOneWaySSLTest extends ActiveMQTestBase { ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocator("tcp://127.0.0.1:61616?sslEnabled=true;trustStoreProvider=" + storeType + ";trustStorePath=" + CLIENT_SIDE_TRUSTSTORE + ";trustStorePassword=" + masked + ";activemq.usemaskedpassword=true")); ClientSessionFactory sf = addSessionFactory(createSessionFactory(locator)); ClientSession session = addClientSession(sf.createSession(false, true, true)); - session.createQueue(CoreClientOverOneWaySSLTest.QUEUE, CoreClientOverOneWaySSLTest.QUEUE, false); + session.createQueue(new QueueConfiguration(CoreClientOverOneWaySSLTest.QUEUE).setDurable(false)); ClientProducer producer = addClientProducer(session.createProducer(CoreClientOverOneWaySSLTest.QUEUE)); ClientMessage message = createTextMessage(session, text); @@ -349,7 +350,7 @@ public class CoreClientOverOneWaySSLTest extends ActiveMQTestBase { ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocator("tcp://127.0.0.1:61616?sslEnabled=true;trustStoreProvider=" + storeType + ";trustStorePath=" + CLIENT_SIDE_TRUSTSTORE + ";trustStorePassword=ENC(" + masked + ")")); ClientSessionFactory sf = addSessionFactory(createSessionFactory(locator)); ClientSession session = addClientSession(sf.createSession(false, true, true)); - session.createQueue(CoreClientOverOneWaySSLTest.QUEUE, CoreClientOverOneWaySSLTest.QUEUE, false); + session.createQueue(new QueueConfiguration(CoreClientOverOneWaySSLTest.QUEUE).setDurable(false)); ClientProducer producer = addClientProducer(session.createProducer(CoreClientOverOneWaySSLTest.QUEUE)); ClientMessage message = createTextMessage(session, text); @@ -380,7 +381,7 @@ public class CoreClientOverOneWaySSLTest extends ActiveMQTestBase { ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(tc)); ClientSessionFactory sf = addSessionFactory(createSessionFactory(locator)); ClientSession session = addClientSession(sf.createSession(false, true, true)); - session.createQueue(CoreClientOverOneWaySSLTest.QUEUE, CoreClientOverOneWaySSLTest.QUEUE, false); + session.createQueue(new QueueConfiguration(CoreClientOverOneWaySSLTest.QUEUE).setDurable(false)); ClientProducer producer = addClientProducer(session.createProducer(CoreClientOverOneWaySSLTest.QUEUE)); ClientMessage message = createTextMessage(session, text); @@ -408,7 +409,7 @@ public class CoreClientOverOneWaySSLTest extends ActiveMQTestBase { ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(tc)); ClientSessionFactory sf = addSessionFactory(createSessionFactory(locator)); ClientSession session = addClientSession(sf.createSession(false, true, true)); - session.createQueue(CoreClientOverOneWaySSLTest.QUEUE, CoreClientOverOneWaySSLTest.QUEUE, false); + session.createQueue(new QueueConfiguration(CoreClientOverOneWaySSLTest.QUEUE).setDurable(false)); ClientProducer producer = addClientProducer(session.createProducer(CoreClientOverOneWaySSLTest.QUEUE)); ClientMessage message = createTextMessage(session, text); @@ -446,7 +447,7 @@ public class CoreClientOverOneWaySSLTest extends ActiveMQTestBase { @Test public void testOneWaySSLReloaded() throws Exception { createCustomSslServer(); - server.createQueue(CoreClientOverOneWaySSLTest.QUEUE, RoutingType.ANYCAST, CoreClientOverOneWaySSLTest.QUEUE, null, false, false); + server.createQueue(new QueueConfiguration(CoreClientOverOneWaySSLTest.QUEUE).setRoutingType(RoutingType.ANYCAST).setDurable(false)); String text = RandomUtil.randomString(); // create a valid SSL connection and keep it for use later @@ -650,7 +651,7 @@ public class CoreClientOverOneWaySSLTest extends ActiveMQTestBase { } ClientSession session = sf.createSession(false, true, true); - session.createQueue(CoreClientOverOneWaySSLTest.QUEUE, CoreClientOverOneWaySSLTest.QUEUE, false); + session.createQueue(new QueueConfiguration(CoreClientOverOneWaySSLTest.QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(CoreClientOverOneWaySSLTest.QUEUE); ClientMessage message = createTextMessage(session, text); @@ -684,7 +685,7 @@ public class CoreClientOverOneWaySSLTest extends ActiveMQTestBase { } ClientSession session = sf.createSession(false, true, true); - session.createQueue(CoreClientOverOneWaySSLTest.QUEUE, CoreClientOverOneWaySSLTest.QUEUE, false); + session.createQueue(new QueueConfiguration(CoreClientOverOneWaySSLTest.QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(CoreClientOverOneWaySSLTest.QUEUE); ClientMessage message = createTextMessage(session, text); @@ -719,7 +720,7 @@ public class CoreClientOverOneWaySSLTest extends ActiveMQTestBase { } ClientSession session = sf.createSession(false, true, true); - session.createQueue(CoreClientOverOneWaySSLTest.QUEUE, CoreClientOverOneWaySSLTest.QUEUE, false); + session.createQueue(new QueueConfiguration(CoreClientOverOneWaySSLTest.QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(CoreClientOverOneWaySSLTest.QUEUE); ClientMessage message = createTextMessage(session, text); @@ -753,7 +754,7 @@ public class CoreClientOverOneWaySSLTest extends ActiveMQTestBase { } ClientSession session = sf.createSession(false, true, true); - session.createQueue(CoreClientOverOneWaySSLTest.QUEUE, CoreClientOverOneWaySSLTest.QUEUE, false); + session.createQueue(new QueueConfiguration(CoreClientOverOneWaySSLTest.QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(CoreClientOverOneWaySSLTest.QUEUE); ClientMessage message = createTextMessage(session, text); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverTwoWayOpenSSLServerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverTwoWayOpenSSLServerTest.java index dac87fcfd2..f7fcca811e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverTwoWayOpenSSLServerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverTwoWayOpenSSLServerTest.java @@ -20,6 +20,7 @@ import io.netty.handler.ssl.SslHandler; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException; import org.apache.activemq.artemis.api.core.Interceptor; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; @@ -154,7 +155,7 @@ public class CoreClientOverTwoWayOpenSSLServerTest extends ActiveMQTestBase { ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(tc)); ClientSessionFactory sf = createSessionFactory(locator); ClientSession session = sf.createSession(false, true, true); - session.createQueue(CoreClientOverTwoWayOpenSSLServerTest.QUEUE, CoreClientOverTwoWayOpenSSLServerTest.QUEUE, false); + session.createQueue(new QueueConfiguration(CoreClientOverTwoWayOpenSSLServerTest.QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(CoreClientOverTwoWayOpenSSLServerTest.QUEUE); ClientMessage message = createTextMessage(session, text); @@ -192,7 +193,7 @@ public class CoreClientOverTwoWayOpenSSLServerTest extends ActiveMQTestBase { ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(tc)); ClientSessionFactory sf = createSessionFactory(locator); ClientSession session = sf.createSession(false, true, true); - session.createQueue(CoreClientOverTwoWayOpenSSLServerTest.QUEUE, CoreClientOverTwoWayOpenSSLServerTest.QUEUE, false); + session.createQueue(new QueueConfiguration(CoreClientOverTwoWayOpenSSLServerTest.QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(CoreClientOverTwoWayOpenSSLServerTest.QUEUE); ClientMessage message = createTextMessage(session, text); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverTwoWayOpenSSLTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverTwoWayOpenSSLTest.java index cb8c73dd27..e557dacfb4 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverTwoWayOpenSSLTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverTwoWayOpenSSLTest.java @@ -20,6 +20,7 @@ import io.netty.handler.ssl.SslHandler; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException; import org.apache.activemq.artemis.api.core.Interceptor; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; @@ -155,7 +156,7 @@ public class CoreClientOverTwoWayOpenSSLTest extends ActiveMQTestBase { ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(tc)); ClientSessionFactory sf = createSessionFactory(locator); ClientSession session = sf.createSession(false, true, true); - session.createQueue(CoreClientOverTwoWayOpenSSLTest.QUEUE, CoreClientOverTwoWayOpenSSLTest.QUEUE, false); + session.createQueue(new QueueConfiguration(CoreClientOverTwoWayOpenSSLTest.QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(CoreClientOverTwoWayOpenSSLTest.QUEUE); ClientMessage message = createTextMessage(session, text); @@ -194,7 +195,7 @@ public class CoreClientOverTwoWayOpenSSLTest extends ActiveMQTestBase { ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(tc)); ClientSessionFactory sf = createSessionFactory(locator); ClientSession session = sf.createSession(false, true, true); - session.createQueue(CoreClientOverTwoWayOpenSSLTest.QUEUE, CoreClientOverTwoWayOpenSSLTest.QUEUE, false); + session.createQueue(new QueueConfiguration(CoreClientOverTwoWayOpenSSLTest.QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(CoreClientOverTwoWayOpenSSLTest.QUEUE); ClientMessage message = createTextMessage(session, text); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverTwoWaySSLTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverTwoWaySSLTest.java index 9c814e93b1..adf6951d58 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverTwoWaySSLTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverTwoWaySSLTest.java @@ -26,6 +26,7 @@ import javax.net.ssl.SSLPeerUnverifiedException; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException; import org.apache.activemq.artemis.api.core.Interceptor; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; @@ -157,7 +158,7 @@ public class CoreClientOverTwoWaySSLTest extends ActiveMQTestBase { ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(tc)); ClientSessionFactory sf = createSessionFactory(locator); ClientSession session = sf.createSession(false, true, true); - session.createQueue(CoreClientOverTwoWaySSLTest.QUEUE, CoreClientOverTwoWaySSLTest.QUEUE, false); + session.createQueue(new QueueConfiguration(CoreClientOverTwoWaySSLTest.QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(CoreClientOverTwoWaySSLTest.QUEUE); ClientMessage message = createTextMessage(session, text); @@ -195,7 +196,7 @@ public class CoreClientOverTwoWaySSLTest extends ActiveMQTestBase { ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(tc)); ClientSessionFactory sf = createSessionFactory(locator); ClientSession session = sf.createSession(false, true, true); - session.createQueue(CoreClientOverTwoWaySSLTest.QUEUE, CoreClientOverTwoWaySSLTest.QUEUE, false); + session.createQueue(new QueueConfiguration(CoreClientOverTwoWaySSLTest.QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(CoreClientOverTwoWaySSLTest.QUEUE); ClientMessage message = createTextMessage(session, text); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/DualAuthenticationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/DualAuthenticationTest.java index 6e94504821..7da92b268a 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/DualAuthenticationTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/DualAuthenticationTest.java @@ -24,6 +24,7 @@ import java.util.Map; import java.util.Set; import org.apache.activemq.artemis.api.core.Message; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; @@ -90,7 +91,7 @@ public class DualAuthenticationTest extends ActiveMQTestBase { ServerLocator producerLocator = addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(tc)); ClientSessionFactory producerSessionFactory = createSessionFactory(producerLocator); ClientSession producerSession = producerSessionFactory.createSession(false, true, true); - producerSession.createQueue(DualAuthenticationTest.QUEUE, DualAuthenticationTest.QUEUE, false); + producerSession.createQueue(new QueueConfiguration(DualAuthenticationTest.QUEUE).setDurable(false)); ClientProducer producer = producerSession.createProducer(DualAuthenticationTest.QUEUE); ClientMessage message = createTextMessage(producerSession, text); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/SSLProviderTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/SSLProviderTest.java index 3fa976fc0c..a6349f2790 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/SSLProviderTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/SSLProviderTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.ssl; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; import org.apache.activemq.artemis.api.core.client.ClientConsumer; @@ -67,7 +68,7 @@ public class SSLProviderTest extends SSLTestBase { ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocator(uri.toString())); ClientSessionFactory sf = addSessionFactory(createSessionFactory(locator)); ClientSession session = addClientSession(sf.createSession(false, true, true)); - session.createQueue(QUEUE, RoutingType.ANYCAST, QUEUE); + session.createQueue(new QueueConfiguration(QUEUE).setRoutingType(RoutingType.ANYCAST)); ClientProducer producer = addClientProducer(session.createProducer(QUEUE)); ClientMessage message = createTextMessage(session, text); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/SSLProviderTwoWayTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/SSLProviderTwoWayTest.java index cc93d47460..6eb8b4a19e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/SSLProviderTwoWayTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/SSLProviderTwoWayTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.ssl; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; import org.apache.activemq.artemis.api.core.client.ClientConsumer; @@ -83,7 +84,7 @@ public class SSLProviderTwoWayTest extends SSLTestBase { ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocator(uri.toString())); ClientSessionFactory sf = addSessionFactory(createSessionFactory(locator)); ClientSession session = addClientSession(sf.createSession(false, true, true)); - session.createQueue(QUEUE, RoutingType.ANYCAST, QUEUE); + session.createQueue(new QueueConfiguration(QUEUE).setRoutingType(RoutingType.ANYCAST)); ClientProducer producer = addClientProducer(session.createProducer(QUEUE)); ClientMessage message = createTextMessage(session, text); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/FQQNStompTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/FQQNStompTest.java index 73179f0579..348ffbf900 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/FQQNStompTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/FQQNStompTest.java @@ -19,9 +19,11 @@ package org.apache.activemq.artemis.tests.integration.stomp; import java.util.Arrays; import java.util.Collection; +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.api.jms.ActiveMQJMSClient; +import org.apache.activemq.artemis.core.protocol.stomp.Stomp; import org.apache.activemq.artemis.core.server.Queue; import org.apache.activemq.artemis.core.server.QueueQueryResult; import org.apache.activemq.artemis.tests.integration.stomp.util.ClientStompFrame; @@ -92,8 +94,8 @@ public class FQQNStompTest extends StompTestBase { final SimpleString q1Name = SimpleString.toSimpleString("q1"); final SimpleString q2Name = SimpleString.toSimpleString("q2"); - Queue q1 = server.createQueue(myAddress, RoutingType.MULTICAST, q1Name, null, true, false); - Queue q2 = server.createQueue(myAddress, RoutingType.MULTICAST, q2Name, null, true, false); + Queue q1 = server.createQueue(new QueueConfiguration(q1Name).setAddress(myAddress)); + Queue q2 = server.createQueue(new QueueConfiguration(q2Name).setAddress(myAddress)); sendJmsMessage("Hello World!", ActiveMQJMSClient.createTopic(myAddress.toString())); assertTrue(Wait.waitFor(() -> q1.getMessageCount() == 1, 2000, 100)); @@ -116,8 +118,8 @@ public class FQQNStompTest extends StompTestBase { final SimpleString q1Name = SimpleString.toSimpleString("q1"); final SimpleString q2Name = SimpleString.toSimpleString("q2"); - Queue q1 = server.createQueue(myAddress, RoutingType.MULTICAST, q1Name, null, true, false); - Queue q2 = server.createQueue(myAddress, RoutingType.MULTICAST, q2Name, null, true, false); + Queue q1 = server.createQueue(new QueueConfiguration(q1Name).setAddress(myAddress)); + Queue q2 = server.createQueue(new QueueConfiguration(q2Name).setAddress(myAddress)); conn.connect(defUser, defPass); send(conn, myAddress + "\\c\\c" + q1Name, null, "Hello World!"); @@ -141,8 +143,8 @@ public class FQQNStompTest extends StompTestBase { final SimpleString q1Name = SimpleString.toSimpleString("q1"); final SimpleString q2Name = SimpleString.toSimpleString("q2"); - Queue q1 = server.createQueue(myAddress, RoutingType.ANYCAST, q1Name, null, true, false); - Queue q2 = server.createQueue(myAddress, RoutingType.ANYCAST, q2Name, null, true, false); + Queue q1 = server.createQueue(new QueueConfiguration(q1Name).setAddress(myAddress).setRoutingType(RoutingType.ANYCAST)); + Queue q2 = server.createQueue(new QueueConfiguration(q2Name).setAddress(myAddress).setRoutingType(RoutingType.ANYCAST)); conn.connect(defUser, defPass); send(conn, myAddress.toString(), null, "Hello World!", false, RoutingType.ANYCAST); @@ -189,9 +191,7 @@ public class FQQNStompTest extends StompTestBase { //queue:: frame = subscribeQueue(conn, "sub-01", getQueueName() + "\\c\\c"); assertNotNull(frame); - assertEquals("ERROR", frame.getCommand()); - assertTrue(frame.getBody().contains(getQueueName())); - assertTrue(frame.getBody().contains("Invalid")); + assertEquals(Stomp.Responses.ERROR, frame.getCommand()); conn.closeTransport(); //need reconnect because stomp disconnect on error @@ -200,7 +200,8 @@ public class FQQNStompTest extends StompTestBase { //:: will subscribe to no queue so no message received. frame = subscribeQueue(conn, "sub-01", "\\c\\c"); - assertTrue(frame.getBody().contains("Invalid queue name: ::")); + assertNotNull(frame); + assertEquals(Stomp.Responses.ERROR, frame.getCommand()); } } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTest.java index 71e596ee1d..fcd2623542 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTest.java @@ -34,6 +34,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; 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.api.core.client.ActiveMQClient; @@ -1921,9 +1922,9 @@ public class StompTest extends StompTestBase { ActiveMQServerControl serverControl = server.getActiveMQServerControl(); serverControl.createAddress(addressA, RoutingType.ANYCAST.toString() + "," + RoutingType.MULTICAST.toString()); - serverControl.createQueue(addressA, queueA, RoutingType.ANYCAST.toString()); - serverControl.createQueue(addressA, queueB, RoutingType.ANYCAST.toString()); - serverControl.createQueue(addressA, queueC, RoutingType.MULTICAST.toString()); + serverControl.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setRoutingType(RoutingType.ANYCAST).toJSON()); + serverControl.createQueue(new QueueConfiguration(queueB).setAddress(addressA).setRoutingType(RoutingType.ANYCAST).toJSON()); + serverControl.createQueue(new QueueConfiguration(queueC).setAddress(addressA).setRoutingType(RoutingType.MULTICAST).toJSON()); send(conn, addressA, null, "Hello World!", true, RoutingType.ANYCAST); @@ -1942,9 +1943,9 @@ public class StompTest extends StompTestBase { ActiveMQServerControl serverControl = server.getActiveMQServerControl(); serverControl.createAddress(addressA, RoutingType.ANYCAST.toString() + "," + RoutingType.MULTICAST.toString()); - serverControl.createQueue(addressA, queueA, RoutingType.ANYCAST.toString()); - serverControl.createQueue(addressA, queueB, RoutingType.MULTICAST.toString()); - serverControl.createQueue(addressA, queueC, RoutingType.MULTICAST.toString()); + serverControl.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setRoutingType(RoutingType.ANYCAST).toJSON()); + serverControl.createQueue(new QueueConfiguration(queueB).setAddress(addressA).setRoutingType(RoutingType.MULTICAST).toJSON()); + serverControl.createQueue(new QueueConfiguration(queueC).setAddress(addressA).setRoutingType(RoutingType.MULTICAST).toJSON()); send(conn, addressA, null, "Hello World!", true, RoutingType.MULTICAST); @@ -1964,10 +1965,10 @@ public class StompTest extends StompTestBase { ActiveMQServerControl serverControl = server.getActiveMQServerControl(); serverControl.createAddress(addressA, RoutingType.ANYCAST.toString() + "," + RoutingType.MULTICAST.toString()); - serverControl.createQueue(addressA, queueA, RoutingType.ANYCAST.toString()); - serverControl.createQueue(addressA, queueB, RoutingType.ANYCAST.toString()); - serverControl.createQueue(addressA, queueC, RoutingType.MULTICAST.toString()); - serverControl.createQueue(addressA, queueD, RoutingType.MULTICAST.toString()); + serverControl.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setRoutingType(RoutingType.ANYCAST).toJSON()); + serverControl.createQueue(new QueueConfiguration(queueB).setAddress(addressA).setRoutingType(RoutingType.ANYCAST).toJSON()); + serverControl.createQueue(new QueueConfiguration(queueC).setAddress(addressA).setRoutingType(RoutingType.MULTICAST).toJSON()); + serverControl.createQueue(new QueueConfiguration(queueD).setAddress(addressA).setRoutingType(RoutingType.MULTICAST).toJSON()); send(conn, addressA, null, "Hello World!", true); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestBase.java index 0194f94a97..8b53f1b796 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestBase.java @@ -35,11 +35,11 @@ import java.util.HashSet; import java.util.List; import java.util.UUID; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.config.CoreAddressConfiguration; -import org.apache.activemq.artemis.core.config.CoreQueueConfiguration; import org.apache.activemq.artemis.core.protocol.stomp.Stomp; import org.apache.activemq.artemis.core.remoting.impl.invm.InVMAcceptorFactory; import org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory; @@ -184,7 +184,7 @@ public abstract class StompTestBase extends ActiveMQTestBase { .addAcceptorConfiguration("stomp", stompAcceptorURI) .addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getName())) .setConnectionTtlCheckInterval(500) - .addQueueConfiguration(new CoreQueueConfiguration().setAddress(getQueueName()).setName(getQueueName()).setRoutingType(RoutingType.ANYCAST)) + .addQueueConfiguration(new QueueConfiguration(getQueueName()).setRoutingType(RoutingType.ANYCAST)) .addAddressConfiguration(new CoreAddressConfiguration().setName(getTopicName()).addRoutingType(RoutingType.MULTICAST)); if (getIncomingInterceptors() != null) { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWebSocketTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWebSocketTest.java index 6a9a08857e..4586959067 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWebSocketTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWebSocketTest.java @@ -19,9 +19,9 @@ package org.apache.activemq.artemis.tests.integration.stomp; import java.util.HashMap; import java.util.Map; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.core.config.Configuration; -import org.apache.activemq.artemis.core.config.CoreQueueConfiguration; import org.apache.activemq.artemis.core.protocol.stomp.StompProtocolManagerFactory; import org.apache.activemq.artemis.core.remoting.impl.invm.InVMAcceptorFactory; import org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptorFactory; @@ -69,9 +69,7 @@ public class StompWebSocketTest extends StompTestBase { .addAcceptorConfiguration(stompTransport) .addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getName())) .setPersistenceEnabled(isPersistenceEnabled()) - .addQueueConfiguration(new CoreQueueConfiguration() - .setAddress(getQueueName()) - .setName(getQueueName()) + .addQueueConfiguration(new QueueConfiguration(getQueueName()) .setDurable(false)); server = addServer(ActiveMQServers.newActiveMQServer(config)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithLargeMessagesTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithLargeMessagesTest.java index 3f9cb6e9e9..4fdc5295a4 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithLargeMessagesTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithLargeMessagesTest.java @@ -19,8 +19,8 @@ package org.apache.activemq.artemis.tests.integration.stomp; import java.util.Arrays; import java.util.Collection; +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.api.core.client.ActiveMQClient; import org.apache.activemq.artemis.core.protocol.stomp.Stomp; import org.apache.activemq.artemis.tests.integration.largemessage.LargeMessageTestBase; @@ -71,7 +71,7 @@ public class StompWithLargeMessagesTest extends StompTestBase { try { String address = "testLargeMessageAddress"; - server.createQueue(SimpleString.toSimpleString(address), RoutingType.ANYCAST, SimpleString.toSimpleString(address), null, true, false); + server.createQueue(new QueueConfiguration(address).setRoutingType(RoutingType.ANYCAST)); // STOMP default is UTF-8 == 1 byte per char. int largeMessageStringSize = 10 * 1024 * 1024; // 10MB diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithRejectingInterceptorTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithRejectingInterceptorTest.java index 7de354413a..849451bec3 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithRejectingInterceptorTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWithRejectingInterceptorTest.java @@ -77,7 +77,7 @@ public class StompWithRejectingInterceptorTest extends StompTestBase { @Override public boolean intercept(StompFrame stompFrame, RemotingConnection connection) { interceptedFrames.add(stompFrame); - if (stompFrame.getCommand() == Stomp.Commands.SEND) { + if (stompFrame.getCommand().equals(Stomp.Commands.SEND)) { return false; } return true; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/transports/netty/NettyConnectorWithHTTPUpgradeTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/transports/netty/NettyConnectorWithHTTPUpgradeTest.java index 96ecb56a90..986d610f7a 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/transports/netty/NettyConnectorWithHTTPUpgradeTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/transports/netty/NettyConnectorWithHTTPUpgradeTest.java @@ -40,6 +40,7 @@ import io.netty.handler.ssl.SslHandler; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQExceptionType; import org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; @@ -148,7 +149,7 @@ public class NettyConnectorWithHTTPUpgradeTest extends ActiveMQTestBase { ClientSessionFactory sf = createSessionFactory(locator); ClientSession session = sf.createSession(false, true, true); - session.createQueue(QUEUE, QUEUE, null, false); + session.createQueue(new QueueConfiguration(QUEUE).setDurable(false)); ClientProducer producer = session.createProducer(QUEUE); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/BasicXaRecoveryTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/BasicXaRecoveryTest.java index 1f17550799..e7cc82ea28 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/BasicXaRecoveryTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/BasicXaRecoveryTest.java @@ -25,6 +25,7 @@ import java.util.Collection; import java.util.HashMap; import java.util.Map; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -265,7 +266,7 @@ public class BasicXaRecoveryTest extends ActiveMQTestBase { addSettings(); - clientSession.createQueue(pageQueue, pageQueue, null, true); + clientSession.createQueue(new QueueConfiguration(pageQueue)); clientSession.start(xid, XAResource.TMNOFLAGS); @@ -342,7 +343,7 @@ public class BasicXaRecoveryTest extends ActiveMQTestBase { addSettings(); - clientSession.createQueue(pageQueue, pageQueue, null, true); + clientSession.createQueue(new QueueConfiguration(pageQueue)); clientSession.start(xid, XAResource.TMNOFLAGS); @@ -991,7 +992,7 @@ public class BasicXaRecoveryTest extends ActiveMQTestBase { ClientSession clientSession2 = sessionFactory.createSession(false, true, true); ClientProducer clientProducer2 = clientSession2.createProducer(atestq); SimpleString anewtestq = new SimpleString("anewtestq"); - clientSession.createQueue(anewtestq, anewtestq, null, true); + clientSession.createQueue(new QueueConfiguration(anewtestq)); ClientProducer clientProducer3 = clientSession2.createProducer(anewtestq); clientProducer2.send(m1); clientProducer2.send(m2); @@ -1077,7 +1078,7 @@ public class BasicXaRecoveryTest extends ActiveMQTestBase { ClientSession clientSession2 = sessionFactory.createSession(false, true, true); ClientProducer clientProducer2 = clientSession2.createProducer(atestq); SimpleString anewtestq = new SimpleString("anewtestq"); - clientSession.createQueue(anewtestq, anewtestq, null, true); + clientSession.createQueue(new QueueConfiguration(anewtestq)); ClientProducer clientProducer3 = clientSession2.createProducer(anewtestq); clientProducer2.send(m1); clientProducer2.send(m2); @@ -1213,7 +1214,7 @@ public class BasicXaRecoveryTest extends ActiveMQTestBase { sessionFactory = createSessionFactory(locator); clientSession = sessionFactory.createSession(true, false, commitACKs); if (createQueue) { - clientSession.createQueue(atestq, atestq, null, true); + clientSession.createQueue(new QueueConfiguration(atestq)); } clientProducer = clientSession.createProducer(atestq); clientConsumer = clientSession.createConsumer(atestq); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/BasicXaTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/BasicXaTest.java index 3f57aea3eb..6b025e5095 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/BasicXaTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/BasicXaTest.java @@ -27,6 +27,7 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import org.apache.activemq.artemis.api.core.ActiveMQException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -108,7 +109,7 @@ public class BasicXaTest extends ActiveMQTestBase { clientSession = addClientSession(sessionFactory.createSession(true, false, false)); - clientSession.createQueue(atestq, atestq, null, true); + clientSession.createQueue(new QueueConfiguration(atestq)); } @Test @@ -120,7 +121,7 @@ public class BasicXaTest extends ActiveMQTestBase { ClientSession session = addClientSession(factory.createSession(true, false, false)); - session.createQueue("Test", RoutingType.ANYCAST, "Test"); + session.createQueue(new QueueConfiguration("Test").setRoutingType(RoutingType.ANYCAST)); ClientProducer prod = session.createProducer("Test"); @@ -141,7 +142,7 @@ public class BasicXaTest extends ActiveMQTestBase { ClientSession session = addClientSession(factory.createSession(false, true, true)); - session.createQueue("Test", RoutingType.ANYCAST, "Test"); + session.createQueue(new QueueConfiguration("Test").setRoutingType(RoutingType.ANYCAST)); ClientProducer prod = session.createProducer("Test"); @@ -719,8 +720,8 @@ public class BasicXaTest extends ActiveMQTestBase { SimpleString ADDRESS1 = new SimpleString("Address-1"); SimpleString ADDRESS2 = new SimpleString("Address-2"); - clientSession.createQueue(ADDRESS1, ADDRESS1, true); - clientSession.createQueue(ADDRESS2, ADDRESS2, true); + clientSession.createQueue(new QueueConfiguration(ADDRESS1)); + clientSession.createQueue(new QueueConfiguration(ADDRESS2)); Xid xid = newXID(); @@ -800,9 +801,9 @@ public class BasicXaTest extends ActiveMQTestBase { if (createQueues) { for (int i = 0; i < NUMBER_OF_QUEUES; i++) { - session.createQueue(ADDRESS, ADDRESS.concat(Integer.toString(i)), true); + session.createQueue(new QueueConfiguration(ADDRESS.concat(Integer.toString(i))).setAddress(ADDRESS)); if (isJoinSession) { - clientSession.createQueue(ADDRESS.concat("-join"), ADDRESS.concat("-join." + i), true); + clientSession.createQueue(new QueueConfiguration(ADDRESS.concat("-join." + i)).setAddress(ADDRESS.concat("-join")).setDurable(true)); } } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/SessionFailureXATest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/SessionFailureXATest.java index 300d8ab706..d80edfc9b9 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/SessionFailureXATest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/SessionFailureXATest.java @@ -25,6 +25,7 @@ import java.util.Map; import java.util.concurrent.TimeUnit; import org.apache.activemq.artemis.api.core.ActiveMQException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -101,7 +102,7 @@ public class SessionFailureXATest extends ActiveMQTestBase { clientSession = addClientSession(sessionFactory.createSession(true, false, false)); - clientSession.createQueue(atestq, atestq, null, true); + clientSession.createQueue(new QueueConfiguration(atestq)); } @Test diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/XaTimeoutTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/XaTimeoutTest.java index f8578aa7c5..7e1f8a03a0 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/XaTimeoutTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/XaTimeoutTest.java @@ -30,6 +30,7 @@ import java.util.concurrent.atomic.AtomicInteger; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.Interceptor; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; @@ -45,7 +46,6 @@ import org.apache.activemq.artemis.core.protocol.core.Packet; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionXAStartMessage; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServers; -import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.core.transaction.Transaction; import org.apache.activemq.artemis.core.transaction.TransactionOperationAbstract; @@ -113,7 +113,7 @@ public class XaTimeoutTest extends ActiveMQTestBase { locator = createInVMNonHALocator(); sessionFactory = createSessionFactory(locator); clientSession = sessionFactory.createSession(true, false, false); - clientSession.createQueue(atestq, atestq, null, true); + clientSession.createQueue(new QueueConfiguration(atestq)); clientProducer = clientSession.createProducer(atestq); clientConsumer = clientSession.createConsumer(atestq); } @@ -382,7 +382,7 @@ public class XaTimeoutTest extends ActiveMQTestBase { simpleTXSession.commit(); // This test needs 2 queues - simpleTXSession.createQueue(outQueue, RoutingType.MULTICAST, outQueue); + simpleTXSession.createQueue(new QueueConfiguration(outQueue)); simpleTXSession.close(); } diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/MessageProducerTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/MessageProducerTest.java index d0a87cfb97..0e2d23cbff 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/MessageProducerTest.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/MessageProducerTest.java @@ -34,6 +34,7 @@ import java.util.EnumSet; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient; import org.apache.activemq.artemis.api.core.RoutingType; @@ -712,7 +713,7 @@ public class MessageProducerTest extends JMSTestCase { EnumSet supportedRoutingTypes = EnumSet.of(RoutingType.ANYCAST, RoutingType.MULTICAST); servers.get(0).getActiveMQServer().addAddressInfo(new AddressInfo(addr, supportedRoutingTypes)); - servers.get(0).getActiveMQServer().createQueue(addr, RoutingType.ANYCAST, addr, null, false, false); + servers.get(0).getActiveMQServer().createQueue(new QueueConfiguration(addr).setRoutingType(RoutingType.ANYCAST).setDurable(false)); Connection pconn = createConnection(); pconn.start(); diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java index 3ba58f0658..04d488da98 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/SecurityTest.java @@ -36,6 +36,7 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; +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.jms.client.ActiveMQConnectionFactory; @@ -195,7 +196,7 @@ public class SecurityTest extends JMSTestCase { public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws Exception { SimpleString queueName = SimpleString.toSimpleString("guest.cannot.send"); if (getJmsServer().locateQueue(queueName) == null) { - getJmsServer().createQueue(queueName, RoutingType.ANYCAST, queueName, null, true, false); + getJmsServer().createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST)); } ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616"); Connection connection = connectionFactory.createConnection("guest", "guest"); @@ -220,7 +221,7 @@ public class SecurityTest extends JMSTestCase { public void testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws Exception { SimpleString queueName = SimpleString.toSimpleString("guest.cannot.send"); if (getJmsServer().locateQueue(queueName) == null) { - getJmsServer().createQueue(queueName, RoutingType.ANYCAST, queueName, null, true, false); + getJmsServer().createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST)); } ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616"); connectionFactory.setConfirmationWindowSize(100); @@ -266,7 +267,7 @@ public class SecurityTest extends JMSTestCase { public void testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistentJMS2() throws Exception { SimpleString queueName = SimpleString.toSimpleString("guest.cannot.send"); if (getJmsServer().locateQueue(queueName) == null) { - getJmsServer().createQueue(queueName, RoutingType.ANYCAST, queueName, null, true, false); + getJmsServer().createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST)); } ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616"); connectionFactory.setConfirmationWindowSize(100); @@ -312,7 +313,7 @@ public class SecurityTest extends JMSTestCase { public void testLoginValidUserAndPasswordButNotAuthorisedToSendLargeNonPersistent() throws Exception { SimpleString queueName = SimpleString.toSimpleString("guest.cannot.send"); if (getJmsServer().locateQueue(queueName) == null) { - getJmsServer().createQueue(queueName, RoutingType.ANYCAST, queueName, null, true, false); + getJmsServer().createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST)); } ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616"); connectionFactory.setConfirmationWindowSize(100); diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/MessageHeaderTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/MessageHeaderTest.java index ecd0f78fd2..69d7f979b1 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/MessageHeaderTest.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/MessageHeaderTest.java @@ -40,6 +40,7 @@ import java.util.Set; import org.apache.activemq.artemis.api.core.ActiveMQBuffer; import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.QueueAttributes; +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.api.core.client.ClientConsumer; @@ -1458,6 +1459,16 @@ public class MessageHeaderTest extends MessageHeaderTestBase { } + @Override + public void createQueue(QueueConfiguration queueConfiguration) throws ActiveMQException { + + } + + @Override + public void createSharedQueue(QueueConfiguration queueConfiguration) throws ActiveMQException { + + } + @Override public FakeSession setSendAcknowledgementHandler(final SendAcknowledgementHandler handler) { return this; diff --git a/tests/karaf-client-integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/client/ArtemisCoreClientFeatureIT.java b/tests/karaf-client-integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/client/ArtemisCoreClientFeatureIT.java index dc9a1b60cf..eed72aaebb 100644 --- a/tests/karaf-client-integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/client/ArtemisCoreClientFeatureIT.java +++ b/tests/karaf-client-integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/client/ArtemisCoreClientFeatureIT.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.integration.karaf.client; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; import org.apache.activemq.artemis.api.core.client.ClientConsumer; @@ -71,7 +72,7 @@ public class ArtemisCoreClientFeatureIT { // send message String textMessage = "Hello"; message.getBodyBuffer().writeString(textMessage); - session.createQueue(queueName, RoutingType.ANYCAST, queueName, true); + session.createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST)); producer.send(message); // assert diff --git a/tests/performance-tests/src/test/java/org/apache/activemq/artemis/tests/performance/paging/MeasurePagingMultiThreadTest.java b/tests/performance-tests/src/test/java/org/apache/activemq/artemis/tests/performance/paging/MeasurePagingMultiThreadTest.java index 575a9e6d64..b7bdb16485 100644 --- a/tests/performance-tests/src/test/java/org/apache/activemq/artemis/tests/performance/paging/MeasurePagingMultiThreadTest.java +++ b/tests/performance-tests/src/test/java/org/apache/activemq/artemis/tests/performance/paging/MeasurePagingMultiThreadTest.java @@ -20,6 +20,7 @@ import java.util.HashMap; import java.util.concurrent.CountDownLatch; import org.apache.activemq.artemis.api.core.ActiveMQException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientProducer; @@ -192,7 +193,7 @@ public class MeasurePagingMultiThreadTest extends ActiveMQTestBase { private void createDestination(final ClientSessionFactory factory, final SimpleString adr) throws ActiveMQException { { ClientSession session = factory.createSession(false, false, false); - session.createQueue(adr, adr, null, true); + session.createQueue(new QueueConfiguration(adr)); session.close(); } } diff --git a/tests/performance-tests/src/test/java/org/apache/activemq/artemis/tests/performance/storage/SendReceiveMultiThreadTest.java b/tests/performance-tests/src/test/java/org/apache/activemq/artemis/tests/performance/storage/SendReceiveMultiThreadTest.java index 0e2db9384c..b55fe8f06b 100644 --- a/tests/performance-tests/src/test/java/org/apache/activemq/artemis/tests/performance/storage/SendReceiveMultiThreadTest.java +++ b/tests/performance-tests/src/test/java/org/apache/activemq/artemis/tests/performance/storage/SendReceiveMultiThreadTest.java @@ -30,12 +30,12 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicInteger; import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; -import org.apache.activemq.artemis.api.core.SimpleString; +import org.apache.activemq.artemis.api.core.QueueConfiguration; +import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.JournalType; import org.apache.activemq.artemis.core.server.Queue; -import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; import org.apache.activemq.artemis.jms.client.DefaultConnectionProperties; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; @@ -79,9 +79,9 @@ public class SendReceiveMultiThreadTest extends ActiveMQTestBase { server.start(); - Queue queue = server.createQueue(SimpleString.toSimpleString("performanceQueue"), RoutingType.ANYCAST, SimpleString.toSimpleString("performanceQueue"), null, true, false); + Queue queue = server.createQueue(new QueueConfiguration("performanceQueue").setRoutingType(RoutingType.ANYCAST)); - Queue queue2 = server.createQueue(SimpleString.toSimpleString("stationaryQueue"), RoutingType.ANYCAST, SimpleString.toSimpleString("stationaryQueue"), null, true, false); + Queue queue2 = server.createQueue(new QueueConfiguration("stationaryQueue").setRoutingType(RoutingType.ANYCAST)); MyThread[] threads = new MyThread[NUMBER_OF_THREADS]; diff --git a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/jmx2/JmxServerControlTest.java b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/jmx2/JmxServerControlTest.java index c2a625fbbb..421e99c783 100644 --- a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/jmx2/JmxServerControlTest.java +++ b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/jmx2/JmxServerControlTest.java @@ -30,6 +30,7 @@ import javax.management.remote.JMXServiceURL; import com.google.common.collect.ImmutableMap; import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; import org.apache.activemq.artemis.api.core.JsonUtil; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.api.core.management.ActiveMQServerControl; import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder; @@ -85,7 +86,7 @@ public class JmxServerControlTest extends SmokeTestBase { String addressName = "test_list_consumers_address"; String queueName = "test_list_consumers_queue"; activeMQServerControl.createAddress(addressName, RoutingType.ANYCAST.name()); - activeMQServerControl.createQueue(addressName, queueName, RoutingType.ANYCAST.name()); + activeMQServerControl.createQueue(new QueueConfiguration(queueName).setAddress(addressName).setRoutingType(RoutingType.ANYCAST).toJSON()); String uri = "tcp://localhost:61616"; try (ActiveMQConnectionFactory cf = ActiveMQJMSClient.createConnectionFactory(uri, null)) { MessageConsumer consumer = cf.createConnection().createSession(true, Session.SESSION_TRANSACTED).createConsumer(new ActiveMQQueue(queueName)); diff --git a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/client/ClientNonDivertedSoakTest.java b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/client/ClientNonDivertedSoakTest.java index fe9a3e6ba7..a1054fba20 100644 --- a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/client/ClientNonDivertedSoakTest.java +++ b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/client/ClientNonDivertedSoakTest.java @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.soak.client; import java.util.HashMap; import java.util.concurrent.TimeUnit; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientProducer; @@ -73,7 +74,7 @@ public class ClientNonDivertedSoakTest extends ActiveMQTestBase { ClientSession session = sf.createSession(); - session.createQueue(ClientNonDivertedSoakTest.ADDRESS, ClientNonDivertedSoakTest.ADDRESS, true); + session.createQueue(new QueueConfiguration(ClientNonDivertedSoakTest.ADDRESS)); session.close(); diff --git a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/client/ClientSoakTest.java b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/client/ClientSoakTest.java index be07b79584..4fae524352 100644 --- a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/client/ClientSoakTest.java +++ b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/client/ClientSoakTest.java @@ -20,6 +20,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.concurrent.TimeUnit; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientProducer; @@ -90,11 +91,11 @@ public class ClientSoakTest extends ActiveMQTestBase { ClientSession session = sf.createSession(); - session.createQueue(ClientSoakTest.ADDRESS, ClientSoakTest.ADDRESS, true); + session.createQueue(new QueueConfiguration(ClientSoakTest.ADDRESS)); - session.createQueue(ClientSoakTest.DIVERTED_AD1, ClientSoakTest.DIVERTED_AD1, true); + session.createQueue(new QueueConfiguration(ClientSoakTest.DIVERTED_AD1)); - session.createQueue(ClientSoakTest.DIVERTED_AD2, ClientSoakTest.DIVERTED_AD2, true); + session.createQueue(new QueueConfiguration(ClientSoakTest.DIVERTED_AD2)); session.close(); diff --git a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/client/SimpleSendReceiveSoakTest.java b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/client/SimpleSendReceiveSoakTest.java index 559727e7b6..57e71d67d7 100644 --- a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/client/SimpleSendReceiveSoakTest.java +++ b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/client/SimpleSendReceiveSoakTest.java @@ -18,6 +18,7 @@ package org.apache.activemq.artemis.tests.soak.client; import java.util.HashMap; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -75,7 +76,7 @@ public class SimpleSendReceiveSoakTest extends ActiveMQTestBase { ClientSession session = sf.createSession(); - session.createQueue(SimpleSendReceiveSoakTest.ADDRESS, SimpleSendReceiveSoakTest.ADDRESS, true); + session.createQueue(new QueueConfiguration(SimpleSendReceiveSoakTest.ADDRESS)); session.close(); } diff --git a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/client/SendStressTest.java b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/client/SendStressTest.java index d98b2ce3a0..428b3efccf 100644 --- a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/client/SendStressTest.java +++ b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/client/SendStressTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.artemis.tests.stress.client; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientProducer; @@ -23,7 +24,6 @@ import org.apache.activemq.artemis.api.core.client.ClientSession; import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.core.server.ActiveMQServer; -import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.junit.Assert; import org.junit.Test; @@ -68,7 +68,7 @@ public class SendStressTest extends ActiveMQTestBase { session = sf.createSession(false, false); - session.createQueue("address", RoutingType.MULTICAST, "queue"); + session.createQueue(new QueueConfiguration("queue").setAddress("address")); ClientProducer producer = session.createProducer("address"); diff --git a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/CompactingStressTest.java b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/CompactingStressTest.java index 2f450a693b..864208fa35 100644 --- a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/CompactingStressTest.java +++ b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/CompactingStressTest.java @@ -21,6 +21,7 @@ import java.util.concurrent.atomic.AtomicInteger; import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; import org.apache.activemq.artemis.api.core.Message; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientProducer; @@ -364,17 +365,17 @@ public class CompactingStressTest extends ActiveMQTestBase { ClientSession sess = addClientSession(sf.createSession()); try { - sess.createQueue(CompactingStressTest.AD1, CompactingStressTest.Q1, true); + sess.createQueue(new QueueConfiguration(CompactingStressTest.Q1).setAddress(CompactingStressTest.AD1)); } catch (Exception ignored) { } try { - sess.createQueue(CompactingStressTest.AD2, CompactingStressTest.Q2, true); + sess.createQueue(new QueueConfiguration(CompactingStressTest.Q2).setAddress(CompactingStressTest.AD2)); } catch (Exception ignored) { } try { - sess.createQueue(CompactingStressTest.AD3, CompactingStressTest.Q3, true); + sess.createQueue(new QueueConfiguration(CompactingStressTest.Q3).setAddress(CompactingStressTest.AD3)); } catch (Exception ignored) { } diff --git a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/JournalRestartStressTest.java b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/JournalRestartStressTest.java index 9d360b23a8..a3dd805fc2 100644 --- a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/JournalRestartStressTest.java +++ b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/JournalRestartStressTest.java @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.stress.journal; import java.util.ArrayList; import java.util.Random; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientProducer; @@ -26,7 +27,6 @@ import org.apache.activemq.artemis.api.core.client.ClientSession; import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.core.server.ActiveMQServer; -import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.utils.RandomUtil; import org.junit.Test; @@ -67,7 +67,7 @@ public class JournalRestartStressTest extends ActiveMQTestBase { ClientSession session = sf.createSession(true, true); try { - session.createQueue("slow-queue", RoutingType.MULTICAST, "slow-queue"); + session.createQueue(new QueueConfiguration("slow-queue")); } catch (Exception ignored) { } @@ -112,7 +112,7 @@ public class JournalRestartStressTest extends ActiveMQTestBase { ClientProducer prod2 = sessionSend.createProducer("slow-queue"); try { - sessionSend.createQueue("Queue", "Queue", true); + sessionSend.createQueue(new QueueConfiguration("Queue")); } catch (Exception ignored) { } diff --git a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/LargeJournalStressTest.java b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/LargeJournalStressTest.java index 0dc3423a95..d1f8be0d5b 100644 --- a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/LargeJournalStressTest.java +++ b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/LargeJournalStressTest.java @@ -20,6 +20,7 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicInteger; import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientProducer; @@ -244,12 +245,12 @@ public class LargeJournalStressTest extends ActiveMQTestBase { ClientSession sess = sf.createSession(); try { - sess.createQueue(LargeJournalStressTest.AD1, LargeJournalStressTest.Q1, true); + sess.createQueue(new QueueConfiguration(LargeJournalStressTest.Q1).setAddress(LargeJournalStressTest.AD1)); } catch (Exception ignored) { } try { - sess.createQueue(LargeJournalStressTest.AD2, LargeJournalStressTest.Q2, true); + sess.createQueue(new QueueConfiguration(LargeJournalStressTest.Q2).setAddress(LargeJournalStressTest.AD2)); } catch (Exception ignored) { } diff --git a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/MultiThreadConsumerStressTest.java b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/MultiThreadConsumerStressTest.java index 64f16d860d..494c2d6cbc 100644 --- a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/MultiThreadConsumerStressTest.java +++ b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/MultiThreadConsumerStressTest.java @@ -20,6 +20,7 @@ import java.util.ArrayList; import java.util.concurrent.CountDownLatch; import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -72,7 +73,7 @@ public class MultiThreadConsumerStressTest extends ActiveMQTestBase { int commitIntervalConsume = 100; ClientSession session = sf.createSession(false, false); - session.createQueue("compact", "compact-queue", true); + session.createQueue(new QueueConfiguration("compact-queue").setAddress("compact")); ClientProducer producer = session.createProducer("compact"); @@ -156,7 +157,7 @@ public class MultiThreadConsumerStressTest extends ActiveMQTestBase { ClientSession sess = sf.createSession(); try { - sess.createQueue(ADDRESS, QUEUE, true); + sess.createQueue(new QueueConfiguration(QUEUE).setAddress(ADDRESS)); } catch (Exception ignored) { } diff --git a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/NIOMultiThreadCompactorStressTest.java b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/NIOMultiThreadCompactorStressTest.java index d093d30682..a1dc080203 100644 --- a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/NIOMultiThreadCompactorStressTest.java +++ b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/NIOMultiThreadCompactorStressTest.java @@ -25,6 +25,7 @@ import java.util.concurrent.CountDownLatch; import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; import org.apache.activemq.artemis.api.core.ActiveMQException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -258,7 +259,7 @@ public class NIOMultiThreadCompactorStressTest extends ActiveMQTestBase { private void addBogusData(final int nmessages, final String queue) throws ActiveMQException { ClientSession session = sf.createSession(false, false); try { - session.createQueue(queue, queue, true); + session.createQueue(new QueueConfiguration(queue)); } catch (Exception ignored) { } @@ -314,7 +315,7 @@ public class NIOMultiThreadCompactorStressTest extends ActiveMQTestBase { ClientSession sess = sf.createSession(); try { - sess.createQueue(ADDRESS, QUEUE, true); + sess.createQueue(new QueueConfiguration(QUEUE).setAddress(ADDRESS)); } catch (Exception ignored) { } diff --git a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/XmlImportExportStressTest.java b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/XmlImportExportStressTest.java index e73687bf12..605bd592d2 100644 --- a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/XmlImportExportStressTest.java +++ b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/XmlImportExportStressTest.java @@ -21,6 +21,7 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientProducer; @@ -48,7 +49,7 @@ public class XmlImportExportStressTest extends ActiveMQTestBase { ClientSessionFactory factory = locator.createSessionFactory(); ClientSession session = factory.createSession(false, false, false); - session.createQueue(QUEUE_NAME, QUEUE_NAME, true); + session.createQueue(new QueueConfiguration(QUEUE_NAME)); ClientProducer producer = session.createProducer(QUEUE_NAME); diff --git a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/paging/MultipleConsumersPageStressTest.java b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/paging/MultipleConsumersPageStressTest.java index b9856b75d7..5182e59754 100644 --- a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/paging/MultipleConsumersPageStressTest.java +++ b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/paging/MultipleConsumersPageStressTest.java @@ -21,6 +21,7 @@ import java.util.HashMap; import java.util.Random; import java.util.concurrent.atomic.AtomicInteger; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -102,7 +103,7 @@ public class MultipleConsumersPageStressTest extends ActiveMQTestBase { server = createServer(true, createDefaultInVMConfig(), 10024, 200024, settings); server.start(); - pagedServerQueue = (QueueImpl) server.createQueue(ADDRESS, RoutingType.ANYCAST, ADDRESS, null, true, false); + pagedServerQueue = (QueueImpl) server.createQueue(new QueueConfiguration(ADDRESS).setRoutingType(RoutingType.ANYCAST)); } diff --git a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/paging/PageCursorStressTest.java b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/paging/PageCursorStressTest.java index 27d0c7d870..48ab45d60e 100644 --- a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/paging/PageCursorStressTest.java +++ b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/paging/PageCursorStressTest.java @@ -27,6 +27,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock; import org.apache.activemq.artemis.api.core.ActiveMQBuffer; import org.apache.activemq.artemis.api.core.Message; +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.config.Configuration; @@ -820,7 +821,7 @@ public class PageCursorStressTest extends ActiveMQTestBase { queueList.clear(); try { - queue = server.createQueue(ADDRESS, RoutingType.ANYCAST, ADDRESS, null, true, false); + queue = server.createQueue(new QueueConfiguration(ADDRESS).setRoutingType(RoutingType.ANYCAST)); queue.pause(); } catch (Exception ignored) { } diff --git a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/paging/PageStressTest.java b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/paging/PageStressTest.java index 0d07549041..e9d56e9715 100644 --- a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/paging/PageStressTest.java +++ b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/paging/PageStressTest.java @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.stress.paging; import java.util.HashMap; import org.apache.activemq.artemis.api.core.ActiveMQException; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -62,7 +63,7 @@ public class PageStressTest extends ActiveMQTestBase { SimpleString address = new SimpleString("page-adr"); - session.createQueue(address, address, null, true); + session.createQueue(new QueueConfiguration(address)); ClientProducer prod = session.createProducer(address); @@ -149,8 +150,8 @@ public class PageStressTest extends ActiveMQTestBase { SimpleString address = new SimpleString("page-adr"); SimpleString[] queue = new SimpleString[]{new SimpleString("queue1"), new SimpleString("queue2")}; - session.createQueue(address, queue[0], null, true); - session.createQueue(address, queue[1], null, true); + session.createQueue(new QueueConfiguration(queue[0]).setAddress(address)); + session.createQueue(new QueueConfiguration(queue[1]).setAddress(address)); ClientProducer prod = session.createProducer(address); diff --git a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/stomp/StompStressTest.java b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/stomp/StompStressTest.java index 331c7d4f0c..24b76a3a3b 100644 --- a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/stomp/StompStressTest.java +++ b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/stomp/StompStressTest.java @@ -25,9 +25,9 @@ import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.core.config.Configuration; -import org.apache.activemq.artemis.core.config.CoreQueueConfiguration; import org.apache.activemq.artemis.core.protocol.stomp.Stomp; import org.apache.activemq.artemis.core.protocol.stomp.StompProtocolManagerFactory; import org.apache.activemq.artemis.core.remoting.impl.invm.InVMAcceptorFactory; @@ -105,7 +105,7 @@ public class StompStressTest extends ActiveMQTestBase { params.put(TransportConstants.PORT_PROP_NAME, TransportConstants.DEFAULT_STOMP_PORT); TransportConfiguration stompTransport = new TransportConfiguration(NettyAcceptorFactory.class.getName(), params); - Configuration config = createBasicConfig().setPersistenceEnabled(false).addAcceptorConfiguration(stompTransport).addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getName())).addQueueConfiguration(new CoreQueueConfiguration().setAddress(destination).setName(destination).setDurable(false)); + Configuration config = createBasicConfig().setPersistenceEnabled(false).addAcceptorConfiguration(stompTransport).addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getName())).addQueueConfiguration(new QueueConfiguration(destination).setDurable(false)); return addServer(ActiveMQServers.newActiveMQServer(config)); } diff --git a/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java b/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java index 3bcaeacf44..8c7f6dfa44 100644 --- a/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java +++ b/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java @@ -44,6 +44,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; +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.api.core.TransportConfiguration; @@ -701,8 +702,8 @@ public class JMSBridgeImplTest extends ActiveMQTestBase { server = addServer(ActiveMQServers.newActiveMQServer(config, false)); server.start(); - server.createQueue(SimpleString.toSimpleString(JMSBridgeImplTest.SOURCE), RoutingType.ANYCAST, SimpleString.toSimpleString(JMSBridgeImplTest.SOURCE), null, true, false); - server.createQueue(SimpleString.toSimpleString(JMSBridgeImplTest.TARGET), RoutingType.ANYCAST, SimpleString.toSimpleString(JMSBridgeImplTest.TARGET), null, true, false); + server.createQueue(new QueueConfiguration(JMSBridgeImplTest.SOURCE).setRoutingType(RoutingType.ANYCAST)); + server.createQueue(new QueueConfiguration(JMSBridgeImplTest.TARGET).setRoutingType(RoutingType.ANYCAST)); } @Test diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/message/impl/MessageImplTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/message/impl/MessageImplTest.java index da9711d0a4..5bec653ed2 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/message/impl/MessageImplTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/message/impl/MessageImplTest.java @@ -23,6 +23,7 @@ import java.util.concurrent.atomic.AtomicInteger; import org.apache.activemq.artemis.api.core.ActiveMQBuffer; import org.apache.activemq.artemis.api.core.ICoreMessage; import org.apache.activemq.artemis.api.core.Message; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; @@ -432,7 +433,7 @@ public class MessageImplTest extends ActiveMQTestBase { session = addClientSession(sf.createSession(false, false, 0)); - session.createQueue(ADDRESS, ADDRESS, true); + session.createQueue(new QueueConfiguration(ADDRESS)); ClientProducer producer = session.createProducer(ADDRESS); diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/QueueImplTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/QueueImplTest.java index a92d0a49fa..0ff9e0d7dc 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/QueueImplTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/QueueImplTest.java @@ -28,6 +28,7 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import org.apache.activemq.artemis.api.core.Message; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientProducer; @@ -1272,7 +1273,7 @@ public class QueueImplTest extends ActiveMQTestBase { ClientSessionFactory factory = createSessionFactory(locator); ClientSession session = addClientSession(factory.createSession(false, true, true)); - session.createQueue(MY_ADDRESS, MY_QUEUE, true); + session.createQueue(new QueueConfiguration(MY_QUEUE).setAddress(MY_ADDRESS)); ClientProducer producer = addClientProducer(session.createProducer(MY_ADDRESS)); 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 fceb3b7911..d617f64adc 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 @@ -23,6 +23,7 @@ import java.util.Set; import org.apache.activemq.artemis.api.core.Message; import org.apache.activemq.artemis.api.core.Pair; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.core.filter.Filter; import org.apache.activemq.artemis.core.persistence.impl.nullpm.NullStorageManager; @@ -81,6 +82,11 @@ public class FakePostOffice implements PostOffice { return null; } + @Override + public QueueBinding updateQueue(QueueConfiguration queueConfiguration) throws Exception { + return null; + } + @Override public AddressInfo updateAddressInfo(SimpleString addressName, EnumSet routingTypes) throws Exception { diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeQueueFactory.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeQueueFactory.java index 70b2eb4cd4..d88923909f 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeQueueFactory.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeQueueFactory.java @@ -20,13 +20,16 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.core.filter.Filter; +import org.apache.activemq.artemis.core.paging.PagingManager; import org.apache.activemq.artemis.core.paging.cursor.PageSubscription; import org.apache.activemq.artemis.core.postoffice.PostOffice; import org.apache.activemq.artemis.core.server.Queue; import org.apache.activemq.artemis.core.server.QueueConfig; import org.apache.activemq.artemis.core.server.QueueFactory; +import org.apache.activemq.artemis.core.server.impl.QueueFactoryImpl; import org.apache.activemq.artemis.core.server.impl.QueueImpl; import org.apache.activemq.artemis.utils.ActiveMQThreadFactory; import org.apache.activemq.artemis.utils.actors.ArtemisExecutor; @@ -46,6 +49,12 @@ public final class FakeQueueFactory implements QueueFactory { scheduledExecutor, postOffice, null, null, ArtemisExecutor.delegate(executor), null, this); } + @Override + public Queue createQueueWith(QueueConfiguration config, PagingManager pagingManager) throws Exception { + PageSubscription pageSubscription = QueueFactoryImpl.getPageSubscription(config, pagingManager); + return new QueueImpl(config, pageSubscription != null ? pageSubscription.getPagingStore() : null, pageSubscription, scheduledExecutor, postOffice, null, null, ArtemisExecutor.delegate(executor), null, this); + } + @Deprecated @Override public Queue createQueue(final long persistenceID, diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/ResourceAdapterTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/ResourceAdapterTest.java index 1cb6798388..2ad2477ab7 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/ResourceAdapterTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/ResourceAdapterTest.java @@ -22,6 +22,7 @@ import java.util.HashMap; import java.util.Map; import org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration; +import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; @@ -436,7 +437,7 @@ public class ResourceAdapterTest extends ActiveMQTestBase { ClientSessionFactory factory = createSessionFactory(locator); ClientSession session = factory.createSession(false, false, false); ActiveMQDestination queue = (ActiveMQDestination) ActiveMQJMSClient.createQueue("test"); - session.createQueue(queue.getSimpleAddress(), queue.getSimpleAddress(), true); + session.createQueue(new QueueConfiguration(queue.getSimpleAddress())); session.close(); ActiveMQResourceAdapter ra = new ActiveMQResourceAdapter();