diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/xml/XMLMessageImporter.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/xml/XMLMessageImporter.java index 800af929c5..95819090d4 100644 --- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/xml/XMLMessageImporter.java +++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/xml/XMLMessageImporter.java @@ -225,7 +225,7 @@ public class XMLMessageImporter { message.putLongProperty(key, Long.parseLong(value)); break; case XmlDataConstants.PROPERTY_TYPE_SIMPLE_STRING: - message.putStringProperty(new SimpleString(key), value == null ? null : SimpleString.toSimpleString(value)); + message.putStringProperty(SimpleString.of(key), value == null ? null : SimpleString.of(value)); break; case XmlDataConstants.PROPERTY_TYPE_STRING: message.putStringProperty(key, value); @@ -270,7 +270,7 @@ public class XMLMessageImporter { * the processor, and reset the cdata for the next event(s) */ if (decodeTextMessage) { - SimpleString text = new SimpleString(cdata.toString()); + SimpleString text = SimpleString.of(cdata.toString()); ByteBuf byteBuf = ByteBufAllocator.DEFAULT.buffer(SimpleString.sizeofNullableString(text)); SimpleString.writeNullableSimpleString(byteBuf, text); byte[] bytes = new byte[SimpleString.sizeofNullableString(text)]; 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 538faa6dc3..c5e063f390 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 @@ -357,7 +357,7 @@ public final class XmlDataImporter extends ConnectionConfigurationAbtract { } message.putBytesProperty(Message.HDR_ROUTE_TO_IDS, buffer.array()); - producer.send(SimpleString.toSimpleString(destination), message); + producer.send(SimpleString.of(destination), message); } private void oldBinding() throws Exception { @@ -416,14 +416,14 @@ public final class XmlDataImporter extends ConnectionConfigurationAbtract { } - ClientSession.AddressQuery addressQuery = session.addressQuery(SimpleString.toSimpleString(address)); + ClientSession.AddressQuery addressQuery = session.addressQuery(SimpleString.of(address)); if (!addressQuery.isExists()) { - session.createAddress(SimpleString.toSimpleString(address), routingType, true); + session.createAddress(SimpleString.of(address), routingType, true); } if (!filter.equals(FilterImpl.GENERIC_IGNORED_FILTER)) { - ClientSession.QueueQuery queueQuery = session.queueQuery(new SimpleString(queueName)); + ClientSession.QueueQuery queueQuery = session.queueQuery(SimpleString.of(queueName)); if (!queueQuery.isExists()) { session.createQueue(new QueueConfiguration(queueName).setAddress(address).setRoutingType(routingType).setFilterString(filter)); @@ -463,7 +463,7 @@ public final class XmlDataImporter extends ConnectionConfigurationAbtract { } } - ClientSession.QueueQuery queueQuery = session.queueQuery(new SimpleString(queueName)); + ClientSession.QueueQuery queueQuery = session.queueQuery(SimpleString.of(queueName)); if (!queueQuery.isExists()) { session.createQueue(new QueueConfiguration(queueName).setAddress(address).setRoutingType(RoutingType.valueOf(routingType)).setFilterString(filter)); @@ -493,14 +493,14 @@ public final class XmlDataImporter extends ConnectionConfigurationAbtract { } } - ClientSession.AddressQuery addressQuery = session.addressQuery(new SimpleString(addressName)); + ClientSession.AddressQuery addressQuery = session.addressQuery(SimpleString.of(addressName)); if (!addressQuery.isExists()) { EnumSet set = EnumSet.noneOf(RoutingType.class); for (String routingType : ListUtil.toList(routingTypes)) { set.add(RoutingType.valueOf(routingType)); } - session.createAddress(SimpleString.toSimpleString(addressName), set, false); + session.createAddress(SimpleString.of(addressName), set, false); logger.debug("Binding address(name={}, routingTypes={})", addressName, routingTypes); } else { logger.debug("Binding {} already exists so won't re-bind.", addressName); diff --git a/artemis-cli/src/test/java/org/apache/activemq/cli/test/ArtemisTest.java b/artemis-cli/src/test/java/org/apache/activemq/cli/test/ArtemisTest.java index 305ce977a2..c4c4be680f 100644 --- a/artemis-cli/src/test/java/org/apache/activemq/cli/test/ArtemisTest.java +++ b/artemis-cli/src/test/java/org/apache/activemq/cli/test/ArtemisTest.java @@ -1399,14 +1399,14 @@ public class ArtemisTest extends CliTestBase { for (String str : queues.split(",")) { String[] seg = str.split(":"); RoutingType routingType = RoutingType.valueOf((seg.length == 2 ? seg[1] : "anycast").toUpperCase()); - ClientSession.QueueQuery queryResult = coreSession.queueQuery(SimpleString.toSimpleString(seg[0])); + ClientSession.QueueQuery queryResult = coreSession.queueQuery(SimpleString.of(seg[0])); assertTrue(queryResult.isExists(), "Couldn't find queue " + seg[0]); assertEquals(routingType, queryResult.getRoutingType()); } for (String str : addresses.split(",")) { String[] seg = str.split(":"); RoutingType routingType = RoutingType.valueOf((seg.length == 2 ? seg[1] : "multicast").toUpperCase()); - ClientSession.AddressQuery queryResult = coreSession.addressQuery(SimpleString.toSimpleString(seg[0])); + ClientSession.AddressQuery queryResult = coreSession.addressQuery(SimpleString.of(seg[0])); assertTrue(queryResult.isExists(), "Couldn't find address " + str); assertTrue(routingType == RoutingType.ANYCAST ? queryResult.isSupportsAnycast() : queryResult.isSupportsMulticast()); } 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 a8af6d4564..0144fdd84e 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 @@ -28,7 +28,7 @@ public class ParameterisedAddress { public static SimpleString toParameterisedAddress(SimpleString address, Map parameters) { if (parameters != null && !parameters.isEmpty()) { - return SimpleString.toSimpleString(toParameterisedAddress(address.toString(), parameters)); + return SimpleString.of(toParameterisedAddress(address.toString(), parameters)); } else { return address; } @@ -71,11 +71,11 @@ public class ParameterisedAddress { @Deprecated public ParameterisedAddress(String address, QueueAttributes queueAttributes) { - this(SimpleString.toSimpleString(address), queueAttributes.toQueueConfiguration()); + this(SimpleString.of(address), queueAttributes.toQueueConfiguration()); } public ParameterisedAddress(String address, QueueConfiguration queueConfiguration) { - this(SimpleString.toSimpleString(address), queueConfiguration); + this(SimpleString.of(address), queueConfiguration); } public ParameterisedAddress(SimpleString address) { @@ -85,10 +85,10 @@ public class ParameterisedAddress { public ParameterisedAddress(String address) { int index = address.indexOf('?'); if (index == -1) { - this.address = SimpleString.toSimpleString(address); + this.address = SimpleString.of(address); this.queueConfiguration = null; } else { - this.address = SimpleString.toSimpleString(address.substring(0, index)); + this.address = SimpleString.of(address.substring(0, index)); QueueConfiguration queueConfiguration = new QueueConfiguration(address); parseQuery(address).forEach(queueConfiguration::set); this.queueConfiguration = queueConfiguration; @@ -108,7 +108,7 @@ public class ParameterisedAddress { } public static SimpleString extractAddress(SimpleString address) { - return SimpleString.toSimpleString(extractAddress(address.toString())); + return SimpleString.of(extractAddress(address.toString())); } /** 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 c9c47f1536..700316a7b4 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 @@ -71,7 +71,7 @@ public class QueueAttributes implements Serializable { if (key.equals(ROUTING_TYPE)) { setRoutingType(RoutingType.valueOf(value.toUpperCase())); } else if (key.equals(FILTER_STRING)) { - setFilterString(SimpleString.toSimpleString(value)); + setFilterString(SimpleString.of(value)); } else if (key.equals(DURABLE)) { setDurable(Boolean.valueOf(value)); } else if (key.equals(MAX_CONSUMERS)) { @@ -81,7 +81,7 @@ public class QueueAttributes implements Serializable { } else if (key.equals(LAST_VALUE)) { setLastValue(Boolean.valueOf(value)); } else if (key.equals(LAST_VALUE_KEY)) { - setLastValueKey(SimpleString.toSimpleString(value)); + setLastValueKey(SimpleString.of(value)); } else if (key.equals(NON_DESTRUCTIVE)) { setNonDestructive(Boolean.valueOf(value)); } else if (key.equals(PURGE_ON_NO_CONSUMERS)) { @@ -99,7 +99,7 @@ public class QueueAttributes implements Serializable { } else if (key.equals(GROUP_BUCKETS)) { setGroupBuckets(Integer.valueOf(value)); } else if (key.equals(GROUP_FIRST_KEY)) { - setGroupFirstKey(SimpleString.toSimpleString(value)); + setGroupFirstKey(SimpleString.of(value)); } else if (key.equals(AUTO_DELETE)) { setAutoDelete(Boolean.valueOf(value)); } else if (key.equals(AUTO_DELETE_DELAY)) { 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 index 42b4f45b2d..db8fdb8fbb 100644 --- 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 @@ -168,7 +168,7 @@ public class QueueConfiguration implements Serializable { * @param name the name to use for the queue */ public QueueConfiguration(String name) { - this(SimpleString.toSimpleString(name)); + this(SimpleString.of(name)); } /** @@ -227,7 +227,7 @@ public class QueueConfiguration implements Serializable { } else if (key.equals(DURABLE)) { setDurable(Boolean.valueOf(value)); } else if (key.equals(USER)) { - setUser(SimpleString.toSimpleString(value)); + setUser(SimpleString.of(value)); } else if (key.equals(MAX_CONSUMERS)) { setMaxConsumers(Integer.valueOf(value)); } else if (key.equals(EXCLUSIVE)) { @@ -320,7 +320,7 @@ public class QueueConfiguration implements Serializable { * @see QueueConfiguration#setAddress(SimpleString) */ public QueueConfiguration setAddress(String address) { - return setAddress(SimpleString.toSimpleString(address)); + return setAddress(SimpleString.of(address)); } public SimpleString getName() { @@ -350,7 +350,7 @@ public class QueueConfiguration implements Serializable { * @see QueueConfiguration#setName(SimpleString) */ public QueueConfiguration setName(String name) { - return setName(SimpleString.toSimpleString(name)); + return setName(SimpleString.of(name)); } public RoutingType getRoutingType() { @@ -372,7 +372,7 @@ public class QueueConfiguration implements Serializable { } public QueueConfiguration setFilterString(String filterString) { - return setFilterString(filterString == null ? null : SimpleString.toSimpleString(filterString)); + return setFilterString(filterString == null ? null : SimpleString.of(filterString)); } /** @@ -398,7 +398,7 @@ public class QueueConfiguration implements Serializable { } public QueueConfiguration setUser(String user) { - return setUser(SimpleString.toSimpleString(user)); + return setUser(SimpleString.of(user)); } public Integer getMaxConsumers() { @@ -438,7 +438,7 @@ public class QueueConfiguration implements Serializable { } public QueueConfiguration setLastValueKey(String lastValueKey) { - return setLastValueKey(SimpleString.toSimpleString(lastValueKey)); + return setLastValueKey(SimpleString.of(lastValueKey)); } public Boolean isNonDestructive() { @@ -533,7 +533,7 @@ public class QueueConfiguration implements Serializable { } public QueueConfiguration setGroupFirstKey(String groupFirstKey) { - return setGroupFirstKey(SimpleString.toSimpleString(groupFirstKey)); + return setGroupFirstKey(SimpleString.of(groupFirstKey)); } public Boolean isAutoDelete() { diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/SimpleString.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/SimpleString.java index 51a76fe35f..9b64e8e945 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/SimpleString.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/SimpleString.java @@ -35,7 +35,7 @@ import org.apache.activemq.artemis.utils.DataConstants; */ public final class SimpleString implements CharSequence, Serializable, Comparable { - private static final SimpleString EMPTY = new SimpleString(""); + private static final SimpleString EMPTY = SimpleString.of(""); private static final long serialVersionUID = 4204223851422244307L; private final byte[] data; @@ -56,26 +56,89 @@ public final class SimpleString implements CharSequence, Serializable, Comparabl * @param string String used to instantiate a SimpleString. * @return A new SimpleString */ - public static SimpleString toSimpleString(final String string) { + public static SimpleString of(final String string) { if (string == null) { return null; } return new SimpleString(string); } - public static SimpleString toSimpleString(final String string, StringSimpleStringPool pool) { + /** + * Returns a SimpleString constructed from the {@code string} parameter. + *

+ * If {@code string} is {@code null}, the return value will be {@code null} too. + * + * @param string String used to instantiate a SimpleString. + * @param pool The pool from which to create the SimpleString + * @return A new SimpleString + */ + public static SimpleString of(final String string, StringSimpleStringPool pool) { if (pool == null) { - return toSimpleString(string); + return of(string); } return pool.getOrCreate(string); } + /** + * creates a SimpleString from a byte array + * + * @param data the byte array to use + */ + public static SimpleString of(final byte[] data) { + return new SimpleString(data); + } + + /** + * creates a SimpleString from a character + * + * @param c the char to use + */ + public static SimpleString of(final char c) { + return new SimpleString(c); + } + + /** + * Returns a SimpleString constructed from the {@code string} parameter. + *

+ * If {@code string} is {@code null}, the return value will be {@code null} too. + * + * @deprecated + * Use {@link #of(String)} instead. + * + * @param string String used to instantiate a SimpleString. + * @return A new SimpleString + */ + @Deprecated(forRemoval = true) + public static SimpleString toSimpleString(final String string) { + return of(string); + } + + /** + * Returns a SimpleString constructed from the {@code string} parameter. + *

+ * If {@code string} is {@code null}, the return value will be {@code null} too. + * + * @deprecated + * Use {@link #of(String, StringSimpleStringPool)} instead. + * + * @param string String used to instantiate a SimpleString. + * @param pool The pool from which to create the SimpleString + * @return A new SimpleString + */ + @Deprecated(forRemoval = true) + public static SimpleString toSimpleString(final String string, StringSimpleStringPool pool) { + return of(string, pool); + } /** * creates a SimpleString from a conventional String * + * @deprecated + * Use {@link #of(String)} instead. + * * @param string the string to transform */ + @Deprecated(forRemoval = true) public SimpleString(final String string) { int len = string.length(); @@ -101,12 +164,25 @@ public final class SimpleString implements CharSequence, Serializable, Comparabl /** * creates a SimpleString from a byte array * + * @deprecated + * Use {@link #of(byte[])} instead. + * * @param data the byte array to use */ + @Deprecated(forRemoval = true) public SimpleString(final byte[] data) { this.data = data; } + /** + * creates a SimpleString from a character + * + * @deprecated + * Use {@link #of(char)} instead. + * + * @param c the char to use + */ + @Deprecated(forRemoval = true) public SimpleString(final char c) { data = new byte[2]; @@ -180,7 +256,7 @@ public final class SimpleString implements CharSequence, Serializable, Comparabl } byte[] data = new byte[length]; buffer.readBytes(data); - return new SimpleString(data); + return SimpleString.of(data); } public static void writeNullableSimpleString(ByteBuf buffer, SimpleString val) { @@ -209,7 +285,7 @@ public final class SimpleString implements CharSequence, Serializable, Comparabl System.arraycopy(data, start << 1, bytes, 0, newlen); - return new SimpleString(bytes); + return SimpleString.of(bytes); } } @@ -387,7 +463,7 @@ public final class SimpleString implements CharSequence, Serializable, Comparabl // Note by Clebert all = new ArrayList<>(2); } - all.add(new SimpleString(bytes)); + all.add(SimpleString.of(bytes)); } } @@ -397,7 +473,7 @@ public final class SimpleString implements CharSequence, Serializable, Comparabl // Adding the last one byte[] bytes = new byte[data.length - lasPos]; System.arraycopy(data, lasPos, bytes, 0, bytes.length); - all.add(new SimpleString(bytes)); + all.add(SimpleString.of(bytes)); // Converting it to arrays SimpleString[] parts = new SimpleString[all.size()]; @@ -445,7 +521,7 @@ public final class SimpleString implements CharSequence, Serializable, Comparabl final int ssIndex = startIndex << 1; final int delIndex = endIndex << 1; final byte[] bytes = Arrays.copyOfRange(data, ssIndex, delIndex); - ss = new SimpleString(bytes); + ss = SimpleString.of(bytes); } // We will create the ArrayList lazily if (all == null) { @@ -513,7 +589,7 @@ public final class SimpleString implements CharSequence, Serializable, Comparabl bytes[offset] = (byte) (c & 0xFF); bytes[offset + 1] = (byte) (c >> 8 & 0xFF); } - return new SimpleString(bytes); + return SimpleString.of(bytes); } /** @@ -526,7 +602,7 @@ public final class SimpleString implements CharSequence, Serializable, Comparabl byte[] bytes = new byte[data.length + toAdd.getData().length]; System.arraycopy(data, 0, bytes, 0, data.length); System.arraycopy(toAdd.getData(), 0, bytes, data.length, toAdd.getData().length); - return new SimpleString(bytes); + return SimpleString.of(bytes); } /** @@ -540,7 +616,7 @@ public final class SimpleString implements CharSequence, Serializable, Comparabl System.arraycopy(data, 0, bytes, 0, data.length); bytes[data.length] = (byte) (c & 0xFF); bytes[data.length + 1] = (byte) (c >> 8 & 0xFF); - return new SimpleString(bytes); + return SimpleString.of(bytes); } /** @@ -660,7 +736,7 @@ public final class SimpleString implements CharSequence, Serializable, Comparabl @Override protected SimpleString create(String value) { - return toSimpleString(value); + return of(value); } @Override diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/core/persistence/CoreMessageObjectPools.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/core/persistence/CoreMessageObjectPools.java index 5db9d53af3..074680531b 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/core/persistence/CoreMessageObjectPools.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/core/persistence/CoreMessageObjectPools.java @@ -72,6 +72,6 @@ public class CoreMessageObjectPools { } public static SimpleString cachedAddressSimpleString(String address, CoreMessageObjectPools coreMessageObjectPools) { - return SimpleString.toSimpleString(address, coreMessageObjectPools == null ? null : coreMessageObjectPools.getAddressStringSimpleStringPool()); + return SimpleString.of(address, coreMessageObjectPools == null ? null : coreMessageObjectPools.getAddressStringSimpleStringPool()); } } diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ByteUtil.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ByteUtil.java index 45ff7f9de4..6e192bd7ae 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ByteUtil.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ByteUtil.java @@ -167,7 +167,7 @@ public class ByteUtil { } public static String toSimpleString(byte[] bytes) { - SimpleString simpleString = new SimpleString(bytes); + SimpleString simpleString = SimpleString.of(bytes); String value = simpleString.toString(); for (char c : value.toCharArray()) { 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 65bbd2d250..e22c8ae89b 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 @@ -23,7 +23,7 @@ public class CompositeAddress { public static final String SEPARATOR = "::"; public static String toFullyQualified(String address, String qName) { - return toFullyQualified(SimpleString.toSimpleString(address), SimpleString.toSimpleString(qName)).toString(); + return toFullyQualified(SimpleString.of(address), SimpleString.of(qName)).toString(); } public static SimpleString toFullyQualified(SimpleString address, SimpleString qName) { @@ -58,7 +58,7 @@ public class CompositeAddress { if (queueName.equals(nameString)) { return name; } - return new SimpleString(queueName); + return SimpleString.of(queueName); } public static String extractQueueName(String queue) { @@ -81,7 +81,7 @@ public class CompositeAddress { if (addressName.equals(addrString)) { return address; } - return new SimpleString(addressName); + return SimpleString.of(addressName); } public static String extractAddressName(String address) { diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/DestinationUtil.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/DestinationUtil.java index 95fa7d6a88..ce693970cd 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/DestinationUtil.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/DestinationUtil.java @@ -68,7 +68,7 @@ public class DestinationUtil { escape(subscriptionName); } } - return SimpleString.toSimpleString(queueName); + return SimpleString.of(queueName); } } diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/RandomUtil.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/RandomUtil.java index 54f44bd139..1ccc8a1fff 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/RandomUtil.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/RandomUtil.java @@ -37,7 +37,7 @@ public class RandomUtil { } public static SimpleString randomSimpleString() { - return new SimpleString(RandomUtil.randomString()); + return SimpleString.of(RandomUtil.randomString()); } public static char randomChar() { diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/UTF8Util.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/UTF8Util.java index 87a929c277..b6cb93e047 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/UTF8Util.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/UTF8Util.java @@ -69,7 +69,7 @@ public final class UTF8Util { saveUTF(buffer, val); } else { // Store as SimpleString, since can't store utf > 0xffff in length - SimpleString.writeSimpleString(buffer, new SimpleString(val)); + SimpleString.writeSimpleString(buffer, SimpleString.of(val)); } } diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/UUIDGenerator.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/UUIDGenerator.java index db5b7465e3..b0f84d36cf 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/UUIDGenerator.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/UUIDGenerator.java @@ -169,7 +169,7 @@ public final class UUIDGenerator { } public SimpleString generateSimpleStringUUID() { - return new SimpleString(generateStringUUID()); + return SimpleString.of(generateStringUUID()); } public UUID generateUUID() { diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/bean/MetaBean.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/bean/MetaBean.java index 70bb0b16e7..70fbcb2c6d 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/bean/MetaBean.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/bean/MetaBean.java @@ -192,7 +192,7 @@ public class MetaBean { } else if (type == String.class) { setter.accept(resultObject, json.getString(name)); } else if (type == SimpleString.class) { - setter.accept(resultObject, SimpleString.toSimpleString(json.getString(name))); + setter.accept(resultObject, SimpleString.of(json.getString(name))); } else if (type == Integer.class) { setter.accept(resultObject, json.getInt(name)); } else if (type == Long.class) { diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/TypedProperties.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/TypedProperties.java index 528802388d..6450cd3bf1 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/TypedProperties.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/TypedProperties.java @@ -297,21 +297,21 @@ public class TypedProperties { if (value instanceof SimpleString) { return (SimpleString) value; } else if (value instanceof Boolean) { - return new SimpleString(value.toString()); + return SimpleString.of(value.toString()); } else if (value instanceof Character) { - return new SimpleString(value.toString()); + return SimpleString.of(value.toString()); } else if (value instanceof Byte) { - return new SimpleString(value.toString()); + return SimpleString.of(value.toString()); } else if (value instanceof Short) { - return new SimpleString(value.toString()); + return SimpleString.of(value.toString()); } else if (value instanceof Integer) { - return new SimpleString(value.toString()); + return SimpleString.of(value.toString()); } else if (value instanceof Long) { - return new SimpleString(value.toString()); + return SimpleString.of(value.toString()); } else if (value instanceof Float) { - return new SimpleString(value.toString()); + return SimpleString.of(value.toString()); } else if (value instanceof Double) { - return new SimpleString(value.toString()); + return SimpleString.of(value.toString()); } throw new ActiveMQPropertyConversionException("Invalid conversion: " + key); } @@ -1199,7 +1199,7 @@ public class TypedProperties { } else if (value instanceof Double) { properties.putDoubleProperty(key, (Double) value); } else if (value instanceof String) { - properties.putSimpleStringProperty(key, new SimpleString((String) value)); + properties.putSimpleStringProperty(key, SimpleString.of((String) value)); } else if (value instanceof SimpleString) { properties.putSimpleStringProperty(key, (SimpleString) value); } else if (value instanceof byte[]) { diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesConcurrencyTest.java b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesConcurrencyTest.java index 72980898b1..09ab0ac52d 100644 --- a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesConcurrencyTest.java +++ b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesConcurrencyTest.java @@ -46,7 +46,7 @@ public class TypedPropertiesConcurrencyTest { try { countDownLatch.await(); for (int h = 0; h < 100; h++) { - props.putSimpleStringProperty(SimpleString.toSimpleString("S" + h), SimpleString.toSimpleString("hello")); + props.putSimpleStringProperty(SimpleString.of("S" + h), SimpleString.of("hello")); } props.clear(); } catch (ConcurrentModificationException t) { @@ -94,7 +94,7 @@ public class TypedPropertiesConcurrencyTest { try { countDownLatch.await(); for (int h = 0; h < 100; h++) { - props.putSimpleStringProperty(SimpleString.toSimpleString("S" + h), SimpleString.toSimpleString("hello")); + props.putSimpleStringProperty(SimpleString.of("S" + h), SimpleString.of("hello")); } props.getPropertyNames().clear(); } catch (UnsupportedOperationException uoe) { @@ -133,7 +133,7 @@ public class TypedPropertiesConcurrencyTest { @Test public void testEncodedSizeAfterClearIsSameAsNewTypedProperties() throws Exception { TypedProperties props = new TypedProperties(); - props.putSimpleStringProperty(SimpleString.toSimpleString("helllllloooooo"), SimpleString.toSimpleString("raaaaaaaaaaaaaaaaaaaaaaaa")); + props.putSimpleStringProperty(SimpleString.of("helllllloooooo"), SimpleString.of("raaaaaaaaaaaaaaaaaaaaaaaa")); props.clear(); @@ -144,7 +144,7 @@ public class TypedPropertiesConcurrencyTest { @Test public void testMemoryOffsetAfterClearIsSameAsNewTypedProperties() throws Exception { TypedProperties props = new TypedProperties(); - props.putSimpleStringProperty(SimpleString.toSimpleString("helllllloooooo"), SimpleString.toSimpleString("raaaaaaaaaaaaaaaaaaaaaaaa")); + props.putSimpleStringProperty(SimpleString.of("helllllloooooo"), SimpleString.of("raaaaaaaaaaaaaaaaaaaaaaaa")); props.clear(); diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesConversionTest.java b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesConversionTest.java index 520ddf18dc..1efc761337 100644 --- a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesConversionTest.java +++ b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesConversionTest.java @@ -36,7 +36,7 @@ public class TypedPropertiesConversionTest { private SimpleString key; - private final SimpleString unknownKey = new SimpleString("this.key.is.never.used"); + private final SimpleString unknownKey = SimpleString.of("this.key.is.never.used"); @BeforeEach public void setUp() throws Exception { @@ -50,9 +50,9 @@ public class TypedPropertiesConversionTest { props.putBooleanProperty(key, val); assertEquals(val, props.getBooleanProperty(key)); - assertEquals(new SimpleString(Boolean.toString(val)), props.getSimpleStringProperty(key)); + assertEquals(SimpleString.of(Boolean.toString(val)), props.getSimpleStringProperty(key)); - props.putSimpleStringProperty(key, new SimpleString(Boolean.toString(val))); + props.putSimpleStringProperty(key, SimpleString.of(Boolean.toString(val))); assertEquals(val, props.getBooleanProperty(key)); try { @@ -71,7 +71,7 @@ public class TypedPropertiesConversionTest { props.putCharProperty(key, val); assertEquals(val, props.getCharProperty(key)); - assertEquals(new SimpleString(Character.toString(val)), props.getSimpleStringProperty(key)); + assertEquals(SimpleString.of(Character.toString(val)), props.getSimpleStringProperty(key)); try { props.putByteProperty(key, RandomUtil.randomByte()); @@ -93,9 +93,9 @@ public class TypedPropertiesConversionTest { props.putByteProperty(key, val); assertEquals(val, props.getByteProperty(key)); - assertEquals(new SimpleString(Byte.toString(val)), props.getSimpleStringProperty(key)); + assertEquals(SimpleString.of(Byte.toString(val)), props.getSimpleStringProperty(key)); - props.putSimpleStringProperty(key, new SimpleString(Byte.toString(val))); + props.putSimpleStringProperty(key, SimpleString.of(Byte.toString(val))); assertEquals(val, props.getByteProperty(key)); try { @@ -130,9 +130,9 @@ public class TypedPropertiesConversionTest { props.putIntProperty(key, val); assertEquals(val, props.getIntProperty(key)); - assertEquals(new SimpleString(Integer.toString(val)), props.getSimpleStringProperty(key)); + assertEquals(SimpleString.of(Integer.toString(val)), props.getSimpleStringProperty(key)); - props.putSimpleStringProperty(key, new SimpleString(Integer.toString(val))); + props.putSimpleStringProperty(key, SimpleString.of(Integer.toString(val))); assertEquals(val, props.getIntProperty(key)); Byte byteVal = RandomUtil.randomByte(); @@ -159,9 +159,9 @@ public class TypedPropertiesConversionTest { props.putLongProperty(key, val); assertEquals(val, props.getLongProperty(key)); - assertEquals(new SimpleString(Long.toString(val)), props.getSimpleStringProperty(key)); + assertEquals(SimpleString.of(Long.toString(val)), props.getSimpleStringProperty(key)); - props.putSimpleStringProperty(key, new SimpleString(Long.toString(val))); + props.putSimpleStringProperty(key, SimpleString.of(Long.toString(val))); assertEquals(val, props.getLongProperty(key)); Byte byteVal = RandomUtil.randomByte(); @@ -196,9 +196,9 @@ public class TypedPropertiesConversionTest { props.putDoubleProperty(key, val); assertEquals(val, props.getDoubleProperty(key)); - assertEquals(new SimpleString(Double.toString(val)), props.getSimpleStringProperty(key)); + assertEquals(SimpleString.of(Double.toString(val)), props.getSimpleStringProperty(key)); - props.putSimpleStringProperty(key, new SimpleString(Double.toString(val))); + props.putSimpleStringProperty(key, SimpleString.of(Double.toString(val))); assertEquals(val, props.getDoubleProperty(key)); try { @@ -222,9 +222,9 @@ public class TypedPropertiesConversionTest { assertEquals(val, props.getFloatProperty(key)); assertEquals(Double.valueOf(val), props.getDoubleProperty(key)); - assertEquals(new SimpleString(Float.toString(val)), props.getSimpleStringProperty(key)); + assertEquals(SimpleString.of(Float.toString(val)), props.getSimpleStringProperty(key)); - props.putSimpleStringProperty(key, new SimpleString(Float.toString(val))); + props.putSimpleStringProperty(key, SimpleString.of(Float.toString(val))); assertEquals(val, props.getFloatProperty(key)); try { @@ -248,9 +248,9 @@ public class TypedPropertiesConversionTest { assertEquals(val, props.getShortProperty(key)); assertEquals(Integer.valueOf(val), props.getIntProperty(key)); - assertEquals(new SimpleString(Short.toString(val)), props.getSimpleStringProperty(key)); + assertEquals(SimpleString.of(Short.toString(val)), props.getSimpleStringProperty(key)); - props.putSimpleStringProperty(key, new SimpleString(Short.toString(val))); + props.putSimpleStringProperty(key, SimpleString.of(Short.toString(val))); assertEquals(val, props.getShortProperty(key)); Byte byteVal = RandomUtil.randomByte(); diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesTest.java b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesTest.java index 3b24cd41ee..d556954186 100644 --- a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesTest.java +++ b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesTest.java @@ -238,7 +238,7 @@ public class TypedPropertiesTest { TypedPropertiesTest.assertEqualsTypeProperties(emptyProps, decodedProps); } - private static final SimpleString PROP_NAME = SimpleString.toSimpleString("TEST_PROP"); + private static final SimpleString PROP_NAME = SimpleString.of("TEST_PROP"); @Test public void testCannotClearInternalPropertiesIfEmpty() { @@ -268,7 +268,7 @@ public class TypedPropertiesTest { ByteBuf buf = Unpooled.buffer(Byte.BYTES, Byte.BYTES); props.encode(buf); buf.resetReaderIndex(); - assertFalse(searchProperty(SimpleString.toSimpleString(""), buf, 0), "There is no property"); + assertFalse(searchProperty(SimpleString.of(""), buf, 0), "There is no property"); } @Test @@ -294,7 +294,7 @@ public class TypedPropertiesTest { assertFalse(searchProperty(value, buf, 0)); props.forEachKey(key -> { assertTrue(searchProperty(key, buf, 0)); - assertTrue(searchProperty(SimpleString.toSimpleString(key.toString()), buf, 0)); + assertTrue(searchProperty(SimpleString.of(key.toString()), buf, 0)); // concat a string just to check if the search won't perform an eager search to find the string pattern assertFalse(searchProperty(key.concat(" "), buf, 0)); }); @@ -308,7 +308,7 @@ public class TypedPropertiesTest { buf.writeByte(DataConstants.NOT_NULL); buf.writeInt(1); buf.resetReaderIndex(); - searchProperty(SimpleString.toSimpleString(" "), buf, 0); + searchProperty(SimpleString.of(" "), buf, 0); }); } @@ -322,7 +322,7 @@ public class TypedPropertiesTest { //SimpleString::data length buf.writeInt(2); buf.resetReaderIndex(); - searchProperty(SimpleString.toSimpleString("a"), buf, 0); + searchProperty(SimpleString.of("a"), buf, 0); }); } @@ -339,7 +339,7 @@ public class TypedPropertiesTest { // invalid type buf.writeByte(Byte.MIN_VALUE); buf.resetReaderIndex(); - searchProperty(SimpleString.toSimpleString(""), buf, 0); + searchProperty(SimpleString.of(""), buf, 0); }); } @@ -355,7 +355,7 @@ public class TypedPropertiesTest { // invalid type buf.writeByte(Byte.MIN_VALUE); buf.resetReaderIndex(); - assertFalse(searchProperty(SimpleString.toSimpleString(""), buf, 0)); + assertFalse(searchProperty(SimpleString.of(""), buf, 0)); } @BeforeEach @@ -369,10 +369,10 @@ public class TypedPropertiesTest { final int capacity = 8; final int chars = Integer.toString(capacity).length(); final TypedProperties.StringValue.ByteBufStringValuePool pool = new TypedProperties.StringValue.ByteBufStringValuePool(capacity, chars); - final int bytes = new SimpleString(Integer.toString(capacity)).sizeof(); + final int bytes = SimpleString.of(Integer.toString(capacity)).sizeof(); final ByteBuf bb = Unpooled.buffer(bytes, bytes); for (int i = 0; i < capacity; i++) { - final SimpleString s = new SimpleString(Integer.toString(i)); + final SimpleString s = SimpleString.of(Integer.toString(i)); bb.resetWriterIndex(); SimpleString.writeSimpleString(bb, s); bb.resetReaderIndex(); @@ -385,7 +385,7 @@ public class TypedPropertiesTest { @Test public void testByteBufStringValuePoolTooLong() { - final SimpleString tooLong = new SimpleString("aa"); + final SimpleString tooLong = SimpleString.of("aa"); final ByteBuf bb = Unpooled.buffer(tooLong.sizeof(), tooLong.sizeof()); SimpleString.writeSimpleString(bb, tooLong); final TypedProperties.StringValue.ByteBufStringValuePool pool = new TypedProperties.StringValue.ByteBufStringValuePool(1, tooLong.length() - 1); @@ -414,7 +414,7 @@ public class TypedPropertiesTest { }; t.start(); for (int i = 0; !error.get() && (i < 100 || copies.get() < 50); i++) { - properties.putIntProperty(SimpleString.toSimpleString("key" + i), i); + properties.putIntProperty(SimpleString.of("key" + i), i); } running.set(false); diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/bean/MetaBeanTest.java b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/bean/MetaBeanTest.java index 50f0076d90..0721104349 100644 --- a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/bean/MetaBeanTest.java +++ b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/bean/MetaBeanTest.java @@ -46,7 +46,7 @@ public class MetaBeanTest { sourceObject.setC(RandomUtil.randomInt()); sourceObject.setD(null); sourceObject.setIdCacheSize(333); - sourceObject.setSimpleString(SimpleString.toSimpleString("mySimpleString")); + sourceObject.setSimpleString(SimpleString.of("mySimpleString")); sourceObject.setFloatValue(33.33f); sourceObject.setDoubleValue(11.11); sourceObject.setBoolValue(true); @@ -71,7 +71,7 @@ public class MetaBeanTest { assertEquals(MyEnum.TWO, result.getMyEnum()); assertTrue(result.getBoolValue()); - sourceObject.setGated(SimpleString.toSimpleString("gated-now-has-value")); + sourceObject.setGated(SimpleString.of("gated-now-has-value")); jsonObject = MYClass.metaBean.toJSON(sourceObject, false); assertTrue(jsonObject.containsKey("gated")); assertEquals("gated-now-has-value", jsonObject.getString("gated")); diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/config/ActiveMQDefaultConfiguration.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/config/ActiveMQDefaultConfiguration.java index 7b996ceaa1..3b580f40b6 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/config/ActiveMQDefaultConfiguration.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/config/ActiveMQDefaultConfiguration.java @@ -176,10 +176,10 @@ public final class ActiveMQDefaultConfiguration { private static String DEFAULT_ADDRESS_PATH_SEPARATOR = "."; - private static SimpleString DEFAULT_MANAGEMENT_ADDRESS = new SimpleString("activemq.management"); + private static SimpleString DEFAULT_MANAGEMENT_ADDRESS = SimpleString.of("activemq.management"); // the name of the address that consumers bind to receive management notifications - private static SimpleString DEFAULT_MANAGEMENT_NOTIFICATION_ADDRESS = new SimpleString("activemq.notifications"); + private static SimpleString DEFAULT_MANAGEMENT_NOTIFICATION_ADDRESS = SimpleString.of("activemq.notifications"); // The default address used for clustering, empty string means all addresses private static String DEFAULT_CLUSTER_ADDRESS = ""; diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/FilterConstants.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/FilterConstants.java index 3803a5452f..e690ba602d 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/FilterConstants.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/FilterConstants.java @@ -25,57 +25,57 @@ public final class FilterConstants { /** * Name of the ActiveMQ Artemis UserID header. */ - public static final SimpleString ACTIVEMQ_USERID = new SimpleString("AMQUserID"); + public static final SimpleString ACTIVEMQ_USERID = SimpleString.of("AMQUserID"); /** * Name of the ActiveMQ Artemis Message expiration header. */ - public static final SimpleString ACTIVEMQ_EXPIRATION = new SimpleString("AMQExpiration"); + public static final SimpleString ACTIVEMQ_EXPIRATION = SimpleString.of("AMQExpiration"); /** * Name of the ActiveMQ Artemis Message durable header. */ - public static final SimpleString ACTIVEMQ_DURABLE = new SimpleString("AMQDurable"); + public static final SimpleString ACTIVEMQ_DURABLE = SimpleString.of("AMQDurable"); /** * Value for the Durable header when the message is non-durable. */ - public static final SimpleString NON_DURABLE = new SimpleString("NON_DURABLE"); + public static final SimpleString NON_DURABLE = SimpleString.of("NON_DURABLE"); /** * Value for the Durable header when the message is durable. */ - public static final SimpleString DURABLE = new SimpleString("DURABLE"); + public static final SimpleString DURABLE = SimpleString.of("DURABLE"); /** * Name of the ActiveMQ Artemis Message timestamp header. */ - public static final SimpleString ACTIVEMQ_TIMESTAMP = new SimpleString("AMQTimestamp"); + public static final SimpleString ACTIVEMQ_TIMESTAMP = SimpleString.of("AMQTimestamp"); /** * Name of the ActiveMQ Artemis Message priority header. */ - public static final SimpleString ACTIVEMQ_PRIORITY = new SimpleString("AMQPriority"); + public static final SimpleString ACTIVEMQ_PRIORITY = SimpleString.of("AMQPriority"); /** * Name of the ActiveMQ Artemis Message size header. */ - public static final SimpleString ACTIVEMQ_SIZE = new SimpleString("AMQSize"); + public static final SimpleString ACTIVEMQ_SIZE = SimpleString.of("AMQSize"); /** * Name of the ActiveMQ Artemis Address header */ - public static final SimpleString ACTIVEMQ_ADDRESS = new SimpleString("AMQAddress"); + public static final SimpleString ACTIVEMQ_ADDRESS = SimpleString.of("AMQAddress"); /** * Name of the ActiveMQ Artemis Message group id header. */ - public static final SimpleString ACTIVEMQ_GROUP_ID = new SimpleString("AMQGroupID"); + public static final SimpleString ACTIVEMQ_GROUP_ID = SimpleString.of("AMQGroupID"); /** * All ActiveMQ Artemis headers are prepended by this prefix. */ - public static final SimpleString ACTIVEMQ_PREFIX = new SimpleString("AMQ"); + public static final SimpleString ACTIVEMQ_PREFIX = SimpleString.of("AMQ"); /** * Proton protocol stores JMSMessageID as NATIVE_MESSAGE_ID diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/Message.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/Message.java index ff4a0c4182..88abfa5531 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/Message.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/Message.java @@ -86,98 +86,98 @@ public interface Message { name -> (name.startsWith(Message.HDR_ROUTE_TO_IDS) && !name.equals(Message.HDR_ROUTE_TO_IDS)) || (name.startsWith(Message.HDR_ROUTE_TO_ACK_IDS) && !name.equals(Message.HDR_ROUTE_TO_ACK_IDS)); - SimpleString HDR_ROUTE_TO_IDS = new SimpleString("_AMQ_ROUTE_TO"); + SimpleString HDR_ROUTE_TO_IDS = SimpleString.of("_AMQ_ROUTE_TO"); - SimpleString HDR_SCALEDOWN_TO_IDS = new SimpleString("_AMQ_SCALEDOWN_TO"); + SimpleString HDR_SCALEDOWN_TO_IDS = SimpleString.of("_AMQ_SCALEDOWN_TO"); - SimpleString HDR_ROUTE_TO_ACK_IDS = new SimpleString("_AMQ_ACK_ROUTE_TO"); + SimpleString HDR_ROUTE_TO_ACK_IDS = SimpleString.of("_AMQ_ACK_ROUTE_TO"); // used by the bridges to set duplicates - SimpleString HDR_BRIDGE_DUPLICATE_ID = new SimpleString("_AMQ_BRIDGE_DUP"); + SimpleString HDR_BRIDGE_DUPLICATE_ID = SimpleString.of("_AMQ_BRIDGE_DUP"); /** * the actual time the message was expired. * * * */ - SimpleString HDR_ACTUAL_EXPIRY_TIME = new SimpleString("_AMQ_ACTUAL_EXPIRY"); + SimpleString HDR_ACTUAL_EXPIRY_TIME = SimpleString.of("_AMQ_ACTUAL_EXPIRY"); /** * The original address of a message when a message is diverted or transferred through DLQ or expiry */ - SimpleString HDR_ORIGINAL_ADDRESS = new SimpleString("_AMQ_ORIG_ADDRESS"); + SimpleString HDR_ORIGINAL_ADDRESS = SimpleString.of("_AMQ_ORIG_ADDRESS"); /** * The original address of a message when a message is transferred through DLQ or expiry */ - SimpleString HDR_ORIGINAL_QUEUE = new SimpleString("_AMQ_ORIG_QUEUE"); + SimpleString HDR_ORIGINAL_QUEUE = SimpleString.of("_AMQ_ORIG_QUEUE"); /** * The original message ID before the message was transferred. */ - SimpleString HDR_ORIG_MESSAGE_ID = new SimpleString("_AMQ_ORIG_MESSAGE_ID"); + SimpleString HDR_ORIG_MESSAGE_ID = SimpleString.of("_AMQ_ORIG_MESSAGE_ID"); /** * For the Message Grouping feature. */ - SimpleString HDR_GROUP_ID = new SimpleString("_AMQ_GROUP_ID"); + SimpleString HDR_GROUP_ID = SimpleString.of("_AMQ_GROUP_ID"); - SimpleString HDR_GROUP_SEQUENCE = new SimpleString("_AMQ_GROUP_SEQUENCE"); + SimpleString HDR_GROUP_SEQUENCE = SimpleString.of("_AMQ_GROUP_SEQUENCE"); /** * to determine if the Large Message was compressed. */ - SimpleString HDR_LARGE_COMPRESSED = new SimpleString("_AMQ_LARGE_COMPRESSED"); + SimpleString HDR_LARGE_COMPRESSED = SimpleString.of("_AMQ_LARGE_COMPRESSED"); /** * The body size of a large message before it was compressed. */ - SimpleString HDR_LARGE_BODY_SIZE = new SimpleString("_AMQ_LARGE_SIZE"); + SimpleString HDR_LARGE_BODY_SIZE = SimpleString.of("_AMQ_LARGE_SIZE"); /** * To be used with Scheduled Delivery. */ - SimpleString HDR_SCHEDULED_DELIVERY_TIME = new SimpleString("_AMQ_SCHED_DELIVERY"); + SimpleString HDR_SCHEDULED_DELIVERY_TIME = SimpleString.of("_AMQ_SCHED_DELIVERY"); /** * To be used with duplicate detection. */ - SimpleString HDR_DUPLICATE_DETECTION_ID = new SimpleString("_AMQ_DUPL_ID"); + SimpleString HDR_DUPLICATE_DETECTION_ID = SimpleString.of("_AMQ_DUPL_ID"); /** * To be used with Last value queues. */ - SimpleString HDR_LAST_VALUE_NAME = new SimpleString("_AMQ_LVQ_NAME"); + SimpleString HDR_LAST_VALUE_NAME = SimpleString.of("_AMQ_LVQ_NAME"); /** * To define the mime-type of body messages. Mainly for stomp but it could be informed on any message for user purposes. */ - SimpleString HDR_CONTENT_TYPE = new SimpleString("_AMQ_CONTENT_TYPE"); + SimpleString HDR_CONTENT_TYPE = SimpleString.of("_AMQ_CONTENT_TYPE"); /** * The name of the validated user who sent the message. Useful for auditing. */ - SimpleString HDR_VALIDATED_USER = new SimpleString("_AMQ_VALIDATED_USER"); + SimpleString HDR_VALIDATED_USER = SimpleString.of("_AMQ_VALIDATED_USER"); /** * The Routing Type for this message. Ensures that this message is only routed to queues with matching routing type. */ - SimpleString HDR_ROUTING_TYPE = new SimpleString("_AMQ_ROUTING_TYPE"); + SimpleString HDR_ROUTING_TYPE = SimpleString.of("_AMQ_ROUTING_TYPE"); /** * The original routing type of a message before getting transferred through DLQ or expiry */ - SimpleString HDR_ORIG_ROUTING_TYPE = new SimpleString("_AMQ_ORIG_ROUTING_TYPE"); + SimpleString HDR_ORIG_ROUTING_TYPE = SimpleString.of("_AMQ_ORIG_ROUTING_TYPE"); /** * The time at which the message arrived at the broker. */ - SimpleString HDR_INGRESS_TIMESTAMP = new SimpleString("_AMQ_INGRESS_TIMESTAMP"); + SimpleString HDR_INGRESS_TIMESTAMP = SimpleString.of("_AMQ_INGRESS_TIMESTAMP"); /** * The prefix used (if any) when sending this message. For protocols (e.g. STOMP) that need to track this and restore * the prefix when the message is consumed. */ - SimpleString HDR_PREFIX = new SimpleString("_AMQ_PREFIX"); + SimpleString HDR_PREFIX = SimpleString.of("_AMQ_PREFIX"); byte DEFAULT_TYPE = 0; @@ -501,7 +501,7 @@ public interface Message { if (duplicateID instanceof SimpleString) { return ((SimpleString) duplicateID).getData(); } else if (duplicateID instanceof String) { - return new SimpleString(duplicateID.toString()).getData(); + return SimpleString.of(duplicateID.toString()).getData(); } else { return (byte[]) duplicateID; } 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 020887fb25..ce03d73ff2 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 @@ -51,7 +51,7 @@ public final class ClientRequestor implements AutoCloseable { queueSession = session; requestProducer = queueSession.createProducer(requestAddress); - replyQueue = new SimpleString(requestAddress + "." + UUID.randomUUID().toString()); + replyQueue = SimpleString.of(requestAddress + "." + UUID.randomUUID().toString()); queueSession.createQueue(new QueueConfiguration(replyQueue).setDurable(false).setTemporary(true)); replyConsumer = queueSession.createConsumer(replyQueue); } @@ -60,7 +60,7 @@ public final class ClientRequestor implements AutoCloseable { * @see ClientRequestor#ClientRequestor(ClientSession, SimpleString) */ public ClientRequestor(final ClientSession session, final String requestAddress) throws Exception { - this(session, SimpleString.toSimpleString(requestAddress)); + this(session, SimpleString.of(requestAddress)); } /** diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ManagementHelper.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ManagementHelper.java index 8f70139c4c..88090c2ef9 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ManagementHelper.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ManagementHelper.java @@ -36,63 +36,63 @@ import org.apache.activemq.artemis.core.message.impl.CoreMessage; */ public final class ManagementHelper { - public static final SimpleString HDR_RESOURCE_NAME = new SimpleString("_AMQ_ResourceName"); + public static final SimpleString HDR_RESOURCE_NAME = SimpleString.of("_AMQ_ResourceName"); - public static final SimpleString HDR_ATTRIBUTE = new SimpleString("_AMQ_Attribute"); + public static final SimpleString HDR_ATTRIBUTE = SimpleString.of("_AMQ_Attribute"); - public static final SimpleString HDR_OPERATION_NAME = new SimpleString("_AMQ_OperationName"); + public static final SimpleString HDR_OPERATION_NAME = SimpleString.of("_AMQ_OperationName"); - public static final SimpleString HDR_OPERATION_SUCCEEDED = new SimpleString("_AMQ_OperationSucceeded"); + public static final SimpleString HDR_OPERATION_SUCCEEDED = SimpleString.of("_AMQ_OperationSucceeded"); - public static final SimpleString HDR_NOTIFICATION_TYPE = new SimpleString("_AMQ_NotifType"); + public static final SimpleString HDR_NOTIFICATION_TYPE = SimpleString.of("_AMQ_NotifType"); - public static final SimpleString HDR_NOTIFICATION_TIMESTAMP = new SimpleString("_AMQ_NotifTimestamp"); + public static final SimpleString HDR_NOTIFICATION_TIMESTAMP = SimpleString.of("_AMQ_NotifTimestamp"); - public static final SimpleString HDR_ROUTING_NAME = new SimpleString("_AMQ_RoutingName"); + public static final SimpleString HDR_ROUTING_NAME = SimpleString.of("_AMQ_RoutingName"); - public static final SimpleString HDR_CLUSTER_NAME = new SimpleString("_AMQ_ClusterName"); + public static final SimpleString HDR_CLUSTER_NAME = SimpleString.of("_AMQ_ClusterName"); - public static final SimpleString HDR_ADDRESS = new SimpleString("_AMQ_Address"); + public static final SimpleString HDR_ADDRESS = SimpleString.of("_AMQ_Address"); - public static final SimpleString HDR_ROUTING_TYPE = new SimpleString("_AMQ_Routing_Type"); + public static final SimpleString HDR_ROUTING_TYPE = SimpleString.of("_AMQ_Routing_Type"); - public static final SimpleString HDR_BINDING_ID = new SimpleString("_AMQ_Binding_ID"); + public static final SimpleString HDR_BINDING_ID = SimpleString.of("_AMQ_Binding_ID"); - public static final SimpleString HDR_BINDING_TYPE = new SimpleString("_AMQ_Binding_Type"); + public static final SimpleString HDR_BINDING_TYPE = SimpleString.of("_AMQ_Binding_Type"); - public static final SimpleString HDR_FILTERSTRING = new SimpleString("_AMQ_FilterString"); + public static final SimpleString HDR_FILTERSTRING = SimpleString.of("_AMQ_FilterString"); - public static final SimpleString HDR_DISTANCE = new SimpleString("_AMQ_Distance"); + public static final SimpleString HDR_DISTANCE = SimpleString.of("_AMQ_Distance"); - public static final SimpleString HDR_CONSUMER_COUNT = new SimpleString("_AMQ_ConsumerCount"); + public static final SimpleString HDR_CONSUMER_COUNT = SimpleString.of("_AMQ_ConsumerCount"); - public static final SimpleString HDR_USER = new SimpleString("_AMQ_User"); + public static final SimpleString HDR_USER = SimpleString.of("_AMQ_User"); - public static final SimpleString HDR_VALIDATED_USER = new SimpleString("_AMQ_ValidatedUser"); + public static final SimpleString HDR_VALIDATED_USER = SimpleString.of("_AMQ_ValidatedUser"); - public static final SimpleString HDR_CERT_SUBJECT_DN = new SimpleString("_AMQ_CertSubjectDN"); + public static final SimpleString HDR_CERT_SUBJECT_DN = SimpleString.of("_AMQ_CertSubjectDN"); - public static final SimpleString HDR_CHECK_TYPE = new SimpleString("_AMQ_CheckType"); + public static final SimpleString HDR_CHECK_TYPE = SimpleString.of("_AMQ_CheckType"); - public static final SimpleString HDR_SESSION_NAME = new SimpleString("_AMQ_SessionName"); + public static final SimpleString HDR_SESSION_NAME = SimpleString.of("_AMQ_SessionName"); - public static final SimpleString HDR_REMOTE_ADDRESS = new SimpleString("_AMQ_RemoteAddress"); + public static final SimpleString HDR_REMOTE_ADDRESS = SimpleString.of("_AMQ_RemoteAddress"); - public static final SimpleString HDR_PROPOSAL_GROUP_ID = new SimpleString("_JBM_ProposalGroupId"); + public static final SimpleString HDR_PROPOSAL_GROUP_ID = SimpleString.of("_JBM_ProposalGroupId"); - public static final SimpleString HDR_PROPOSAL_VALUE = new SimpleString("_JBM_ProposalValue"); + public static final SimpleString HDR_PROPOSAL_VALUE = SimpleString.of("_JBM_ProposalValue"); - public static final SimpleString HDR_PROPOSAL_ALT_VALUE = new SimpleString("_JBM_ProposalAltValue"); + public static final SimpleString HDR_PROPOSAL_ALT_VALUE = SimpleString.of("_JBM_ProposalAltValue"); - public static final SimpleString HDR_CONSUMER_NAME = new SimpleString("_AMQ_ConsumerName"); + public static final SimpleString HDR_CONSUMER_NAME = SimpleString.of("_AMQ_ConsumerName"); - public static final SimpleString HDR_CONNECTION_NAME = new SimpleString("_AMQ_ConnectionName"); + public static final SimpleString HDR_CONNECTION_NAME = SimpleString.of("_AMQ_ConnectionName"); - public static final SimpleString HDR_MESSAGE_ID = new SimpleString("_AMQ_Message_ID"); + public static final SimpleString HDR_MESSAGE_ID = SimpleString.of("_AMQ_Message_ID"); - public static final SimpleString HDR_PROTOCOL_NAME = new SimpleString("_AMQ_Protocol_Name"); + public static final SimpleString HDR_PROTOCOL_NAME = SimpleString.of("_AMQ_Protocol_Name"); - public static final SimpleString HDR_CLIENT_ID = new SimpleString("_AMQ_Client_ID"); + public static final SimpleString HDR_CLIENT_ID = SimpleString.of("_AMQ_Client_ID"); // Lambda declaration for management function. Pretty much same thing as java.util.function.Consumer but with an exception in the declaration that was needed. public interface MessageAcceptor { @@ -142,8 +142,8 @@ public final class ManagementHelper { * @see ResourceNames */ public static void putAttribute(final ICoreMessage message, final String resourceName, final String attribute) { - message.putStringProperty(ManagementHelper.HDR_RESOURCE_NAME, new SimpleString(resourceName)); - message.putStringProperty(ManagementHelper.HDR_ATTRIBUTE, new SimpleString(attribute)); + message.putStringProperty(ManagementHelper.HDR_RESOURCE_NAME, SimpleString.of(resourceName)); + message.putStringProperty(ManagementHelper.HDR_ATTRIBUTE, SimpleString.of(attribute)); } /** @@ -174,8 +174,8 @@ public final class ManagementHelper { final String operationName, final Object... parameters) throws Exception { // store the name of the operation in the headers - message.putStringProperty(ManagementHelper.HDR_RESOURCE_NAME, new SimpleString(resourceName)); - message.putStringProperty(ManagementHelper.HDR_OPERATION_NAME, new SimpleString(operationName)); + message.putStringProperty(ManagementHelper.HDR_RESOURCE_NAME, SimpleString.of(resourceName)); + message.putStringProperty(ManagementHelper.HDR_OPERATION_NAME, SimpleString.of(operationName)); // and the params go in the body, since might be too large for header @@ -189,7 +189,7 @@ public final class ManagementHelper { paramString = null; } - message.getBodyBuffer().writeNullableSimpleString(SimpleString.toSimpleString(paramString)); + message.getBodyBuffer().writeNullableSimpleString(SimpleString.of(paramString)); } /** @@ -238,7 +238,7 @@ public final class ManagementHelper { resultString = null; } - message.getBodyBuffer().writeNullableSimpleString(SimpleString.toSimpleString(resultString)); + message.getBodyBuffer().writeNullableSimpleString(SimpleString.of(resultString)); } /** diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ResourceNames.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ResourceNames.java index 6092214e31..e07f99ce4e 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ResourceNames.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ResourceNames.java @@ -61,7 +61,7 @@ public final class ResourceNames { } private static SimpleString getRetroactiveResourceName(String prefix, String delimiter, SimpleString address, String resourceType) { - return SimpleString.toSimpleString(prefix.concat(address.toString()).concat(delimiter).concat(resourceType).concat(delimiter).concat(RETROACTIVE_SUFFIX)); + return SimpleString.of(prefix.concat(address.toString()).concat(delimiter).concat(resourceType).concat(delimiter).concat(RETROACTIVE_SUFFIX)); } public static boolean isRetroactiveResource(String prefix, SimpleString address) { diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientConsumerImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientConsumerImpl.java index b8a7b86546..431921b13a 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientConsumerImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientConsumerImpl.java @@ -59,7 +59,7 @@ public final class ClientConsumerImpl implements ClientConsumerInternal { private static final int NUM_PRIORITIES = 10; - public static final SimpleString FORCED_DELIVERY_MESSAGE = new SimpleString("_hornetq.forced.delivery.seq"); + public static final SimpleString FORCED_DELIVERY_MESSAGE = SimpleString.of("_hornetq.forced.delivery.seq"); private final ClientSessionInternal session; diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientProducerCreditManagerImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientProducerCreditManagerImpl.java index fba2928343..59762aa786 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientProducerCreditManagerImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientProducerCreditManagerImpl.java @@ -237,7 +237,7 @@ public class ClientProducerCreditManagerImpl implements ClientProducerCreditMana @Override public SimpleString getAddress() { - return SimpleString.toSimpleString(""); + return SimpleString.of(""); } @Override diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientProducerImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientProducerImpl.java index f3b01a7eca..e538379b90 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientProducerImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientProducerImpl.java @@ -131,7 +131,7 @@ public class ClientProducerImpl implements ClientProducerInternal { @Override public void send(final String address1, final Message message) throws ActiveMQException { - send(SimpleString.toSimpleString(address1), message); + send(SimpleString.of(address1), message); } @Override 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 0e1b7a4c01..065a1945fc 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 @@ -276,7 +276,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi public void createQueue(final String address, final String queueName, final boolean durable) throws ActiveMQException { - createQueue(SimpleString.toSimpleString(address), SimpleString.toSimpleString(queueName), durable); + createQueue(SimpleString.of(address), SimpleString.of(queueName), durable); } @Override @@ -346,9 +346,9 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi final String queueName, final String filterString, final boolean durable) throws ActiveMQException { - createQueue(SimpleString.toSimpleString(address), - SimpleString.toSimpleString(queueName), - SimpleString.toSimpleString(filterString), + createQueue(SimpleString.of(address), + SimpleString.of(queueName), + SimpleString.of(filterString), durable); } @@ -367,7 +367,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi final String filterString, final boolean durable, final boolean autoCreated) throws ActiveMQException { - createQueue(SimpleString.toSimpleString(address), SimpleString.toSimpleString(queueName), SimpleString.toSimpleString(filterString), durable, autoCreated); + createQueue(SimpleString.of(address), SimpleString.of(queueName), SimpleString.of(filterString), durable, autoCreated); } @Override @@ -377,7 +377,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi @Override public void createTemporaryQueue(final String address, final String queueName) throws ActiveMQException { - createTemporaryQueue(SimpleString.toSimpleString(address), SimpleString.toSimpleString(queueName)); + createTemporaryQueue(SimpleString.of(address), SimpleString.of(queueName)); } @Override @@ -391,7 +391,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi public void createTemporaryQueue(final String address, final String queueName, final String filter) throws ActiveMQException { - createTemporaryQueue(SimpleString.toSimpleString(address), SimpleString.toSimpleString(queueName), SimpleString.toSimpleString(filter)); + createTemporaryQueue(SimpleString.of(address), SimpleString.of(queueName), SimpleString.of(filter)); } @@ -421,10 +421,10 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi @Override public void createQueue(final String address, final RoutingType routingType, final String queueName, final String filterString, final boolean durable, final boolean autoCreated) throws ActiveMQException { - createQueue(SimpleString.toSimpleString(address), + createQueue(SimpleString.of(address), routingType, - SimpleString.toSimpleString(queueName), - SimpleString.toSimpleString(filterString), + SimpleString.of(queueName), + SimpleString.of(filterString), durable, autoCreated); } @@ -493,10 +493,10 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi @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, Boolean exclusive, Boolean lastValue) throws ActiveMQException { - createQueue(SimpleString.toSimpleString(address), + createQueue(SimpleString.of(address), routingType, - SimpleString.toSimpleString(queueName), - SimpleString.toSimpleString(filterString), + SimpleString.of(queueName), + SimpleString.of(filterString), durable, autoCreated, maxConsumers, @@ -514,7 +514,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi @Override public void createTemporaryQueue(final String address, final RoutingType routingType, final String queueName) throws ActiveMQException { - createTemporaryQueue(SimpleString.toSimpleString(address), routingType, SimpleString.toSimpleString(queueName)); + createTemporaryQueue(SimpleString.of(address), routingType, SimpleString.of(queueName)); } @Deprecated @@ -564,7 +564,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi @Override public void createTemporaryQueue(final String address, final RoutingType routingType, final String queueName, final String filter) throws ActiveMQException { - createTemporaryQueue(SimpleString.toSimpleString(address), routingType, SimpleString.toSimpleString(queueName), SimpleString.toSimpleString(filter)); + createTemporaryQueue(SimpleString.of(address), routingType, SimpleString.of(queueName), SimpleString.of(filter)); } /** @@ -679,7 +679,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi */ @Override public void createQueue(String address, RoutingType routingType, String queueName, boolean durable) throws ActiveMQException { - createQueue(SimpleString.toSimpleString(address), routingType, SimpleString.toSimpleString(queueName), durable); + createQueue(SimpleString.of(address), routingType, SimpleString.of(queueName), durable); } /** @@ -693,8 +693,8 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi @Deprecated @Override public void createQueue(String address, RoutingType routingType, String queueName) throws ActiveMQException { - internalCreateQueue(SimpleString.toSimpleString(address), - SimpleString.toSimpleString(queueName), + internalCreateQueue(SimpleString.of(address), + SimpleString.of(queueName), false, false, new QueueAttributes() @@ -766,7 +766,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi */ @Override public void createQueue(String address, RoutingType routingType, String queueName, String filter, boolean durable) throws ActiveMQException { - createQueue(SimpleString.toSimpleString(address), routingType, SimpleString.toSimpleString(queueName), SimpleString.toSimpleString(filter), + createQueue(SimpleString.of(address), routingType, SimpleString.of(queueName), SimpleString.of(filter), durable); } @@ -785,7 +785,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi @Override public void deleteQueue(final String queueName) throws ActiveMQException { - deleteQueue(SimpleString.toSimpleString(queueName)); + deleteQueue(SimpleString.of(queueName)); } @Override @@ -815,7 +815,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi @Override public ClientConsumer createConsumer(final String queueName) throws ActiveMQException { - return createConsumer(SimpleString.toSimpleString(queueName)); + return createConsumer(SimpleString.of(queueName)); } @Override @@ -826,12 +826,12 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi @Override public void createQueue(final String address, final String queueName) throws ActiveMQException { - createQueue(SimpleString.toSimpleString(address), SimpleString.toSimpleString(queueName)); + createQueue(SimpleString.of(address), SimpleString.of(queueName)); } @Override public ClientConsumer createConsumer(final String queueName, final String filterString) throws ActiveMQException { - return createConsumer(SimpleString.toSimpleString(queueName), SimpleString.toSimpleString(filterString)); + return createConsumer(SimpleString.of(queueName), SimpleString.of(filterString)); } @Override @@ -859,12 +859,12 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi public ClientConsumer createConsumer(final String queueName, final String filterString, final boolean browseOnly) throws ActiveMQException { - return createConsumer(SimpleString.toSimpleString(queueName), SimpleString.toSimpleString(filterString), browseOnly); + return createConsumer(SimpleString.of(queueName), SimpleString.of(filterString), browseOnly); } @Override public ClientConsumer createConsumer(final String queueName, final boolean browseOnly) throws ActiveMQException { - return createConsumer(SimpleString.toSimpleString(queueName), null, browseOnly); + return createConsumer(SimpleString.of(queueName), null, browseOnly); } @Override @@ -907,7 +907,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi final int windowSize, final int maxRate, final boolean browseOnly) throws ActiveMQException { - return createConsumer(SimpleString.toSimpleString(queueName), SimpleString.toSimpleString(filterString), windowSize, maxRate, browseOnly); + return createConsumer(SimpleString.of(queueName), SimpleString.of(filterString), windowSize, maxRate, browseOnly); } @Override @@ -922,7 +922,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi @Override public ClientProducer createProducer(final String address) throws ActiveMQException { - return createProducer(SimpleString.toSimpleString(address)); + return createProducer(SimpleString.of(address)); } @Override @@ -931,7 +931,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi } public ClientProducer createProducer(final String address, final int rate) throws ActiveMQException { - return createProducer(SimpleString.toSimpleString(address), rate); + return createProducer(SimpleString.of(address), rate); } @Override @@ -2040,7 +2040,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi maxRate == -1 ? null : new TokenBucketLimiterImpl(maxRate, false), autoCommitSends && blockOnNonDurableSend, autoCommitSends && blockOnDurableSend, - autoGroup, groupID == null ? null : new SimpleString(groupID), + autoGroup, groupID == null ? null : SimpleString.of(groupID), minLargeMessageSize, sessionContext, producerIDs.incrementAndGet()); diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/CompressedLargeMessageControllerImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/CompressedLargeMessageControllerImpl.java index eae68326be..e2e16231e1 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/CompressedLargeMessageControllerImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/CompressedLargeMessageControllerImpl.java @@ -631,7 +631,7 @@ final class CompressedLargeMessageControllerImpl implements LargeMessageControll int len = readInt(); byte[] data = new byte[len]; readBytes(data); - return new SimpleString(data); + return SimpleString.of(data); } @Override diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/LargeMessageControllerImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/LargeMessageControllerImpl.java index 798bd49a6a..56736afbfd 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/LargeMessageControllerImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/LargeMessageControllerImpl.java @@ -1016,7 +1016,7 @@ public class LargeMessageControllerImpl implements LargeMessageController { int len = readInt(); byte[] data = new byte[len]; readBytes(data); - return new SimpleString(data); + return SimpleString.of(data); } @Override diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/cluster/DiscoveryGroup.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/cluster/DiscoveryGroup.java index b7bb3d133d..577694aecc 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/cluster/DiscoveryGroup.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/cluster/DiscoveryGroup.java @@ -130,7 +130,7 @@ public final class DiscoveryGroup implements ActiveMQComponent { if (notificationService != null) { TypedProperties props = new TypedProperties(); - props.putSimpleStringProperty(new SimpleString("name"), new SimpleString(name)); + props.putSimpleStringProperty(SimpleString.of("name"), SimpleString.of(name)); Notification notification = new Notification(nodeID, CoreNotificationType.DISCOVERY_GROUP_STARTED, props); @@ -191,7 +191,7 @@ public final class DiscoveryGroup implements ActiveMQComponent { if (notificationService != null) { TypedProperties props = new TypedProperties(); - props.putSimpleStringProperty(new SimpleString("name"), new SimpleString(name)); + props.putSimpleStringProperty(SimpleString.of("name"), SimpleString.of(name)); Notification notification = new Notification(nodeID, CoreNotificationType.DISCOVERY_GROUP_STOPPED, props); try { notificationService.sendNotification(notification); diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java index 7cb58e24f6..8575fc573b 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java @@ -313,7 +313,7 @@ public class CoreMessage extends RefCountMessage implements ICoreMessage { @Override public CoreMessage setGroupID(String groupId) { - return this.setGroupID(SimpleString.toSimpleString(groupId, coreMessageObjectPools == null ? null : coreMessageObjectPools.getGroupIdStringSimpleStringPool())); + return this.setGroupID(SimpleString.of(groupId, coreMessageObjectPools == null ? null : coreMessageObjectPools.getGroupIdStringSimpleStringPool())); } @Override @@ -860,7 +860,7 @@ public class CoreMessage extends RefCountMessage implements ICoreMessage { @Override public CoreMessage setAddress(String address) { messageChanged(); - this.address = SimpleString.toSimpleString(address, coreMessageObjectPools == null ? null : coreMessageObjectPools.getAddressStringSimpleStringPool()); + this.address = SimpleString.of(address, coreMessageObjectPools == null ? null : coreMessageObjectPools.getAddressStringSimpleStringPool()); return this; } @@ -1308,11 +1308,11 @@ public class CoreMessage extends RefCountMessage implements ICoreMessage { } private SimpleString key(String key) { - return SimpleString.toSimpleString(key, getPropertyKeysPool()); + return SimpleString.of(key, getPropertyKeysPool()); } private SimpleString value(String value) { - return SimpleString.toSimpleString(value, getPropertyValuesPool()); + return SimpleString.of(value, getPropertyValuesPool()); } private SimpleString.StringSimpleStringPool getPropertyKeysPool() { diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/PacketImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/PacketImpl.java index 9d5b6e8a0d..8b59358b62 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/PacketImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/PacketImpl.java @@ -53,10 +53,10 @@ public class PacketImpl implements Packet { // 2.29.0 public static final int ARTEMIS_2_29_0_VERSION = 135; - public static final SimpleString OLD_QUEUE_PREFIX = new SimpleString("jms.queue."); - public static final SimpleString OLD_TEMP_QUEUE_PREFIX = new SimpleString("jms.tempqueue."); - public static final SimpleString OLD_TOPIC_PREFIX = new SimpleString("jms.topic."); - public static final SimpleString OLD_TEMP_TOPIC_PREFIX = new SimpleString("jms.temptopic."); + public static final SimpleString OLD_QUEUE_PREFIX = SimpleString.of("jms.queue."); + public static final SimpleString OLD_TEMP_QUEUE_PREFIX = SimpleString.of("jms.tempqueue."); + public static final SimpleString OLD_TOPIC_PREFIX = SimpleString.of("jms.topic."); + public static final SimpleString OLD_TEMP_TOPIC_PREFIX = SimpleString.of("jms.temptopic."); // The minimal size for all the packets, Common data for all the packets (look at // PacketImpl.encode) diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/RemotingConnectionImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/RemotingConnectionImpl.java index 45a009dc6c..1d47d56ffb 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/RemotingConnectionImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/RemotingConnectionImpl.java @@ -288,7 +288,7 @@ public class RemotingConnectionImpl extends AbstractRemotingConnection implement Packet disconnect; if (channel0.supports(PacketImpl.DISCONNECT_V3)) { - disconnect = new DisconnectMessage_V3(nodeID, reason, SimpleString.toSimpleString(targetNodeID), targetConnector); + disconnect = new DisconnectMessage_V3(nodeID, reason, SimpleString.of(targetNodeID), targetConnector); } else if (channel0.supports(PacketImpl.DISCONNECT_V2)) { disconnect = new DisconnectMessage_V2(nodeID, reason.isScaleDown() ? targetNodeID : null); } else { diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/DisconnectMessage_V2.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/DisconnectMessage_V2.java index 99461597fb..b920b77c92 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/DisconnectMessage_V2.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/DisconnectMessage_V2.java @@ -28,7 +28,7 @@ public class DisconnectMessage_V2 extends DisconnectMessage { this.nodeID = nodeID; - this.scaleDownNodeID = SimpleString.toSimpleString(scaleDownNodeID); + this.scaleDownNodeID = SimpleString.of(scaleDownNodeID); } public DisconnectMessage_V2() { diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/MessageUtil.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/MessageUtil.java index 780085f4fd..eb4fcf74d0 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/MessageUtil.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/MessageUtil.java @@ -36,19 +36,19 @@ public class MessageUtil { public static final String CORRELATIONID_HEADER_NAME_STRING = "JMSCorrelationID"; - public static final SimpleString CORRELATIONID_HEADER_NAME = new SimpleString(CORRELATIONID_HEADER_NAME_STRING); + public static final SimpleString CORRELATIONID_HEADER_NAME = SimpleString.of(CORRELATIONID_HEADER_NAME_STRING); - public static final SimpleString REPLYTO_HEADER_NAME = new SimpleString("JMSReplyTo"); + public static final SimpleString REPLYTO_HEADER_NAME = SimpleString.of("JMSReplyTo"); public static final String TYPE_HEADER_NAME_STRING = "JMSType"; - public static final SimpleString TYPE_HEADER_NAME = new SimpleString(TYPE_HEADER_NAME_STRING); + public static final SimpleString TYPE_HEADER_NAME = SimpleString.of(TYPE_HEADER_NAME_STRING); - public static final SimpleString JMS = new SimpleString("JMS"); + public static final SimpleString JMS = SimpleString.of("JMS"); - public static final SimpleString JMSX = new SimpleString("JMSX"); + public static final SimpleString JMSX = SimpleString.of("JMSX"); - public static final SimpleString JMS_ = new SimpleString("JMS_"); + public static final SimpleString JMS_ = SimpleString.of("JMS_"); public static final String JMSXDELIVERYCOUNT = "JMSXDeliveryCount"; @@ -60,7 +60,7 @@ public class MessageUtil { public static final String CONNECTION_ID_PROPERTY_NAME_STRING = "__AMQ_CID"; - public static final SimpleString CONNECTION_ID_PROPERTY_NAME = new SimpleString(CONNECTION_ID_PROPERTY_NAME_STRING); + public static final SimpleString CONNECTION_ID_PROPERTY_NAME = SimpleString.of(CONNECTION_ID_PROPERTY_NAME_STRING); // public static ActiveMQBuffer getBodyBuffer(Message message) { // return message.getBodyBuffer(); @@ -77,7 +77,7 @@ public class MessageUtil { } public static void setJMSType(Message message, String type) { - message.putStringProperty(TYPE_HEADER_NAME, new SimpleString(type)); + message.putStringProperty(TYPE_HEADER_NAME, SimpleString.of(type)); } public static String getJMSType(Message message) { @@ -102,7 +102,7 @@ public class MessageUtil { if (correlationID == null) { message.removeProperty(CORRELATIONID_HEADER_NAME); } else { - message.putStringProperty(CORRELATIONID_HEADER_NAME, new SimpleString(correlationID)); + message.putStringProperty(CORRELATIONID_HEADER_NAME, SimpleString.of(correlationID)); } } @@ -178,7 +178,7 @@ public class MessageUtil { } public static boolean propertyExists(Message message, String name) { - return message.containsProperty(new SimpleString(name)) || name.equals(MessageUtil.JMSXDELIVERYCOUNT) || + return message.containsProperty(SimpleString.of(name)) || name.equals(MessageUtil.JMSXDELIVERYCOUNT) || (MessageUtil.JMSXGROUPID.equals(name) && message.containsProperty(Message.HDR_GROUP_ID)) || (MessageUtil.JMSXGROUPSEQ.equals(name) && message.containsProperty(Message.HDR_GROUP_SEQUENCE)) || (MessageUtil.JMSXUSERID.equals(name) && message.containsProperty(Message.HDR_VALIDATED_USER)); diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/BufferHelper.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/BufferHelper.java index ca92d60d58..9cd689532b 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/BufferHelper.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/BufferHelper.java @@ -45,7 +45,7 @@ public class BufferHelper { } public static void writeAsNullableSimpleString(ActiveMQBuffer buffer, String str) { - buffer.writeNullableSimpleString(SimpleString.toSimpleString(str)); + buffer.writeNullableSimpleString(SimpleString.of(str)); } public static String readNullableSimpleStringAsString(ActiveMQBuffer buffer) { @@ -54,7 +54,7 @@ public class BufferHelper { } public static void writeAsSimpleString(ActiveMQBuffer buffer, String str) { - buffer.writeSimpleString(new SimpleString(str)); + buffer.writeSimpleString(SimpleString.of(str)); } /** diff --git a/artemis-core-client/src/test/java/org/apache/activemq/artemis/api/core/management/ResourceNamesTest.java b/artemis-core-client/src/test/java/org/apache/activemq/artemis/api/core/management/ResourceNamesTest.java index 285fc42d85..06893b9295 100644 --- a/artemis-core-client/src/test/java/org/apache/activemq/artemis/api/core/management/ResourceNamesTest.java +++ b/artemis-core-client/src/test/java/org/apache/activemq/artemis/api/core/management/ResourceNamesTest.java @@ -54,7 +54,7 @@ public class ResourceNamesTest { super(); this.delimiterChar = delimiterChar; delimiter = "" + delimiterChar; - testAddress = SimpleString.toSimpleString(UUID.randomUUID().toString()); + testAddress = SimpleString.of(UUID.randomUUID().toString()); prefix = ActiveMQDefaultConfiguration.getInternalNamingPrefix().replace('.', delimiterChar); baseName = prefix + testAddress + delimiter; testResourceAddressName = baseName + ResourceNames.ADDRESS.replace('.', delimiterChar) + ResourceNames.RETROACTIVE_SUFFIX; @@ -86,8 +86,8 @@ public class ResourceNamesTest { @TestTemplate public void testIsRetroactiveResource() { - assertTrue(ResourceNames.isRetroactiveResource(prefix, SimpleString.toSimpleString(testResourceAddressName))); - assertTrue(ResourceNames.isRetroactiveResource(prefix, SimpleString.toSimpleString(testResourceMulticastQueueName))); - assertTrue(ResourceNames.isRetroactiveResource(prefix, SimpleString.toSimpleString(testResourceDivertName))); + assertTrue(ResourceNames.isRetroactiveResource(prefix, SimpleString.of(testResourceAddressName))); + assertTrue(ResourceNames.isRetroactiveResource(prefix, SimpleString.of(testResourceMulticastQueueName))); + assertTrue(ResourceNames.isRetroactiveResource(prefix, SimpleString.of(testResourceDivertName))); } } diff --git a/artemis-core-client/src/test/java/org/apache/activemq/artemis/message/CoreMTMessageTest.java b/artemis-core-client/src/test/java/org/apache/activemq/artemis/message/CoreMTMessageTest.java index 581e274e33..00fc02904b 100644 --- a/artemis-core-client/src/test/java/org/apache/activemq/artemis/message/CoreMTMessageTest.java +++ b/artemis-core-client/src/test/java/org/apache/activemq/artemis/message/CoreMTMessageTest.java @@ -38,8 +38,8 @@ import org.junit.jupiter.api.Test; public class CoreMTMessageTest { - public static final SimpleString ADDRESS = new SimpleString("this.local.address"); - public static final SimpleString ADDRESS2 = new SimpleString("some.other.address"); + public static final SimpleString ADDRESS = SimpleString.of("this.local.address"); + public static final SimpleString ADDRESS2 = SimpleString.of("some.other.address"); public static final byte MESSAGE_TYPE = Message.TEXT_TYPE; public static final boolean DURABLE = true; public static final long EXPIRATION = 123L; @@ -62,11 +62,11 @@ public class CoreMTMessageTest { UUID userID = UUIDGenerator.getInstance().generateUUID(); String body = UUIDGenerator.getInstance().generateStringUUID(); ClientMessageImpl message = new ClientMessageImpl(MESSAGE_TYPE, DURABLE, EXPIRATION, TIMESTAMP, PRIORITY, 10 * 1024, objectPools); - TextMessageUtil.writeBodyText(message.getBodyBuffer(), SimpleString.toSimpleString(body)); + TextMessageUtil.writeBodyText(message.getBodyBuffer(), SimpleString.of(body)); message.setAddress(ADDRESS); message.setUserID(userID); - message.getProperties().putSimpleStringProperty(SimpleString.toSimpleString("str-prop"), propValue); + message.getProperties().putSimpleStringProperty(SimpleString.of("str-prop"), propValue); ActiveMQBuffer buffer = ActiveMQBuffers.dynamicBuffer(10 * 1024); message.sendBuffer(buffer.byteBuf(), 0); @@ -96,7 +96,7 @@ public class CoreMTMessageTest { recMessage.receiveBuffer(buffer.byteBuf()); assertEquals(ADDRESS2, recMessage.getAddressSimpleString()); assertEquals(33, recMessage.getMessageID()); - assertEquals(propValue, recMessage.getSimpleStringProperty(SimpleString.toSimpleString("str-prop"))); + assertEquals(propValue, recMessage.getSimpleStringProperty(SimpleString.of("str-prop"))); } catch (Throwable e) { e.printStackTrace(); errors.incrementAndGet(); diff --git a/artemis-core-client/src/test/java/org/apache/activemq/artemis/message/CoreMessageTest.java b/artemis-core-client/src/test/java/org/apache/activemq/artemis/message/CoreMessageTest.java index 8f46a95e65..55dbc77ee2 100644 --- a/artemis-core-client/src/test/java/org/apache/activemq/artemis/message/CoreMessageTest.java +++ b/artemis-core-client/src/test/java/org/apache/activemq/artemis/message/CoreMessageTest.java @@ -44,7 +44,7 @@ import org.junit.jupiter.api.Test; public class CoreMessageTest { - public static final SimpleString ADDRESS = new SimpleString("this.local.address"); + public static final SimpleString ADDRESS = SimpleString.of("this.local.address"); public static final byte MESSAGE_TYPE = Message.TEXT_TYPE; public static final boolean DURABLE = true; public static final long EXPIRATION = 123L; @@ -57,8 +57,8 @@ public class CoreMessageTest { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}); - public static final SimpleString PROP1_NAME = new SimpleString("t1"); - public static final SimpleString PROP1_VALUE = new SimpleString("value-t1"); + public static final SimpleString PROP1_NAME = SimpleString.of("t1"); + public static final SimpleString PROP1_VALUE = SimpleString.of("value-t1"); /** * This encode was generated by {@link #generate()}. @@ -276,7 +276,7 @@ public class CoreMessageTest { legacyBuffer.resetWriterIndex(); legacyBuffer.clear(); - TextMessageUtil.writeBodyText(legacyBuffer, SimpleString.toSimpleString(newString)); + TextMessageUtil.writeBodyText(legacyBuffer, SimpleString.of(newString)); ByteBuf newbuffer = Unpooled.buffer(150000); @@ -400,7 +400,7 @@ public class CoreMessageTest { public String generate(String body) throws Exception { ClientMessageImpl message = new ClientMessageImpl(MESSAGE_TYPE, DURABLE, EXPIRATION, TIMESTAMP, PRIORITY, 10 * 1024, null); - TextMessageUtil.writeBodyText(message.getBodyBuffer(), SimpleString.toSimpleString(body)); + TextMessageUtil.writeBodyText(message.getBodyBuffer(), SimpleString.of(body)); message.setAddress(ADDRESS); message.setUserID(uuid); 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 ec9a2b8e39..9f3e70c96e 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 @@ -213,11 +213,11 @@ public class ActiveMQDestination extends JNDIStorable implements Destination, Se } public static SimpleString createQueueAddressFromName(final String name) { - return new SimpleString(QUEUE_QUALIFIED_PREFIX + name); + return SimpleString.of(QUEUE_QUALIFIED_PREFIX + name); } public static SimpleString createTopicAddressFromName(final String name) { - return new SimpleString(TOPIC_QUALIFIED_PREFIX + name); + return SimpleString.of(TOPIC_QUALIFIED_PREFIX + name); } public static ActiveMQQueue createQueue(final String address) { @@ -320,7 +320,7 @@ public class ActiveMQDestination extends JNDIStorable implements Destination, Se protected ActiveMQDestination(final String address, final TYPE type, final ActiveMQSession session) { - this(SimpleString.toSimpleString(address), type, session); + this(SimpleString.of(address), type, session); } protected ActiveMQDestination(final SimpleString address, @@ -344,7 +344,7 @@ public class ActiveMQDestination extends JNDIStorable implements Destination, Se final String name, final TYPE type, final ActiveMQSession session) { - this(SimpleString.toSimpleString(address), name, type, session); + this(SimpleString.of(address), name, type, session); } @Deprecated @@ -360,7 +360,7 @@ public class ActiveMQDestination extends JNDIStorable implements Destination, Se } public void setAddress(String address) { - setSimpleAddress(SimpleString.toSimpleString(address)); + setSimpleAddress(SimpleString.of(address)); } @Override @@ -390,7 +390,7 @@ public class ActiveMQDestination extends JNDIStorable implements Destination, Se } public void setSimpleAddress(String address) { - setSimpleAddress(new SimpleString(address)); + setSimpleAddress(SimpleString.of(address)); } public void delete() throws JMSException { diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQJMSProducer.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQJMSProducer.java index e97a3c2102..b7345c0479 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQJMSProducer.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQJMSProducer.java @@ -332,57 +332,57 @@ public final class ActiveMQJMSProducer implements JMSProducer { @Override public JMSProducer setProperty(String name, boolean value) { checkName(name); - properties.putBooleanProperty(new SimpleString(name), value); + properties.putBooleanProperty(SimpleString.of(name), value); return this; } @Override public JMSProducer setProperty(String name, byte value) { checkName(name); - properties.putByteProperty(new SimpleString(name), value); + properties.putByteProperty(SimpleString.of(name), value); return this; } @Override public JMSProducer setProperty(String name, short value) { checkName(name); - properties.putShortProperty(new SimpleString(name), value); + properties.putShortProperty(SimpleString.of(name), value); return this; } @Override public JMSProducer setProperty(String name, int value) { checkName(name); - properties.putIntProperty(new SimpleString(name), value); + properties.putIntProperty(SimpleString.of(name), value); return this; } @Override public JMSProducer setProperty(String name, long value) { checkName(name); - properties.putLongProperty(new SimpleString(name), value); + properties.putLongProperty(SimpleString.of(name), value); return this; } @Override public JMSProducer setProperty(String name, float value) { checkName(name); - properties.putFloatProperty(new SimpleString(name), value); + properties.putFloatProperty(SimpleString.of(name), value); return this; } @Override public JMSProducer setProperty(String name, double value) { checkName(name); - properties.putDoubleProperty(new SimpleString(name), value); + properties.putDoubleProperty(SimpleString.of(name), value); return this; } @Override public JMSProducer setProperty(String name, String value) { checkName(name); - SimpleString key = new SimpleString(name); - properties.putSimpleStringProperty(key, new SimpleString(value)); + SimpleString key = SimpleString.of(name); + properties.putSimpleStringProperty(key, SimpleString.of(value)); stringPropertyNames.add(key); return this; } @@ -391,7 +391,7 @@ public final class ActiveMQJMSProducer implements JMSProducer { public JMSProducer setProperty(String name, Object value) { checkName(name); try { - TypedProperties.setObjectProperty(new SimpleString(name), value, properties); + TypedProperties.setObjectProperty(SimpleString.of(name), value, properties); } catch (ActiveMQPropertyConversionException amqe) { throw new MessageFormatRuntimeException(amqe.getMessage()); } catch (RuntimeException e) { @@ -413,13 +413,13 @@ public final class ActiveMQJMSProducer implements JMSProducer { @Override public boolean propertyExists(String name) { - return properties.containsProperty(new SimpleString(name)); + return properties.containsProperty(SimpleString.of(name)); } @Override public boolean getBooleanProperty(String name) { try { - return properties.getBooleanProperty(new SimpleString(name)); + return properties.getBooleanProperty(SimpleString.of(name)); } catch (ActiveMQPropertyConversionException ce) { throw new MessageFormatRuntimeException(ce.getMessage()); } catch (RuntimeException e) { @@ -430,7 +430,7 @@ public final class ActiveMQJMSProducer implements JMSProducer { @Override public byte getByteProperty(String name) { try { - return properties.getByteProperty(new SimpleString(name)); + return properties.getByteProperty(SimpleString.of(name)); } catch (ActiveMQPropertyConversionException ce) { throw new MessageFormatRuntimeException(ce.getMessage()); } @@ -439,7 +439,7 @@ public final class ActiveMQJMSProducer implements JMSProducer { @Override public short getShortProperty(String name) { try { - return properties.getShortProperty(new SimpleString(name)); + return properties.getShortProperty(SimpleString.of(name)); } catch (ActiveMQPropertyConversionException ce) { throw new MessageFormatRuntimeException(ce.getMessage()); } @@ -448,7 +448,7 @@ public final class ActiveMQJMSProducer implements JMSProducer { @Override public int getIntProperty(String name) { try { - return properties.getIntProperty(new SimpleString(name)); + return properties.getIntProperty(SimpleString.of(name)); } catch (ActiveMQPropertyConversionException ce) { throw new MessageFormatRuntimeException(ce.getMessage()); } @@ -457,7 +457,7 @@ public final class ActiveMQJMSProducer implements JMSProducer { @Override public long getLongProperty(String name) { try { - return properties.getLongProperty(new SimpleString(name)); + return properties.getLongProperty(SimpleString.of(name)); } catch (ActiveMQPropertyConversionException ce) { throw new MessageFormatRuntimeException(ce.getMessage()); } @@ -466,7 +466,7 @@ public final class ActiveMQJMSProducer implements JMSProducer { @Override public float getFloatProperty(String name) { try { - return properties.getFloatProperty(new SimpleString(name)); + return properties.getFloatProperty(SimpleString.of(name)); } catch (ActiveMQPropertyConversionException ce) { throw new MessageFormatRuntimeException(ce.getMessage()); } @@ -475,7 +475,7 @@ public final class ActiveMQJMSProducer implements JMSProducer { @Override public double getDoubleProperty(String name) { try { - return properties.getDoubleProperty(new SimpleString(name)); + return properties.getDoubleProperty(SimpleString.of(name)); } catch (ActiveMQPropertyConversionException ce) { throw new MessageFormatRuntimeException(ce.getMessage()); } @@ -484,7 +484,7 @@ public final class ActiveMQJMSProducer implements JMSProducer { @Override public String getStringProperty(String name) { try { - SimpleString prop = properties.getSimpleStringProperty(new SimpleString(name)); + SimpleString prop = properties.getSimpleStringProperty(SimpleString.of(name)); if (prop == null) return null; return prop.toString(); @@ -498,7 +498,7 @@ public final class ActiveMQJMSProducer implements JMSProducer { @Override public Object getObjectProperty(String name) { try { - SimpleString key = new SimpleString(name); + SimpleString key = SimpleString.of(name); Object property = properties.getProperty(key); if (stringPropertyNames.contains(key)) { property = property.toString(); diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMapMessage.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMapMessage.java index bf1e0593cc..11ecd7efba 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMapMessage.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMapMessage.java @@ -95,70 +95,70 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage { @Override public void setBoolean(final String name, final boolean value) throws JMSException { checkName(name); - map.putBooleanProperty(new SimpleString(name), value); + map.putBooleanProperty(SimpleString.of(name), value); invalid = true; } @Override public void setByte(final String name, final byte value) throws JMSException { checkName(name); - map.putByteProperty(new SimpleString(name), value); + map.putByteProperty(SimpleString.of(name), value); invalid = true; } @Override public void setShort(final String name, final short value) throws JMSException { checkName(name); - map.putShortProperty(new SimpleString(name), value); + map.putShortProperty(SimpleString.of(name), value); invalid = true; } @Override public void setChar(final String name, final char value) throws JMSException { checkName(name); - map.putCharProperty(new SimpleString(name), value); + map.putCharProperty(SimpleString.of(name), value); invalid = true; } @Override public void setInt(final String name, final int value) throws JMSException { checkName(name); - map.putIntProperty(new SimpleString(name), value); + map.putIntProperty(SimpleString.of(name), value); invalid = true; } @Override public void setLong(final String name, final long value) throws JMSException { checkName(name); - map.putLongProperty(new SimpleString(name), value); + map.putLongProperty(SimpleString.of(name), value); invalid = true; } @Override public void setFloat(final String name, final float value) throws JMSException { checkName(name); - map.putFloatProperty(new SimpleString(name), value); + map.putFloatProperty(SimpleString.of(name), value); invalid = true; } @Override public void setDouble(final String name, final double value) throws JMSException { checkName(name); - map.putDoubleProperty(new SimpleString(name), value); + map.putDoubleProperty(SimpleString.of(name), value); invalid = true; } @Override public void setString(final String name, final String value) throws JMSException { checkName(name); - map.putSimpleStringProperty(new SimpleString(name), value == null ? null : new SimpleString(value)); + map.putSimpleStringProperty(SimpleString.of(name), value == null ? null : SimpleString.of(value)); invalid = true; } @Override public void setBytes(final String name, final byte[] value) throws JMSException { checkName(name); - map.putBytesProperty(new SimpleString(name), value); + map.putBytesProperty(SimpleString.of(name), value); invalid = true; } @@ -170,7 +170,7 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage { } byte[] newBytes = new byte[length]; System.arraycopy(value, offset, newBytes, 0, length); - map.putBytesProperty(new SimpleString(name), newBytes); + map.putBytesProperty(SimpleString.of(name), newBytes); invalid = true; } @@ -178,7 +178,7 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage { public void setObject(final String name, final Object value) throws JMSException { checkName(name); try { - TypedProperties.setObjectProperty(new SimpleString(name), value, map); + TypedProperties.setObjectProperty(SimpleString.of(name), value, map); } catch (ActiveMQPropertyConversionException e) { throw new MessageFormatException(e.getMessage()); } @@ -188,7 +188,7 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage { @Override public boolean getBoolean(final String name) throws JMSException { try { - return map.getBooleanProperty(new SimpleString(name)); + return map.getBooleanProperty(SimpleString.of(name)); } catch (ActiveMQPropertyConversionException e) { throw new MessageFormatException(e.getMessage()); } @@ -197,7 +197,7 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage { @Override public byte getByte(final String name) throws JMSException { try { - return map.getByteProperty(new SimpleString(name)); + return map.getByteProperty(SimpleString.of(name)); } catch (ActiveMQPropertyConversionException e) { throw new MessageFormatException(e.getMessage()); } @@ -206,7 +206,7 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage { @Override public short getShort(final String name) throws JMSException { try { - return map.getShortProperty(new SimpleString(name)); + return map.getShortProperty(SimpleString.of(name)); } catch (ActiveMQPropertyConversionException e) { throw new MessageFormatException(e.getMessage()); } @@ -215,7 +215,7 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage { @Override public char getChar(final String name) throws JMSException { try { - return map.getCharProperty(new SimpleString(name)); + return map.getCharProperty(SimpleString.of(name)); } catch (ActiveMQPropertyConversionException e) { throw new MessageFormatException(e.getMessage()); } @@ -224,7 +224,7 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage { @Override public int getInt(final String name) throws JMSException { try { - return map.getIntProperty(new SimpleString(name)); + return map.getIntProperty(SimpleString.of(name)); } catch (ActiveMQPropertyConversionException e) { throw new MessageFormatException(e.getMessage()); } @@ -233,7 +233,7 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage { @Override public long getLong(final String name) throws JMSException { try { - return map.getLongProperty(new SimpleString(name)); + return map.getLongProperty(SimpleString.of(name)); } catch (ActiveMQPropertyConversionException e) { throw new MessageFormatException(e.getMessage()); } @@ -242,7 +242,7 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage { @Override public float getFloat(final String name) throws JMSException { try { - return map.getFloatProperty(new SimpleString(name)); + return map.getFloatProperty(SimpleString.of(name)); } catch (ActiveMQPropertyConversionException e) { throw new MessageFormatException(e.getMessage()); } @@ -251,7 +251,7 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage { @Override public double getDouble(final String name) throws JMSException { try { - return map.getDoubleProperty(new SimpleString(name)); + return map.getDoubleProperty(SimpleString.of(name)); } catch (ActiveMQPropertyConversionException e) { throw new MessageFormatException(e.getMessage()); } @@ -260,7 +260,7 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage { @Override public String getString(final String name) throws JMSException { try { - SimpleString str = map.getSimpleStringProperty(new SimpleString(name)); + SimpleString str = map.getSimpleStringProperty(SimpleString.of(name)); if (str == null) { return null; } else { @@ -274,7 +274,7 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage { @Override public byte[] getBytes(final String name) throws JMSException { try { - return map.getBytesProperty(new SimpleString(name)); + return map.getBytesProperty(SimpleString.of(name)); } catch (ActiveMQPropertyConversionException e) { throw new MessageFormatException(e.getMessage()); } @@ -282,7 +282,7 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage { @Override public Object getObject(final String name) throws JMSException { - Object val = map.getProperty(new SimpleString(name)); + Object val = map.getProperty(SimpleString.of(name)); if (val instanceof SimpleString) { val = ((SimpleString) val).toString(); @@ -298,7 +298,7 @@ public class ActiveMQMapMessage extends ActiveMQMessage implements MapMessage { @Override public boolean itemExists(final String name) throws JMSException { - return map.containsProperty(new SimpleString(name)); + return map.containsProperty(SimpleString.of(name)); } @Override diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessage.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessage.java index 9ca991844d..1fcc53bb5d 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessage.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessage.java @@ -66,10 +66,10 @@ public class ActiveMQMessage implements javax.jms.Message { public static final byte TYPE = org.apache.activemq.artemis.api.core.Message.DEFAULT_TYPE; - public static final SimpleString OLD_QUEUE_QUALIFIED_PREFIX = SimpleString.toSimpleString(ActiveMQDestination.QUEUE_QUALIFIED_PREFIX + PacketImpl.OLD_QUEUE_PREFIX); - public static final SimpleString OLD_TEMP_QUEUE_QUALIFED_PREFIX = SimpleString.toSimpleString(ActiveMQDestination.TEMP_QUEUE_QUALIFED_PREFIX + PacketImpl.OLD_TEMP_QUEUE_PREFIX); - public static final SimpleString OLD_TOPIC_QUALIFIED_PREFIX = SimpleString.toSimpleString(ActiveMQDestination.TOPIC_QUALIFIED_PREFIX + PacketImpl.OLD_TOPIC_PREFIX); - public static final SimpleString OLD_TEMP_TOPIC_QUALIFED_PREFIX = SimpleString.toSimpleString(ActiveMQDestination.TEMP_TOPIC_QUALIFED_PREFIX + PacketImpl.OLD_TEMP_TOPIC_PREFIX); + public static final SimpleString OLD_QUEUE_QUALIFIED_PREFIX = SimpleString.of(ActiveMQDestination.QUEUE_QUALIFIED_PREFIX + PacketImpl.OLD_QUEUE_PREFIX); + public static final SimpleString OLD_TEMP_QUEUE_QUALIFED_PREFIX = SimpleString.of(ActiveMQDestination.TEMP_QUEUE_QUALIFED_PREFIX + PacketImpl.OLD_TEMP_QUEUE_PREFIX); + public static final SimpleString OLD_TOPIC_QUALIFIED_PREFIX = SimpleString.of(ActiveMQDestination.TOPIC_QUALIFIED_PREFIX + PacketImpl.OLD_TOPIC_PREFIX); + public static final SimpleString OLD_TEMP_TOPIC_QUALIFED_PREFIX = SimpleString.of(ActiveMQDestination.TEMP_TOPIC_QUALIFED_PREFIX + PacketImpl.OLD_TEMP_TOPIC_PREFIX); public static Map coreMaptoJMSMap(final Map coreMessage) { Map jmsMessage = new HashMap<>(); diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageProducer.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageProducer.java index a9e761b1df..ffc419bc82 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageProducer.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageProducer.java @@ -83,7 +83,7 @@ public class ActiveMQMessageProducer implements MessageProducer, QueueSender, To this.options = options; this.connection = connection; - connID = connection.getClientID() != null ? new SimpleString(connection.getClientID()) : connection.getUID(); + connID = connection.getClientID() != null ? SimpleString.of(connection.getClientID()) : connection.getUID(); this.clientProducer = producer; diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQQueueBrowser.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQQueueBrowser.java index 76e13065a7..0466ad29f8 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQQueueBrowser.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQQueueBrowser.java @@ -59,7 +59,7 @@ public final class ActiveMQQueueBrowser implements QueueBrowser { this.session = session; this.queue = queue; if (messageSelector != null) { - filterString = new SimpleString(SelectorTranslator.convertToActiveMQFilterString(messageSelector)); + filterString = SimpleString.of(SelectorTranslator.convertToActiveMQFilterString(messageSelector)); } this.enable1xPrefixes = enable1xPrefixes; } 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 32228300ef..9970d84f2b 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 @@ -92,7 +92,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { public static final int TYPE_TOPIC_SESSION = 2; - private static SimpleString REJECTING_FILTER = new SimpleString("_AMQX=-1"); + private static SimpleString REJECTING_FILTER = SimpleString.of("_AMQX=-1"); private final ConnectionFactoryOptions options; @@ -736,7 +736,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { SimpleString coreFilterString = null; if (selectorString != null) { - coreFilterString = new SimpleString(SelectorTranslator.convertToActiveMQFilterString(selectorString)); + coreFilterString = SimpleString.of(SelectorTranslator.convertToActiveMQFilterString(selectorString)); } ClientConsumer consumer; @@ -810,7 +810,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { SimpleString coreFilterString = null; if (selectorString != null) { - coreFilterString = new SimpleString(SelectorTranslator.convertToActiveMQFilterString(selectorString)); + coreFilterString = SimpleString.of(SelectorTranslator.convertToActiveMQFilterString(selectorString)); } ClientConsumer consumer; @@ -854,7 +854,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { if (CompositeAddress.isFullyQualified(dest.getAddress())) { queueName = createFQQNSubscription(dest, coreFilterString, response); } else { - queueName = new SimpleString(UUID.randomUUID().toString()); + queueName = SimpleString.of(UUID.randomUUID().toString()); createTemporaryQueue(dest, RoutingType.MULTICAST, queueName, coreFilterString, response); } @@ -996,7 +996,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { SelectorParser.parse(filterString.trim()); } } catch (FilterException e) { - throw JMSExceptionHelper.convertFromActiveMQException(ActiveMQJMSClientBundle.BUNDLE.invalidFilter(new SimpleString(filterString), e)); + throw JMSExceptionHelper.convertFromActiveMQException(ActiveMQJMSClientBundle.BUNDLE.invalidFilter(SimpleString.of(filterString), e)); } ActiveMQDestination activeMQDestination = (ActiveMQDestination) queue; @@ -1006,7 +1006,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { } try { - AddressQuery response = session.addressQuery(new SimpleString(activeMQDestination.getAddress())); + AddressQuery response = session.addressQuery(SimpleString.of(activeMQDestination.getAddress())); if (!response.isExists()) { if (response.isAutoCreateQueues()) { createQueue(activeMQDestination, RoutingType.ANYCAST, activeMQDestination.getSimpleAddress(), null, true, true, response); diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTextMessage.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTextMessage.java index ebb10ed078..2e213f6054 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTextMessage.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTextMessage.java @@ -73,7 +73,7 @@ public class ActiveMQTextMessage extends ActiveMQMessage implements TextMessage checkWrite(); if (text != null) { - this.text = new SimpleString(text); + this.text = SimpleString.of(text); } else { this.text = null; } diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/persistence/config/PersistedDestination.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/persistence/config/PersistedDestination.java index e898b8646e..18d1b92772 100644 --- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/persistence/config/PersistedDestination.java +++ b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/persistence/config/PersistedDestination.java @@ -87,8 +87,8 @@ public class PersistedDestination implements EncodingSupport { @Override public void encode(final ActiveMQBuffer buffer) { buffer.writeByte(type.getType()); - buffer.writeSimpleString(SimpleString.toSimpleString(name)); - buffer.writeNullableSimpleString(SimpleString.toSimpleString(selector)); + buffer.writeSimpleString(SimpleString.of(name)); + buffer.writeNullableSimpleString(SimpleString.of(selector)); buffer.writeBoolean(durable); } 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 c5d265138f..e5507a1839 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 @@ -779,11 +779,11 @@ public class JMSServerManagerImpl extends CleaningActivateCallback implements JM public synchronized boolean destroyQueue(final String name, final boolean removeConsumers) throws Exception { checkInitialised(); - server.destroyQueue(SimpleString.toSimpleString(name), null, !removeConsumers, removeConsumers); + server.destroyQueue(SimpleString.of(name), null, !removeConsumers, removeConsumers); // if the queue has consumers and 'removeConsumers' is false then the queue won't actually be removed // therefore only remove the queue from Bindings, etc. if the queue is actually removed - if (this.server.getPostOffice().getBinding(SimpleString.toSimpleString(name)) == null) { + if (this.server.getPostOffice().getBinding(SimpleString.of(name)) == null) { removeFromBindings(queues, queueBindings, name); queues.remove(name); @@ -809,7 +809,7 @@ public class JMSServerManagerImpl extends CleaningActivateCallback implements JM AddressControl addressControl = (AddressControl) server.getManagementService().getResource(ResourceNames.ADDRESS + name); if (addressControl != null) { for (String queueName : addressControl.getAllQueueNames()) { - Binding binding = server.getPostOffice().getBinding(new SimpleString(queueName)); + Binding binding = server.getPostOffice().getBinding(SimpleString.of(queueName)); if (binding == null) { ActiveMQJMSServerLogger.LOGGER.noQueueOnTopic(queueName, name); continue; @@ -817,13 +817,13 @@ public class JMSServerManagerImpl extends CleaningActivateCallback implements JM // We can't remove the remote binding. As this would be the bridge associated with the topic on this case if (binding.getType() != BindingType.REMOTE_QUEUE) { - server.destroyQueue(SimpleString.toSimpleString(queueName), null, !removeConsumers, removeConsumers, false); + server.destroyQueue(SimpleString.of(queueName), null, !removeConsumers, removeConsumers, false); } } if (addressControl.getAllQueueNames().length == 0) { try { - server.removeAddressInfo(SimpleString.toSimpleString(name), null); + server.removeAddressInfo(SimpleString.of(name), null); } catch (ActiveMQAddressDoesNotExistException e) { // ignore } @@ -1030,7 +1030,7 @@ public class JMSServerManagerImpl extends CleaningActivateCallback implements JM private void sendNotification(JMSNotificationType type, String message) { TypedProperties prop = new TypedProperties(); - prop.putSimpleStringProperty(JMSNotificationType.MESSAGE, SimpleString.toSimpleString(message)); + prop.putSimpleStringProperty(JMSNotificationType.MESSAGE, SimpleString.of(message)); Notification notif = new Notification(null, type, prop); try { server.getManagementService().sendNotification(notif); @@ -1080,7 +1080,7 @@ public class JMSServerManagerImpl extends CleaningActivateCallback implements JM coreFilterString = SelectorTranslator.convertToActiveMQFilterString(selectorString); } - server.addOrUpdateAddressInfo(new AddressInfo(SimpleString.toSimpleString(queueName)).addRoutingType(RoutingType.ANYCAST)); + server.addOrUpdateAddressInfo(new AddressInfo(SimpleString.of(queueName)).addRoutingType(RoutingType.ANYCAST)); server.createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST).setFilterString(coreFilterString).setDurable(durable), true); @@ -1114,7 +1114,7 @@ public class JMSServerManagerImpl extends CleaningActivateCallback implements JM } else { // Create the JMS topic with topicName as the logical name of the topic *and* address as its address ActiveMQTopic activeMQTopic = ActiveMQDestination.createTopic(address, topicName); - server.addOrUpdateAddressInfo(new AddressInfo(SimpleString.toSimpleString(activeMQTopic.getAddress()), RoutingType.MULTICAST)); + server.addOrUpdateAddressInfo(new AddressInfo(SimpleString.of(activeMQTopic.getAddress()), RoutingType.MULTICAST)); topics.put(address, activeMQTopic); diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/management/JMSNotificationType.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/management/JMSNotificationType.java index 5f71effbd9..a287d4c54c 100644 --- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/management/JMSNotificationType.java +++ b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/management/JMSNotificationType.java @@ -27,7 +27,7 @@ public enum JMSNotificationType implements NotificationType { CONNECTION_FACTORY_CREATED(4), CONNECTION_FACTORY_DESTROYED(5); - public static final SimpleString MESSAGE = new SimpleString("message"); + public static final SimpleString MESSAGE = SimpleString.of("message"); private int type; diff --git a/artemis-junit/artemis-junit-4/src/main/java/org/apache/activemq/artemis/junit/ActiveMQConsumerResource.java b/artemis-junit/artemis-junit-4/src/main/java/org/apache/activemq/artemis/junit/ActiveMQConsumerResource.java index 5a02681648..b6f310895c 100644 --- a/artemis-junit/artemis-junit-4/src/main/java/org/apache/activemq/artemis/junit/ActiveMQConsumerResource.java +++ b/artemis-junit/artemis-junit-4/src/main/java/org/apache/activemq/artemis/junit/ActiveMQConsumerResource.java @@ -54,7 +54,7 @@ public class ActiveMQConsumerResource extends ExternalResource implements Active public ActiveMQConsumerResource(String url, String queueName, String username, String password) { this.activeMQConsumer = - new ActiveMQConsumerDelegate(url, SimpleString.toSimpleString(queueName), username, password); + new ActiveMQConsumerDelegate(url, SimpleString.of(queueName), username, password); } public ActiveMQConsumerResource(String url, SimpleString queueName, String username, String password) { @@ -66,11 +66,11 @@ public class ActiveMQConsumerResource extends ExternalResource implements Active } public ActiveMQConsumerResource(ServerLocator serverLocator, String queueName, String username, String password) { - this(serverLocator, SimpleString.toSimpleString(queueName), username, password); + this(serverLocator, SimpleString.of(queueName), username, password); } public ActiveMQConsumerResource(ServerLocator serverLocator, String queueName) { - this(serverLocator, SimpleString.toSimpleString(queueName), null, null); + this(serverLocator, SimpleString.of(queueName), null, null); } public ActiveMQConsumerResource(ServerLocator serverLocator, SimpleString queueName, String username, diff --git a/artemis-junit/artemis-junit-4/src/main/java/org/apache/activemq/artemis/junit/ActiveMQProducerResource.java b/artemis-junit/artemis-junit-4/src/main/java/org/apache/activemq/artemis/junit/ActiveMQProducerResource.java index 5959c82dc0..a2665f4d5a 100644 --- a/artemis-junit/artemis-junit-4/src/main/java/org/apache/activemq/artemis/junit/ActiveMQProducerResource.java +++ b/artemis-junit/artemis-junit-4/src/main/java/org/apache/activemq/artemis/junit/ActiveMQProducerResource.java @@ -67,7 +67,7 @@ public class ActiveMQProducerResource extends ExternalResource implements Active } public ActiveMQProducerResource(String url, String address, String username, String password) { - activeMQProducer = new ActiveMQProducerDelegate(url, SimpleString.toSimpleString(address), username, password); + activeMQProducer = new ActiveMQProducerDelegate(url, SimpleString.of(address), username, password); } public ActiveMQProducerResource(String url, String address) { @@ -84,11 +84,11 @@ public class ActiveMQProducerResource extends ExternalResource implements Active public ActiveMQProducerResource(ServerLocator serverLocator, String address, String username, String password) { activeMQProducer = - new ActiveMQProducerDelegate(serverLocator, SimpleString.toSimpleString(address), username, password); + new ActiveMQProducerDelegate(serverLocator, SimpleString.of(address), username, password); } public ActiveMQProducerResource(ServerLocator serverLocator, String address) { - activeMQProducer = new ActiveMQProducerDelegate(serverLocator, SimpleString.toSimpleString(address)); + activeMQProducer = new ActiveMQProducerDelegate(serverLocator, SimpleString.of(address)); } public ActiveMQProducerResource(ServerLocator serverLocator, SimpleString address, String username, diff --git a/artemis-junit/artemis-junit-4/src/test/java/org/apache/activemq/artemis/junit/ActiveMQConsumerResourceTest.java b/artemis-junit/artemis-junit-4/src/test/java/org/apache/activemq/artemis/junit/ActiveMQConsumerResourceTest.java index 8d6bb1b0ac..822761f4c8 100644 --- a/artemis-junit/artemis-junit-4/src/test/java/org/apache/activemq/artemis/junit/ActiveMQConsumerResourceTest.java +++ b/artemis-junit/artemis-junit-4/src/test/java/org/apache/activemq/artemis/junit/ActiveMQConsumerResourceTest.java @@ -34,8 +34,8 @@ import static org.junit.Assert.assertTrue; public class ActiveMQConsumerResourceTest { - static final SimpleString TEST_QUEUE = new SimpleString("test.queue"); - static final SimpleString TEST_ADDRESS = new SimpleString("test.queue"); + static final SimpleString TEST_QUEUE = SimpleString.of("test.queue"); + static final SimpleString TEST_ADDRESS = SimpleString.of("test.queue"); static final String TEST_BODY = "Test Message"; static final Map TEST_PROPERTIES; diff --git a/artemis-junit/artemis-junit-4/src/test/java/org/apache/activemq/artemis/junit/ActiveMQDynamicProducerResourceTest.java b/artemis-junit/artemis-junit-4/src/test/java/org/apache/activemq/artemis/junit/ActiveMQDynamicProducerResourceTest.java index 19dfa3e8ea..bc22e1b7a4 100644 --- a/artemis-junit/artemis-junit-4/src/test/java/org/apache/activemq/artemis/junit/ActiveMQDynamicProducerResourceTest.java +++ b/artemis-junit/artemis-junit-4/src/test/java/org/apache/activemq/artemis/junit/ActiveMQDynamicProducerResourceTest.java @@ -34,8 +34,8 @@ import static org.junit.Assert.assertTrue; public class ActiveMQDynamicProducerResourceTest { - static final SimpleString TEST_QUEUE_ONE = new SimpleString("test.queue.one"); - static final SimpleString TEST_QUEUE_TWO = new SimpleString("test.queue.two"); + static final SimpleString TEST_QUEUE_ONE = SimpleString.of("test.queue.one"); + static final SimpleString TEST_QUEUE_TWO = SimpleString.of("test.queue.two"); static final String TEST_BODY = "Test Message"; static final Map TEST_PROPERTIES; diff --git a/artemis-junit/artemis-junit-4/src/test/java/org/apache/activemq/artemis/junit/ActiveMQDynamicProducerResourceWithoutAddressExceptionTest.java b/artemis-junit/artemis-junit-4/src/test/java/org/apache/activemq/artemis/junit/ActiveMQDynamicProducerResourceWithoutAddressExceptionTest.java index 35d4a385fa..b014505e66 100644 --- a/artemis-junit/artemis-junit-4/src/test/java/org/apache/activemq/artemis/junit/ActiveMQDynamicProducerResourceWithoutAddressExceptionTest.java +++ b/artemis-junit/artemis-junit-4/src/test/java/org/apache/activemq/artemis/junit/ActiveMQDynamicProducerResourceWithoutAddressExceptionTest.java @@ -28,7 +28,7 @@ import org.junit.rules.RuleChain; public class ActiveMQDynamicProducerResourceWithoutAddressExceptionTest { - static final SimpleString TEST_QUEUE_ONE = new SimpleString("test.queue.one"); + static final SimpleString TEST_QUEUE_ONE = SimpleString.of("test.queue.one"); static final String TEST_BODY = "Test Message"; static final Map TEST_PROPERTIES; diff --git a/artemis-junit/artemis-junit-4/src/test/java/org/apache/activemq/artemis/junit/ActiveMQDynamicProducerResourceWithoutAddressTest.java b/artemis-junit/artemis-junit-4/src/test/java/org/apache/activemq/artemis/junit/ActiveMQDynamicProducerResourceWithoutAddressTest.java index a77efdb911..933ed285ae 100644 --- a/artemis-junit/artemis-junit-4/src/test/java/org/apache/activemq/artemis/junit/ActiveMQDynamicProducerResourceWithoutAddressTest.java +++ b/artemis-junit/artemis-junit-4/src/test/java/org/apache/activemq/artemis/junit/ActiveMQDynamicProducerResourceWithoutAddressTest.java @@ -35,8 +35,8 @@ import static org.junit.Assert.assertTrue; public class ActiveMQDynamicProducerResourceWithoutAddressTest { - static final SimpleString TEST_QUEUE_ONE = new SimpleString("test.queue.one"); - static final SimpleString TEST_QUEUE_TWO = new SimpleString("test.queue.two"); + static final SimpleString TEST_QUEUE_ONE = SimpleString.of("test.queue.one"); + static final SimpleString TEST_QUEUE_TWO = SimpleString.of("test.queue.two"); static final String TEST_BODY = "Test Message"; static final Map TEST_PROPERTIES; diff --git a/artemis-junit/artemis-junit-4/src/test/java/org/apache/activemq/artemis/junit/ActiveMQProducerResourceTest.java b/artemis-junit/artemis-junit-4/src/test/java/org/apache/activemq/artemis/junit/ActiveMQProducerResourceTest.java index 8c5ab7d781..bc3fcefb1c 100644 --- a/artemis-junit/artemis-junit-4/src/test/java/org/apache/activemq/artemis/junit/ActiveMQProducerResourceTest.java +++ b/artemis-junit/artemis-junit-4/src/test/java/org/apache/activemq/artemis/junit/ActiveMQProducerResourceTest.java @@ -33,8 +33,8 @@ import static org.junit.Assert.assertTrue; public class ActiveMQProducerResourceTest { - static final SimpleString TEST_QUEUE = new SimpleString("test.queue"); - static final SimpleString TEST_ADDRESS = new SimpleString("test.queue"); + static final SimpleString TEST_QUEUE = SimpleString.of("test.queue"); + static final SimpleString TEST_ADDRESS = SimpleString.of("test.queue"); static final String TEST_BODY = "Test Message"; static final Map TEST_PROPERTIES; diff --git a/artemis-junit/artemis-junit-4/src/test/java/org/apache/activemq/artemis/junit/EmbeddedActiveMQResourceTest.java b/artemis-junit/artemis-junit-4/src/test/java/org/apache/activemq/artemis/junit/EmbeddedActiveMQResourceTest.java index ec0f27bcfc..7cf37cf9dc 100644 --- a/artemis-junit/artemis-junit-4/src/test/java/org/apache/activemq/artemis/junit/EmbeddedActiveMQResourceTest.java +++ b/artemis-junit/artemis-junit-4/src/test/java/org/apache/activemq/artemis/junit/EmbeddedActiveMQResourceTest.java @@ -35,8 +35,8 @@ import static org.junit.Assert.assertTrue; public class EmbeddedActiveMQResourceTest { - static final SimpleString TEST_QUEUE = new SimpleString("test.queue"); - static final SimpleString TEST_ADDRESS = new SimpleString("test.queueName"); + static final SimpleString TEST_QUEUE = SimpleString.of("test.queue"); + static final SimpleString TEST_ADDRESS = SimpleString.of("test.queueName"); static final String TEST_BODY = "Test Message"; static final Map TEST_PROPERTIES; diff --git a/artemis-junit/artemis-junit-4/src/test/java/org/apache/activemq/artemis/junit/MultipleEmbeddedActiveMQResourcesTest.java b/artemis-junit/artemis-junit-4/src/test/java/org/apache/activemq/artemis/junit/MultipleEmbeddedActiveMQResourcesTest.java index 6712a0c9e7..3bb261b9ee 100644 --- a/artemis-junit/artemis-junit-4/src/test/java/org/apache/activemq/artemis/junit/MultipleEmbeddedActiveMQResourcesTest.java +++ b/artemis-junit/artemis-junit-4/src/test/java/org/apache/activemq/artemis/junit/MultipleEmbeddedActiveMQResourcesTest.java @@ -28,10 +28,10 @@ import static org.junit.Assert.assertNotNull; public class MultipleEmbeddedActiveMQResourcesTest { - static final SimpleString TEST_QUEUE_ONE = new SimpleString("test.queue.one"); - static final SimpleString TEST_QUEUE_TWO = new SimpleString("test.queue.two"); - static final SimpleString TEST_ADDRESS_ONE = new SimpleString("test.address.one"); - static final SimpleString TEST_ADDRESS_TWO = new SimpleString("test.address.two"); + static final SimpleString TEST_QUEUE_ONE = SimpleString.of("test.queue.one"); + static final SimpleString TEST_QUEUE_TWO = SimpleString.of("test.queue.two"); + static final SimpleString TEST_ADDRESS_ONE = SimpleString.of("test.address.one"); + static final SimpleString TEST_ADDRESS_TWO = SimpleString.of("test.address.two"); static final String TEST_BODY = "Test Message"; @@ -48,8 +48,8 @@ public class MultipleEmbeddedActiveMQResourcesTest { @Before public void setUp() throws Exception { - serverOne.getServer().getActiveMQServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setDeadLetterAddress(SimpleString.toSimpleString("DLA")).setExpiryAddress(SimpleString.toSimpleString("Expiry"))); - serverTwo.getServer().getActiveMQServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setDeadLetterAddress(SimpleString.toSimpleString("DLA")).setExpiryAddress(SimpleString.toSimpleString("Expiry"))); + serverOne.getServer().getActiveMQServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setDeadLetterAddress(SimpleString.of("DLA")).setExpiryAddress(SimpleString.of("Expiry"))); + serverTwo.getServer().getActiveMQServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setDeadLetterAddress(SimpleString.of("DLA")).setExpiryAddress(SimpleString.of("Expiry"))); serverOne.createQueue(TEST_ADDRESS_ONE, TEST_QUEUE_ONE); serverTwo.createQueue(TEST_ADDRESS_TWO, TEST_QUEUE_TWO); diff --git a/artemis-junit/artemis-junit-4/src/test/java/org/apache/activemq/artemis/junit/MultipleEmbeddedJMSResourcesTest.java b/artemis-junit/artemis-junit-4/src/test/java/org/apache/activemq/artemis/junit/MultipleEmbeddedJMSResourcesTest.java index 053699c523..9332b63484 100644 --- a/artemis-junit/artemis-junit-4/src/test/java/org/apache/activemq/artemis/junit/MultipleEmbeddedJMSResourcesTest.java +++ b/artemis-junit/artemis-junit-4/src/test/java/org/apache/activemq/artemis/junit/MultipleEmbeddedJMSResourcesTest.java @@ -44,8 +44,8 @@ public class MultipleEmbeddedJMSResourcesTest { @Test public void testMultipleServers() throws Exception { - jmsServerOne.getJmsServer().getActiveMQServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setDeadLetterAddress(SimpleString.toSimpleString("DLA")).setExpiryAddress(SimpleString.toSimpleString("Expiry"))); - jmsServerTwo.getJmsServer().getActiveMQServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setDeadLetterAddress(SimpleString.toSimpleString("DLA")).setExpiryAddress(SimpleString.toSimpleString("Expiry"))); + jmsServerOne.getJmsServer().getActiveMQServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setDeadLetterAddress(SimpleString.of("DLA")).setExpiryAddress(SimpleString.of("Expiry"))); + jmsServerTwo.getJmsServer().getActiveMQServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setDeadLetterAddress(SimpleString.of("DLA")).setExpiryAddress(SimpleString.of("Expiry"))); Message pushedOne = jmsServerOne.pushMessage(TEST_QUEUE_ONE, TEST_BODY); assertNotNull(String.format(ASSERT_PUSHED_FORMAT, TEST_QUEUE_ONE), pushedOne); diff --git a/artemis-junit/artemis-junit-5/src/test/java/org/apache/activemq/artemis/junit/ActiveMQConsumerResourceTest.java b/artemis-junit/artemis-junit-5/src/test/java/org/apache/activemq/artemis/junit/ActiveMQConsumerResourceTest.java index 9360bbd740..8b8aa40d00 100644 --- a/artemis-junit/artemis-junit-5/src/test/java/org/apache/activemq/artemis/junit/ActiveMQConsumerResourceTest.java +++ b/artemis-junit/artemis-junit-5/src/test/java/org/apache/activemq/artemis/junit/ActiveMQConsumerResourceTest.java @@ -36,8 +36,8 @@ import static org.junit.jupiter.api.TestInstance.Lifecycle; @TestInstance(Lifecycle.PER_CLASS) public class ActiveMQConsumerResourceTest { - static final SimpleString TEST_QUEUE = new SimpleString("test.queue"); - static final SimpleString TEST_ADDRESS = new SimpleString("test.queue"); + static final SimpleString TEST_QUEUE = SimpleString.of("test.queue"); + static final SimpleString TEST_ADDRESS = SimpleString.of("test.queue"); static final String TEST_BODY = "Test Message"; static final Map TEST_PROPERTIES; diff --git a/artemis-junit/artemis-junit-5/src/test/java/org/apache/activemq/artemis/junit/ActiveMQDynamicProducerResourceTest.java b/artemis-junit/artemis-junit-5/src/test/java/org/apache/activemq/artemis/junit/ActiveMQDynamicProducerResourceTest.java index c7ba052b2d..e86c8c2b16 100644 --- a/artemis-junit/artemis-junit-5/src/test/java/org/apache/activemq/artemis/junit/ActiveMQDynamicProducerResourceTest.java +++ b/artemis-junit/artemis-junit-5/src/test/java/org/apache/activemq/artemis/junit/ActiveMQDynamicProducerResourceTest.java @@ -36,8 +36,8 @@ import static org.junit.jupiter.api.TestInstance.Lifecycle; @TestInstance(Lifecycle.PER_CLASS) public class ActiveMQDynamicProducerResourceTest { - static final SimpleString TEST_QUEUE_ONE = new SimpleString("test.queue.one"); - static final SimpleString TEST_QUEUE_TWO = new SimpleString("test.queue.two"); + static final SimpleString TEST_QUEUE_ONE = SimpleString.of("test.queue.one"); + static final SimpleString TEST_QUEUE_TWO = SimpleString.of("test.queue.two"); static final String TEST_BODY = "Test Message"; static final Map TEST_PROPERTIES; diff --git a/artemis-junit/artemis-junit-5/src/test/java/org/apache/activemq/artemis/junit/ActiveMQDynamicProducerResourceWithoutAddressExceptionTest.java b/artemis-junit/artemis-junit-5/src/test/java/org/apache/activemq/artemis/junit/ActiveMQDynamicProducerResourceWithoutAddressExceptionTest.java index 89373f53d6..443828e394 100644 --- a/artemis-junit/artemis-junit-5/src/test/java/org/apache/activemq/artemis/junit/ActiveMQDynamicProducerResourceWithoutAddressExceptionTest.java +++ b/artemis-junit/artemis-junit-5/src/test/java/org/apache/activemq/artemis/junit/ActiveMQDynamicProducerResourceWithoutAddressExceptionTest.java @@ -32,7 +32,7 @@ import static org.junit.jupiter.api.TestInstance.Lifecycle; @TestInstance(Lifecycle.PER_CLASS) public class ActiveMQDynamicProducerResourceWithoutAddressExceptionTest { - static final SimpleString TEST_QUEUE_ONE = new SimpleString("test.queue.one"); + static final SimpleString TEST_QUEUE_ONE = SimpleString.of("test.queue.one"); static final String TEST_BODY = "Test Message"; static final Map TEST_PROPERTIES; diff --git a/artemis-junit/artemis-junit-5/src/test/java/org/apache/activemq/artemis/junit/ActiveMQDynamicProducerResourceWithoutAddressTest.java b/artemis-junit/artemis-junit-5/src/test/java/org/apache/activemq/artemis/junit/ActiveMQDynamicProducerResourceWithoutAddressTest.java index 79d6d451e6..a3a1d4a39e 100644 --- a/artemis-junit/artemis-junit-5/src/test/java/org/apache/activemq/artemis/junit/ActiveMQDynamicProducerResourceWithoutAddressTest.java +++ b/artemis-junit/artemis-junit-5/src/test/java/org/apache/activemq/artemis/junit/ActiveMQDynamicProducerResourceWithoutAddressTest.java @@ -37,8 +37,8 @@ import static org.junit.jupiter.api.TestInstance.Lifecycle; @TestInstance(Lifecycle.PER_CLASS) public class ActiveMQDynamicProducerResourceWithoutAddressTest { - static final SimpleString TEST_QUEUE_ONE = new SimpleString("test.queue.one"); - static final SimpleString TEST_QUEUE_TWO = new SimpleString("test.queue.two"); + static final SimpleString TEST_QUEUE_ONE = SimpleString.of("test.queue.one"); + static final SimpleString TEST_QUEUE_TWO = SimpleString.of("test.queue.two"); static final String TEST_BODY = "Test Message"; static final Map TEST_PROPERTIES; diff --git a/artemis-junit/artemis-junit-5/src/test/java/org/apache/activemq/artemis/junit/ActiveMQProducerResourceTest.java b/artemis-junit/artemis-junit-5/src/test/java/org/apache/activemq/artemis/junit/ActiveMQProducerResourceTest.java index eac5fb17df..e8eddc2e6e 100644 --- a/artemis-junit/artemis-junit-5/src/test/java/org/apache/activemq/artemis/junit/ActiveMQProducerResourceTest.java +++ b/artemis-junit/artemis-junit-5/src/test/java/org/apache/activemq/artemis/junit/ActiveMQProducerResourceTest.java @@ -36,8 +36,8 @@ import static org.junit.jupiter.api.TestInstance.Lifecycle; @TestInstance(Lifecycle.PER_CLASS) public class ActiveMQProducerResourceTest { - static final SimpleString TEST_QUEUE = new SimpleString("test.queue"); - static final SimpleString TEST_ADDRESS = new SimpleString("test.queue"); + static final SimpleString TEST_QUEUE = SimpleString.of("test.queue"); + static final SimpleString TEST_ADDRESS = SimpleString.of("test.queue"); static final String TEST_BODY = "Test Message"; static final Map TEST_PROPERTIES; diff --git a/artemis-junit/artemis-junit-5/src/test/java/org/apache/activemq/artemis/junit/EmbeddedActiveMQResourceTest.java b/artemis-junit/artemis-junit-5/src/test/java/org/apache/activemq/artemis/junit/EmbeddedActiveMQResourceTest.java index 3aa81e15e3..f51b35568d 100644 --- a/artemis-junit/artemis-junit-5/src/test/java/org/apache/activemq/artemis/junit/EmbeddedActiveMQResourceTest.java +++ b/artemis-junit/artemis-junit-5/src/test/java/org/apache/activemq/artemis/junit/EmbeddedActiveMQResourceTest.java @@ -36,8 +36,8 @@ import static org.junit.jupiter.api.TestInstance.Lifecycle; @TestInstance(Lifecycle.PER_CLASS) public class EmbeddedActiveMQResourceTest { - static final SimpleString TEST_QUEUE = new SimpleString("test.queue"); - static final SimpleString TEST_ADDRESS = new SimpleString("test.queueName"); + static final SimpleString TEST_QUEUE = SimpleString.of("test.queue"); + static final SimpleString TEST_ADDRESS = SimpleString.of("test.queueName"); static final String TEST_BODY = "Test Message"; static final Map TEST_PROPERTIES; diff --git a/artemis-junit/artemis-junit-5/src/test/java/org/apache/activemq/artemis/junit/MultipleEmbeddedActiveMQResourcesTest.java b/artemis-junit/artemis-junit-5/src/test/java/org/apache/activemq/artemis/junit/MultipleEmbeddedActiveMQResourcesTest.java index 29a6f3731a..e001b0cdee 100644 --- a/artemis-junit/artemis-junit-5/src/test/java/org/apache/activemq/artemis/junit/MultipleEmbeddedActiveMQResourcesTest.java +++ b/artemis-junit/artemis-junit-5/src/test/java/org/apache/activemq/artemis/junit/MultipleEmbeddedActiveMQResourcesTest.java @@ -31,10 +31,10 @@ import static org.junit.jupiter.api.TestInstance.Lifecycle; @TestInstance(Lifecycle.PER_CLASS) public class MultipleEmbeddedActiveMQResourcesTest { - static final SimpleString TEST_QUEUE_ONE = new SimpleString("test.queue.one"); - static final SimpleString TEST_QUEUE_TWO = new SimpleString("test.queue.two"); - static final SimpleString TEST_ADDRESS_ONE = new SimpleString("test.address.one"); - static final SimpleString TEST_ADDRESS_TWO = new SimpleString("test.address.two"); + static final SimpleString TEST_QUEUE_ONE = SimpleString.of("test.queue.one"); + static final SimpleString TEST_QUEUE_TWO = SimpleString.of("test.queue.two"); + static final SimpleString TEST_ADDRESS_ONE = SimpleString.of("test.address.one"); + static final SimpleString TEST_ADDRESS_TWO = SimpleString.of("test.address.two"); static final String TEST_BODY = "Test Message"; @@ -51,8 +51,8 @@ public class MultipleEmbeddedActiveMQResourcesTest { @BeforeAll public void setUp() throws Exception { - serverOne.getServer().getActiveMQServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setDeadLetterAddress(SimpleString.toSimpleString("DLA")).setExpiryAddress(SimpleString.toSimpleString("Expiry"))); - serverTwo.getServer().getActiveMQServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setDeadLetterAddress(SimpleString.toSimpleString("DLA")).setExpiryAddress(SimpleString.toSimpleString("Expiry"))); + serverOne.getServer().getActiveMQServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setDeadLetterAddress(SimpleString.of("DLA")).setExpiryAddress(SimpleString.of("Expiry"))); + serverTwo.getServer().getActiveMQServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setDeadLetterAddress(SimpleString.of("DLA")).setExpiryAddress(SimpleString.of("Expiry"))); serverOne.createQueue(TEST_ADDRESS_ONE, TEST_QUEUE_ONE); serverTwo.createQueue(TEST_ADDRESS_TWO, TEST_QUEUE_TWO); diff --git a/artemis-junit/artemis-junit-commons/src/main/java/org/apache/activemq/artemis/junit/ActiveMQConsumerDelegate.java b/artemis-junit/artemis-junit-commons/src/main/java/org/apache/activemq/artemis/junit/ActiveMQConsumerDelegate.java index 8e1deed270..e04e41c54c 100644 --- a/artemis-junit/artemis-junit-commons/src/main/java/org/apache/activemq/artemis/junit/ActiveMQConsumerDelegate.java +++ b/artemis-junit/artemis-junit-commons/src/main/java/org/apache/activemq/artemis/junit/ActiveMQConsumerDelegate.java @@ -35,11 +35,11 @@ public class ActiveMQConsumerDelegate extends AbstractActiveMQClientDelegate imp ClientConsumer consumer; public ActiveMQConsumerDelegate(String url, String queueName) { - this(url, SimpleString.toSimpleString(queueName), null, null); + this(url, SimpleString.of(queueName), null, null); } public ActiveMQConsumerDelegate(String url, String queueName, String username, String password) { - this(url, SimpleString.toSimpleString(queueName), username, password); + this(url, SimpleString.of(queueName), username, password); } public ActiveMQConsumerDelegate(String url, SimpleString queueName, String username, String password) { @@ -52,11 +52,11 @@ public class ActiveMQConsumerDelegate extends AbstractActiveMQClientDelegate imp } public ActiveMQConsumerDelegate(ServerLocator serverLocator, String queueName, String username, String password) { - this(serverLocator, SimpleString.toSimpleString(queueName), username, password); + this(serverLocator, SimpleString.of(queueName), username, password); } public ActiveMQConsumerDelegate(ServerLocator serverLocator, String queueName) { - this(serverLocator, SimpleString.toSimpleString(queueName), null, null); + this(serverLocator, SimpleString.of(queueName), null, null); } public ActiveMQConsumerDelegate(ServerLocator serverLocator, SimpleString queueName, String username, diff --git a/artemis-junit/artemis-junit-commons/src/main/java/org/apache/activemq/artemis/junit/ActiveMQProducerDelegate.java b/artemis-junit/artemis-junit-commons/src/main/java/org/apache/activemq/artemis/junit/ActiveMQProducerDelegate.java index 84d50888e5..b655438378 100644 --- a/artemis-junit/artemis-junit-commons/src/main/java/org/apache/activemq/artemis/junit/ActiveMQProducerDelegate.java +++ b/artemis-junit/artemis-junit-commons/src/main/java/org/apache/activemq/artemis/junit/ActiveMQProducerDelegate.java @@ -51,7 +51,7 @@ public class ActiveMQProducerDelegate extends AbstractActiveMQClientDelegate imp } protected ActiveMQProducerDelegate(String url, String address, String username, String password) { - this(url, SimpleString.toSimpleString(address), username, password); + this(url, SimpleString.of(address), username, password); } protected ActiveMQProducerDelegate(String url, String address) { @@ -72,11 +72,11 @@ public class ActiveMQProducerDelegate extends AbstractActiveMQClientDelegate imp } protected ActiveMQProducerDelegate(ServerLocator serverLocator, String address, String username, String password) { - this(serverLocator, SimpleString.toSimpleString(address), username, password); + this(serverLocator, SimpleString.of(address), username, password); } protected ActiveMQProducerDelegate(ServerLocator serverLocator, String address) { - this(serverLocator, SimpleString.toSimpleString(address)); + this(serverLocator, SimpleString.of(address)); } protected ActiveMQProducerDelegate(ServerLocator serverLocator, SimpleString address, String username, diff --git a/artemis-junit/artemis-junit-commons/src/main/java/org/apache/activemq/artemis/junit/EmbeddedActiveMQDelegate.java b/artemis-junit/artemis-junit-commons/src/main/java/org/apache/activemq/artemis/junit/EmbeddedActiveMQDelegate.java index a86d064bec..5cbc047036 100644 --- a/artemis-junit/artemis-junit-commons/src/main/java/org/apache/activemq/artemis/junit/EmbeddedActiveMQDelegate.java +++ b/artemis-junit/artemis-junit-commons/src/main/java/org/apache/activemq/artemis/junit/EmbeddedActiveMQDelegate.java @@ -75,8 +75,8 @@ public class EmbeddedActiveMQDelegate implements EmbeddedActiveMQOperations { .setSecurityEnabled(false) .addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getName())) .addAddressSetting("#", - new AddressSettings().setDeadLetterAddress(SimpleString.toSimpleString("dla")) - .setExpiryAddress(SimpleString.toSimpleString("expiry"))); + new AddressSettings().setDeadLetterAddress(SimpleString.of("dla")) + .setExpiryAddress(SimpleString.of("expiry"))); init(); } @@ -237,7 +237,7 @@ public class EmbeddedActiveMQDelegate implements EmbeddedActiveMQOperations { @Override public long getMessageCount(String queueName) { - return getMessageCount(SimpleString.toSimpleString(queueName)); + return getMessageCount(SimpleString.of(queueName)); } @Override @@ -253,7 +253,7 @@ public class EmbeddedActiveMQDelegate implements EmbeddedActiveMQOperations { @Override public Queue locateQueue(String queueName) { - return locateQueue(SimpleString.toSimpleString(queueName)); + return locateQueue(SimpleString.of(queueName)); } @Override @@ -263,7 +263,7 @@ public class EmbeddedActiveMQDelegate implements EmbeddedActiveMQOperations { @Override public List getBoundQueues(String address) { - return getBoundQueues(SimpleString.toSimpleString(address)); + return getBoundQueues(SimpleString.of(address)); } @Override @@ -290,12 +290,12 @@ public class EmbeddedActiveMQDelegate implements EmbeddedActiveMQOperations { @Override public Queue createQueue(String name) { - return createQueue(SimpleString.toSimpleString(name), SimpleString.toSimpleString(name)); + return createQueue(SimpleString.of(name), SimpleString.of(name)); } @Override public Queue createQueue(String address, String name) { - return createQueue(SimpleString.toSimpleString(address), SimpleString.toSimpleString(name)); + return createQueue(SimpleString.of(address), SimpleString.of(name)); } @Override @@ -315,14 +315,14 @@ public class EmbeddedActiveMQDelegate implements EmbeddedActiveMQOperations { @Override public void createSharedQueue(String name, String user) { - createSharedQueue(SimpleString.toSimpleString(name), SimpleString.toSimpleString(name), - SimpleString.toSimpleString(user)); + createSharedQueue(SimpleString.of(name), SimpleString.of(name), + SimpleString.of(user)); } @Override public void createSharedQueue(String address, String name, String user) { - createSharedQueue(SimpleString.toSimpleString(address), SimpleString.toSimpleString(name), - SimpleString.toSimpleString(user)); + createSharedQueue(SimpleString.of(address), SimpleString.of(name), + SimpleString.of(user)); } @Override @@ -401,32 +401,32 @@ public class EmbeddedActiveMQDelegate implements EmbeddedActiveMQOperations { @Override public void sendMessage(String address, ClientMessage message) { - sendMessage(SimpleString.toSimpleString(address), message); + sendMessage(SimpleString.of(address), message); } @Override public ClientMessage sendMessage(String address, byte[] body) { - return sendMessage(SimpleString.toSimpleString(address), body); + return sendMessage(SimpleString.of(address), body); } @Override public ClientMessage sendMessage(String address, String body) { - return sendMessage(SimpleString.toSimpleString(address), body); + return sendMessage(SimpleString.of(address), body); } @Override public ClientMessage sendMessageWithProperties(String address, Map properties) { - return sendMessageWithProperties(SimpleString.toSimpleString(address), properties); + return sendMessageWithProperties(SimpleString.of(address), properties); } @Override public ClientMessage sendMessageWithProperties(String address, byte[] body, Map properties) { - return sendMessageWithProperties(SimpleString.toSimpleString(address), body, properties); + return sendMessageWithProperties(SimpleString.of(address), body, properties); } @Override public ClientMessage sendMessageWithProperties(String address, String body, Map properties) { - return sendMessageWithProperties(SimpleString.toSimpleString(address), body, properties); + return sendMessageWithProperties(SimpleString.of(address), body, properties); } @Override @@ -478,12 +478,12 @@ public class EmbeddedActiveMQDelegate implements EmbeddedActiveMQOperations { @Override public ClientMessage receiveMessage(String queueName) { - return receiveMessage(SimpleString.toSimpleString(queueName)); + return receiveMessage(SimpleString.of(queueName)); } @Override public ClientMessage receiveMessage(String queueName, long timeout) { - return receiveMessage(SimpleString.toSimpleString(queueName), timeout); + return receiveMessage(SimpleString.of(queueName), timeout); } @Override @@ -500,12 +500,12 @@ public class EmbeddedActiveMQDelegate implements EmbeddedActiveMQOperations { @Override public ClientMessage browseMessage(String queueName) { - return browseMessage(SimpleString.toSimpleString(queueName), defaultReceiveTimeout); + return browseMessage(SimpleString.of(queueName), defaultReceiveTimeout); } @Override public ClientMessage browseMessage(String queueName, long timeout) { - return browseMessage(SimpleString.toSimpleString(queueName), timeout); + return browseMessage(SimpleString.of(queueName), timeout); } @Override diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java index 1d814f5443..7b7846f8d2 100644 --- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java +++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java @@ -118,11 +118,11 @@ import static org.apache.activemq.artemis.protocol.amqp.converter.AMQPMessageSup */ public abstract class AMQPMessage extends RefCountMessage implements org.apache.activemq.artemis.api.core.Message { - private static final SimpleString ANNOTATION_AREA_PREFIX = SimpleString.toSimpleString("m."); + private static final SimpleString ANNOTATION_AREA_PREFIX = SimpleString.of("m."); protected static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - public static final SimpleString ADDRESS_PROPERTY = SimpleString.toSimpleString("_AMQ_AD"); + public static final SimpleString ADDRESS_PROPERTY = SimpleString.of("_AMQ_AD"); // used to perform quick search private static final Symbol[] SCHEDULED_DELIVERY_SYMBOLS = new Symbol[]{ AMQPMessageSupport.SCHEDULED_DELIVERY_TIME, AMQPMessageSupport.SCHEDULED_DELIVERY_DELAY}; @@ -1299,7 +1299,7 @@ public abstract class AMQPMessage extends RefCountMessage implements org.apache. @Override public final SimpleString getReplyTo() { if (properties != null) { - return SimpleString.toSimpleString(properties.getReplyTo()); + return SimpleString.of(properties.getReplyTo()); } else { return null; } @@ -1353,8 +1353,8 @@ public abstract class AMQPMessage extends RefCountMessage implements org.apache. ensureMessageDataScanned(); if (properties != null && properties.getGroupId() != null) { - return SimpleString.toSimpleString(properties.getGroupId(), - coreMessageObjectPools == null ? null : coreMessageObjectPools.getGroupIdStringSimpleStringPool()); + return SimpleString.of(properties.getGroupId(), + coreMessageObjectPools == null ? null : coreMessageObjectPools.getGroupIdStringSimpleStringPool()); } else { return null; } @@ -1612,7 +1612,7 @@ public abstract class AMQPMessage extends RefCountMessage implements org.apache. public final Set getPropertyNames() { HashSet values = new HashSet<>(); for (Object k : getApplicationPropertiesMap(false).keySet()) { - values.add(SimpleString.toSimpleString(k.toString(), getPropertyKeysPool())); + values.add(SimpleString.of(k.toString(), getPropertyKeysPool())); } return values; } @@ -1678,7 +1678,7 @@ public abstract class AMQPMessage extends RefCountMessage implements org.apache. } @Override public final SimpleString getSimpleStringProperty(String key) throws ActiveMQPropertyConversionException { - return SimpleString.toSimpleString((String) getApplicationPropertiesMap(false).get(key), getPropertyValuesPool()); + return SimpleString.of((String) getApplicationPropertiesMap(false).get(key), getPropertyValuesPool()); } // Core Message Application Property update methods, calling these puts the message in a dirty 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 a274bac726..f6c9167459 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 @@ -280,7 +280,7 @@ public class AMQPSessionCallback implements SessionCallback { boolean browserOnly, Number priority) throws Exception { final long consumerID = consumerIDGenerator.generateID(); - final SimpleString filterString = SimpleString.toSimpleString(SelectorTranslator.convertToActiveMQFilterString(filter)); + final SimpleString filterString = SimpleString.of(SelectorTranslator.convertToActiveMQFilterString(filter)); final int consumerPriority = priority != null ? priority.intValue() : ActiveMQDefaultConfiguration.getDefaultConsumerPriority(); final ServerConsumer consumer = serverSession.createConsumer( consumerID, queue, filterString, consumerPriority, browserOnly, false, null); diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/ProtonProtocolManager.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/ProtonProtocolManager.java index 6f246531e1..f465d83e48 100644 --- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/ProtonProtocolManager.java +++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/ProtonProtocolManager.java @@ -335,14 +335,14 @@ public class ProtonProtocolManager extends AbstractProtocolManager im public static final Symbol ADDRESS = Symbol.getSymbol("x-opt-amq-mr-adr"); public static final Symbol QUEUE = Symbol.getSymbol("x-opt-amq-mr-qu"); public static final Symbol BROKER_ID = Symbol.getSymbol("x-opt-amq-bkr-id"); - public static final SimpleString BROKER_ID_SIMPLE_STRING = SimpleString.toSimpleString(BROKER_ID.toString()); + public static final SimpleString BROKER_ID_SIMPLE_STRING = SimpleString.of(BROKER_ID.toString()); // Events: public static final Symbol ADD_ADDRESS = Symbol.getSymbol("addAddress"); @@ -90,8 +90,8 @@ public class AMQPMirrorControllerSource extends BasicMirrorController im public static final Symbol MIRROR_CAPABILITY = Symbol.getSymbol("amq.mirror"); public static final Symbol QPID_DISPATCH_WAYPOINT_CAPABILITY = Symbol.valueOf("qd.waypoint"); - public static final SimpleString INTERNAL_ID_EXTRA_PROPERTY = SimpleString.toSimpleString(INTERNAL_ID.toString()); - public static final SimpleString INTERNAL_BROKER_ID_EXTRA_PROPERTY = SimpleString.toSimpleString(BROKER_ID.toString()); + public static final SimpleString INTERNAL_ID_EXTRA_PROPERTY = SimpleString.of(INTERNAL_ID.toString()); + public static final SimpleString INTERNAL_BROKER_ID_EXTRA_PROPERTY = SimpleString.of(BROKER_ID.toString()); private static final ThreadLocal mirrorControlRouting = ThreadLocal.withInitial(() -> new RoutingContextImpl(null)); diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/connect/mirror/AMQPMirrorControllerTarget.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/connect/mirror/AMQPMirrorControllerTarget.java index 4028f77262..a5c549483f 100644 --- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/connect/mirror/AMQPMirrorControllerTarget.java +++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/connect/mirror/AMQPMirrorControllerTarget.java @@ -241,7 +241,7 @@ public class AMQPMirrorControllerTarget extends ProtonAbstractReceiver implement String address = (String) AMQPMessageBrokerAccessor.getMessageAnnotationProperty(amqpMessage, ADDRESS); String queueName = (String) AMQPMessageBrokerAccessor.getMessageAnnotationProperty(amqpMessage, QUEUE); - deleteQueue(SimpleString.toSimpleString(address), SimpleString.toSimpleString(queueName)); + deleteQueue(SimpleString.of(address), SimpleString.of(queueName)); } else if (eventType.equals(POST_ACK)) { String nodeID = (String) AMQPMessageBrokerAccessor.getMessageAnnotationProperty(amqpMessage, BROKER_ID); @@ -458,7 +458,7 @@ public class AMQPMirrorControllerTarget extends ProtonAbstractReceiver implement logger.trace("Setting up duplicate detection cache on {}, ServerID={} with {} elements, being the number of credits", ProtonProtocolManager.MIRROR_ADDRESS, internalMirrorID, connection.getAmqpCredits()); lruDuplicateIDKey = internalMirrorID; - lruduplicateIDCache = server.getPostOffice().getDuplicateIDCache(SimpleString.toSimpleString(ProtonProtocolManager.MIRROR_ADDRESS + "_" + internalMirrorID), connection.getAmqpCredits()); + lruduplicateIDCache = server.getPostOffice().getDuplicateIDCache(SimpleString.of(ProtonProtocolManager.MIRROR_ADDRESS + "_" + internalMirrorID), connection.getAmqpCredits()); duplicateIDCache = lruduplicateIDCache; } diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/connect/mirror/MirrorAddressFilter.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/connect/mirror/MirrorAddressFilter.java index ec4e710edc..ea6e47de8a 100644 --- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/connect/mirror/MirrorAddressFilter.java +++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/connect/mirror/MirrorAddressFilter.java @@ -36,9 +36,9 @@ public class MirrorAddressFilter { for (String part : parts) { if (!"".equals(part) && !"!".equals(part)) { if (part.startsWith("!")) { - denyList.add(new SimpleString(part.substring(1))); + denyList.add(SimpleString.of(part.substring(1))); } else { - allowList.add(new SimpleString(part)); + allowList.add(SimpleString.of(part)); } } } diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/AMQPMessageSupport.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/AMQPMessageSupport.java index 1b47944269..71eaf610fe 100644 --- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/AMQPMessageSupport.java +++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/AMQPMessageSupport.java @@ -63,7 +63,7 @@ public final class AMQPMessageSupport { public static final int MESSAGE_DEFAULT_PRIORITY = 4; - public static SimpleString HDR_ORIGINAL_ADDRESS_ANNOTATION = SimpleString.toSimpleString("x-opt-ORIG-ADDRESS"); + public static SimpleString HDR_ORIGINAL_ADDRESS_ANNOTATION = SimpleString.of("x-opt-ORIG-ADDRESS"); public static final String JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL_NAME = "x-opt-jms-reply-to"; public static final String X_OPT_DELIVERY_TIME = "x-opt-delivery-time"; diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/coreWrapper/CoreMapMessageWrapper.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/coreWrapper/CoreMapMessageWrapper.java index bb72eb35bc..aa0d19c349 100644 --- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/coreWrapper/CoreMapMessageWrapper.java +++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/coreWrapper/CoreMapMessageWrapper.java @@ -80,49 +80,49 @@ public final class CoreMapMessageWrapper extends CoreMessageWrapper { } public void setBoolean(final String name, final boolean value) { - map.putBooleanProperty(new SimpleString(name), value); + map.putBooleanProperty(SimpleString.of(name), value); } public void setByte(final String name, final byte value) { - map.putByteProperty(new SimpleString(name), value); + map.putByteProperty(SimpleString.of(name), value); } public void setShort(final String name, final short value) { - map.putShortProperty(new SimpleString(name), value); + map.putShortProperty(SimpleString.of(name), value); } public void setChar(final String name, final char value) { - map.putCharProperty(new SimpleString(name), value); + map.putCharProperty(SimpleString.of(name), value); } public void setInt(final String name, final int value) { - map.putIntProperty(new SimpleString(name), value); + map.putIntProperty(SimpleString.of(name), value); } public void setLong(final String name, final long value) { - map.putLongProperty(new SimpleString(name), value); + map.putLongProperty(SimpleString.of(name), value); } public void setFloat(final String name, final float value) { - map.putFloatProperty(new SimpleString(name), value); + map.putFloatProperty(SimpleString.of(name), value); } public void setDouble(final String name, final double value) { - map.putDoubleProperty(new SimpleString(name), value); + map.putDoubleProperty(SimpleString.of(name), value); } public void setString(final String name, final String value) { - map.putSimpleStringProperty(new SimpleString(name), SimpleString.toSimpleString(value)); + map.putSimpleStringProperty(SimpleString.of(name), SimpleString.of(value)); } public void setBytes(final String name, final byte[] value) { - map.putBytesProperty(new SimpleString(name), value); + map.putBytesProperty(SimpleString.of(name), value); } public void setBytes(final String name, final byte[] value, final int offset, final int length) { byte[] newBytes = new byte[length]; System.arraycopy(value, offset, newBytes, 0, length); - map.putBytesProperty(new SimpleString(name), newBytes); + map.putBytesProperty(SimpleString.of(name), newBytes); } public void setObject(final String name, final Object value) throws ActiveMQPropertyConversionException { @@ -137,43 +137,43 @@ public final class CoreMapMessageWrapper extends CoreMessageWrapper { } else if (value instanceof UnsignedLong) { val = ((UnsignedLong) value).longValue(); } - TypedProperties.setObjectProperty(new SimpleString(name), val, map); + TypedProperties.setObjectProperty(SimpleString.of(name), val, map); } public boolean getBoolean(final String name) throws ActiveMQPropertyConversionException { - return map.getBooleanProperty(new SimpleString(name)); + return map.getBooleanProperty(SimpleString.of(name)); } public byte getByte(final String name) throws ActiveMQPropertyConversionException { - return map.getByteProperty(new SimpleString(name)); + return map.getByteProperty(SimpleString.of(name)); } public short getShort(final String name) throws ActiveMQPropertyConversionException { - return map.getShortProperty(new SimpleString(name)); + return map.getShortProperty(SimpleString.of(name)); } public char getChar(final String name) throws ActiveMQPropertyConversionException { - return map.getCharProperty(new SimpleString(name)); + return map.getCharProperty(SimpleString.of(name)); } public int getInt(final String name) throws ActiveMQPropertyConversionException { - return map.getIntProperty(new SimpleString(name)); + return map.getIntProperty(SimpleString.of(name)); } public long getLong(final String name) throws ActiveMQPropertyConversionException { - return map.getLongProperty(new SimpleString(name)); + return map.getLongProperty(SimpleString.of(name)); } public float getFloat(final String name) throws ActiveMQPropertyConversionException { - return map.getFloatProperty(new SimpleString(name)); + return map.getFloatProperty(SimpleString.of(name)); } public double getDouble(final String name) throws ActiveMQPropertyConversionException { - return map.getDoubleProperty(new SimpleString(name)); + return map.getDoubleProperty(SimpleString.of(name)); } public String getString(final String name) throws ActiveMQPropertyConversionException { - SimpleString str = map.getSimpleStringProperty(new SimpleString(name)); + SimpleString str = map.getSimpleStringProperty(SimpleString.of(name)); if (str == null) { return null; } else { @@ -182,11 +182,11 @@ public final class CoreMapMessageWrapper extends CoreMessageWrapper { } public byte[] getBytes(final String name) throws ActiveMQPropertyConversionException { - return map.getBytesProperty(new SimpleString(name)); + return map.getBytesProperty(SimpleString.of(name)); } public Object getObject(final String name) { - Object val = map.getProperty(new SimpleString(name)); + Object val = map.getProperty(SimpleString.of(name)); if (val instanceof SimpleString) { val = ((SimpleString) val).toString(); @@ -200,7 +200,7 @@ public final class CoreMapMessageWrapper extends CoreMessageWrapper { } public boolean itemExists(final String name) { - return map.containsProperty(new SimpleString(name)); + return map.containsProperty(SimpleString.of(name)); } @Override diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/coreWrapper/CoreMessageWrapper.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/coreWrapper/CoreMessageWrapper.java index cf1917a72b..929e1db397 100644 --- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/coreWrapper/CoreMessageWrapper.java +++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/coreWrapper/CoreMessageWrapper.java @@ -187,14 +187,14 @@ public class CoreMessageWrapper { } public final void setJMSReplyTo(String replyTo) { - MessageUtil.setJMSReplyTo(message, SimpleString.toSimpleString(replyTo)); + MessageUtil.setJMSReplyTo(message, SimpleString.of(replyTo)); } public SimpleString getDestination() { if (message.getAddress() == null || message.getAddress().isEmpty()) { return null; } - return SimpleString.toSimpleString(AMQPMessageSupport.destination(message.getRoutingType(), message.getAddress())); + return SimpleString.of(AMQPMessageSupport.destination(message.getRoutingType(), message.getAddress())); } public final void setDestination(String destination) { diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/coreWrapper/CoreTextMessageWrapper.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/coreWrapper/CoreTextMessageWrapper.java index dd9c42cc0b..43e30eede2 100644 --- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/coreWrapper/CoreTextMessageWrapper.java +++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/coreWrapper/CoreTextMessageWrapper.java @@ -88,7 +88,7 @@ public class CoreTextMessageWrapper extends CoreMessageWrapper { public void setText(final String text) { if (text != null) { - this.text = new SimpleString(text); + this.text = SimpleString.of(text); } else { this.text = null; } diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPConnectionContext.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPConnectionContext.java index 5e8c76f14a..b31d463433 100644 --- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPConnectionContext.java +++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPConnectionContext.java @@ -439,7 +439,7 @@ public class AMQPConnectionContext extends ProtonInitializable implements EventH private void handleReplicaTargetLinkOpened(AMQPSessionContext protonSession, Receiver receiver) throws Exception { try { try { - protonSession.getSessionSPI().check(SimpleString.toSimpleString(receiver.getTarget().getAddress()), CheckType.SEND, getSecurityAuth()); + protonSession.getSessionSPI().check(SimpleString.of(receiver.getTarget().getAddress()), CheckType.SEND, getSecurityAuth()); } catch (ActiveMQSecurityException e) { throw ActiveMQAMQPProtocolMessageBundle.BUNDLE.securityErrorCreatingProducer(e.getMessage()); } @@ -472,7 +472,7 @@ public class AMQPConnectionContext extends ProtonInitializable implements EventH private void handleFederationControlLinkOpened(AMQPSessionContext protonSession, Receiver receiver) throws Exception { try { try { - protonSession.getSessionSPI().check(SimpleString.toSimpleString(FEDERATION_BASE_VALIDATION_ADDRESS), CheckType.SEND, getSecurityAuth()); + protonSession.getSessionSPI().check(SimpleString.of(FEDERATION_BASE_VALIDATION_ADDRESS), CheckType.SEND, getSecurityAuth()); } catch (ActiveMQSecurityException e) { throw new ActiveMQAMQPSecurityException( "User does not have permission to attach to the federation control address"); diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AmqpSupport.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AmqpSupport.java index c75bf0d71b..d030f7ed36 100644 --- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AmqpSupport.java +++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AmqpSupport.java @@ -381,7 +381,7 @@ public class AmqpSupport { } } - return SimpleString.toSimpleString(queue); + return SimpleString.of(queue); } } } diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/DefaultSenderController.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/DefaultSenderController.java index 21708b4e1c..e9d730f852 100644 --- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/DefaultSenderController.java +++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/DefaultSenderController.java @@ -202,7 +202,7 @@ public class DefaultSenderController implements SenderController { } else if (source.getDynamic()) { // if dynamic we have to create the node (queue) and set the address on the target, the // node is temporary and will be deleted on closing of the session - queue = SimpleString.toSimpleString(java.util.UUID.randomUUID().toString()); + queue = SimpleString.of(java.util.UUID.randomUUID().toString()); tempQueueName = queue; try { sessionSPI.createTemporaryQueue(queue, RoutingType.ANYCAST); @@ -226,11 +226,11 @@ public class DefaultSenderController implements SenderController { //find out if we have an address made up of the address and queue name, if yes then set queue name if (CompositeAddress.isFullyQualified(sourceAddress)) { isFQQN = true; - addressToUse = SimpleString.toSimpleString(CompositeAddress.extractAddressName(sourceAddress)); - queueNameToUse = SimpleString.toSimpleString(CompositeAddress.extractQueueName(sourceAddress)); + addressToUse = SimpleString.of(CompositeAddress.extractAddressName(sourceAddress)); + queueNameToUse = SimpleString.of(CompositeAddress.extractQueueName(sourceAddress)); } else { isFQQN = false; - addressToUse = SimpleString.toSimpleString(sourceAddress); + addressToUse = SimpleString.of(sourceAddress); } //check to see if the client has defined how we act @@ -312,7 +312,7 @@ public class DefaultSenderController implements SenderController { supportedFilters.put(filter.getKey(), filter.getValue()); } - SimpleString simpleStringSelector = SimpleString.toSimpleString(selector); + SimpleString simpleStringSelector = SimpleString.of(selector); queue = getMatchingQueue(queueNameToUse, addressToUse, RoutingType.MULTICAST, simpleStringSelector, isFQQN); //if the address specifies a broker configured queue then we always use this, treat it as a queue @@ -365,7 +365,7 @@ public class DefaultSenderController implements SenderController { sessionSPI.createSharedVolatileQueue(addressToUse, RoutingType.MULTICAST, queue, simpleStringSelector); } } else { - queue = SimpleString.toSimpleString(java.util.UUID.randomUUID().toString()); + queue = SimpleString.of(java.util.UUID.randomUUID().toString()); tempQueueName = queue; try { sessionSPI.createTemporaryQueue(addressToUse, queue, RoutingType.MULTICAST, simpleStringSelector); @@ -452,7 +452,7 @@ public class DefaultSenderController implements SenderController { String sourceAddress = getSourceAddress(source); if (source != null && sourceAddress != null && multicast) { - SimpleString queueName = SimpleString.toSimpleString(sourceAddress); + SimpleString queueName = SimpleString.of(sourceAddress); QueueQueryResult result = sessionSPI.queueQuery(queueName, routingTypeToUse, false); if (result.isExists() && source.getDynamic()) { sessionSPI.deleteQueue(queueName); @@ -474,7 +474,7 @@ public class DefaultSenderController implements SenderController { } } else if (source != null && source.getDynamic() && (source.getExpiryPolicy() == TerminusExpiryPolicy.LINK_DETACH || source.getExpiryPolicy() == TerminusExpiryPolicy.SESSION_END)) { try { - sessionSPI.removeTemporaryQueue(SimpleString.toSimpleString(sourceAddress)); + sessionSPI.removeTemporaryQueue(SimpleString.of(sourceAddress)); } catch (Exception e) { // Ignore on close, its temporary anyway and will be removed later } diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerReceiverContext.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerReceiverContext.java index f8edea304f..77eff0bff6 100644 --- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerReceiverContext.java +++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerReceiverContext.java @@ -93,7 +93,7 @@ public class ProtonServerReceiverContext extends ProtonAbstractReceiver { if (target.getDynamic()) { // if dynamic we have to create the node (queue) and set the address on the target, the node is temporary and // will be deleted on closing of the session - address = SimpleString.toSimpleString(sessionSPI.tempQueueName()); + address = SimpleString.of(sessionSPI.tempQueueName()); defRoutingType = getRoutingType(target.getCapabilities(), address); try { @@ -112,7 +112,7 @@ public class ProtonServerReceiverContext extends ProtonAbstractReceiver { // matched on receive of the message. String targetAddress = target.getAddress(); if (targetAddress != null && !targetAddress.isEmpty()) { - address = SimpleString.toSimpleString(targetAddress); + address = SimpleString.of(targetAddress); } if (address != null) { @@ -289,7 +289,7 @@ public class ProtonServerReceiverContext extends ProtonAbstractReceiver { org.apache.qpid.proton.amqp.messaging.Target target = (org.apache.qpid.proton.amqp.messaging.Target) receiver.getRemoteTarget(); if (target != null && target.getDynamic() && (target.getExpiryPolicy() == TerminusExpiryPolicy.LINK_DETACH || target.getExpiryPolicy() == TerminusExpiryPolicy.SESSION_END)) { try { - sessionSPI.removeTemporaryQueue(SimpleString.toSimpleString(target.getAddress())); + sessionSPI.removeTemporaryQueue(SimpleString.of(target.getAddress())); } catch (Exception e) { //ignore on close, its temp anyway and will be removed later } diff --git a/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessageTest.java b/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessageTest.java index aceae67b25..8ed39125c2 100644 --- a/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessageTest.java +++ b/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessageTest.java @@ -298,7 +298,7 @@ public class AMQPMessageTest { assertTrue(encodedProtonMessage.length < decoded.getMemoryEstimate()); assertEquals(estimate, decoded.getMemoryEstimate()); - decoded.putStringProperty(new SimpleString("newProperty"), "newValue"); + decoded.putStringProperty(SimpleString.of("newProperty"), "newValue"); decoded.reencode(); assertNotEquals(estimate, decoded.getMemoryEstimate()); @@ -424,7 +424,7 @@ public class AMQPMessageTest { @Test public void testSetLastValueFromMessageWithNone() { - SimpleString lastValue = new SimpleString("last-address"); + SimpleString lastValue = SimpleString.of("last-address"); MessageImpl protonMessage = (MessageImpl) Message.Factory.create(); AMQPStandardMessage decoded = encodeAndDecodeMessage(protonMessage); @@ -556,7 +556,7 @@ public class AMQPMessageTest { @Test public void testSetAddressFromMessage() { final String ADDRESS = "myQueue"; - final SimpleString NEW_ADDRESS = new SimpleString("myQueue-1"); + final SimpleString NEW_ADDRESS = SimpleString.of("myQueue-1"); MessageImpl protonMessage = (MessageImpl) Message.Factory.create(); protonMessage.setAddress(ADDRESS); @@ -571,7 +571,7 @@ public class AMQPMessageTest { @Test public void testSetAddressFromMessageUpdatesPropertiesOnReencode() { final String ADDRESS = "myQueue"; - final SimpleString NEW_ADDRESS = new SimpleString("myQueue-1"); + final SimpleString NEW_ADDRESS = SimpleString.of("myQueue-1"); MessageImpl protonMessage = (MessageImpl) Message.Factory.create(); protonMessage.setAddress(ADDRESS); @@ -857,7 +857,7 @@ public class AMQPMessageTest { AMQPStandardMessage decoded = encodeAndDecodeMessage(protonMessage); assertNull(decoded.getReplyTo()); - decoded.setReplyTo(new SimpleString(REPLY_TO)); + decoded.setReplyTo(SimpleString.of(REPLY_TO)); decoded.reencode(); assertEquals(REPLY_TO, decoded.getReplyTo().toString()); @@ -872,7 +872,7 @@ public class AMQPMessageTest { AMQPStandardMessage decoded = encodeAndDecodeMessage(protonMessage); assertNull(decoded.getReplyTo()); - decoded.setReplyTo(new SimpleString(REPLY_TO)); + decoded.setReplyTo(SimpleString.of(REPLY_TO)); decoded.reencode(); assertEquals(REPLY_TO, decoded.getReplyTo().toString()); @@ -1374,8 +1374,8 @@ public class AMQPMessageTest { public void testGetAnnotation() { AMQPStandardMessage message = new AMQPStandardMessage(0, encodedProtonMessage, null); - Object result = message.getAnnotation(new SimpleString(TEST_MESSAGE_ANNOTATION_KEY)); - String stringResult = message.getAnnotationString(new SimpleString(TEST_MESSAGE_ANNOTATION_KEY)); + Object result = message.getAnnotation(SimpleString.of(TEST_MESSAGE_ANNOTATION_KEY)); + String stringResult = message.getAnnotationString(SimpleString.of(TEST_MESSAGE_ANNOTATION_KEY)); assertEquals(result, stringResult); } @@ -1384,9 +1384,9 @@ public class AMQPMessageTest { public void testRemoveAnnotation() { AMQPStandardMessage message = new AMQPStandardMessage(0, encodedProtonMessage, null); - assertNotNull(message.getAnnotation(new SimpleString(TEST_MESSAGE_ANNOTATION_KEY))); - message.removeAnnotation(new SimpleString(TEST_MESSAGE_ANNOTATION_KEY)); - assertNull(message.getAnnotation(new SimpleString(TEST_MESSAGE_ANNOTATION_KEY))); + assertNotNull(message.getAnnotation(SimpleString.of(TEST_MESSAGE_ANNOTATION_KEY))); + message.removeAnnotation(SimpleString.of(TEST_MESSAGE_ANNOTATION_KEY)); + assertNull(message.getAnnotation(SimpleString.of(TEST_MESSAGE_ANNOTATION_KEY))); message.reencode(); @@ -1397,7 +1397,7 @@ public class AMQPMessageTest { public void testSetAnnotation() { AMQPStandardMessage message = new AMQPStandardMessage(0, encodedProtonMessage, null); - final SimpleString newAnnotation = new SimpleString("testSetAnnotation"); + final SimpleString newAnnotation = SimpleString.of("testSetAnnotation"); final String newValue = "newValue"; message.setAnnotation(newAnnotation, newValue); @@ -1417,7 +1417,7 @@ public class AMQPMessageTest { assertProtonMessageEquals(protonMessage, message.getProtonMessage()); - message.setAnnotation(new SimpleString("testGetProtonMessage"), "1"); + message.setAnnotation(SimpleString.of("testGetProtonMessage"), "1"); message.messageChanged(); assertProtonMessageNotEquals(protonMessage, message.getProtonMessage()); @@ -1566,7 +1566,7 @@ public class AMQPMessageTest { @Test public void testMessageAnnotationsReencodeAfterUpdate() { - final SimpleString TEST_ANNOTATION = new SimpleString("testMessageAnnotationsReencodeAfterUpdate"); + final SimpleString TEST_ANNOTATION = SimpleString.of("testMessageAnnotationsReencodeAfterUpdate"); MessageImpl protonMessage = createProtonMessage(); AMQPStandardMessage decoded = encodeAndDecodeMessage(protonMessage); @@ -1588,7 +1588,7 @@ public class AMQPMessageTest { MessageImpl protonMessage = (MessageImpl) Message.Factory.create(); byte[] value = RandomUtil.randomBytes(); - SimpleString name = SimpleString.toSimpleString("myProperty"); + SimpleString name = SimpleString.of("myProperty"); AMQPStandardMessage decoded = encodeAndDecodeMessage(protonMessage); @@ -1608,7 +1608,7 @@ public class AMQPMessageTest { MessageImpl protonMessage = (MessageImpl) Message.Factory.create(); byte[] original = RandomUtil.randomBytes(); - SimpleString name = SimpleString.toSimpleString("myProperty"); + SimpleString name = SimpleString.of("myProperty"); AMQPStandardMessage decoded = encodeAndDecodeMessage(protonMessage); decoded.setAddress("someAddress"); decoded.setMessageID(33); @@ -1780,9 +1780,9 @@ public class AMQPMessageTest { assertEquals(TEST_STRING_BODY, ((AmqpValue) message.getBody()).getValue()); // Update the message - message.setAnnotation(new SimpleString("x-opt-extra-1"), "test-1"); - message.setAnnotation(new SimpleString("x-opt-extra-2"), "test-2"); - message.setAnnotation(new SimpleString("x-opt-extra-3"), "test-3"); + message.setAnnotation(SimpleString.of("x-opt-extra-1"), "test-1"); + message.setAnnotation(SimpleString.of("x-opt-extra-2"), "test-2"); + message.setAnnotation(SimpleString.of("x-opt-extra-3"), "test-3"); // Reencode and then decode the message again message.reencode(); @@ -2413,8 +2413,8 @@ public class AMQPMessageTest { MessageImpl protonMessage = (MessageImpl) Message.Factory.create(); TypedProperties extraProperties = new TypedProperties(); - extraProperties.putProperty(new SimpleString(TEST_EXTRA_PROPERTY_KEY1), TEST_EXTRA_PROPERTY_VALUE1); - extraProperties.putProperty(new SimpleString(TEST_EXTRA_PROPERTY_KEY2), TEST_EXTRA_PROPERTY_VALUE2); + extraProperties.putProperty(SimpleString.of(TEST_EXTRA_PROPERTY_KEY1), TEST_EXTRA_PROPERTY_VALUE1); + extraProperties.putProperty(SimpleString.of(TEST_EXTRA_PROPERTY_KEY2), TEST_EXTRA_PROPERTY_VALUE2); AMQPStandardMessage decoded = encodeAndDecodeMessage(protonMessage, extraProperties); @@ -2543,8 +2543,8 @@ public class AMQPMessageTest { Message protonMessage = Message.Factory.create(); AMQPStandardMessage decoded = encodeAndDecodeMessage(protonMessage); TypedProperties props = decoded.createExtraProperties(); - props.putSimpleStringProperty(new SimpleString("firstString"), new SimpleString("firstValue")); - props.putLongProperty(new SimpleString("secondLong"), 1234567); + props.putSimpleStringProperty(SimpleString.of("firstString"), SimpleString.of("firstValue")); + props.putLongProperty(SimpleString.of("secondLong"), 1234567); // same as toPropertyMap(false,5) Map map = decoded.toPropertyMap(-1); diff --git a/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPPersisterTest.java b/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPPersisterTest.java index c2af7859ef..4563e6bf4e 100644 --- a/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPPersisterTest.java +++ b/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPPersisterTest.java @@ -92,7 +92,7 @@ public class AMQPPersisterTest { @Test public void testEncodeSize() throws Exception { - Message message = createMessage(SimpleString.toSimpleString("Test"), 1, new byte[10]); + Message message = createMessage(SimpleString.of("Test"), 1, new byte[10]); MessagePersister persister = AMQPMessagePersisterV3.getInstance(); diff --git a/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallbackTest.java b/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallbackTest.java index 439fe488da..53e351d7ae 100644 --- a/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallbackTest.java +++ b/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallbackTest.java @@ -151,7 +151,7 @@ public class AMQPSessionCallbackTest { // Credit is above threshold Mockito.when(receiver.getCredit()).thenReturn(AMQP_LOW_CREDITS_DEFAULT + 1); - session.flow(new SimpleString("test"), ProtonServerReceiverContext.createCreditRunnable(AMQP_CREDITS_DEFAULT, AMQP_LOW_CREDITS_DEFAULT, receiver, connection)); + session.flow(SimpleString.of("test"), ProtonServerReceiverContext.createCreditRunnable(AMQP_CREDITS_DEFAULT, AMQP_LOW_CREDITS_DEFAULT, receiver, connection)); // Run the credit refill code. Mockito.verify(pagingStore).checkMemory(argument.capture(), Mockito.isA(Consumer.class)); @@ -182,7 +182,7 @@ public class AMQPSessionCallbackTest { // Credit is at threshold Mockito.when(receiver.getCredit()).thenReturn(AMQP_LOW_CREDITS_DEFAULT); - session.flow(new SimpleString("test"), ProtonServerReceiverContext.createCreditRunnable(AMQP_CREDITS_DEFAULT, AMQP_LOW_CREDITS_DEFAULT, receiver, connection)); + session.flow(SimpleString.of("test"), ProtonServerReceiverContext.createCreditRunnable(AMQP_CREDITS_DEFAULT, AMQP_LOW_CREDITS_DEFAULT, receiver, connection)); // Run the credit refill code. Mockito.verify(pagingStore).checkMemory(argument.capture(), Mockito.isA(Consumer.class)); @@ -243,7 +243,7 @@ public class AMQPSessionCallbackTest { // Credit is at threshold Mockito.when(receiver.getCredit()).thenReturn(AMQP_LOW_CREDITS_DEFAULT); - session.flow(new SimpleString("test"), ProtonServerReceiverContext.createCreditRunnable(1, AMQP_LOW_CREDITS_DEFAULT, receiver, connection)); + session.flow(SimpleString.of("test"), ProtonServerReceiverContext.createCreditRunnable(1, AMQP_LOW_CREDITS_DEFAULT, receiver, connection)); // Run the credit refill code. Mockito.verify(pagingStore).checkMemory(argument.capture(), Mockito.isA(Consumer.class)); diff --git a/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/connect/federation/AMQPFederationPolicySupportTest.java b/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/connect/federation/AMQPFederationPolicySupportTest.java index e4a09e6b02..2215305823 100644 --- a/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/connect/federation/AMQPFederationPolicySupportTest.java +++ b/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/connect/federation/AMQPFederationPolicySupportTest.java @@ -147,7 +147,7 @@ public class AMQPFederationPolicySupportTest { final AMQPMessage message = AMQPFederationPolicySupport.encodeQueuePolicyControlMessage(policy); - assertEquals(ADD_QUEUE_POLICY, message.getAnnotation(SimpleString.toSimpleString(OPERATION_TYPE.toString()))); + assertEquals(ADD_QUEUE_POLICY, message.getAnnotation(SimpleString.of(OPERATION_TYPE.toString()))); assertNotNull(message.getBody()); assertTrue(message.getBody() instanceof AmqpValue); @@ -251,7 +251,7 @@ public class AMQPFederationPolicySupportTest { final AMQPMessage message = AMQPFederationPolicySupport.encodeAddressPolicyControlMessage(policy); - assertEquals(ADD_ADDRESS_POLICY, message.getAnnotation(SimpleString.toSimpleString(OPERATION_TYPE.toString()))); + assertEquals(ADD_ADDRESS_POLICY, message.getAnnotation(SimpleString.of(OPERATION_TYPE.toString()))); assertNotNull(message.getBody()); assertTrue(message.getBody() instanceof AmqpValue); diff --git a/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/connect/mirror/MirrorAddressFilterTest.java b/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/connect/mirror/MirrorAddressFilterTest.java index cfb2560207..04464c4d8c 100644 --- a/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/connect/mirror/MirrorAddressFilterTest.java +++ b/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/connect/mirror/MirrorAddressFilterTest.java @@ -26,13 +26,13 @@ public class MirrorAddressFilterTest { @Test public void testAddressFilter() { - assertTrue(new MirrorAddressFilter("").match(new SimpleString("any"))); - assertTrue(new MirrorAddressFilter("test").match(new SimpleString("test123"))); - assertTrue(new MirrorAddressFilter("a,b").match(new SimpleString("b"))); - assertTrue(new MirrorAddressFilter("!c").match(new SimpleString("a"))); - assertTrue(new MirrorAddressFilter("!a,!").match(new SimpleString("b123"))); - assertFalse(new MirrorAddressFilter("a,b,!ab").match(new SimpleString("ab"))); - assertFalse(new MirrorAddressFilter("!a,!b").match(new SimpleString("b123"))); - assertFalse(new MirrorAddressFilter("a,").match(new SimpleString("b"))); + assertTrue(new MirrorAddressFilter("").match(SimpleString.of("any"))); + assertTrue(new MirrorAddressFilter("test").match(SimpleString.of("test123"))); + assertTrue(new MirrorAddressFilter("a,b").match(SimpleString.of("b"))); + assertTrue(new MirrorAddressFilter("!c").match(SimpleString.of("a"))); + assertTrue(new MirrorAddressFilter("!a,!").match(SimpleString.of("b123"))); + assertFalse(new MirrorAddressFilter("a,b,!ab").match(SimpleString.of("ab"))); + assertFalse(new MirrorAddressFilter("!a,!b").match(SimpleString.of("b123"))); + assertFalse(new MirrorAddressFilter("a,").match(SimpleString.of("b"))); } } diff --git a/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/converter/TestConversions.java b/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/converter/TestConversions.java index a081b3e69b..d5edada504 100644 --- a/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/converter/TestConversions.java +++ b/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/converter/TestConversions.java @@ -144,9 +144,9 @@ public class TestConversions { private TypedProperties createTypedPropertiesMap() { TypedProperties typedProperties = new TypedProperties(); - typedProperties.putBooleanProperty(new SimpleString("true"), Boolean.TRUE); - typedProperties.putBooleanProperty(new SimpleString("false"), Boolean.FALSE); - typedProperties.putSimpleStringProperty(new SimpleString("foo"), new SimpleString("bar")); + typedProperties.putBooleanProperty(SimpleString.of("true"), Boolean.TRUE); + typedProperties.putBooleanProperty(SimpleString.of("false"), Boolean.FALSE); + typedProperties.putSimpleStringProperty(SimpleString.of("foo"), SimpleString.of("bar")); return typedProperties; } @@ -238,7 +238,7 @@ public class TestConversions { AMQPMessage encodedMessage = encodeAndCreateAMQPMessage(message); TypedProperties extraProperties = createTypedPropertiesMap(); - extraProperties.putBytesProperty(new SimpleString("bytesProp"), "value".getBytes()); + extraProperties.putBytesProperty(SimpleString.of("bytesProp"), "value".getBytes()); encodedMessage.setExtraProperties(extraProperties); ICoreMessage serverMessage = encodedMessage.toCore(); @@ -419,7 +419,7 @@ public class TestConversions { AMQPMessage encodedMessage = encodeAndCreateAMQPMessage(message); TypedProperties extraProperties = new TypedProperties(); - encodedMessage.setAddress(SimpleString.toSimpleString("xxxx.v1.queue")); + encodedMessage.setAddress(SimpleString.of("xxxx.v1.queue")); for (int i = 0; i < 10; i++) { if (logger.isDebugEnabled()) { @@ -453,7 +453,7 @@ public class TestConversions { AMQPMessage encodedMessage = encodeAndCreateAMQPMessage(message); TypedProperties extraProperties = new TypedProperties(); - encodedMessage.setAddress(SimpleString.toSimpleString("xxxx.v1.queue")); + encodedMessage.setAddress(SimpleString.of("xxxx.v1.queue")); for (int i = 0; i < 100; i++) { encodedMessage.putStringProperty("another" + i, "value" + i); @@ -497,14 +497,14 @@ public class TestConversions { AMQPMessage encodedMessage = encodeAndCreateAMQPMessage(message); TypedProperties extraProperties = new TypedProperties(); - encodedMessage.setAddress(SimpleString.toSimpleString("xxxx.v1.queue")); + encodedMessage.setAddress(SimpleString.of("xxxx.v1.queue")); for (int i = 0; i < 100; i++) { encodedMessage.setMessageID(333L); if (i % 3 == 0) { - encodedMessage.referenceOriginalMessage(encodedMessage, SimpleString.toSimpleString("SOME-OTHER-QUEUE-DOES-NOT-MATTER-WHAT")); + encodedMessage.referenceOriginalMessage(encodedMessage, SimpleString.of("SOME-OTHER-QUEUE-DOES-NOT-MATTER-WHAT")); } else { - encodedMessage.referenceOriginalMessage(encodedMessage, SimpleString.toSimpleString("XXX")); + encodedMessage.referenceOriginalMessage(encodedMessage, SimpleString.of("XXX")); } encodedMessage.putStringProperty("another " + i, "value " + i); encodedMessage.messageChanged(); diff --git a/artemis-protocols/artemis-hornetq-protocol/src/test/java/org/apache/activemq/artemis/core/protocol/hornetq/PropertiesConversionTest.java b/artemis-protocols/artemis-hornetq-protocol/src/test/java/org/apache/activemq/artemis/core/protocol/hornetq/PropertiesConversionTest.java index 949ecb6401..6f1ca384bc 100644 --- a/artemis-protocols/artemis-hornetq-protocol/src/test/java/org/apache/activemq/artemis/core/protocol/hornetq/PropertiesConversionTest.java +++ b/artemis-protocols/artemis-hornetq-protocol/src/test/java/org/apache/activemq/artemis/core/protocol/hornetq/PropertiesConversionTest.java @@ -58,11 +58,11 @@ public class PropertiesConversionTest { public void testParallelHornetQConversions() throws Throwable { CoreMessage coreMessage = new CoreMessage(1, 1024); for (int i = 0; i < 10; i++) { - coreMessage.putBooleanProperty(SimpleString.toSimpleString("key1"), true); + coreMessage.putBooleanProperty(SimpleString.of("key1"), true); } - coreMessage.putStringProperty(new SimpleString("_HQ_ORIG_ADDRESS"), SimpleString.toSimpleString("hqOne")); - coreMessage.putStringProperty(new SimpleString("_AMQ_ORIG_QUEUE"), SimpleString.toSimpleString("amqOne")); - coreMessage.putStringProperty(new SimpleString("_AMQ_ORIG_MESSAGE_ID"), SimpleString.toSimpleString("asdfkhaksdjfhaskfdjhas")); + coreMessage.putStringProperty(SimpleString.of("_HQ_ORIG_ADDRESS"), SimpleString.of("hqOne")); + coreMessage.putStringProperty(SimpleString.of("_AMQ_ORIG_QUEUE"), SimpleString.of("amqOne")); + coreMessage.putStringProperty(SimpleString.of("_AMQ_ORIG_MESSAGE_ID"), SimpleString.of("asdfkhaksdjfhaskfdjhas")); int threads = 100; int conversions = 100; @@ -134,11 +134,11 @@ public class PropertiesConversionTest { public void testMultiThreadChanges() throws Throwable { CoreMessage coreMessage = new CoreMessage(1, 1024); for (int i = 0; i < 10; i++) { - coreMessage.putBooleanProperty(SimpleString.toSimpleString("key1"), true); + coreMessage.putBooleanProperty(SimpleString.of("key1"), true); } - coreMessage.putStringProperty(new SimpleString("_HQ_ORIG_ADDRESS"), SimpleString.toSimpleString("hqOne")); - coreMessage.putStringProperty(new SimpleString("_AMQ_ORIG_QUEUE"), SimpleString.toSimpleString("amqOne")); - coreMessage.putStringProperty(new SimpleString("_AMQ_ORIG_MESSAGE_ID"), SimpleString.toSimpleString("asdfkhaksdjfhaskfdjhas")); + coreMessage.putStringProperty(SimpleString.of("_HQ_ORIG_ADDRESS"), SimpleString.of("hqOne")); + coreMessage.putStringProperty(SimpleString.of("_AMQ_ORIG_QUEUE"), SimpleString.of("amqOne")); + coreMessage.putStringProperty(SimpleString.of("_AMQ_ORIG_MESSAGE_ID"), SimpleString.of("asdfkhaksdjfhaskfdjhas")); int threads = 100; int conversions = 100; diff --git a/artemis-protocols/artemis-hqclient-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/hornetq/HQFilterConversionInterceptor.java b/artemis-protocols/artemis-hqclient-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/hornetq/HQFilterConversionInterceptor.java index 761aca678f..2654465769 100644 --- a/artemis-protocols/artemis-hqclient-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/hornetq/HQFilterConversionInterceptor.java +++ b/artemis-protocols/artemis-hqclient-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/hornetq/HQFilterConversionInterceptor.java @@ -56,7 +56,7 @@ public class HQFilterConversionInterceptor implements Interceptor { if (filterString == null) { return null; } - return SimpleString.toSimpleString(convertHQToActiveMQFilterString(filterString.toString())); + return SimpleString.of(convertHQToActiveMQFilterString(filterString.toString())); } diff --git a/artemis-protocols/artemis-hqclient-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/hornetq/util/HQPropertiesConverter.java b/artemis-protocols/artemis-hqclient-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/hornetq/util/HQPropertiesConverter.java index cfb8d2f888..14dd751577 100644 --- a/artemis-protocols/artemis-hqclient-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/hornetq/util/HQPropertiesConverter.java +++ b/artemis-protocols/artemis-hqclient-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/hornetq/util/HQPropertiesConverter.java @@ -36,16 +36,16 @@ public class HQPropertiesConverter { Map d = new HashMap<>(); // Add entries for outgoing messages - d.put(new SimpleString("_HQ_ACTUAL_EXPIRY"), new SimpleString("_AMQ_ACTUAL_EXPIRY")); - d.put(new SimpleString("_HQ_ORIG_ADDRESS"), new SimpleString("_AMQ_ORIG_ADDRESS")); - d.put(new SimpleString("_HQ_ORIG_QUEUE"), new SimpleString("_AMQ_ORIG_QUEUE")); - d.put(new SimpleString("_HQ_ORIG_MESSAGE_ID"), new SimpleString("_AMQ_ORIG_MESSAGE_ID")); - d.put(new SimpleString("_HQ_GROUP_ID"), new SimpleString("_AMQ_GROUP_ID")); - d.put(new SimpleString("_HQ_LARGE_COMPRESSED"), new SimpleString("_AMQ_LARGE_COMPRESSED")); - d.put(new SimpleString("_HQ_LARGE_SIZE"), new SimpleString("_AMQ_LARGE_SIZE")); - d.put(new SimpleString("_HQ_SCHED_DELIVERY"), new SimpleString("_AMQ_SCHED_DELIVERY")); - d.put(new SimpleString("_HQ_DUPL_ID"), new SimpleString("_AMQ_DUPL_ID")); - d.put(new SimpleString("_HQ_LVQ_NAME"), new SimpleString("_AMQ_LVQ_NAME")); + d.put(SimpleString.of("_HQ_ACTUAL_EXPIRY"), SimpleString.of("_AMQ_ACTUAL_EXPIRY")); + d.put(SimpleString.of("_HQ_ORIG_ADDRESS"), SimpleString.of("_AMQ_ORIG_ADDRESS")); + d.put(SimpleString.of("_HQ_ORIG_QUEUE"), SimpleString.of("_AMQ_ORIG_QUEUE")); + d.put(SimpleString.of("_HQ_ORIG_MESSAGE_ID"), SimpleString.of("_AMQ_ORIG_MESSAGE_ID")); + d.put(SimpleString.of("_HQ_GROUP_ID"), SimpleString.of("_AMQ_GROUP_ID")); + d.put(SimpleString.of("_HQ_LARGE_COMPRESSED"), SimpleString.of("_AMQ_LARGE_COMPRESSED")); + d.put(SimpleString.of("_HQ_LARGE_SIZE"), SimpleString.of("_AMQ_LARGE_SIZE")); + d.put(SimpleString.of("_HQ_SCHED_DELIVERY"), SimpleString.of("_AMQ_SCHED_DELIVERY")); + d.put(SimpleString.of("_HQ_DUPL_ID"), SimpleString.of("_AMQ_DUPL_ID")); + d.put(SimpleString.of("_HQ_LVQ_NAME"), SimpleString.of("_AMQ_LVQ_NAME")); hqAmqDictionary = Collections.unmodifiableMap(d); 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 386235928a..5a06b4dd4d 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 @@ -130,7 +130,7 @@ public class MQTTPublishManager { } private SimpleString createManagementAddress() { - return new SimpleString(MQTTUtil.MANAGEMENT_QUEUE_PREFIX + session.getState().getClientId()); + return SimpleString.of(MQTTUtil.MANAGEMENT_QUEUE_PREFIX + session.getState().getClientId()); } private void createManagementQueue() throws Exception { @@ -217,7 +217,7 @@ public class MQTTPublishManager { } } String coreAddress = MQTTUtil.getCoreAddressFromMqttTopic(topic, session.getWildcardConfiguration()); - SimpleString address = SimpleString.toSimpleString(coreAddress, session.getCoreMessageObjectPools().getAddressStringSimpleStringPool()); + SimpleString address = SimpleString.of(coreAddress, session.getCoreMessageObjectPools().getAddressStringSimpleStringPool()); Message serverMessage = MQTTUtil.createServerMessageFromByteBuf(session, address, message); int qos = message.fixedHeader().qosLevel().value(); if (qos > 0) { 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 b04f09f784..4a073eec7c 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 @@ -66,7 +66,7 @@ public class MQTTRetainMessageManager { void addRetainedMessagesToQueue(Queue queue, String address) throws Exception { // The address filter that matches all retained message queues. String retainAddress = MQTTUtil.getCoreRetainAddressFromMqttTopic(address, session.getWildcardConfiguration()); - BindingQueryResult bindingQueryResult = session.getServerSession().executeBindingQuery(new SimpleString(retainAddress)); + BindingQueryResult bindingQueryResult = session.getServerSession().executeBindingQuery(SimpleString.of(retainAddress)); // Iterate over all matching retain queues and add the queue Transaction tx = session.getServerSession().newTransaction(); 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 377d19c9d1..6217b14480 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 @@ -85,14 +85,14 @@ public class MQTTSubscriptionManager { StringBuilder messageFilter = new StringBuilder(baseFilter); messageFilter.append(")"); - this.messageFilter = new SimpleString(messageFilter.toString()); + this.messageFilter = SimpleString.of(messageFilter.toString()); // [MQTT-4.7.2-1] StringBuilder messageFilterNoDollar = new StringBuilder(baseFilter); messageFilterNoDollar.append(" OR "); messageFilterNoDollar.append("(").append(FilterConstants.ACTIVEMQ_ADDRESS).append(" LIKE '").append(DOLLAR).append("%')"); messageFilterNoDollar.append(")"); - this.messageFilterNoDollar = new SimpleString(messageFilterNoDollar.toString()); + this.messageFilterNoDollar = SimpleString.of(messageFilterNoDollar.toString()); } synchronized void start() throws Exception { @@ -156,7 +156,7 @@ public class MQTTSubscriptionManager { // the subscription queue does not exist so we need to create it if (q == null) { - SimpleString sAddress = SimpleString.toSimpleString(coreAddress); + SimpleString sAddress = SimpleString.of(coreAddress); // only check if we can auto create queues if it's FQQN BindingQueryResult bindingQueryResult = session.getServerSession().executeBindingQuery(sAddress); @@ -227,7 +227,7 @@ public class MQTTSubscriptionManager { long cid = existingConsumerId != null ? existingConsumerId : session.getServer().getStorageManager().generateID(); // for noLocal support we use the MQTT *client id* rather than the connection ID, but we still use the existing property name - ServerConsumer consumer = session.getServerSession().createConsumer(cid, queue.getName(), noLocal ? SimpleString.toSimpleString(CONNECTION_ID_PROPERTY_NAME_STRING + " <> '" + session.getState().getClientId() + "'") : null, false, false, -1); + ServerConsumer consumer = session.getServerSession().createConsumer(cid, queue.getName(), noLocal ? SimpleString.of(CONNECTION_ID_PROPERTY_NAME_STRING + " <> '" + session.getState().getClientId() + "'") : null, false, false, -1); ServerConsumer existingConsumer = consumers.put(topicFilter, consumer); if (existingConsumer != null) { @@ -262,7 +262,7 @@ public class MQTTSubscriptionManager { consumerQoSLevels.remove(removed.getID()); } - SimpleString internalQueueName = SimpleString.toSimpleString(MQTTUtil.getCoreQueueFromMqttTopic(topics.get(i), state.getClientId(), session.getServer().getConfiguration().getWildcardConfiguration())); + SimpleString internalQueueName = SimpleString.of(MQTTUtil.getCoreQueueFromMqttTopic(topics.get(i), state.getClientId(), session.getServer().getConfiguration().getWildcardConfiguration())); Queue queue = session.getServer().locateQueue(internalQueueName); if (queue != null) { if (queue.isConfigurationManaged()) { diff --git a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTUtil.java b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTUtil.java index 73bdd8d06a..8ca7f69672 100644 --- a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTUtil.java +++ b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTUtil.java @@ -92,29 +92,29 @@ public class MQTTUtil { public static final String MQTT_RETAIN_ADDRESS_PREFIX = DOLLAR + "sys.mqtt.retain."; - public static final SimpleString MQTT_QOS_LEVEL_KEY = SimpleString.toSimpleString("mqtt.qos.level"); + public static final SimpleString MQTT_QOS_LEVEL_KEY = SimpleString.of("mqtt.qos.level"); - public static final SimpleString MQTT_MESSAGE_ID_KEY = SimpleString.toSimpleString("mqtt.message.id"); + public static final SimpleString MQTT_MESSAGE_ID_KEY = SimpleString.of("mqtt.message.id"); - public static final SimpleString MQTT_MESSAGE_TYPE_KEY = SimpleString.toSimpleString("mqtt.message.type"); + public static final SimpleString MQTT_MESSAGE_TYPE_KEY = SimpleString.of("mqtt.message.type"); - public static final SimpleString MQTT_MESSAGE_RETAIN_KEY = SimpleString.toSimpleString("mqtt.message.retain"); + public static final SimpleString MQTT_MESSAGE_RETAIN_KEY = SimpleString.of("mqtt.message.retain"); - public static final SimpleString MQTT_MESSAGE_RETAIN_INITIAL_DISTRIBUTION_KEY = SimpleString.toSimpleString("mqtt.message.retain.initial.distribution"); + public static final SimpleString MQTT_MESSAGE_RETAIN_INITIAL_DISTRIBUTION_KEY = SimpleString.of("mqtt.message.retain.initial.distribution"); - public static final SimpleString MQTT_PAYLOAD_FORMAT_INDICATOR_KEY = SimpleString.toSimpleString("mqtt.payload.format.indicator"); + public static final SimpleString MQTT_PAYLOAD_FORMAT_INDICATOR_KEY = SimpleString.of("mqtt.payload.format.indicator"); - public static final SimpleString MQTT_RESPONSE_TOPIC_KEY = SimpleString.toSimpleString("mqtt.response.topic"); + public static final SimpleString MQTT_RESPONSE_TOPIC_KEY = SimpleString.of("mqtt.response.topic"); - public static final SimpleString MQTT_CORRELATION_DATA_KEY = SimpleString.toSimpleString("mqtt.correlation.data"); + public static final SimpleString MQTT_CORRELATION_DATA_KEY = SimpleString.of("mqtt.correlation.data"); public static final String MQTT_USER_PROPERTY_EXISTS_KEY = "mqtt.user.property.exists"; public static final String MQTT_USER_PROPERTY_KEY_PREFIX = "mqtt.ordered.user.property."; - public static final SimpleString MQTT_USER_PROPERTY_KEY_PREFIX_SIMPLE = SimpleString.toSimpleString(MQTT_USER_PROPERTY_KEY_PREFIX); + public static final SimpleString MQTT_USER_PROPERTY_KEY_PREFIX_SIMPLE = SimpleString.of(MQTT_USER_PROPERTY_KEY_PREFIX); - public static final SimpleString MQTT_CONTENT_TYPE_KEY = SimpleString.toSimpleString("mqtt.content.type"); + public static final SimpleString MQTT_CONTENT_TYPE_KEY = SimpleString.of("mqtt.content.type"); public static final String MANAGEMENT_QUEUE_PREFIX = DOLLAR + "sys.mqtt.queue.qos2."; 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 4352b8f2ba..518b72f7df 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 @@ -917,7 +917,7 @@ public class OpenWireConnection extends AbstractRemotingConnection implements Se return; } - SimpleString qName = SimpleString.toSimpleString(dest.getPhysicalName()); + SimpleString qName = SimpleString.of(dest.getPhysicalName()); AutoCreateResult autoCreateResult = internalSession.checkAutoCreate(new QueueConfiguration(qName) .setRoutingType(dest.isQueue() ? RoutingType.ANYCAST : RoutingType.MULTICAST) @@ -1158,7 +1158,7 @@ public class OpenWireConnection extends AbstractRemotingConnection implements Se logger.warn("OpenWire client sending a queue remove towards {}", dest.getPhysicalName()); } try { - server.destroyQueue(new SimpleString(dest.getPhysicalName()), getRemotingConnection()); + server.destroyQueue(SimpleString.of(dest.getPhysicalName()), getRemotingConnection()); } catch (ActiveMQNonExistentQueueException neq) { //this is ok, ActiveMQ 5 allows this and will actually do it quite often logger.debug("queue never existed"); diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConstants.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConstants.java index e4e04017b2..ee995415b9 100644 --- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConstants.java +++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConstants.java @@ -19,22 +19,22 @@ package org.apache.activemq.artemis.core.protocol.openwire; import org.apache.activemq.artemis.api.core.SimpleString; public class OpenWireConstants { - private static final SimpleString AMQ_PREFIX = new SimpleString("__HDR_"); - public static final SimpleString AMQ_MSG_DLQ_DELIVERY_FAILURE_CAUSE_PROPERTY = new SimpleString(AMQ_PREFIX + "dlqDeliveryFailureCause"); - public static final SimpleString AMQ_MSG_ARRIVAL = new SimpleString(AMQ_PREFIX + "ARRIVAL"); - public static final SimpleString AMQ_MSG_BROKER_IN_TIME = new SimpleString(AMQ_PREFIX + "BROKER_IN_TIME"); - public static final SimpleString AMQ_MSG_BROKER_PATH = new SimpleString(AMQ_PREFIX + "BROKER_PATH"); - public static final SimpleString AMQ_MSG_CLUSTER = new SimpleString(AMQ_PREFIX + "CLUSTER"); - public static final SimpleString AMQ_MSG_COMMAND_ID = new SimpleString(AMQ_PREFIX + "COMMAND_ID"); - public static final SimpleString AMQ_MSG_DATASTRUCTURE = new SimpleString(AMQ_PREFIX + "DATASTRUCTURE"); - public static final SimpleString AMQ_MSG_MESSAGE_ID = new SimpleString(AMQ_PREFIX + "MESSAGE_ID"); - public static final SimpleString AMQ_MSG_ORIG_DESTINATION = new SimpleString(AMQ_PREFIX + "ORIG_DESTINATION"); - public static final SimpleString AMQ_MSG_PRODUCER_ID = new SimpleString(AMQ_PREFIX + "PRODUCER_ID"); - public static final SimpleString AMQ_MSG_REPLY_TO = new SimpleString(AMQ_PREFIX + "REPLY_TO"); - public static final SimpleString AMQ_MSG_USER_ID = new SimpleString(AMQ_PREFIX + "USER_ID"); - public static final SimpleString AMQ_MSG_DROPPABLE = new SimpleString(AMQ_PREFIX + "DROPPABLE"); - public static final SimpleString AMQ_MSG_COMPRESSED = new SimpleString(AMQ_PREFIX + "COMPRESSED"); + private static final SimpleString AMQ_PREFIX = SimpleString.of("__HDR_"); + public static final SimpleString AMQ_MSG_DLQ_DELIVERY_FAILURE_CAUSE_PROPERTY = SimpleString.of(AMQ_PREFIX + "dlqDeliveryFailureCause"); + public static final SimpleString AMQ_MSG_ARRIVAL = SimpleString.of(AMQ_PREFIX + "ARRIVAL"); + public static final SimpleString AMQ_MSG_BROKER_IN_TIME = SimpleString.of(AMQ_PREFIX + "BROKER_IN_TIME"); + public static final SimpleString AMQ_MSG_BROKER_PATH = SimpleString.of(AMQ_PREFIX + "BROKER_PATH"); + public static final SimpleString AMQ_MSG_CLUSTER = SimpleString.of(AMQ_PREFIX + "CLUSTER"); + public static final SimpleString AMQ_MSG_COMMAND_ID = SimpleString.of(AMQ_PREFIX + "COMMAND_ID"); + public static final SimpleString AMQ_MSG_DATASTRUCTURE = SimpleString.of(AMQ_PREFIX + "DATASTRUCTURE"); + public static final SimpleString AMQ_MSG_MESSAGE_ID = SimpleString.of(AMQ_PREFIX + "MESSAGE_ID"); + public static final SimpleString AMQ_MSG_ORIG_DESTINATION = SimpleString.of(AMQ_PREFIX + "ORIG_DESTINATION"); + public static final SimpleString AMQ_MSG_PRODUCER_ID = SimpleString.of(AMQ_PREFIX + "PRODUCER_ID"); + public static final SimpleString AMQ_MSG_REPLY_TO = SimpleString.of(AMQ_PREFIX + "REPLY_TO"); + public static final SimpleString AMQ_MSG_USER_ID = SimpleString.of(AMQ_PREFIX + "USER_ID"); + public static final SimpleString AMQ_MSG_DROPPABLE = SimpleString.of(AMQ_PREFIX + "DROPPABLE"); + public static final SimpleString AMQ_MSG_COMPRESSED = SimpleString.of(AMQ_PREFIX + "COMPRESSED"); - public static final SimpleString JMS_TYPE_PROPERTY = new SimpleString("JMSType"); - public static final SimpleString JMS_CORRELATION_ID_PROPERTY = new SimpleString("JMSCorrelationID"); + public static final SimpleString JMS_TYPE_PROPERTY = SimpleString.of("JMSType"); + public static final SimpleString JMS_CORRELATION_ID_PROPERTY = SimpleString.of("JMSCorrelationID"); } diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverter.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverter.java index 617f076af9..8dab2cdf7a 100644 --- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverter.java +++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverter.java @@ -101,7 +101,7 @@ public final class OpenWireMessageConverter { final String type = messageSend.getType(); if (type != null) { - coreMessage.putStringProperty(OpenWireConstants.JMS_TYPE_PROPERTY, new SimpleString(type)); + coreMessage.putStringProperty(OpenWireConstants.JMS_TYPE_PROPERTY, SimpleString.of(type)); } coreMessage.setDurable(messageSend.isPersistent()); coreMessage.setExpiration(messageSend.getExpiration()); @@ -176,14 +176,14 @@ public final class OpenWireMessageConverter { final MessageId messageId = messageSend.getMessageId(); if (messageId != null) { - coreMessage.putStringProperty(OpenWireConstants.AMQ_MSG_MESSAGE_ID, SimpleString.toSimpleString(messageId.toString())); + coreMessage.putStringProperty(OpenWireConstants.AMQ_MSG_MESSAGE_ID, SimpleString.of(messageId.toString())); } coreMessage.setUserID(UUIDGenerator.getInstance().generateUUID()); final ProducerId producerId = messageSend.getProducerId(); if (producerId != null) { - coreMessage.putStringProperty(OpenWireConstants.AMQ_MSG_PRODUCER_ID, SimpleString.toSimpleString(producerId.toString())); + coreMessage.putStringProperty(OpenWireConstants.AMQ_MSG_PRODUCER_ID, SimpleString.of(producerId.toString())); } putMsgProperties(messageSend, coreMessage); @@ -206,7 +206,7 @@ public final class OpenWireMessageConverter { final String userId = messageSend.getUserID(); if (userId != null) { - coreMessage.putStringProperty(OpenWireConstants.AMQ_MSG_USER_ID, new SimpleString(userId)); + coreMessage.putStringProperty(OpenWireConstants.AMQ_MSG_USER_ID, SimpleString.of(userId)); } coreMessage.putBooleanProperty(OpenWireConstants.AMQ_MSG_DROPPABLE, messageSend.isDroppable()); @@ -235,7 +235,7 @@ public final class OpenWireMessageConverter { DataInputStream tdataIn = new DataInputStream(tis); String text = MarshallingSupport.readUTF8(tdataIn); tdataIn.close(); - body.writeNullableSimpleString(new SimpleString(text)); + body.writeNullableSimpleString(SimpleString.of(text)); } private static void writeMapType(final ByteSequence contents, @@ -409,7 +409,7 @@ public final class OpenWireMessageConverter { builder.append(','); //is this separator safe? } } - coreMessage.putStringProperty(OpenWireConstants.AMQ_MSG_BROKER_PATH, new SimpleString(builder.toString())); + coreMessage.putStringProperty(OpenWireConstants.AMQ_MSG_BROKER_PATH, SimpleString.of(builder.toString())); } private static void putMsgCluster(final BrokerId[] cluster, final CoreMessage coreMessage) { @@ -420,7 +420,7 @@ public final class OpenWireMessageConverter { builder.append(','); //is this separator safe? } } - coreMessage.putStringProperty(OpenWireConstants.AMQ_MSG_CLUSTER, new SimpleString(builder.toString())); + coreMessage.putStringProperty(OpenWireConstants.AMQ_MSG_CLUSTER, SimpleString.of(builder.toString())); } private static void putMsgDataStructure(final DataStructure ds, @@ -451,7 +451,7 @@ public final class OpenWireMessageConverter { private static void loadMapIntoProperties(TypedProperties props, Map map) { for (Entry entry : map.entrySet()) { - SimpleString key = new SimpleString(entry.getKey()); + SimpleString key = SimpleString.of(entry.getKey()); Object value = entry.getValue(); if (value instanceof UTF8Buffer) { value = value.toString(); diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java index 1d0c541631..60fc05820c 100644 --- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java +++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java @@ -489,7 +489,7 @@ public class OpenWireProtocolManager extends AbstractProtocolManager'" + id + "'"; if (selector == null) { - selector = new SimpleString(noLocalSelector); + selector = SimpleString.of(noLocalSelector); } else { - selector = new SimpleString(info.getSelector() + " AND " + noLocalSelector); + selector = SimpleString.of(info.getSelector() + " AND " + noLocalSelector); } } - SimpleString destinationName = new SimpleString(session.convertWildcard(openwireDestination)); + SimpleString destinationName = SimpleString.of(session.convertWildcard(openwireDestination)); if (openwireDestination.isTopic()) { SimpleString queueName = createTopicSubscription(info.isDurable(), info.getClientId(), destinationName.toString(), info.getSubscriptionName(), selector, destinationName); @@ -245,12 +245,12 @@ public class AMQConsumer { * The consumer may be using FQQN in which case the queue might already exist. */ if (CompositeAddress.isFullyQualified(physicalName)) { - queueName = CompositeAddress.extractQueueName(SimpleString.toSimpleString(physicalName)); + queueName = CompositeAddress.extractQueueName(SimpleString.of(physicalName)); if (session.getCoreServer().locateQueue(queueName) != null) { return queueName; } } else { - queueName = new SimpleString(UUID.randomUUID().toString()); + queueName = SimpleString.of(UUID.randomUUID().toString()); } session.getCoreSession().createQueue(new QueueConfiguration(queueName).setAddress(address).setFilterString(selector).setDurable(false).setTemporary(true).setInternal(internalAddress)); @@ -379,7 +379,7 @@ public class AMQConsumer { Throwable poisonCause = ack.getPoisonCause(); if (poisonCause != null) { ((QueueImpl) ref.getQueue()).decDelivering(ref); - ref.getMessage().putStringProperty(OpenWireConstants.AMQ_MSG_DLQ_DELIVERY_FAILURE_CAUSE_PROPERTY, new SimpleString(poisonCause.toString())); + ref.getMessage().putStringProperty(OpenWireConstants.AMQ_MSG_DLQ_DELIVERY_FAILURE_CAUSE_PROPERTY, SimpleString.of(poisonCause.toString())); ((QueueImpl) ref.getQueue()).incDelivering(ref); } ref.getQueue().sendToDeadLetterAddress(transaction, ref); 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 f1f7c749e1..0a9a209ae1 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 @@ -106,7 +106,7 @@ public class AMQSession implements SessionCallback { OpenWireProtocolManager protocolManager, CoreMessageObjectPools coreMessageObjectPools) { this.connInfo = connInfo; this.sessInfo = sessInfo; - this.clientId = SimpleString.toSimpleString(connInfo.getClientId()); + this.clientId = SimpleString.of(connInfo.getClientId()); this.server = server; this.connection = connection; this.protocolManager = protocolManager; @@ -181,7 +181,7 @@ public class AMQSession implements SessionCallback { } if (openWireDest.isQueue()) { openWireDest = protocolManager.virtualTopicConsumerToFQQN(openWireDest); - SimpleString queueName = new SimpleString(convertWildcard(openWireDest)); + SimpleString queueName = SimpleString.of(convertWildcard(openWireDest)); if (!checkAutoCreateQueue(queueName, openWireDest.isTemporary(), OpenWireUtil.extractFilterStringOrNull(info, openWireDest))) { throw new InvalidDestinationException("Destination doesn't exist: " + queueName); @@ -385,7 +385,7 @@ public class AMQSession implements SessionCallback { * message comes from failover connection. If so we add a DUPLICATE_ID to handle duplicates after a resend. */ if (connection.getContext().isFaultTolerant() && protocolManager.isOpenwireUseDuplicateDetectionOnFailover() && !messageSend.getProperties().containsKey(org.apache.activemq.artemis.api.core.Message.HDR_DUPLICATE_DETECTION_ID.toString()) && !isTemporary(producerInfo)) { - originalCoreMsg.putStringProperty(org.apache.activemq.artemis.api.core.Message.HDR_DUPLICATE_DETECTION_ID, SimpleString.toSimpleString(messageSend.getMessageId().toString())); + originalCoreMsg.putStringProperty(org.apache.activemq.artemis.api.core.Message.HDR_DUPLICATE_DETECTION_ID, SimpleString.of(messageSend.getMessageId().toString())); } final boolean shouldBlockProducer = producerInfo.getWindowSize() > 0 || messageSend.isResponseRequired(); @@ -399,7 +399,7 @@ public class AMQSession implements SessionCallback { for (int i = 0; i < actualDestinationsCount; i++) { final ActiveMQDestination dest = actualDestinations != null ? actualDestinations[i] : destination; final String physicalName = dest.getPhysicalName(); - final SimpleString address = SimpleString.toSimpleString(physicalName, coreMessageObjectPools.getAddressStringSimpleStringPool()); + final SimpleString address = SimpleString.of(physicalName, coreMessageObjectPools.getAddressStringSimpleStringPool()); //the last coreMsg could be directly the original one -> it avoid 1 copy if actualDestinations > 1 and ANY copy if actualDestinations == 1 final org.apache.activemq.artemis.api.core.Message coreMsg = (i == actualDestinationsCount - 1) ? originalCoreMsg : originalCoreMsg.copy(); coreMsg.setAddress(address); diff --git a/artemis-protocols/artemis-openwire-protocol/src/test/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverterTest.java b/artemis-protocols/artemis-openwire-protocol/src/test/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverterTest.java index d3d7f8a894..4cb96a104d 100644 --- a/artemis-protocols/artemis-openwire-protocol/src/test/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverterTest.java +++ b/artemis-protocols/artemis-openwire-protocol/src/test/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverterTest.java @@ -229,7 +229,7 @@ public class OpenWireMessageConverterTest { final String CORRELATION_ID = RandomUtil.randomString(); ICoreMessage coreMessage = new CoreMessage().initBuffer(8); - coreMessage.putStringProperty(OpenWireConstants.JMS_CORRELATION_ID_PROPERTY, new SimpleString(CORRELATION_ID)); + coreMessage.putStringProperty(OpenWireConstants.JMS_CORRELATION_ID_PROPERTY, SimpleString.of(CORRELATION_ID)); MessageReference messageReference = new MessageReferenceImpl(coreMessage, Mockito.mock(Queue.class)); AMQConsumer amqConsumer = Mockito.mock(AMQConsumer.class); Mockito.when(amqConsumer.getOpenwireDestination()).thenReturn(destination); 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 b7835548a9..d3c2263bb3 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 @@ -171,7 +171,7 @@ public final class StompConnection extends AbstractRemotingConnection { public void autoCreateDestinationIfPossible(String destination, RoutingType routingType) throws ActiveMQStompException { try { - SimpleString simpleDestination = SimpleString.toSimpleString(destination); + SimpleString simpleDestination = SimpleString.of(destination); AddressInfo addressInfo = manager.getServer().getAddressInfo(simpleDestination); AddressSettings addressSettings = manager.getServer().getAddressSettingsRepository().getMatch(destination); RoutingType effectiveAddressRoutingType = routingType == null ? addressSettings.getDefaultAddressRoutingType() : routingType; @@ -208,7 +208,7 @@ public final class StompConnection extends AbstractRemotingConnection { } public void checkRoutingSemantics(String destination, RoutingType routingType) throws ActiveMQStompException { - AddressInfo addressInfo = manager.getServer().getAddressInfo(SimpleString.toSimpleString(destination)); + AddressInfo addressInfo = manager.getServer().getAddressInfo(SimpleString.of(destination)); // may be null here if, for example, the management address is being checked if (addressInfo != null) { diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompProtocolManager.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompProtocolManager.java index 291b595399..610254247b 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompProtocolManager.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompProtocolManager.java @@ -404,7 +404,7 @@ public class StompProtocolManager extends AbstractProtocolManager T convert(Class type, Object value) { - return (T) SimpleString.toSimpleString(value.toString()); + return (T) SimpleString.of(value.toString()); } }, SimpleString.class); 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 9f6ab681e6..1315175cc6 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 @@ -483,9 +483,9 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { config.setPersistIDCache(getBoolean(e, "persist-id-cache", config.isPersistIDCache())); - config.setManagementAddress(new SimpleString(getString(e, "management-address", config.getManagementAddress().toString(), NOT_NULL_OR_EMPTY))); + config.setManagementAddress(SimpleString.of(getString(e, "management-address", config.getManagementAddress().toString(), NOT_NULL_OR_EMPTY))); - config.setManagementNotificationAddress(new SimpleString(getString(e, "management-notification-address", config.getManagementNotificationAddress().toString(), NOT_NULL_OR_EMPTY))); + config.setManagementNotificationAddress(SimpleString.of(getString(e, "management-notification-address", config.getManagementNotificationAddress().toString(), NOT_NULL_OR_EMPTY))); config.setMaskPassword(getBoolean(e, "mask-password", null)); @@ -1331,9 +1331,9 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { final Node child = children.item(i); final String name = child.getNodeName(); if (DEAD_LETTER_ADDRESS_NODE_NAME.equalsIgnoreCase(name)) { - addressSettings.setDeadLetterAddress(new SimpleString(getTrimmedTextContent(child))); + addressSettings.setDeadLetterAddress(SimpleString.of(getTrimmedTextContent(child))); } else if (EXPIRY_ADDRESS_NODE_NAME.equalsIgnoreCase(name)) { - addressSettings.setExpiryAddress(new SimpleString(getTrimmedTextContent(child))); + addressSettings.setExpiryAddress(SimpleString.of(getTrimmedTextContent(child))); } else if (EXPIRY_DELAY_NODE_NAME.equalsIgnoreCase(name)) { addressSettings.setExpiryDelay(XMLUtil.parseLong(child)); } else if (MIN_EXPIRY_DELAY_NODE_NAME.equalsIgnoreCase(name)) { @@ -1386,7 +1386,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { } else if (LVQ_NODE_NAME.equalsIgnoreCase(name) || DEFAULT_LVQ_NODE_NAME.equalsIgnoreCase(name)) { addressSettings.setDefaultLastValueQueue(XMLUtil.parseBoolean(child)); } else if (DEFAULT_LVQ_KEY_NODE_NAME.equalsIgnoreCase(name)) { - addressSettings.setDefaultLastValueKey(SimpleString.toSimpleString(getTrimmedTextContent(child))); + addressSettings.setDefaultLastValueKey(SimpleString.of(getTrimmedTextContent(child))); } else if (DEFAULT_NON_DESTRUCTIVE_NODE_NAME.equalsIgnoreCase(name)) { addressSettings.setDefaultNonDestructive(XMLUtil.parseBoolean(child)); } else if (DEFAULT_EXCLUSIVE_NODE_NAME.equalsIgnoreCase(name)) { @@ -1398,7 +1398,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { } else if (DEFAULT_GROUP_BUCKETS.equalsIgnoreCase(name)) { addressSettings.setDefaultGroupBuckets(XMLUtil.parseInt(child)); } else if (DEFAULT_GROUP_FIRST_KEY.equalsIgnoreCase(name)) { - addressSettings.setDefaultGroupFirstKey(SimpleString.toSimpleString(getTrimmedTextContent(child))); + addressSettings.setDefaultGroupFirstKey(SimpleString.of(getTrimmedTextContent(child))); } else if (MAX_DELIVERY_ATTEMPTS.equalsIgnoreCase(name)) { addressSettings.setMaxDeliveryAttempts(XMLUtil.parseInt(child)); } else if (REDISTRIBUTION_DELAY_NODE_NAME.equalsIgnoreCase(name)) { @@ -1472,15 +1472,15 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { } else if (AUTO_CREATE_DEAD_LETTER_RESOURCES_NODE_NAME.equalsIgnoreCase(name)) { addressSettings.setAutoCreateDeadLetterResources(XMLUtil.parseBoolean(child)); } else if (DEAD_LETTER_QUEUE_PREFIX_NODE_NAME.equalsIgnoreCase(name)) { - addressSettings.setDeadLetterQueuePrefix(new SimpleString(getTrimmedTextContent(child))); + addressSettings.setDeadLetterQueuePrefix(SimpleString.of(getTrimmedTextContent(child))); } else if (DEAD_LETTER_QUEUE_SUFFIX_NODE_NAME.equalsIgnoreCase(name)) { - addressSettings.setDeadLetterQueueSuffix(new SimpleString(getTrimmedTextContent(child))); + addressSettings.setDeadLetterQueueSuffix(SimpleString.of(getTrimmedTextContent(child))); } else if (AUTO_CREATE_EXPIRY_RESOURCES_NODE_NAME.equalsIgnoreCase(name)) { addressSettings.setAutoCreateExpiryResources(XMLUtil.parseBoolean(child)); } else if (EXPIRY_QUEUE_PREFIX_NODE_NAME.equalsIgnoreCase(name)) { - addressSettings.setExpiryQueuePrefix(new SimpleString(getTrimmedTextContent(child))); + addressSettings.setExpiryQueuePrefix(SimpleString.of(getTrimmedTextContent(child))); } else if (EXPIRY_QUEUE_SUFFIX_NODE_NAME.equalsIgnoreCase(name)) { - addressSettings.setExpiryQueueSuffix(new SimpleString(getTrimmedTextContent(child))); + addressSettings.setExpiryQueueSuffix(SimpleString.of(getTrimmedTextContent(child))); } else if (ENABLE_METRICS.equalsIgnoreCase(name)) { addressSettings.setEnableMetrics(XMLUtil.parseBoolean(child)); } else if (ENABLE_INGRESS_TIMESTAMP.equalsIgnoreCase(name)) { @@ -1499,7 +1499,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { protected ResourceLimitSettings parseResourceLimitSettings(final Node node) { ResourceLimitSettings resourceLimitSettings = new ResourceLimitSettings(); - resourceLimitSettings.setMatch(SimpleString.toSimpleString(getAttributeValue(node, "match"))); + resourceLimitSettings.setMatch(SimpleString.of(getAttributeValue(node, "match"))); NodeList children = node.getChildNodes(); @@ -2244,8 +2244,8 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { String match = getAttributeValue(e2, "address-match"); String queue = getAttributeValue(e2, "queue-name"); connectionElement = new AMQPBrokerConnectionElement(); - connectionElement.setMatchAddress(SimpleString.toSimpleString(match)).setType(nodeType); - connectionElement.setQueueName(SimpleString.toSimpleString(queue)); + connectionElement.setMatchAddress(SimpleString.of(match)).setType(nodeType); + connectionElement.setQueueName(SimpleString.of(queue)); } config.addElement(connectionElement); @@ -2437,7 +2437,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { Integer timeout = getInteger(node, "timeout", ActiveMQDefaultConfiguration.getDefaultGroupingHandlerTimeout(), GT_ZERO); Long groupTimeout = getLong(node, "group-timeout", ActiveMQDefaultConfiguration.getDefaultGroupingHandlerGroupTimeout(), MINUS_ONE_OR_GT_ZERO); Long reaperPeriod = getLong(node, "reaper-period", ActiveMQDefaultConfiguration.getDefaultGroupingHandlerReaperPeriod(), GT_ZERO); - mainConfiguration.setGroupingHandlerConfiguration(new GroupingHandlerConfiguration().setName(new SimpleString(name)).setType(type.equals(GroupingHandlerConfiguration.TYPE.LOCAL.getType()) ? GroupingHandlerConfiguration.TYPE.LOCAL : GroupingHandlerConfiguration.TYPE.REMOTE).setAddress(new SimpleString(address)).setTimeout(timeout).setGroupTimeout(groupTimeout).setReaperPeriod(reaperPeriod)); + mainConfiguration.setGroupingHandlerConfiguration(new GroupingHandlerConfiguration().setName(SimpleString.of(name)).setType(type.equals(GroupingHandlerConfiguration.TYPE.LOCAL.getType()) ? GroupingHandlerConfiguration.TYPE.LOCAL : GroupingHandlerConfiguration.TYPE.REMOTE).setAddress(SimpleString.of(address)).setTimeout(timeout).setGroupTimeout(groupTimeout).setReaperPeriod(reaperPeriod)); } private TransformerConfiguration getTransformerConfiguration(final Node node) { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/filter/impl/FilterImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/filter/impl/FilterImpl.java index ce34fcef42..e46545c5c6 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/filter/impl/FilterImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/filter/impl/FilterImpl.java @@ -69,7 +69,7 @@ public class FilterImpl implements Filter { * @throws ActiveMQException if the string does not correspond to a valid filter */ public static Filter createFilter(final String filterStr) throws ActiveMQException { - return FilterImpl.createFilter(SimpleString.toSimpleString(filterStr == null ? null : filterStr.trim())); + return FilterImpl.createFilter(SimpleString.of(filterStr == null ? null : filterStr.trim())); } /** @@ -162,15 +162,15 @@ public class FilterImpl implements Filter { // Proton stores JMSMessageID as NATIVE_MESSAGE_ID that is an arbitrary string String amqpNativeID = msg.getStringProperty(NATIVE_MESSAGE_ID); if (amqpNativeID != null) { - return SimpleString.toSimpleString(amqpNativeID); + return SimpleString.of(amqpNativeID); } } // It's the stringified (hex) representation of a user id that can be used in a selector expression String userID = msg.getUserID().toString(); if (userID.startsWith("ID:")) { - return SimpleString.toSimpleString(userID); + return SimpleString.of(userID); } else { - return SimpleString.toSimpleString("ID:" + msg.getUserID()); + return SimpleString.of("ID:" + msg.getUserID()); } } else if (FilterConstants.ACTIVEMQ_PRIORITY.equals(fieldName)) { return (int) msg.getPriority(); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AbstractControl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AbstractControl.java index 205956394e..810a79aced 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AbstractControl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AbstractControl.java @@ -135,7 +135,7 @@ public abstract class AbstractControl extends StandardMBean { message.setTimestamp(System.currentTimeMillis()); if (body != null) { if (type == Message.TEXT_TYPE) { - message.getBodyBuffer().writeNullableSimpleString(new SimpleString(body)); + message.getBodyBuffer().writeNullableSimpleString(SimpleString.of(body)); } else { message.getBodyBuffer().writeBytes(Base64.decode(body)); } 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 df33a69f7c..c424101000 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 @@ -938,7 +938,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active for (String routingType : ListUtil.toList(routingTypes)) { set.add(RoutingType.valueOf(routingType)); } - final AddressInfo addressInfo = new AddressInfo(new SimpleString(name), set); + final AddressInfo addressInfo = new AddressInfo(SimpleString.of(name), set); if (server.addAddressInfo(addressInfo)) { String result = AddressInfoTextFormatter.Long.format(addressInfo, new StringBuilder()).toString(); if (AuditLogger.isResourceLoggingEnabled()) { @@ -973,16 +973,16 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active routingTypeSet.add(RoutingType.valueOf(routingTypeName)); } } - if (!server.updateAddressInfo(SimpleString.toSimpleString(name), routingTypeSet)) { + if (!server.updateAddressInfo(SimpleString.of(name), routingTypeSet)) { if (AuditLogger.isResourceLoggingEnabled()) { AuditLogger.updateAddressFailure(name, routingTypes); } - throw ActiveMQMessageBundle.BUNDLE.addressDoesNotExist(SimpleString.toSimpleString(name)); + throw ActiveMQMessageBundle.BUNDLE.addressDoesNotExist(SimpleString.of(name)); } if (AuditLogger.isResourceLoggingEnabled()) { AuditLogger.updateAddressSuccess(name, routingTypes); } - return AddressInfoTextFormatter.Long.format(server.getAddressInfo(SimpleString.toSimpleString(name)), new StringBuilder()).toString(); + return AddressInfoTextFormatter.Long.format(server.getAddressInfo(SimpleString.of(name)), new StringBuilder()).toString(); } finally { blockOnIO(); } @@ -1003,7 +1003,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active clearIO(); try { - server.removeAddressInfo(new SimpleString(name), null, force); + server.removeAddressInfo(SimpleString.of(name), null, force); if (AuditLogger.isResourceLoggingEnabled()) { AuditLogger.deleteAddressSuccess(name); } @@ -1269,10 +1269,10 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active clearIO(); - SimpleString filter = filterStr == null ? null : new SimpleString(filterStr); + SimpleString filter = filterStr == null ? null : SimpleString.of(filterStr); try { if (filterStr != null && !filterStr.trim().equals("")) { - filter = new SimpleString(filterStr); + filter = SimpleString.of(filterStr); } 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)); @@ -1433,7 +1433,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active if (AuditLogger.isResourceLoggingEnabled()) { AuditLogger.updateQueueFailure(name, routingType); } - throw ActiveMQMessageBundle.BUNDLE.noSuchQueue(new SimpleString(name)); + throw ActiveMQMessageBundle.BUNDLE.noSuchQueue(SimpleString.of(name)); } if (AuditLogger.isResourceLoggingEnabled()) { AuditLogger.updateQueueSuccess(name, routingType); @@ -1607,7 +1607,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active clearIO(); try { - SimpleString queueName = new SimpleString(name); + SimpleString queueName = SimpleString.of(name); try { server.destroyQueue(queueName, null, !removeConsumers, removeConsumers, forceAutoDeleteAddress); } catch (Exception e) { @@ -1644,9 +1644,9 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active clearIO(); try { - final AddressInfo addressInfo = server.getAddressInfo(SimpleString.toSimpleString(address)); + final AddressInfo addressInfo = server.getAddressInfo(SimpleString.of(address)); if (addressInfo == null) { - throw ActiveMQMessageBundle.BUNDLE.addressDoesNotExist(SimpleString.toSimpleString(address)); + throw ActiveMQMessageBundle.BUNDLE.addressDoesNotExist(SimpleString.of(address)); } else { return AddressInfoTextFormatter.Long.format(addressInfo, new StringBuilder()).toString(); } @@ -1664,7 +1664,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active clearIO(); try { - final Bindings bindings = server.getPostOffice().lookupBindingsForAddress(new SimpleString(address)); + final Bindings bindings = server.getPostOffice().lookupBindingsForAddress(SimpleString.of(address)); return bindings == null ? "" : bindings.getBindings().stream().map(Binding::toManagementString).collect(Collectors.joining(",")); } finally { blockOnIO(); @@ -2305,7 +2305,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active clearIO(); try { - for (Binding binding : postOffice.getMatchingBindings(SimpleString.toSimpleString(address))) { + for (Binding binding : postOffice.getMatchingBindings(SimpleString.of(address))) { if (binding instanceof LocalQueueBinding) { Queue queue = ((LocalQueueBinding) binding).getQueue(); for (Consumer consumer : queue.getConsumers()) { @@ -2986,7 +2986,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active clearIO(); try { server.getSecurityRepository().removeMatch(addressMatch); - storageManager.deleteSecuritySetting(new SimpleString(addressMatch)); + storageManager.deleteSecuritySetting(SimpleString.of(addressMatch)); } finally { blockOnIO(); } @@ -3491,8 +3491,8 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active } AddressSettings addressSettings = new AddressSettings(); - addressSettings.setDeadLetterAddress(DLA == null ? null : new SimpleString(DLA)); - addressSettings.setExpiryAddress(expiryAddress == null ? null : new SimpleString(expiryAddress)); + addressSettings.setDeadLetterAddress(DLA == null ? null : SimpleString.of(DLA)); + addressSettings.setExpiryAddress(expiryAddress == null ? null : SimpleString.of(expiryAddress)); addressSettings.setExpiryDelay(expiryDelay); addressSettings.setMinExpiryDelay(minExpiryDelay); addressSettings.setMaxExpiryDelay(maxExpiryDelay); @@ -3521,12 +3521,12 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active addressSettings.setConfigDeleteQueues(configDeleteQueues == null || configDeleteQueues.isEmpty() ? AddressSettings.DEFAULT_CONFIG_DELETE_QUEUES : DeletionPolicy.valueOf(configDeleteQueues.toUpperCase())); addressSettings.setConfigDeleteAddresses(configDeleteAddresses == null || configDeleteAddresses.isEmpty() ? AddressSettings.DEFAULT_CONFIG_DELETE_ADDRESSES : DeletionPolicy.valueOf(configDeleteAddresses.toUpperCase())); addressSettings.setMaxSizeBytesRejectThreshold(maxSizeBytesRejectThreshold); - addressSettings.setDefaultLastValueKey(defaultLastValueKey == null || defaultLastValueKey.isEmpty() ? ActiveMQDefaultConfiguration.getDefaultLastValueKey() : new SimpleString(defaultLastValueKey)); + addressSettings.setDefaultLastValueKey(defaultLastValueKey == null || defaultLastValueKey.isEmpty() ? ActiveMQDefaultConfiguration.getDefaultLastValueKey() : SimpleString.of(defaultLastValueKey)); addressSettings.setDefaultNonDestructive(defaultNonDestructive); addressSettings.setDefaultExclusiveQueue(defaultExclusiveQueue); addressSettings.setDefaultGroupRebalance(defaultGroupRebalance); addressSettings.setDefaultGroupBuckets(defaultGroupBuckets); - addressSettings.setDefaultGroupFirstKey(defaultGroupFirstKey == null || defaultGroupFirstKey.isEmpty() ? ActiveMQDefaultConfiguration.getDefaultGroupFirstKey() : new SimpleString(defaultGroupFirstKey)); + addressSettings.setDefaultGroupFirstKey(defaultGroupFirstKey == null || defaultGroupFirstKey.isEmpty() ? ActiveMQDefaultConfiguration.getDefaultGroupFirstKey() : SimpleString.of(defaultGroupFirstKey)); addressSettings.setDefaultMaxConsumers(defaultMaxConsumers); addressSettings.setDefaultPurgeOnNoConsumers(defaultPurgeOnNoConsumers); addressSettings.setDefaultConsumersBeforeDispatch(defaultConsumersBeforeDispatch); @@ -3542,16 +3542,16 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active addressSettings.setRedeliveryCollisionAvoidanceFactor(redeliveryCollisionAvoidanceFactor); addressSettings.setRetroactiveMessageCount(retroactiveMessageCount); addressSettings.setAutoCreateDeadLetterResources(autoCreateDeadLetterResources); - addressSettings.setDeadLetterQueuePrefix(deadLetterQueuePrefix == null || deadLetterQueuePrefix.isEmpty() ? null : new SimpleString(deadLetterQueuePrefix)); - addressSettings.setDeadLetterQueueSuffix(deadLetterQueueSuffix == null || deadLetterQueueSuffix.isEmpty() ? null : new SimpleString(deadLetterQueueSuffix)); + addressSettings.setDeadLetterQueuePrefix(deadLetterQueuePrefix == null || deadLetterQueuePrefix.isEmpty() ? null : SimpleString.of(deadLetterQueuePrefix)); + addressSettings.setDeadLetterQueueSuffix(deadLetterQueueSuffix == null || deadLetterQueueSuffix.isEmpty() ? null : SimpleString.of(deadLetterQueueSuffix)); addressSettings.setAutoCreateExpiryResources(autoCreateExpiryResources); - addressSettings.setExpiryQueuePrefix(expiryQueuePrefix == null || expiryQueuePrefix.isEmpty() ? null : new SimpleString(expiryQueuePrefix)); - addressSettings.setExpiryQueueSuffix(expiryQueueSuffix == null || expiryQueueSuffix.isEmpty() ? null : new SimpleString(expiryQueueSuffix)); + addressSettings.setExpiryQueuePrefix(expiryQueuePrefix == null || expiryQueuePrefix.isEmpty() ? null : SimpleString.of(expiryQueuePrefix)); + addressSettings.setExpiryQueueSuffix(expiryQueueSuffix == null || expiryQueueSuffix.isEmpty() ? null : SimpleString.of(expiryQueueSuffix)); addressSettings.setEnableMetrics(enableMetrics); server.getAddressSettingsRepository().addMatch(address, addressSettings); - storageManager.storeAddressSetting(new PersistedAddressSettingJSON(new SimpleString(address), addressSettings, addressSettings.toJSON())); + storageManager.storeAddressSetting(new PersistedAddressSettingJSON(SimpleString.of(address), addressSettings, addressSettings.toJSON())); } @@ -3580,7 +3580,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active } server.getAddressSettingsRepository().addMatch(address, addressSettingsConfiguration); - storageManager.storeAddressSetting(new PersistedAddressSettingJSON(new SimpleString(address), addressSettingsConfiguration, SimpleString.toSimpleString(addressSettingsConfigurationAsJson))); + storageManager.storeAddressSetting(new PersistedAddressSettingJSON(SimpleString.of(address), addressSettingsConfiguration, SimpleString.of(addressSettingsConfigurationAsJson))); return addressSettingsConfiguration.toJSON(); } catch (ActiveMQException e) { throw new IllegalStateException(e.getMessage()); @@ -3597,7 +3597,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active checkStarted(); server.getAddressSettingsRepository().removeMatch(addressMatch); - storageManager.deleteAddressSetting(new SimpleString(addressMatch)); + storageManager.deleteAddressSetting(SimpleString.of(addressMatch)); } public void sendQueueInfoToQueue(final String queueName, final String address) throws Exception { @@ -3605,7 +3605,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active clearIO(); try { - postOffice.sendQueueInfoToQueue(new SimpleString(queueName), new SimpleString(address == null ? "" : address)); + postOffice.sendQueueInfoToQueue(SimpleString.of(queueName), SimpleString.of(address == null ? "" : address)); GroupingHandler handler = server.getGroupingHandler(); if (handler != null) { @@ -3743,7 +3743,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active clearIO(); try { - server.destroyDivert(SimpleString.toSimpleString(name), true); + server.destroyDivert(SimpleString.of(name), true); } finally { blockOnIO(); } @@ -4145,7 +4145,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active public void updateDuplicateIdCache(String address, Object[] ids) throws Exception { clearIO(); try { - DuplicateIDCache duplicateIDCache = server.getPostOffice().getDuplicateIDCache(new SimpleString(address)); + DuplicateIDCache duplicateIDCache = server.getPostOffice().getDuplicateIDCache(SimpleString.of(address)); for (Object id : ids) { duplicateIDCache.addToCache(((String) id).getBytes(), null); } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java index 460d3119fa..d99b0a8526 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java @@ -1088,7 +1088,7 @@ public class QueueControlImpl extends AbstractControl implements QueueControl { Map result = new HashMap<>(); try { Filter filter = FilterImpl.createFilter(filterStr); - SimpleString groupByProperty = SimpleString.toSimpleString(groupByPropertyStr); + SimpleString groupByProperty = SimpleString.of(groupByPropertyStr); if (filter == null && groupByProperty == null) { result.put(null, getMessageCount()); } else { @@ -1141,7 +1141,7 @@ public class QueueControlImpl extends AbstractControl implements QueueControl { Map result = new HashMap<>(); try { Filter filter = FilterImpl.createFilter(filterStr); - SimpleString groupByProperty = SimpleString.toSimpleString(groupByPropertyStr); + SimpleString groupByProperty = SimpleString.of(groupByPropertyStr); if (filter == null && groupByProperty == null) { result.put(null, (long) getDeliveringCount()); } else { @@ -1299,7 +1299,7 @@ public class QueueControlImpl extends AbstractControl implements QueueControl { @Override public SimpleString getFilterString() { - return new SimpleString("custom filter for MESSAGEID= messageID"); + return SimpleString.of("custom filter for MESSAGEID= messageID"); } }; @@ -1346,7 +1346,7 @@ public class QueueControlImpl extends AbstractControl implements QueueControl { clearIO(); try { - Binding binding = server.getPostOffice().getBinding(new SimpleString(otherQueueName)); + Binding binding = server.getPostOffice().getBinding(SimpleString.of(otherQueueName)); if (binding == null) { throw ActiveMQMessageBundle.BUNDLE.noQueueFound(otherQueueName); @@ -1390,7 +1390,7 @@ public class QueueControlImpl extends AbstractControl implements QueueControl { try { Filter filter = FilterImpl.createFilter(filterStr); - Binding binding = server.getPostOffice().getBinding(new SimpleString(otherQueueName)); + Binding binding = server.getPostOffice().getBinding(SimpleString.of(otherQueueName)); if (binding == null) { throw ActiveMQMessageBundle.BUNDLE.noQueueFound(otherQueueName); @@ -1846,7 +1846,7 @@ public class QueueControlImpl extends AbstractControl implements QueueControl { clearIO(); try { - queue.resetGroup(SimpleString.toSimpleString(groupID)); + queue.resetGroup(SimpleString.of(groupID)); } finally { blockOnIO(); } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/QueueView.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/QueueView.java index f825e1744c..bc502742f1 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/QueueView.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/QueueView.java @@ -43,7 +43,7 @@ public class QueueView extends ActiveMQAbstractView { @Override public JsonObjectBuilder toJson(QueueControl queue) { - Queue q = server.locateQueue(new SimpleString(queue.getName())); + Queue q = server.locateQueue(SimpleString.of(queue.getName())); JsonObjectBuilder obj = JsonLoader.createObjectBuilder() .add(QueueField.ID.getName(), toString(queue.getID())) .add(QueueField.NAME.getName(), toString(queue.getName())) @@ -84,7 +84,7 @@ public class QueueView extends ActiveMQAbstractView { @Override public Object getField(QueueControl queue, String fieldName) { - Queue q = server.locateQueue(new SimpleString(queue.getName())); + Queue q = server.locateQueue(SimpleString.of(queue.getName())); QueueField field = QueueField.valueOfName(fieldName); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/predicate/QueueFilterPredicate.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/predicate/QueueFilterPredicate.java index 9066441a77..923627f197 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/predicate/QueueFilterPredicate.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/predicate/QueueFilterPredicate.java @@ -46,7 +46,7 @@ public class QueueFilterPredicate extends ActiveMQFilterPredicate case NAME: return matches(queue.getName()); case CONSUMER_ID: - Queue q = server.locateQueue(new SimpleString(queue.getName())); + Queue q = server.locateQueue(SimpleString.of(queue.getName())); for (Consumer consumer : q.getConsumers()) { if (matches(consumer.sequentialID())) return true; @@ -73,7 +73,7 @@ public class QueueFilterPredicate extends ActiveMQFilterPredicate case ROUTING_TYPE: return matches(queue.getRoutingType()); case AUTO_CREATED: - return matches(server.locateQueue(new SimpleString(queue.getName())).isAutoCreated()); + return matches(server.locateQueue(SimpleString.of(queue.getName())).isAutoCreated()); case DURABLE: return matches(queue.isDurable()); case PAUSED: diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreFactoryDatabase.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreFactoryDatabase.java index 2300a132f1..c85fb44a01 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreFactoryDatabase.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreFactoryDatabase.java @@ -177,7 +177,7 @@ public class PagingStoreFactoryDatabase implements PagingStoreFactory { ((JDBCSequentialFileFactory)fileFactory).destroy(); String tableName = factoryToTableName.remove(fileFactory); if (tableName != null) { - SimpleString removeTableName = SimpleString.toSimpleString(tableName); + SimpleString removeTableName = SimpleString.of(tableName); JDBCSequentialFile directoryList = (JDBCSequentialFile) pagingFactoryFileFactory.createSequentialFile(DIRECTORY_NAME); directoryList.open(); @@ -244,7 +244,7 @@ public class PagingStoreFactoryDatabase implements PagingStoreFactory { private synchronized SequentialFileFactory newFileFactory(final String directoryName, boolean writeToDirectory) throws Exception { JDBCSequentialFile directoryList = (JDBCSequentialFile) pagingFactoryFileFactory.createSequentialFile(DIRECTORY_NAME); directoryList.open(); - SimpleString simpleString = SimpleString.toSimpleString(directoryName); + SimpleString simpleString = SimpleString.of(directoryName); ActiveMQBuffer buffer = ActiveMQBuffers.fixedBuffer(simpleString.sizeof()); buffer.writeSimpleString(simpleString); if (writeToDirectory) directoryList.write(buffer, true); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreFactoryNIO.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreFactoryNIO.java index cdb7f76c8e..9e8d5cf748 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreFactoryNIO.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreFactoryNIO.java @@ -224,7 +224,7 @@ public class PagingStoreFactoryNIO implements PagingStoreFactory { continue; } - SimpleString address = new SimpleString(addressString); + SimpleString address = SimpleString.of(addressString); SequentialFileFactory factory = newFileFactory(guid); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/config/PersistedAddressSettingJSON.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/config/PersistedAddressSettingJSON.java index 40aec90159..3f47c97767 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/config/PersistedAddressSettingJSON.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/config/PersistedAddressSettingJSON.java @@ -47,7 +47,7 @@ public class PersistedAddressSettingJSON extends AbstractPersistedAddressSetting } public PersistedAddressSettingJSON(SimpleString addressMatch, AddressSettings setting, String jsonSetting) { - this(addressMatch, setting, SimpleString.toSimpleString(jsonSetting)); + this(addressMatch, setting, SimpleString.of(jsonSetting)); } @Override diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/config/PersistedSecuritySetting.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/config/PersistedSecuritySetting.java index b858573f84..4b4c0b2f90 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/config/PersistedSecuritySetting.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/config/PersistedSecuritySetting.java @@ -87,19 +87,19 @@ public class PersistedSecuritySetting implements EncodingSupport { final String viewRoles, final String editRoles) { super(); - this.addressMatch = SimpleString.toSimpleString(addressMatch); - this.sendRoles = SimpleString.toSimpleString(sendRoles); - this.consumeRoles = SimpleString.toSimpleString(consumeRoles); - this.createDurableQueueRoles = SimpleString.toSimpleString(createDurableQueueRoles); - this.deleteDurableQueueRoles = SimpleString.toSimpleString(deleteDurableQueueRoles); - this.createNonDurableQueueRoles = SimpleString.toSimpleString(createNonDurableQueueRoles); - this.deleteNonDurableQueueRoles = SimpleString.toSimpleString(deleteNonDurableQueueRoles); - this.manageRoles = SimpleString.toSimpleString(manageRoles); - this.browseRoles = SimpleString.toSimpleString(browseRoles); - this.createAddressRoles = SimpleString.toSimpleString(createAddressRoles); - this.deleteAddressRoles = SimpleString.toSimpleString(deleteAddressRoles); - this.viewRoles = SimpleString.toSimpleString(viewRoles); - this.editRoles = SimpleString.toSimpleString(editRoles); + this.addressMatch = SimpleString.of(addressMatch); + this.sendRoles = SimpleString.of(sendRoles); + this.consumeRoles = SimpleString.of(consumeRoles); + this.createDurableQueueRoles = SimpleString.of(createDurableQueueRoles); + this.deleteDurableQueueRoles = SimpleString.of(deleteDurableQueueRoles); + this.createNonDurableQueueRoles = SimpleString.of(createNonDurableQueueRoles); + this.deleteNonDurableQueueRoles = SimpleString.of(deleteNonDurableQueueRoles); + this.manageRoles = SimpleString.of(manageRoles); + this.browseRoles = SimpleString.of(browseRoles); + this.createAddressRoles = SimpleString.of(createAddressRoles); + this.deleteAddressRoles = SimpleString.of(deleteAddressRoles); + this.viewRoles = SimpleString.of(viewRoles); + this.editRoles = SimpleString.of(editRoles); } @@ -204,7 +204,7 @@ public class PersistedSecuritySetting implements EncodingSupport { @Override public void encode(final ActiveMQBuffer buffer) { if (addressMatch == null) { - addressMatch = new SimpleString(""); + addressMatch = SimpleString.of(""); } buffer.writeSimpleString(addressMatch); buffer.writeNullableSimpleString(sendRoles); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/DuplicateIDEncoding.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/DuplicateIDEncoding.java index 11b4eeace9..ab2cda98e7 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/DuplicateIDEncoding.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/DuplicateIDEncoding.java @@ -76,7 +76,7 @@ public class DuplicateIDEncoding implements EncodingSupport { // and this may be useful to validate the journal on those tests // You may uncomment these two lines on that case and replcate the toString for the PrintData - // SimpleString simpleStr = new SimpleString(duplID); + // SimpleString simpleStr = SimpleString.of(duplID); // return "DuplicateIDEncoding [address=" + address + ", duplID=" + simpleStr + "]"; String bridgeRepresentation = null; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PersistentQueueBindingEncoding.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PersistentQueueBindingEncoding.java index c9f55dcc99..71464a5141 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PersistentQueueBindingEncoding.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PersistentQueueBindingEncoding.java @@ -387,7 +387,7 @@ public class PersistentQueueBindingEncoding implements EncodingSupport, QueueBin String[] keyValuePair = element.split("="); if (keyValuePair.length == 2) { if (keyValuePair[0].equals("user")) { - user = SimpleString.toSimpleString(keyValuePair[1]); + user = SimpleString.of(keyValuePair[1]); } } } @@ -555,6 +555,6 @@ public class PersistentQueueBindingEncoding implements EncodingSupport, QueueBin if (user != null) { metadata.append("user=").append(user).append(";"); } - return SimpleString.toSimpleString(metadata.toString()); + return SimpleString.of(metadata.toString()); } } 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 74374ce819..b1e8cda52c 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 @@ -118,11 +118,11 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - public static final SimpleString HDR_RESET_QUEUE_DATA = new SimpleString("_AMQ_RESET_QUEUE_DATA"); + public static final SimpleString HDR_RESET_QUEUE_DATA = SimpleString.of("_AMQ_RESET_QUEUE_DATA"); - public static final SimpleString HDR_RESET_QUEUE_DATA_COMPLETE = new SimpleString("_AMQ_RESET_QUEUE_DATA_COMPLETE"); + public static final SimpleString HDR_RESET_QUEUE_DATA_COMPLETE = SimpleString.of("_AMQ_RESET_QUEUE_DATA_COMPLETE"); - public static final SimpleString BRIDGE_CACHE_STR = new SimpleString("BRIDGE."); + public static final SimpleString BRIDGE_CACHE_STR = SimpleString.of("BRIDGE."); private final AddressManager addressManager; @@ -579,11 +579,11 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding String delimiter = server.getConfiguration().getWildcardConfiguration().getDelimiterString(); String address = ResourceNames.decomposeRetroactiveResourceAddressName(prefix, delimiter, name.toString()); AddressSettings settings = addressSettingsRepository.getMatch(address); - Queue internalAnycastQueue = server.locateQueue(ResourceNames.getRetroactiveResourceQueueName(prefix, delimiter, SimpleString.toSimpleString(address), RoutingType.ANYCAST)); + Queue internalAnycastQueue = server.locateQueue(ResourceNames.getRetroactiveResourceQueueName(prefix, delimiter, SimpleString.of(address), RoutingType.ANYCAST)); if (internalAnycastQueue != null && internalAnycastQueue.getRingSize() != settings.getRetroactiveMessageCount()) { internalAnycastQueue.setRingSize(settings.getRetroactiveMessageCount()); } - Queue internalMulticastQueue = server.locateQueue(ResourceNames.getRetroactiveResourceQueueName(prefix, delimiter, SimpleString.toSimpleString(address), RoutingType.MULTICAST)); + Queue internalMulticastQueue = server.locateQueue(ResourceNames.getRetroactiveResourceQueueName(prefix, delimiter, SimpleString.of(address), RoutingType.MULTICAST)); if (internalMulticastQueue != null && internalMulticastQueue.getRingSize() != settings.getRetroactiveMessageCount()) { internalMulticastQueue.setRingSize(settings.getRetroactiveMessageCount()); } @@ -792,7 +792,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding changed = true; queue.setDelayBeforeDispatch(queueConfiguration.getDelayBeforeDispatch()); } - final SimpleString empty = new SimpleString(""); + final SimpleString empty = SimpleString.of(""); Filter oldFilter = FilterImpl.createFilter(queue.getFilter() == null ? empty : queue.getFilter().getFilterString()); Filter newFilter = FilterImpl.createFilter(queueConfiguration.getFilterString() == null ? empty : queueConfiguration.getFilterString()); if ((forceUpdate || newFilter != oldFilter) && !Objects.equals(oldFilter, newFilter)) { @@ -1930,7 +1930,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding message.setAddress(queueName); - message.putStringProperty(ManagementHelper.HDR_NOTIFICATION_TYPE, new SimpleString(type.toString())); + message.putStringProperty(ManagementHelper.HDR_NOTIFICATION_TYPE, SimpleString.of(type.toString())); long timestamp = System.currentTimeMillis(); message.putLongProperty(ManagementHelper.HDR_NOTIFICATION_TIMESTAMP, timestamp); 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 b3077f8cd7..0417b43fb2 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 @@ -138,7 +138,7 @@ public class ActiveMQPacketHandler implements ChannelHandler { private void handleCheckForFailover(CheckFailoverMessage failoverMessage) { String nodeID = failoverMessage.getNodeID(); - boolean okToFailover = nodeID == null || server.getNodeID().toString().equals(nodeID) || !(server.getHAPolicy().canScaleDown() && !server.hasScaledDown(new SimpleString(nodeID))); + boolean okToFailover = nodeID == null || server.getNodeID().toString().equals(nodeID) || !(server.getHAPolicy().canScaleDown() && !server.hasScaledDown(SimpleString.of(nodeID))); channel1.send(new CheckFailoverReplyMessage(okToFailover)); } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/CoreProtocolManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/CoreProtocolManager.java index a9f86c588a..8c5c9a9a99 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/CoreProtocolManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/CoreProtocolManager.java @@ -215,14 +215,14 @@ public class CoreProtocolManager implements ProtocolManager getLocators() { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java index e2117758f4..50668350fd 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java @@ -402,7 +402,7 @@ public class ClusterManager implements ActiveMQComponent { return false; } - Binding binding = postOffice.getBinding(new SimpleString(config.getQueueName())); + Binding binding = postOffice.getBinding(SimpleString.of(config.getQueueName())); if (binding == null) { ActiveMQServerLogger.LOGGER.bridgeQueueNotFound(config.getQueueName(), config.getName()); @@ -627,7 +627,7 @@ public class ClusterManager implements ActiveMQComponent { logger.debug("{} Starting a Discovery Group Cluster Connection, name={}, dg={}", this, config.getDiscoveryGroupName(), dg); } - clusterConnection = new ClusterConnectionImpl(this, dg, connector, new SimpleString(config.getName()), new SimpleString(config.getAddress() != null ? config.getAddress() : ""), config.getMinLargeMessageSize(), config.getClientFailureCheckPeriod(), config.getConnectionTTL(), config.getRetryInterval(), config.getRetryIntervalMultiplier(), config.getMaxRetryInterval(), config.getInitialConnectAttempts(), config.getReconnectAttempts(), config.getCallTimeout(), config.getCallFailoverTimeout(), config.isDuplicateDetection(), config.getMessageLoadBalancingType(), config.getConfirmationWindowSize(), config.getProducerWindowSize(), executorFactory, server, postOffice, managementService, scheduledExecutor, config.getMaxHops(), nodeManager, server.getConfiguration().getClusterUser(), server.getConfiguration().getClusterPassword(), config.isAllowDirectConnectionsOnly(), config.getClusterNotificationInterval(), config.getClusterNotificationAttempts()); + clusterConnection = new ClusterConnectionImpl(this, dg, connector, SimpleString.of(config.getName()), SimpleString.of(config.getAddress() != null ? config.getAddress() : ""), config.getMinLargeMessageSize(), config.getClientFailureCheckPeriod(), config.getConnectionTTL(), config.getRetryInterval(), config.getRetryIntervalMultiplier(), config.getMaxRetryInterval(), config.getInitialConnectAttempts(), config.getReconnectAttempts(), config.getCallTimeout(), config.getCallFailoverTimeout(), config.isDuplicateDetection(), config.getMessageLoadBalancingType(), config.getConfirmationWindowSize(), config.getProducerWindowSize(), executorFactory, server, postOffice, managementService, scheduledExecutor, config.getMaxHops(), nodeManager, server.getConfiguration().getClusterUser(), server.getConfiguration().getClusterPassword(), config.isAllowDirectConnectionsOnly(), config.getClusterNotificationInterval(), config.getClusterNotificationAttempts()); clusterController.addClusterConnection(clusterConnection.getName(), dg, config, connector); } else { @@ -637,7 +637,7 @@ public class ClusterManager implements ActiveMQComponent { logger.debug("{} defining cluster connection towards {}", this, Arrays.toString(tcConfigs)); } - clusterConnection = new ClusterConnectionImpl(this, tcConfigs, connector, new SimpleString(config.getName()), new SimpleString(config.getAddress()), config.getMinLargeMessageSize(), config.getClientFailureCheckPeriod(), config.getConnectionTTL(), config.getRetryInterval(), config.getRetryIntervalMultiplier(), config.getMaxRetryInterval(), config.getInitialConnectAttempts(), config.getReconnectAttempts(), config.getCallTimeout(), config.getCallFailoverTimeout(), config.isDuplicateDetection(), config.getMessageLoadBalancingType(), config.getConfirmationWindowSize(), config.getProducerWindowSize(), executorFactory, server, postOffice, managementService, scheduledExecutor, config.getMaxHops(), nodeManager, server.getConfiguration().getClusterUser(), server.getConfiguration().getClusterPassword(), config.isAllowDirectConnectionsOnly(), config.getClusterNotificationInterval(), config.getClusterNotificationAttempts()); + clusterConnection = new ClusterConnectionImpl(this, tcConfigs, connector, SimpleString.of(config.getName()), SimpleString.of(config.getAddress()), config.getMinLargeMessageSize(), config.getClientFailureCheckPeriod(), config.getConnectionTTL(), config.getRetryInterval(), config.getRetryIntervalMultiplier(), config.getMaxRetryInterval(), config.getInitialConnectAttempts(), config.getReconnectAttempts(), config.getCallTimeout(), config.getCallFailoverTimeout(), config.isDuplicateDetection(), config.getMessageLoadBalancingType(), config.getConfirmationWindowSize(), config.getProducerWindowSize(), executorFactory, server, postOffice, managementService, scheduledExecutor, config.getMaxHops(), nodeManager, server.getConfiguration().getClusterUser(), server.getConfiguration().getClusterPassword(), config.isAllowDirectConnectionsOnly(), config.getClusterNotificationInterval(), config.getClusterNotificationAttempts()); clusterController.addClusterConnection(clusterConnection.getName(), tcConfigs, config, connector); } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BridgeImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BridgeImpl.java index 61df64d845..7e24c96353 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BridgeImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BridgeImpl.java @@ -263,7 +263,7 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled if (notificationService != null) { TypedProperties props = new TypedProperties(); - props.putSimpleStringProperty(new SimpleString("name"), SimpleString.toSimpleString(configuration.getName())); + props.putSimpleStringProperty(SimpleString.of("name"), SimpleString.of(configuration.getName())); Notification notification = new Notification(nodeUUID.toString(), CoreNotificationType.BRIDGE_STARTED, props); notificationService.sendNotification(notification); } @@ -383,7 +383,7 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled if (notificationService != null) { TypedProperties props = new TypedProperties(); - props.putSimpleStringProperty(new SimpleString("name"), SimpleString.toSimpleString(configuration.getName())); + props.putSimpleStringProperty(SimpleString.of("name"), SimpleString.of(configuration.getName())); Notification notification = new Notification(nodeUUID.toString(), CoreNotificationType.BRIDGE_STOPPED, props); try { notificationService.sendNotification(notification); @@ -401,7 +401,7 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled if (notificationService != null) { TypedProperties props = new TypedProperties(); - props.putSimpleStringProperty(new SimpleString("name"), SimpleString.toSimpleString(configuration.getName())); + props.putSimpleStringProperty(SimpleString.of("name"), SimpleString.of(configuration.getName())); Notification notification = new Notification(nodeUUID.toString(), CoreNotificationType.BRIDGE_STOPPED, props); try { notificationService.sendNotification(notification); @@ -428,7 +428,7 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled @Override public SimpleString getName() { - return SimpleString.toSimpleString(configuration.getName()); + return SimpleString.of(configuration.getName()); } @Override @@ -445,7 +445,7 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled @Override public SimpleString getForwardingAddress() { - return SimpleString.toSimpleString(configuration.getForwardingAddress()); + return SimpleString.of(configuration.getForwardingAddress()); } // For testing only @@ -605,7 +605,7 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled final SimpleString dest; if (configuration.getForwardingAddress() != null) { - dest = SimpleString.toSimpleString(configuration.getForwardingAddress()); + dest = SimpleString.of(configuration.getForwardingAddress()); } else { // Preserve the original address dest = ref.getMessage().getAddressSimpleString(); @@ -708,7 +708,7 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled if (logger.isDebugEnabled()) { logger.debug("Moving {} messages from {} to {}", queue.getMessageCount(), queue.getName(), scaleDownTargetNodeID); } - ((QueueImpl) queue).moveReferencesBetweenSnFQueues(SimpleString.toSimpleString(scaleDownTargetNodeID)); + ((QueueImpl) queue).moveReferencesBetweenSnFQueues(SimpleString.of(scaleDownTargetNodeID)); // stop the bridge from trying to reconnect and clean up all the bindings fail(true, true); @@ -960,7 +960,7 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled ClientSession.AddressQuery query = null; try { - query = session.addressQuery(SimpleString.toSimpleString(configuration.getForwardingAddress())); + query = session.addressQuery(SimpleString.of(configuration.getForwardingAddress())); } catch (Throwable e) { ActiveMQServerLogger.LOGGER.errorQueryingBridge(configuration.getName(), e); // This was an issue during startup, we will not count this retry diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BroadcastGroupImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BroadcastGroupImpl.java index 7d9ab5667c..e41e8780b9 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BroadcastGroupImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BroadcastGroupImpl.java @@ -110,7 +110,7 @@ public class BroadcastGroupImpl implements BroadcastGroup, Runnable { if (notificationService != null) { TypedProperties props = new TypedProperties(); - props.putSimpleStringProperty(new SimpleString("name"), new SimpleString(name)); + props.putSimpleStringProperty(SimpleString.of("name"), SimpleString.of(name)); Notification notification = new Notification(nodeManager.getNodeId().toString(), CoreNotificationType.BROADCAST_GROUP_STARTED, props); notificationService.sendNotification(notification); } @@ -138,7 +138,7 @@ public class BroadcastGroupImpl implements BroadcastGroup, Runnable { if (notificationService != null) { TypedProperties props = new TypedProperties(); - props.putSimpleStringProperty(new SimpleString("name"), new SimpleString(name)); + props.putSimpleStringProperty(SimpleString.of("name"), SimpleString.of(name)); Notification notification = new Notification(nodeManager.getNodeId().toString(), CoreNotificationType.BROADCAST_GROUP_STOPPED, props); try { notificationService.sendNotification(notification); 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 22a8bdb476..2eebb775e1 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 @@ -245,9 +245,9 @@ public class ClusterConnectionBridge extends BridgeImpl { "." + clusterConnection.getServer().toString().replaceAll(CompositeAddress.SEPARATOR, "_"); - SimpleString notifQueueName = new SimpleString(qName); + SimpleString notifQueueName = SimpleString.of(qName); - SimpleString filter = new SimpleString("(" + ManagementHelper.HDR_BINDING_TYPE + " <> " + BindingType.DIVERT.toInt() + + SimpleString filter = SimpleString.of("(" + ManagementHelper.HDR_BINDING_TYPE + " <> " + BindingType.DIVERT.toInt() + " OR " + ManagementHelper.HDR_BINDING_TYPE + " IS NULL)" + " AND " + 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 b377da262e..7eaaafea4a 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 @@ -457,7 +457,7 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn if (managementService != null) { TypedProperties props = new TypedProperties(); - props.putSimpleStringProperty(new SimpleString("name"), name); + props.putSimpleStringProperty(SimpleString.of("name"), name); //nodeID can be null if there's only a backup SimpleString nodeId = nodeManager.getNodeId(); Notification notification = new Notification(nodeId == null ? null : nodeId.toString(), CoreNotificationType.CLUSTER_CONNECTION_STOPPED, props); @@ -718,7 +718,7 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn if (managementService != null) { TypedProperties props = new TypedProperties(); - props.putSimpleStringProperty(new SimpleString("name"), name); + props.putSimpleStringProperty(SimpleString.of("name"), name); Notification notification = new Notification(nodeManager.getNodeId().toString(), CoreNotificationType.CLUSTER_CONNECTION_STARTED, props); logger.debug("sending notification: {}", notification); managementService.sendNotification(notification); @@ -822,7 +822,7 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn } public SimpleString getSfQueueName(String nodeID) { - return new SimpleString(storeAndForwardPrefix + name + "." + nodeID); + return SimpleString.of(storeAndForwardPrefix + name + "." + nodeID); } @Override diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/quorum/QuorumVoteServerConnect.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/quorum/QuorumVoteServerConnect.java index 5ba9be143c..7b1aa55c49 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/quorum/QuorumVoteServerConnect.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/quorum/QuorumVoteServerConnect.java @@ -28,7 +28,7 @@ import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; */ public class QuorumVoteServerConnect extends QuorumVote { - public static final SimpleString PRIMARY_FAILOVER_VOTE = new SimpleString("PrimaryFailoverQuorumVote"); + public static final SimpleString PRIMARY_FAILOVER_VOTE = SimpleString.of("PrimaryFailoverQuorumVote"); // this flag mark the end of the vote private final CountDownLatch voteCompleted; private final String targetNodeId; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/federation/AbstractFederationStream.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/federation/AbstractFederationStream.java index 09e3f93f95..609321c17e 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/federation/AbstractFederationStream.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/federation/AbstractFederationStream.java @@ -48,7 +48,7 @@ public abstract class AbstractFederationStream implements FederationStream { this.server = server; this.federation = federation; Objects.requireNonNull(config.getName()); - this.name = SimpleString.toSimpleString(config.getName()); + this.name = SimpleString.of(config.getName()); this.config = config; this.connection = connection != null ? connection : new FederationConnection(server.getConfiguration(), name, config.getConnectionConfiguration()); } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/federation/Federation.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/federation/Federation.java index 074b218195..e9b974ccca 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/federation/Federation.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/federation/Federation.java @@ -59,7 +59,7 @@ public class Federation { this.server = server; this.config = config; Objects.requireNonNull(config.getName()); - this.name = SimpleString.toSimpleString(config.getName()); + this.name = SimpleString.of(config.getName()); } public synchronized void start() throws ActiveMQException { 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 a2d42e8a0d..95802bd300 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 @@ -72,7 +72,7 @@ public class FederatedAddress extends FederatedAbstract implements ActiveMQServe public static final String FEDERATED_QUEUE_PREFIX = "federated"; - public static final SimpleString HDR_HOPS = new SimpleString("_AMQ_Hops"); + public static final SimpleString HDR_HOPS = SimpleString.of("_AMQ_Hops"); private final SimpleString queueNameFormat; private final SimpleString filterString; private final Set includes; @@ -90,7 +90,7 @@ public class FederatedAddress extends FederatedAbstract implements ActiveMQServe } else { this.filterString = HDR_HOPS.concat(" IS NULL OR ").concat(HDR_HOPS).concat("<").concat(Integer.toString(config.getMaxHops())); } - this.queueNameFormat = SimpleString.toSimpleString(FEDERATED_QUEUE_PREFIX + ".${federation}.${upstream}.${address}.${routeType}"); + this.queueNameFormat = SimpleString.of(FEDERATED_QUEUE_PREFIX + ".${federation}.${upstream}.${address}.${routeType}"); if (config.getIncludes().isEmpty()) { includes = Collections.emptySet(); } else { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/federation/address/FederatedAddressConsumerKey.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/federation/address/FederatedAddressConsumerKey.java index 8958f7743d..9b896362ce 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/federation/address/FederatedAddressConsumerKey.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/federation/address/FederatedAddressConsumerKey.java @@ -55,7 +55,7 @@ public class FederatedAddressConsumerKey implements FederatedConsumerKey { data.put("routeType", routingType.name().toLowerCase()); data.put("upstream", upstream.toString()); data.put("federation", federation.toString()); - queueName = SimpleString.toSimpleString(StrSubstitutor.replace(queueNameFormat, data)); + queueName = SimpleString.of(StrSubstitutor.replace(queueNameFormat, data)); } return queueName; } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/LocalGroupingHandler.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/LocalGroupingHandler.java index 40850d3cbb..4eefd41a53 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/LocalGroupingHandler.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/LocalGroupingHandler.java @@ -382,7 +382,7 @@ public final class LocalGroupingHandler extends GroupHandlingAbstract { try { storageManager.commitBindings(txID); } catch (Exception e) { - ActiveMQServerLogger.LOGGER.unableToDeleteGroupBindings(SimpleString.toSimpleString("TX:" + txID), e); + ActiveMQServerLogger.LOGGER.unableToDeleteGroupBindings(SimpleString.of("TX:" + txID), e); } } } @@ -446,7 +446,7 @@ public final class LocalGroupingHandler extends GroupHandlingAbstract { try { storageManager.commitBindings(txID); } catch (Exception e) { - ActiveMQServerLogger.LOGGER.unableToDeleteGroupBindings(SimpleString.toSimpleString("TX:" + txID), e); + ActiveMQServerLogger.LOGGER.unableToDeleteGroupBindings(SimpleString.of("TX:" + txID), e); } } } 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 6877d7bc33..1c3b796c0a 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 @@ -1072,7 +1072,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { @Override public boolean isAddressBound(String address) throws Exception { - return postOffice.isAddressBound(SimpleString.toSimpleString(address)); + return postOffice.isAddressBound(SimpleString.of(address)); } @Override @@ -1873,7 +1873,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { } public int getQueueCountForUser(String username) throws Exception { - SimpleString userNameSimpleString = SimpleString.toSimpleString(username); + SimpleString userNameSimpleString = SimpleString.of(username); AtomicInteger bindingsCount = new AtomicInteger(0); postOffice.getAllBindings().forEach((b) -> { @@ -1914,7 +1914,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { autoCommitSends, autoCommitAcks, preAcknowledge, xa, defaultAddress, callback, autoCreateQueues, context, prefixes)); } - ServerSessionImpl session = new ServerSessionImpl(name, username, password, validatedUser, minLargeMessageSize, autoCommitSends, autoCommitAcks, preAcknowledge, configuration.isPersistDeliveryCountBeforeDelivery(), xa, connection, storageManager, postOffice, resourceManager, securityStore, managementService, this, configuration.getManagementAddress(), defaultAddress == null ? null : new SimpleString(defaultAddress), callback, context, pagingManager, prefixes, securityDomain, isLegacyProducer); + ServerSessionImpl session = new ServerSessionImpl(name, username, password, validatedUser, minLargeMessageSize, autoCommitSends, autoCommitAcks, preAcknowledge, configuration.isPersistDeliveryCountBeforeDelivery(), xa, connection, storageManager, postOffice, resourceManager, securityStore, managementService, this, configuration.getManagementAddress(), defaultAddress == null ? null : SimpleString.of(defaultAddress), callback, context, pagingManager, prefixes, securityDomain, isLegacyProducer); sessions.put(name, session); @@ -2411,7 +2411,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { final String filterString, final boolean durable, final boolean temporary) throws Exception { - return deployQueue(SimpleString.toSimpleString(address), SimpleString.toSimpleString(resourceName), SimpleString.toSimpleString(filterString), durable, temporary); + return deployQueue(SimpleString.of(address), SimpleString.of(resourceName), SimpleString.of(filterString), durable, temporary); } @Override @@ -2918,7 +2918,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { return null; } - SimpleString sName = new SimpleString(config.getName()); + SimpleString sName = SimpleString.of(config.getName()); if (postOffice.getBinding(sName) != null) { ActiveMQServerLogger.LOGGER.divertBindingAlreadyExists(sName); @@ -2926,14 +2926,14 @@ public class ActiveMQServerImpl implements ActiveMQServer { return null; } - SimpleString sAddress = new SimpleString(config.getAddress()); + SimpleString sAddress = SimpleString.of(config.getAddress()); Transformer transformer = getServiceRegistry().getDivertTransformer(config.getName(), config.getTransformerConfiguration()); Filter filter = FilterImpl.createFilter(config.getFilterString()); - Divert divert = new DivertImpl(sName, sAddress, new SimpleString(config.getForwardingAddress()), - new SimpleString(config.getRoutingName()), config.isExclusive(), + Divert divert = new DivertImpl(sName, sAddress, SimpleString.of(config.getForwardingAddress()), + SimpleString.of(config.getRoutingName()), config.isExclusive(), filter, transformer, postOffice, storageManager, config.getRoutingType()); Binding binding = new DivertBinding(storageManager.generateID(), sAddress, divert); @@ -2949,7 +2949,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { @Override public Divert updateDivert(DivertConfiguration config) throws Exception { - final DivertBinding divertBinding = (DivertBinding) postOffice.getBinding(SimpleString.toSimpleString(config.getName())); + final DivertBinding divertBinding = (DivertBinding) postOffice.getBinding(SimpleString.of(config.getName())); if (divertBinding == null) { return null; } @@ -2973,7 +2973,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { } if (config.getForwardingAddress() != null) { - SimpleString forwardAddress = SimpleString.toSimpleString(config.getForwardingAddress()); + SimpleString forwardAddress = SimpleString.of(config.getForwardingAddress()); if (!forwardAddress.equals(divert.getForwardAddress())) { divert.setForwardAddress(forwardAddress); } @@ -3783,7 +3783,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { for (CoreAddressConfiguration config : configuration.getAddressConfigurations()) { try { ActiveMQServerLogger.LOGGER.deployAddress(config.getName(), config.getRoutingTypes().toString()); - SimpleString address = SimpleString.toSimpleString(config.getName()); + SimpleString address = SimpleString.of(config.getName()); AddressInfo tobe = new AddressInfo(address, config.getRoutingTypes()); @@ -4713,7 +4713,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { setDefaultIfUnset(c::isNonDestructive, c::setNonDestructive, ActiveMQDefaultConfiguration.getDefaultNonDestructive()); setDefaultIfUnset(c::getConsumersBeforeDispatch, c::setConsumersBeforeDispatch, ActiveMQDefaultConfiguration.getDefaultConsumersBeforeDispatch()); setDefaultIfUnset(c::getDelayBeforeDispatch, c::setDelayBeforeDispatch, ActiveMQDefaultConfiguration.getDefaultDelayBeforeDispatch()); - setDefaultIfUnset(c::getFilterString, c::setFilterString, new SimpleString("")); + setDefaultIfUnset(c::getFilterString, c::setFilterString, SimpleString.of("")); // Defaults to false automatically as per isConfigurationManaged() JavaDoc setDefaultIfUnset(c::isConfigurationManaged, c::setConfigurationManaged, false); // Setting to null might have side effects @@ -4740,9 +4740,9 @@ public class ActiveMQServerImpl implements ActiveMQServer { // Go through the currently configured diverts for (DivertConfiguration divertConfig : configuration.getDivertConfigurations()) { // Retain diverts still configured to exist - divertsToRemove.remove(SimpleString.toSimpleString(divertConfig.getName())); + divertsToRemove.remove(SimpleString.of(divertConfig.getName())); // Deploy newly added diverts, reconfigure existing - final SimpleString divertName = new SimpleString(divertConfig.getName()); + final SimpleString divertName = SimpleString.of(divertConfig.getName()); final DivertBinding divertBinding = (DivertBinding) postOffice.getBinding(divertName); if (divertBinding == null) { deployDivert(divertConfig); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AddressInfo.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AddressInfo.java index 61359cf411..44942f5e9a 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AddressInfo.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AddressInfo.java @@ -102,7 +102,7 @@ public class AddressInfo { } public AddressInfo(String name) { - this(SimpleString.toSimpleString(name), createEmptySet()); + this(SimpleString.of(name), createEmptySet()); } public AddressInfo(SimpleString name) { @@ -410,7 +410,7 @@ public class AddressInfo { this.id = jsonLong.longValue(); } else if (key.equals("name")) { JsonString jasonString = (JsonString) value; - this.name = SimpleString.toSimpleString(jasonString.getString()); + this.name = SimpleString.of(jasonString.getString()); } else if (key.equals("auto-created")) { this.autoCreated = Boolean.valueOf(value.toString()); } else if (key.equals("temporary")) { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/BucketMessageGroups.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/BucketMessageGroups.java index 066bbf011f..15f7e14e38 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/BucketMessageGroups.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/BucketMessageGroups.java @@ -37,7 +37,7 @@ public class BucketMessageGroups implements MessageGroups { //2) Admin users still need to interact with a specific bucket/group e.g. they may need to reset a bucket. //3) Choice of key is we want to avoid risk of clashing with users groups keys. //4) Actually makes testing a little easier as we know how the parsed int will hash. - private static SimpleString _AMQ_GROUP_BUCKET_INT_KEY = new SimpleString("_AMQ_GROUP_BUCKET_INT_KEY_"); + private static SimpleString _AMQ_GROUP_BUCKET_INT_KEY = SimpleString.of("_AMQ_GROUP_BUCKET_INT_KEY_"); private final int bucketCount; private C[] buckets; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ColocatedActivation.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ColocatedActivation.java index 19eb131bcd..b0091cf703 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ColocatedActivation.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ColocatedActivation.java @@ -46,7 +46,7 @@ import org.apache.activemq.artemis.spi.core.remoting.Acceptor; public class ColocatedActivation extends PrimaryActivation { - private static final SimpleString REQUEST_BACKUP_QUORUM_VOTE = new SimpleString("RequestBackupQuorumVote"); + private static final SimpleString REQUEST_BACKUP_QUORUM_VOTE = SimpleString.of("RequestBackupQuorumVote"); private final ColocatedHAManager colocatedHAManager; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/DivertImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/DivertImpl.java index ff622fd87a..a279e2d123 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/DivertImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/DivertImpl.java @@ -210,7 +210,7 @@ public class DivertImpl implements Divert { String[] split = forwardAddress.toString().split(","); SimpleString[] forwardAddresses = new SimpleString[split.length]; for (int i = 0; i < split.length; i++) { - forwardAddresses[i] = new SimpleString(split[i].trim()); + forwardAddresses[i] = SimpleString.of(split[i].trim()); } this.forwardAddresses = forwardAddresses; 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 917b96e85e..55c0e0b69f 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 @@ -2823,7 +2823,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { Binding binding = null; if (originalMessageQueue != null) { - binding = postOffice.getBinding(SimpleString.toSimpleString(originalMessageQueue)); + binding = postOffice.getBinding(SimpleString.of(originalMessageQueue)); } if (originalMessageAddress != null && binding != null) { @@ -2841,7 +2841,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { } } - move(tx, SimpleString.toSimpleString(originalMessageAddress), null, ref, false, AckReason.NORMAL, null, targetQueue, true); + move(tx, SimpleString.of(originalMessageAddress), null, ref, false, AckReason.NORMAL, null, targetQueue, true); return true; } @@ -3950,7 +3950,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { if (isAutoCreate && !getAddress().equals(destinationAddress)) { if (destinationAddress != null && destinationAddress.length() != 0) { SimpleString destinationQueueName = prefix.concat(getAddress()).concat(suffix); - SimpleString filter = new SimpleString(String.format("%s = '%s'", Message.HDR_ORIGINAL_ADDRESS, getAddress())); + SimpleString filter = SimpleString.of(String.format("%s = '%s'", Message.HDR_ORIGINAL_ADDRESS, getAddress())); try { server.createQueue(new QueueConfiguration(destinationQueueName).setAddress(destinationAddress).setFilterString(filter).setAutoCreated(true).setAutoCreateAddress(true), true); } catch (ActiveMQQueueExistsException e) { @@ -4851,15 +4851,15 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { props.putSimpleStringProperty(ManagementHelper.HDR_ADDRESS, address); - props.putSimpleStringProperty(ManagementHelper.HDR_REMOTE_ADDRESS, SimpleString.toSimpleString(connection.getRemoteAddress())); + props.putSimpleStringProperty(ManagementHelper.HDR_REMOTE_ADDRESS, SimpleString.of(connection.getRemoteAddress())); if (connection.getID() != null) { - props.putSimpleStringProperty(ManagementHelper.HDR_CONNECTION_NAME, SimpleString.toSimpleString(connection.getID().toString())); + props.putSimpleStringProperty(ManagementHelper.HDR_CONNECTION_NAME, SimpleString.of(connection.getID().toString())); } props.putLongProperty(ManagementHelper.HDR_CONSUMER_NAME, serverConsumer.getID()); - props.putSimpleStringProperty(ManagementHelper.HDR_SESSION_NAME, SimpleString.toSimpleString(serverConsumer.getSessionID())); + props.putSimpleStringProperty(ManagementHelper.HDR_SESSION_NAME, SimpleString.of(serverConsumer.getSessionID())); Notification notification = new Notification(null, CoreNotificationType.CONSUMER_SLOW, props); 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 4540b51e7c..ff1dee0573 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 @@ -101,7 +101,7 @@ public class ScaleDownHandler { ActiveMQServerLogger.LOGGER.infoScaledDownMessages(num); scaleDownTransactions(sessionFactory, resourceManager, clusterControl.getClusterUser(), clusterControl.getClusterPassword()); scaleDownDuplicateIDs(duplicateIDMap, sessionFactory, managementAddress, clusterControl.getClusterUser(), clusterControl.getClusterPassword()); - clusterControl.announceScaleDown(new SimpleString(this.targetNodeId), nodeManager.getNodeId()); + clusterControl.announceScaleDown(SimpleString.of(this.targetNodeId), nodeManager.getNodeId()); return num; } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java index 22fa616c0e..f3e744e370 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java @@ -614,14 +614,14 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener { props.putIntProperty(ManagementHelper.HDR_CONSUMER_COUNT, messageQueue.getConsumerCount()); // HORNETQ-946 - props.putSimpleStringProperty(ManagementHelper.HDR_USER, SimpleString.toSimpleString(session.getUsername())); + props.putSimpleStringProperty(ManagementHelper.HDR_USER, SimpleString.of(session.getUsername())); - props.putSimpleStringProperty(ManagementHelper.HDR_REMOTE_ADDRESS, SimpleString.toSimpleString(session.getRemotingConnection().getRemoteAddress())); + props.putSimpleStringProperty(ManagementHelper.HDR_REMOTE_ADDRESS, SimpleString.of(session.getRemotingConnection().getRemoteAddress())); - props.putSimpleStringProperty(ManagementHelper.HDR_SESSION_NAME, SimpleString.toSimpleString(session.getName())); + props.putSimpleStringProperty(ManagementHelper.HDR_SESSION_NAME, SimpleString.of(session.getName())); if (session.getRemotingConnection().getClientID() != null) { - props.putSimpleStringProperty(ManagementHelper.HDR_CLIENT_ID, SimpleString.toSimpleString(session.getRemotingConnection().getClientID())); + props.putSimpleStringProperty(ManagementHelper.HDR_CLIENT_ID, SimpleString.of(session.getRemotingConnection().getClientID())); } props.putLongProperty(ManagementHelper.HDR_CONSUMER_NAME, getID()); 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 0c13ffc04f..5d4dd6ace1 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 @@ -495,13 +495,13 @@ public class ServerSessionImpl implements ServerSession, FailureListener { } final TypedProperties props = new TypedProperties(); if (this.getConnectionID() != null) { - props.putSimpleStringProperty(ManagementHelper.HDR_CONNECTION_NAME, SimpleString.toSimpleString(this.getConnectionID().toString())); + props.putSimpleStringProperty(ManagementHelper.HDR_CONNECTION_NAME, SimpleString.of(this.getConnectionID().toString())); } - props.putSimpleStringProperty(ManagementHelper.HDR_USER, SimpleString.toSimpleString(this.getUsername())); - props.putSimpleStringProperty(ManagementHelper.HDR_SESSION_NAME, SimpleString.toSimpleString(this.getName())); + props.putSimpleStringProperty(ManagementHelper.HDR_USER, SimpleString.of(this.getUsername())); + props.putSimpleStringProperty(ManagementHelper.HDR_SESSION_NAME, SimpleString.of(this.getName())); - props.putSimpleStringProperty(ManagementHelper.HDR_CLIENT_ID, SimpleString.toSimpleString(this.remotingConnection.getClientID())); - props.putSimpleStringProperty(ManagementHelper.HDR_PROTOCOL_NAME, SimpleString.toSimpleString(this.remotingConnection.getProtocolName())); + props.putSimpleStringProperty(ManagementHelper.HDR_CLIENT_ID, SimpleString.of(this.remotingConnection.getClientID())); + props.putSimpleStringProperty(ManagementHelper.HDR_PROTOCOL_NAME, SimpleString.of(this.remotingConnection.getProtocolName())); props.putSimpleStringProperty(ManagementHelper.HDR_ADDRESS, managementService.getManagementNotificationAddress()); props.putIntProperty(ManagementHelper.HDR_DISTANCE, 0); managementService.sendNotification(new Notification(null, type, props)); @@ -609,9 +609,9 @@ public class ServerSessionImpl implements ServerSession, FailureListener { props.putIntProperty(ManagementHelper.HDR_CONSUMER_COUNT, theQueue.getConsumerCount()); // HORNETQ-946 - props.putSimpleStringProperty(ManagementHelper.HDR_USER, SimpleString.toSimpleString(username)); + props.putSimpleStringProperty(ManagementHelper.HDR_USER, SimpleString.of(username)); - props.putSimpleStringProperty(ManagementHelper.HDR_VALIDATED_USER, SimpleString.toSimpleString(validatedUser)); + props.putSimpleStringProperty(ManagementHelper.HDR_VALIDATED_USER, SimpleString.of(validatedUser)); String certSubjectDN = "unavailable"; X509Certificate[] certs = CertificateUtil.getCertsFromConnection(this.remotingConnection); @@ -619,18 +619,18 @@ public class ServerSessionImpl implements ServerSession, FailureListener { certSubjectDN = certs[0].getSubjectDN().getName(); } - props.putSimpleStringProperty(ManagementHelper.HDR_CERT_SUBJECT_DN, SimpleString.toSimpleString(certSubjectDN)); + props.putSimpleStringProperty(ManagementHelper.HDR_CERT_SUBJECT_DN, SimpleString.of(certSubjectDN)); - props.putSimpleStringProperty(ManagementHelper.HDR_REMOTE_ADDRESS, SimpleString.toSimpleString(this.remotingConnection.getRemoteAddress())); + props.putSimpleStringProperty(ManagementHelper.HDR_REMOTE_ADDRESS, SimpleString.of(this.remotingConnection.getRemoteAddress())); - props.putSimpleStringProperty(ManagementHelper.HDR_SESSION_NAME, SimpleString.toSimpleString(name)); + props.putSimpleStringProperty(ManagementHelper.HDR_SESSION_NAME, SimpleString.of(name)); if (filter != null) { props.putSimpleStringProperty(ManagementHelper.HDR_FILTERSTRING, filter.getFilterString()); } if (remotingConnection.getClientID() != null) { - props.putSimpleStringProperty(ManagementHelper.HDR_CLIENT_ID, SimpleString.toSimpleString(remotingConnection.getClientID())); + props.putSimpleStringProperty(ManagementHelper.HDR_CLIENT_ID, SimpleString.of(remotingConnection.getClientID())); } props.putLongProperty(ManagementHelper.HDR_CONSUMER_NAME, consumer.getID()); @@ -2225,9 +2225,9 @@ public class ServerSessionImpl implements ServerSession, FailureListener { if (replyTo != null) { // TODO: move this check somewhere else? this is a JMS-specific bit of logic in the core impl if (replyTo.toString().startsWith("queue://") || replyTo.toString().startsWith("topic://")) { - replyTo = SimpleString.toSimpleString(replyTo.toString().substring(8)); + replyTo = SimpleString.of(replyTo.toString().substring(8)); } else if (replyTo.toString().startsWith("temp-queue://") || replyTo.toString().startsWith("temp-topic://")) { - replyTo = SimpleString.toSimpleString(replyTo.toString().substring(13)); + replyTo = SimpleString.of(replyTo.toString().substring(13)); } reply.setAddress(replyTo); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/ArtemisRbacInvocationHandler.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/ArtemisRbacInvocationHandler.java index b400433663..5c2831a0ea 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/ArtemisRbacInvocationHandler.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/ArtemisRbacInvocationHandler.java @@ -141,7 +141,7 @@ public class ArtemisRbacInvocationHandler implements GuardInvocationHandler { brokerDomain = activeMQServer.getConfiguration().getJMXDomain(); viewPermissionMatcher = Pattern.compile(activeMQServer.getConfiguration().getViewPermissionMethodMatchPattern()); - rbacPrefix = SimpleString.toSimpleString(activeMQServer.getConfiguration().getManagementRbacPrefix()); + rbacPrefix = SimpleString.of(activeMQServer.getConfiguration().getManagementRbacPrefix()); mBeanServerRbacAddressPrefix = rbacPrefix.concat(".mbeanserver."); ((ActiveMQServerControlImpl) args[0]).getServer().registerActivateCallback(new ActivateCallback() { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java index 065175dbb1..d5529a6baa 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java @@ -178,7 +178,7 @@ public class ManagementServiceImpl implements ManagementService { broadcaster = new NotificationBroadcasterSupport(); notificationsEnabled = true; objectNameBuilder = ObjectNameBuilder.create(configuration.getJMXDomain(), configuration.getName(), configuration.isJMXUseBrokerName()); - managementMessageRbacResourceNamePrefix = configuration.isManagementMessageRbac() ? SimpleString.toSimpleString(configuration.getManagementRbacPrefix()).concat('.') : null; + managementMessageRbacResourceNamePrefix = configuration.isManagementMessageRbac() ? SimpleString.of(configuration.getManagementRbacPrefix()).concat('.') : null; viewPermissionMatcher = Pattern.compile(configuration.getViewPermissionMethodMatchPattern()); } @@ -839,7 +839,7 @@ public class ManagementServiceImpl implements ManagementService { props.forEach(notificationMessage::putObjectProperty); } - notificationMessage.putStringProperty(ManagementHelper.HDR_NOTIFICATION_TYPE, new SimpleString(notification.getType().toString())); + notificationMessage.putStringProperty(ManagementHelper.HDR_NOTIFICATION_TYPE, SimpleString.of(notification.getType().toString())); long timestamp = System.currentTimeMillis(); notificationMessage.putLongProperty(ManagementHelper.HDR_NOTIFICATION_TIMESTAMP, timestamp); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/plugin/impl/NotificationActiveMQServerPlugin.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/plugin/impl/NotificationActiveMQServerPlugin.java index fe7d90cea3..8199ac4cac 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/plugin/impl/NotificationActiveMQServerPlugin.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/plugin/impl/NotificationActiveMQServerPlugin.java @@ -175,9 +175,9 @@ public class NotificationActiveMQServerPlugin implements ActiveMQServerPlugin { try { String certSubjectDN = CertificateUtil.getCertSubjectDN(connection); final TypedProperties props = new TypedProperties(); - props.putSimpleStringProperty(ManagementHelper.HDR_CONNECTION_NAME, SimpleString.toSimpleString(connection.getID().toString())); - props.putSimpleStringProperty(ManagementHelper.HDR_CERT_SUBJECT_DN, SimpleString.toSimpleString(certSubjectDN)); - props.putSimpleStringProperty(ManagementHelper.HDR_REMOTE_ADDRESS, SimpleString.toSimpleString(connection.getRemoteAddress())); + props.putSimpleStringProperty(ManagementHelper.HDR_CONNECTION_NAME, SimpleString.of(connection.getID().toString())); + props.putSimpleStringProperty(ManagementHelper.HDR_CERT_SUBJECT_DN, SimpleString.of(certSubjectDN)); + props.putSimpleStringProperty(ManagementHelper.HDR_REMOTE_ADDRESS, SimpleString.of(connection.getRemoteAddress())); managementService.sendNotification(new Notification(null, type, props)); } catch (Exception e) { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/transformer/AddHeadersTransformer.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/transformer/AddHeadersTransformer.java index 4bfeaa042f..be4c5cea9d 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/transformer/AddHeadersTransformer.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/transformer/AddHeadersTransformer.java @@ -28,7 +28,7 @@ public class AddHeadersTransformer implements Transformer { @Override public void init(Map properties) { - properties.forEach((k,v) -> headers.put(SimpleString.toSimpleString(k), SimpleString.toSimpleString(v))); + properties.forEach((k,v) -> headers.put(SimpleString.of(k), SimpleString.of(v))); } @Override diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/transformer/ServerMessageImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/transformer/ServerMessageImpl.java index d8a26c8bc2..866bc69f1b 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/transformer/ServerMessageImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/transformer/ServerMessageImpl.java @@ -138,7 +138,7 @@ public class ServerMessageImpl extends MessageInternalImpl implements ServerMess message.putLongProperty(Message.HDR_ORIG_MESSAGE_ID, other.getLongProperty(Message.HDR_ORIG_MESSAGE_ID)); } else { - message.putStringProperty(Message.HDR_ORIGINAL_ADDRESS, new SimpleString(other.getAddress())); + message.putStringProperty(Message.HDR_ORIGINAL_ADDRESS, SimpleString.of(other.getAddress())); message.putLongProperty(Message.HDR_ORIG_MESSAGE_ID, other.getMessageID()); } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/AddressSettings.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/AddressSettings.java index fdda8bc4e1..ac74b99aa8 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/AddressSettings.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/AddressSettings.java @@ -107,9 +107,9 @@ public class AddressSettings implements Mergeable, Serializable public static final boolean DEFAULT_AUTO_CREATE_EXPIRY_RESOURCES = false; - public static final SimpleString DEFAULT_EXPIRY_QUEUE_PREFIX = SimpleString.toSimpleString("EXP."); + public static final SimpleString DEFAULT_EXPIRY_QUEUE_PREFIX = SimpleString.of("EXP."); - public static final SimpleString DEFAULT_EXPIRY_QUEUE_SUFFIX = SimpleString.toSimpleString(""); + public static final SimpleString DEFAULT_EXPIRY_QUEUE_SUFFIX = SimpleString.of(""); public static final long DEFAULT_EXPIRY_DELAY = -1; @@ -134,9 +134,9 @@ public class AddressSettings implements Mergeable, Serializable public static final boolean DEFAULT_AUTO_CREATE_DEAD_LETTER_RESOURCES = false; - public static final SimpleString DEFAULT_DEAD_LETTER_QUEUE_PREFIX = SimpleString.toSimpleString("DLQ."); + public static final SimpleString DEFAULT_DEAD_LETTER_QUEUE_PREFIX = SimpleString.of("DLQ."); - public static final SimpleString DEFAULT_DEAD_LETTER_QUEUE_SUFFIX = SimpleString.toSimpleString(""); + public static final SimpleString DEFAULT_DEAD_LETTER_QUEUE_SUFFIX = SimpleString.of(""); public static final boolean DEFAULT_ENABLE_METRICS = true; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/ResourceLimitSettings.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/ResourceLimitSettings.java index c776e32684..1c80f03ebf 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/ResourceLimitSettings.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/ResourceLimitSettings.java @@ -36,7 +36,7 @@ public class ResourceLimitSettings implements Serializable, EncodingSupport { // public static final Long DEFAULT_MAX_QUEUE_SIZE_BYTES = -1L; - // public static final SimpleString DEFAULT_QUEUE_NAME_REGEX = new SimpleString(".+"); + // public static final SimpleString DEFAULT_QUEUE_NAME_REGEX = SimpleString.of(".+"); SimpleString match = null; @@ -49,7 +49,7 @@ public class ResourceLimitSettings implements Serializable, EncodingSupport { // SimpleString queueNameRegex = null; public void setName(String name) { - setMatch(SimpleString.toSimpleString(name)); + setMatch(SimpleString.of(name)); } public SimpleString getMatch() { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/protocol/AbstractProtocolManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/protocol/AbstractProtocolManager.java index a1f556e4bd..4b10b90a59 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/protocol/AbstractProtocolManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/protocol/AbstractProtocolManager.java @@ -54,14 +54,14 @@ public abstract class AbstractProtocolManager, C @Override public void setAnycastPrefix(String anycastPrefix) { for (String prefix : anycastPrefix.split(",")) { - prefixes.put(SimpleString.toSimpleString(prefix), RoutingType.ANYCAST); + prefixes.put(SimpleString.of(prefix), RoutingType.ANYCAST); } } @Override public void setMulticastPrefix(String multicastPrefix) { for (String prefix : multicastPrefix.split(",")) { - prefixes.put(SimpleString.toSimpleString(prefix), RoutingType.MULTICAST); + prefixes.put(SimpleString.of(prefix), RoutingType.MULTICAST); } } diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/amqpBrokerConnectivity/AMQPMirrorBrokerConnectionElementTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/amqpBrokerConnectivity/AMQPMirrorBrokerConnectionElementTest.java index 12eb049414..abdff64548 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/amqpBrokerConnectivity/AMQPMirrorBrokerConnectionElementTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/amqpBrokerConnectivity/AMQPMirrorBrokerConnectionElementTest.java @@ -64,9 +64,9 @@ public class AMQPMirrorBrokerConnectionElementTest { assertEquals(mirror1, mirror2); // Mirror SNF - mirror1.setMirrorSNF(SimpleString.toSimpleString("test")); + mirror1.setMirrorSNF(SimpleString.of("test")); assertNotEquals(mirror1, mirror2); - mirror2.setMirrorSNF(SimpleString.toSimpleString("test")); + mirror2.setMirrorSNF(SimpleString.of("test")); assertEquals(mirror1, mirror2); // Address Filter @@ -112,9 +112,9 @@ public class AMQPMirrorBrokerConnectionElementTest { assertEquals(mirror1.hashCode(), mirror2.hashCode()); // Mirror SNF - mirror1.setMirrorSNF(SimpleString.toSimpleString("test")); + mirror1.setMirrorSNF(SimpleString.of("test")); assertNotEquals(mirror1.hashCode(), mirror2.hashCode()); - mirror2.setMirrorSNF(SimpleString.toSimpleString("test")); + mirror2.setMirrorSNF(SimpleString.of("test")); assertEquals(mirror1.hashCode(), mirror2.hashCode()); // Address Filter diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/AMQPConnectMatchTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/AMQPConnectMatchTest.java index e3cf3952e2..8ff5ee17ea 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/AMQPConnectMatchTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/AMQPConnectMatchTest.java @@ -32,7 +32,7 @@ public class AMQPConnectMatchTest { String checkAddressMatching = "AD.TEST"; String checkAddressNotMatching = "DD.TEST"; WildcardConfiguration configuration = new WildcardConfiguration(); - assertTrue(AMQPBrokerConnectionElement.match(SimpleString.toSimpleString(match), SimpleString.toSimpleString(checkAddressMatching), configuration)); - assertFalse(AMQPBrokerConnectionElement.match(SimpleString.toSimpleString(match), SimpleString.toSimpleString(checkAddressNotMatching), configuration)); + assertTrue(AMQPBrokerConnectionElement.match(SimpleString.of(match), SimpleString.of(checkAddressMatching), configuration)); + assertFalse(AMQPBrokerConnectionElement.match(SimpleString.of(match), SimpleString.of(checkAddressNotMatching), configuration)); } } diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/AbstractConfigurationTestBase.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/AbstractConfigurationTestBase.java index 291277c9bb..85612f5b6c 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/AbstractConfigurationTestBase.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/AbstractConfigurationTestBase.java @@ -112,7 +112,7 @@ public abstract class AbstractConfigurationTestBase extends ServerTestBase { assertEquals(i, configuration.getJournalMaxIO_NIO()); s = RandomUtil.randomString(); - configuration.setManagementAddress(new SimpleString(s)); + configuration.setManagementAddress(SimpleString.of(s)); assertEquals(s, configuration.getManagementAddress().toString()); l = RandomUtil.randomLong(); @@ -314,7 +314,7 @@ public abstract class AbstractConfigurationTestBase extends ServerTestBase { assertEquals(i, configuration.getJournalMaxIO_NIO()); s = RandomUtil.randomString(); - configuration.setManagementAddress(new SimpleString(s)); + configuration.setManagementAddress(SimpleString.of(s)); assertEquals(s, configuration.getManagementAddress().toString()); l = RandomUtil.randomLong(); diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImplTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImplTest.java index a4c5954af6..a65dfb630a 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImplTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImplTest.java @@ -1165,7 +1165,7 @@ public class ConfigurationImplTest extends AbstractConfigurationTestBase { assertEquals(1, configuration.getAddressConfigurations().size()); assertEquals(1, configuration.getAddressConfigurations().get(0).getQueueConfigs().size()); - assertEquals(SimpleString.toSimpleString("LB.TEST"), configuration.getAddressConfigurations().get(0).getQueueConfigs().get(0).getAddress()); + assertEquals(SimpleString.of("LB.TEST"), configuration.getAddressConfigurations().get(0).getQueueConfigs().get(0).getAddress()); assertNotNull(configuration.getAddressConfigurations().get(0).getQueueConfigs().get(0).isDurable()); assertFalse(configuration.getAddressConfigurations().get(0).getQueueConfigs().get(0).isDurable()); } @@ -1338,17 +1338,17 @@ public class ConfigurationImplTest extends AbstractConfigurationTestBase { configuration.parsePrefixedProperties(properties, null); assertEquals(4, configuration.getAddressSettings().size()); - assertEquals(SimpleString.toSimpleString("sharedExpiry"), configuration.getAddressSettings().get("#").getExpiryAddress()); - assertEquals(SimpleString.toSimpleString("important"), configuration.getAddressSettings().get("NeedToTrackExpired").getExpiryAddress()); - assertEquals(SimpleString.toSimpleString("moreImportant"), configuration.getAddressSettings().get("Name.With.Dots").getExpiryAddress()); + assertEquals(SimpleString.of("sharedExpiry"), configuration.getAddressSettings().get("#").getExpiryAddress()); + assertEquals(SimpleString.of("important"), configuration.getAddressSettings().get("NeedToTrackExpired").getExpiryAddress()); + assertEquals(SimpleString.of("moreImportant"), configuration.getAddressSettings().get("Name.With.Dots").getExpiryAddress()); assertTrue(configuration.getAddressSettings().get("NeedToSet").isAutoCreateExpiryResources()); - assertEquals(SimpleString.toSimpleString("iamDeadLetterAdd"), configuration.getAddressSettings().get("NeedToSet").getDeadLetterAddress()); - assertEquals(SimpleString.toSimpleString("add1Expiry"), configuration.getAddressSettings().get("NeedToSet").getExpiryQueuePrefix()); + assertEquals(SimpleString.of("iamDeadLetterAdd"), configuration.getAddressSettings().get("NeedToSet").getDeadLetterAddress()); + assertEquals(SimpleString.of("add1Expiry"), configuration.getAddressSettings().get("NeedToSet").getExpiryQueuePrefix()); assertEquals(20000000, configuration.getAddressSettings().get("NeedToSet").getMaxReadPageBytes()); assertEquals(512, configuration.getAddressSettings().get("NeedToSet").getManagementMessageAttributeSizeLimit()); - assertEquals(SimpleString.toSimpleString("iamDeadLetterQueuePre"), configuration.getAddressSettings().get("NeedToSet").getDeadLetterQueuePrefix()); + assertEquals(SimpleString.of("iamDeadLetterQueuePre"), configuration.getAddressSettings().get("NeedToSet").getDeadLetterQueuePrefix()); assertEquals(12345, configuration.getAddressSettings().get("NeedToSet").getPageSizeBytes()); - assertEquals(SimpleString.toSimpleString("add1ExpirySuffix"), configuration.getAddressSettings().get("NeedToSet").getExpiryQueueSuffix()); + assertEquals(SimpleString.of("add1ExpirySuffix"), configuration.getAddressSettings().get("NeedToSet").getExpiryQueueSuffix()); assertEquals(Long.valueOf(44), configuration.getAddressSettings().get("NeedToSet").getExpiryDelay()); assertEquals(Long.valueOf(5), configuration.getAddressSettings().get("NeedToSet").getMinExpiryDelay()); assertEquals(Long.valueOf(10), configuration.getAddressSettings().get("NeedToSet").getMaxExpiryDelay()); @@ -1356,9 +1356,9 @@ public class ConfigurationImplTest extends AbstractConfigurationTestBase { assertEquals(300, configuration.getAddressSettings().get("NeedToSet").getManagementBrowsePageSize()); assertEquals(-1, configuration.getAddressSettings().get("NeedToSet").getRetroactiveMessageCount()); assertEquals(10, configuration.getAddressSettings().get("NeedToSet").getMaxDeliveryAttempts()); - assertEquals(SimpleString.toSimpleString("add1Key"), configuration.getAddressSettings().get("NeedToSet").getDefaultGroupFirstKey()); + assertEquals(SimpleString.of("add1Key"), configuration.getAddressSettings().get("NeedToSet").getDefaultGroupFirstKey()); assertEquals(100, configuration.getAddressSettings().get("NeedToSet").getSlowConsumerCheckPeriod()); - assertEquals(SimpleString.toSimpleString("add1Lvk"), configuration.getAddressSettings().get("NeedToSet").getDefaultLastValueKey()); + assertEquals(SimpleString.of("add1Lvk"), configuration.getAddressSettings().get("NeedToSet").getDefaultLastValueKey()); assertEquals(DeletionPolicy.FORCE, configuration.getAddressSettings().get("NeedToSet").getConfigDeleteDiverts()); assertEquals(1000, configuration.getAddressSettings().get("NeedToSet").getDefaultConsumerWindowSize()); assertEquals(7, configuration.getAddressSettings().get("NeedToSet").getMessageCounterHistoryDayLimit()); @@ -1384,7 +1384,7 @@ public class ConfigurationImplTest extends AbstractConfigurationTestBase { assertTrue(configuration.getAddressSettings().get("NeedToSet").isSendToDLAOnNoRoute()); assertEquals(SlowConsumerThresholdMeasurementUnit.MESSAGES_PER_HOUR, configuration.getAddressSettings().get("NeedToSet").getSlowConsumerThresholdMeasurementUnit()); assertEquals(900, configuration.getAddressSettings().get("NeedToSet").getQueuePrefetch()); - assertEquals(SimpleString.toSimpleString("iamDeadLetterQueueSuf"), configuration.getAddressSettings().get("NeedToSet").getDeadLetterQueueSuffix()); + assertEquals(SimpleString.of("iamDeadLetterQueueSuf"), configuration.getAddressSettings().get("NeedToSet").getDeadLetterQueueSuffix()); assertTrue(configuration.getAddressSettings().get("NeedToSet").isDefaultNonDestructive()); assertEquals(DeletionPolicy.FORCE, configuration.getAddressSettings().get("NeedToSet").getConfigDeleteAddresses()); assertEquals(10, configuration.getAddressSettings().get("NeedToSet").getSlowConsumerThreshold()); @@ -1418,12 +1418,12 @@ public class ConfigurationImplTest extends AbstractConfigurationTestBase { configuration.parsePrefixedProperties(properties, null); assertEquals(1, configuration.getAddressSettings().size()); - assertEquals(SimpleString.toSimpleString(randomString), configuration.getAddressSettings().get("#").getExpiryAddress()); + assertEquals(SimpleString.of(randomString), configuration.getAddressSettings().get("#").getExpiryAddress()); assertEquals(300L, configuration.getAddressSettings().get("#").getPageLimitMessages().longValue()); assertEquals(300000L, configuration.getAddressSettings().get("#").getPageLimitBytes().longValue()); assertEquals("DROP", configuration.getAddressSettings().get("#").getPageFullMessagePolicy().toString()); - PagingStore storeImpl = new PagingStoreImpl(new SimpleString("Test"), (ScheduledExecutorService) null, 100L, Mockito.mock(PagingManager.class), Mockito.mock(StorageManager.class), Mockito.mock(SequentialFileFactory.class), Mockito.mock(PagingStoreFactory.class), new SimpleString("Test"), configuration.getAddressSettings().get("#"), null, null, true); + PagingStore storeImpl = new PagingStoreImpl(SimpleString.of("Test"), (ScheduledExecutorService) null, 100L, Mockito.mock(PagingManager.class), Mockito.mock(StorageManager.class), Mockito.mock(SequentialFileFactory.class), Mockito.mock(PagingStoreFactory.class), SimpleString.of("Test"), configuration.getAddressSettings().get("#"), null, null, true); assertEquals(300L, storeImpl.getPageLimitMessages().longValue()); assertEquals(300000L, storeImpl.getPageLimitBytes().longValue()); @@ -1448,12 +1448,12 @@ public class ConfigurationImplTest extends AbstractConfigurationTestBase { configuration.parsePrefixedProperties(properties, null); assertEquals(1, configuration.getAddressSettings().size()); - assertEquals(SimpleString.toSimpleString(randomString), configuration.getAddressSettings().get("#").getExpiryAddress()); + assertEquals(SimpleString.of(randomString), configuration.getAddressSettings().get("#").getExpiryAddress()); assertEquals((Long)300L, configuration.getAddressSettings().get("#").getPageLimitMessages()); assertEquals((Long)300000L, configuration.getAddressSettings().get("#").getPageLimitBytes()); assertNull(configuration.getAddressSettings().get("#").getPageFullMessagePolicy()); - PagingStore storeImpl = new PagingStoreImpl(new SimpleString("Test"), (ScheduledExecutorService) null, 100L, Mockito.mock(PagingManager.class), Mockito.mock(StorageManager.class), Mockito.mock(SequentialFileFactory.class), Mockito.mock(PagingStoreFactory.class), new SimpleString("Test"), configuration.getAddressSettings().get("#"), null, null, true); + PagingStore storeImpl = new PagingStoreImpl(SimpleString.of("Test"), (ScheduledExecutorService) null, 100L, Mockito.mock(PagingManager.class), Mockito.mock(StorageManager.class), Mockito.mock(SequentialFileFactory.class), Mockito.mock(PagingStoreFactory.class), SimpleString.of("Test"), configuration.getAddressSettings().get("#"), null, null, true); assertNull(storeImpl.getPageLimitMessages()); assertNull(storeImpl.getPageLimitBytes()); @@ -1479,12 +1479,12 @@ public class ConfigurationImplTest extends AbstractConfigurationTestBase { configuration.parsePrefixedProperties(properties, null); assertEquals(1, configuration.getAddressSettings().size()); - assertEquals(SimpleString.toSimpleString(randomString), configuration.getAddressSettings().get("#").getExpiryAddress()); + assertEquals(SimpleString.of(randomString), configuration.getAddressSettings().get("#").getExpiryAddress()); assertEquals((Long)300L, configuration.getAddressSettings().get("#").getPageLimitMessages()); assertNull(configuration.getAddressSettings().get("#").getPageLimitBytes()); assertNull(configuration.getAddressSettings().get("#").getPageFullMessagePolicy()); - PagingStore storeImpl = new PagingStoreImpl(new SimpleString("Test"), (ScheduledExecutorService) null, 100L, Mockito.mock(PagingManager.class), Mockito.mock(StorageManager.class), Mockito.mock(SequentialFileFactory.class), Mockito.mock(PagingStoreFactory.class), new SimpleString("Test"), configuration.getAddressSettings().get("#"), null, null, true); + PagingStore storeImpl = new PagingStoreImpl(SimpleString.of("Test"), (ScheduledExecutorService) null, 100L, Mockito.mock(PagingManager.class), Mockito.mock(StorageManager.class), Mockito.mock(SequentialFileFactory.class), Mockito.mock(PagingStoreFactory.class), SimpleString.of("Test"), configuration.getAddressSettings().get("#"), null, null, true); assertNull(storeImpl.getPageLimitMessages()); assertNull(storeImpl.getPageLimitBytes()); @@ -1509,12 +1509,12 @@ public class ConfigurationImplTest extends AbstractConfigurationTestBase { configuration.parsePrefixedProperties(properties, null); assertEquals(1, configuration.getAddressSettings().size()); - assertEquals(SimpleString.toSimpleString(randomString), configuration.getAddressSettings().get("#").getExpiryAddress()); + assertEquals(SimpleString.of(randomString), configuration.getAddressSettings().get("#").getExpiryAddress()); assertNull(configuration.getAddressSettings().get("#").getPageLimitMessages()); assertEquals((Long)300000L, configuration.getAddressSettings().get("#").getPageLimitBytes()); assertNull(configuration.getAddressSettings().get("#").getPageFullMessagePolicy()); - PagingStore storeImpl = new PagingStoreImpl(new SimpleString("Test"), (ScheduledExecutorService) null, 100L, Mockito.mock(PagingManager.class), Mockito.mock(StorageManager.class), Mockito.mock(SequentialFileFactory.class), Mockito.mock(PagingStoreFactory.class), new SimpleString("Test"), configuration.getAddressSettings().get("#"), null, null, true); + PagingStore storeImpl = new PagingStoreImpl(SimpleString.of("Test"), (ScheduledExecutorService) null, 100L, Mockito.mock(PagingManager.class), Mockito.mock(StorageManager.class), Mockito.mock(SequentialFileFactory.class), Mockito.mock(PagingStoreFactory.class), SimpleString.of("Test"), configuration.getAddressSettings().get("#"), null, null, true); assertNull(storeImpl.getPageLimitMessages()); assertNull(storeImpl.getPageLimitBytes()); @@ -1539,12 +1539,12 @@ public class ConfigurationImplTest extends AbstractConfigurationTestBase { configuration.parsePrefixedProperties(properties, null); assertEquals(1, configuration.getAddressSettings().size()); - assertEquals(SimpleString.toSimpleString(randomString), configuration.getAddressSettings().get("#").getExpiryAddress()); + assertEquals(SimpleString.of(randomString), configuration.getAddressSettings().get("#").getExpiryAddress()); assertNull(configuration.getAddressSettings().get("#").getPageLimitMessages()); assertNull(configuration.getAddressSettings().get("#").getPageLimitBytes()); assertEquals("DROP", configuration.getAddressSettings().get("#").getPageFullMessagePolicy().toString()); - PagingStore storeImpl = new PagingStoreImpl(new SimpleString("Test"), (ScheduledExecutorService) null, 100L, Mockito.mock(PagingManager.class), Mockito.mock(StorageManager.class), Mockito.mock(SequentialFileFactory.class), Mockito.mock(PagingStoreFactory.class), new SimpleString("Test"), configuration.getAddressSettings().get("#"), null, null, true); + PagingStore storeImpl = new PagingStoreImpl(SimpleString.of("Test"), (ScheduledExecutorService) null, 100L, Mockito.mock(PagingManager.class), Mockito.mock(StorageManager.class), Mockito.mock(SequentialFileFactory.class), Mockito.mock(PagingStoreFactory.class), SimpleString.of("Test"), configuration.getAddressSettings().get("#"), null, null, true); assertNull(storeImpl.getPageLimitMessages()); assertNull(storeImpl.getPageLimitBytes()); @@ -1569,12 +1569,12 @@ public class ConfigurationImplTest extends AbstractConfigurationTestBase { configuration.parsePrefixedProperties(properties, null); assertEquals(1, configuration.getAddressSettings().size()); - assertEquals(SimpleString.toSimpleString(randomString), configuration.getAddressSettings().get("#").getExpiryAddress()); + assertEquals(SimpleString.of(randomString), configuration.getAddressSettings().get("#").getExpiryAddress()); assertEquals(-1L, configuration.getAddressSettings().get("#").getPageLimitMessages().longValue()); assertEquals(-1L, configuration.getAddressSettings().get("#").getPageLimitBytes().longValue()); assertEquals("DROP", configuration.getAddressSettings().get("#").getPageFullMessagePolicy().toString()); - PagingStore storeImpl = new PagingStoreImpl(new SimpleString("Test"), (ScheduledExecutorService) null, 100L, Mockito.mock(PagingManager.class), Mockito.mock(StorageManager.class), Mockito.mock(SequentialFileFactory.class), Mockito.mock(PagingStoreFactory.class), new SimpleString("Test"), configuration.getAddressSettings().get("#"), null, null, true); + PagingStore storeImpl = new PagingStoreImpl(SimpleString.of("Test"), (ScheduledExecutorService) null, 100L, Mockito.mock(PagingManager.class), Mockito.mock(StorageManager.class), Mockito.mock(SequentialFileFactory.class), Mockito.mock(PagingStoreFactory.class), SimpleString.of("Test"), configuration.getAddressSettings().get("#"), null, null, true); assertNull(storeImpl.getPageLimitMessages()); assertNull(storeImpl.getPageLimitBytes()); @@ -1596,11 +1596,11 @@ public class ConfigurationImplTest extends AbstractConfigurationTestBase { configuration.parsePrefixedProperties(properties, null); assertEquals(1, configuration.getAddressSettings().size()); - assertEquals(SimpleString.toSimpleString(randomString), configuration.getAddressSettings().get("#").getExpiryAddress()); + assertEquals(SimpleString.of(randomString), configuration.getAddressSettings().get("#").getExpiryAddress()); assertEquals(333, configuration.getAddressSettings().get("#").getPrefetchPageMessages()); assertEquals(777, configuration.getAddressSettings().get("#").getPrefetchPageBytes()); - PagingStore storeImpl = new PagingStoreImpl(new SimpleString("Test"), (ScheduledExecutorService) null, 100L, Mockito.mock(PagingManager.class), Mockito.mock(StorageManager.class), Mockito.mock(SequentialFileFactory.class), Mockito.mock(PagingStoreFactory.class), new SimpleString("Test"), configuration.getAddressSettings().get("#"), null, null, true); + PagingStore storeImpl = new PagingStoreImpl(SimpleString.of("Test"), (ScheduledExecutorService) null, 100L, Mockito.mock(PagingManager.class), Mockito.mock(StorageManager.class), Mockito.mock(SequentialFileFactory.class), Mockito.mock(PagingStoreFactory.class), SimpleString.of("Test"), configuration.getAddressSettings().get("#"), null, null, true); assertEquals(333, storeImpl.getPrefetchPageMessages()); assertEquals(777, storeImpl.getPrefetchPageBytes()); @@ -1625,7 +1625,7 @@ public class ConfigurationImplTest extends AbstractConfigurationTestBase { assertEquals(333, configuration.getAddressSettings().get("#").getMaxReadPageMessages()); assertEquals(777, configuration.getAddressSettings().get("#").getMaxReadPageBytes()); - PagingStore storeImpl = new PagingStoreImpl(new SimpleString("Test"), (ScheduledExecutorService) null, 100L, Mockito.mock(PagingManager.class), Mockito.mock(StorageManager.class), Mockito.mock(SequentialFileFactory.class), Mockito.mock(PagingStoreFactory.class), new SimpleString("Test"), configuration.getAddressSettings().get("#"), null, null, true); + PagingStore storeImpl = new PagingStoreImpl(SimpleString.of("Test"), (ScheduledExecutorService) null, 100L, Mockito.mock(PagingManager.class), Mockito.mock(StorageManager.class), Mockito.mock(SequentialFileFactory.class), Mockito.mock(PagingStoreFactory.class), SimpleString.of("Test"), configuration.getAddressSettings().get("#"), null, null, true); assertEquals(333, storeImpl.getPrefetchPageMessages()); assertEquals(777, storeImpl.getPrefetchPageBytes()); @@ -2026,9 +2026,9 @@ public class ConfigurationImplTest extends AbstractConfigurationTestBase { configuration.parsePrefixedProperties(properties, null); assertEquals(3, configuration.getAddressSettings().size()); - assertEquals(SimpleString.toSimpleString("sharedExpiry"), configuration.getAddressSettings().get("#").getExpiryAddress()); - assertEquals(SimpleString.toSimpleString("important"), configuration.getAddressSettings().get("NeedToTrackExpired").getExpiryAddress()); - assertEquals(SimpleString.toSimpleString("moreImportant"), configuration.getAddressSettings().get("Name.With.Dots").getExpiryAddress()); + assertEquals(SimpleString.of("sharedExpiry"), configuration.getAddressSettings().get("#").getExpiryAddress()); + assertEquals(SimpleString.of("important"), configuration.getAddressSettings().get("NeedToTrackExpired").getExpiryAddress()); + assertEquals(SimpleString.of("moreImportant"), configuration.getAddressSettings().get("Name.With.Dots").getExpiryAddress()); assertTrue(configuration.getStatus().contains("\"errors\":[]")); } diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationParserTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationParserTest.java index 7cae74e70e..161c4d9630 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationParserTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationParserTest.java @@ -102,7 +102,7 @@ public class FileConfigurationParserTest extends ServerTestBase { deploymentManager.readConfiguration(); ActiveMQServer server = addServer((ActiveMQServer) deploymentManager.buildService(null, null, null).get("core")); server.start(); - assertEquals(0, server.locateQueue(SimpleString.toSimpleString("q")).getMaxConsumers()); + assertEquals(0, server.locateQueue(SimpleString.of("q")).getMaxConsumers()); } @Test 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 6f644a9dc7..d14cbbe413 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 @@ -189,8 +189,8 @@ public class FileConfigurationTest extends AbstractConfigurationTestBase { assertEquals(333, conf.getAuthenticationCacheSize()); assertEquals(444, conf.getAuthorizationCacheSize()); assertTrue(conf.isWildcardRoutingEnabled()); - assertEquals(new SimpleString("Giraffe"), conf.getManagementAddress()); - assertEquals(new SimpleString("Whatever"), conf.getManagementNotificationAddress()); + assertEquals(SimpleString.of("Giraffe"), conf.getManagementAddress()); + assertEquals(SimpleString.of("Whatever"), conf.getManagementNotificationAddress()); assertEquals("Frog", conf.getClusterUser()); assertEquals("Wombat", conf.getClusterPassword()); assertFalse(conf.isJMXManagementEnabled()); diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/filter/impl/FilterTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/filter/impl/FilterTest.java index 97c0015153..8747a1155e 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/filter/impl/FilterTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/filter/impl/FilterTest.java @@ -50,18 +50,18 @@ public class FilterTest extends SilentTestCase { @Test public void testNewlineMatch() throws Exception { - filter = FilterImpl.createFilter(new SimpleString("fooprop LIKE '%1234%'")); + filter = FilterImpl.createFilter(SimpleString.of("fooprop LIKE '%1234%'")); - message.putStringProperty(new SimpleString("fooprop"), new SimpleString("hello1234\n")); + message.putStringProperty(SimpleString.of("fooprop"), SimpleString.of("hello1234\n")); assertTrue(filter.match(message)); } @Test public void testFilterForgets() throws Exception { - filter = FilterImpl.createFilter(new SimpleString("color = 'RED'")); + filter = FilterImpl.createFilter(SimpleString.of("color = 'RED'")); - message.putStringProperty(new SimpleString("color"), new SimpleString("RED")); + message.putStringProperty(SimpleString.of("color"), SimpleString.of("RED")); assertTrue(filter.match(message)); message = new CoreMessage(); assertFalse(filter.match(message)); @@ -70,10 +70,10 @@ public class FilterTest extends SilentTestCase { @Test public void testInvalidString() throws Exception { testInvalidFilter("color = 'red"); - testInvalidFilter(new SimpleString("color = 'red")); + testInvalidFilter(SimpleString.of("color = 'red")); testInvalidFilter("3"); - testInvalidFilter(new SimpleString("3")); + testInvalidFilter(SimpleString.of("3")); } @Test @@ -81,12 +81,12 @@ public class FilterTest extends SilentTestCase { assertNull(FilterImpl.createFilter((String) null)); assertNull(FilterImpl.createFilter("")); assertNull(FilterImpl.createFilter((SimpleString) null)); - assertNull(FilterImpl.createFilter(new SimpleString(""))); + assertNull(FilterImpl.createFilter(SimpleString.of(""))); } @Test public void testAMQDurable() throws Exception { - filter = FilterImpl.createFilter(new SimpleString("AMQDurable='DURABLE'")); + filter = FilterImpl.createFilter(SimpleString.of("AMQDurable='DURABLE'")); message.setDurable(true); @@ -96,7 +96,7 @@ public class FilterTest extends SilentTestCase { assertFalse(filter.match(message)); - filter = FilterImpl.createFilter(new SimpleString("AMQDurable='NON_DURABLE'")); + filter = FilterImpl.createFilter(SimpleString.of("AMQDurable='NON_DURABLE'")); message = new CoreMessage(); message.setDurable(true); @@ -115,11 +115,11 @@ public class FilterTest extends SilentTestCase { int encodeSize = message.getEncodeSize(); - Filter moreThanSmall = FilterImpl.createFilter(new SimpleString("AMQSize > " + (encodeSize - 1))); - Filter lessThanLarge = FilterImpl.createFilter(new SimpleString("AMQSize < " + (encodeSize + 1))); + Filter moreThanSmall = FilterImpl.createFilter(SimpleString.of("AMQSize > " + (encodeSize - 1))); + Filter lessThanLarge = FilterImpl.createFilter(SimpleString.of("AMQSize < " + (encodeSize + 1))); - Filter lessThanSmall = FilterImpl.createFilter(new SimpleString("AMQSize < " + encodeSize)); - Filter moreThanLarge = FilterImpl.createFilter(new SimpleString("AMQSize > " + encodeSize)); + Filter lessThanSmall = FilterImpl.createFilter(SimpleString.of("AMQSize < " + encodeSize)); + Filter moreThanLarge = FilterImpl.createFilter(SimpleString.of("AMQSize > " + encodeSize)); assertTrue(moreThanSmall.match(message)); assertTrue(lessThanLarge.match(message)); @@ -131,7 +131,7 @@ public class FilterTest extends SilentTestCase { @Test public void testAMQPriority() throws Exception { - filter = FilterImpl.createFilter(new SimpleString("AMQPriority=3")); + filter = FilterImpl.createFilter(SimpleString.of("AMQPriority=3")); for (int i = 0; i < 10; i++) { message.setPriority((byte) i); @@ -146,7 +146,7 @@ public class FilterTest extends SilentTestCase { @Test public void testAMQTimestamp() throws Exception { - filter = FilterImpl.createFilter(new SimpleString("AMQTimestamp=12345678")); + filter = FilterImpl.createFilter(SimpleString.of("AMQTimestamp=12345678")); message.setTimestamp(87654321); @@ -159,59 +159,59 @@ public class FilterTest extends SilentTestCase { @Test public void testBooleanTrue() throws Exception { - filter = FilterImpl.createFilter(new SimpleString("MyBoolean=true")); + filter = FilterImpl.createFilter(SimpleString.of("MyBoolean=true")); testBoolean("MyBoolean", true); } @Test public void testIdentifier() throws Exception { - filter = FilterImpl.createFilter(new SimpleString("MyBoolean")); + filter = FilterImpl.createFilter(SimpleString.of("MyBoolean")); testBoolean("MyBoolean", true); } @Test public void testDifferentNullString() throws Exception { - filter = FilterImpl.createFilter(new SimpleString("prop <> 'foo'")); + filter = FilterImpl.createFilter(SimpleString.of("prop <> 'foo'")); assertFalse(filter.match(message)); - filter = FilterImpl.createFilter(new SimpleString("prop <> 'foo' OR prop IS NULL")); + filter = FilterImpl.createFilter(SimpleString.of("prop <> 'foo' OR prop IS NULL")); assertTrue(filter.match(message)); - filter = FilterImpl.createFilter(new SimpleString("NOT (prop = 'foo')")); + filter = FilterImpl.createFilter(SimpleString.of("NOT (prop = 'foo')")); assertFalse(filter.match(message)); - filter = FilterImpl.createFilter(new SimpleString("NOT (prop = 'foo') OR prop IS NULL")); + filter = FilterImpl.createFilter(SimpleString.of("NOT (prop = 'foo') OR prop IS NULL")); assertTrue(filter.match(message)); - filter = FilterImpl.createFilter(new SimpleString("prop <> 'foo'")); + filter = FilterImpl.createFilter(SimpleString.of("prop <> 'foo'")); doPutStringProperty("prop", "bar"); assertTrue(filter.match(message)); - filter = FilterImpl.createFilter(new SimpleString("prop <> 'foo'")); + filter = FilterImpl.createFilter(SimpleString.of("prop <> 'foo'")); doPutStringProperty("prop", "foo"); assertFalse(filter.match(message)); } @Test public void testBooleanFalse() throws Exception { - filter = FilterImpl.createFilter(new SimpleString("MyBoolean=false")); + filter = FilterImpl.createFilter(SimpleString.of("MyBoolean=false")); testBoolean("MyBoolean", false); } private void testBoolean(final String name, final boolean flag) throws Exception { - message.putBooleanProperty(new SimpleString(name), flag); + message.putBooleanProperty(SimpleString.of(name), flag); assertTrue(filter.match(message)); - message.putBooleanProperty(new SimpleString(name), !flag); + message.putBooleanProperty(SimpleString.of(name), !flag); assertTrue(!filter.match(message)); } @Test public void testStringEquals() throws Exception { // First, simple test of string equality and inequality - filter = FilterImpl.createFilter(new SimpleString("MyString='astring'")); + filter = FilterImpl.createFilter(SimpleString.of("MyString='astring'")); doPutStringProperty("MyString", "astring"); assertTrue(filter.match(message)); @@ -220,7 +220,7 @@ public class FilterTest extends SilentTestCase { assertTrue(!filter.match(message)); // test empty string - filter = FilterImpl.createFilter(new SimpleString("MyString=''")); + filter = FilterImpl.createFilter(SimpleString.of("MyString=''")); doPutStringProperty("MyString", ""); assertTrue(filter.match(message), "test 1"); @@ -230,7 +230,7 @@ public class FilterTest extends SilentTestCase { // test literal apostrophes (which are escaped using two apostrophes // in selectors) - filter = FilterImpl.createFilter(new SimpleString("MyString='test JBoss''s filter'")); + filter = FilterImpl.createFilter(SimpleString.of("MyString='test JBoss''s filter'")); // note: apostrophes are not escaped in string properties doPutStringProperty("MyString", "test JBoss's filter"); @@ -244,7 +244,7 @@ public class FilterTest extends SilentTestCase { @Test public void testNOT_INWithNullProperty() throws Exception { - filter = FilterImpl.createFilter(new SimpleString("myNullProp NOT IN ('foo','jms','test')")); + filter = FilterImpl.createFilter(SimpleString.of("myNullProp NOT IN ('foo','jms','test')")); assertFalse(filter.match(message)); @@ -254,7 +254,7 @@ public class FilterTest extends SilentTestCase { @Test public void testNOT_LIKEWithNullProperty() throws Exception { - filter = FilterImpl.createFilter(new SimpleString("myNullProp NOT LIKE '1_3'")); + filter = FilterImpl.createFilter(SimpleString.of("myNullProp NOT LIKE '1_3'")); assertFalse(filter.match(message)); @@ -264,7 +264,7 @@ public class FilterTest extends SilentTestCase { @Test public void testIS_NOT_NULLWithNullProperty() throws Exception { - filter = FilterImpl.createFilter(new SimpleString("myNullProp IS NOT NULL")); + filter = FilterImpl.createFilter(SimpleString.of("myNullProp IS NOT NULL")); assertFalse(filter.match(message)); @@ -275,7 +275,7 @@ public class FilterTest extends SilentTestCase { @Test public void testStringLike() throws Exception { // test LIKE operator with no wildcards - filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'astring'")); + filter = FilterImpl.createFilter(SimpleString.of("MyString LIKE 'astring'")); assertFalse(filter.match(message)); // test where LIKE operand matches @@ -283,17 +283,17 @@ public class FilterTest extends SilentTestCase { assertTrue(filter.match(message)); // test one character string - filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'a'")); + filter = FilterImpl.createFilter(SimpleString.of("MyString LIKE 'a'")); doPutStringProperty("MyString", "a"); assertTrue(filter.match(message)); // test empty string - filter = FilterImpl.createFilter(new SimpleString("MyString LIKE ''")); + filter = FilterImpl.createFilter(SimpleString.of("MyString LIKE ''")); doPutStringProperty("MyString", ""); assertTrue(filter.match(message)); // tests where operand does not match - filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'astring'")); + filter = FilterImpl.createFilter(SimpleString.of("MyString LIKE 'astring'")); // test with extra characters at beginning doPutStringProperty("MyString", "NOTastring"); @@ -328,7 +328,7 @@ public class FilterTest extends SilentTestCase { // matches any single character // first, some tests with the wildcard by itself - filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '_'")); + filter = FilterImpl.createFilter(SimpleString.of("MyString LIKE '_'")); assertFalse(filter.match(message)); // test match against single character @@ -344,7 +344,7 @@ public class FilterTest extends SilentTestCase { assertTrue(!filter.match(message)); // next, tests with wildcard at the beginning of the string - filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '_bcdf'")); + filter = FilterImpl.createFilter(SimpleString.of("MyString LIKE '_bcdf'")); // test match at beginning of string doPutStringProperty("MyString", "abcdf"); @@ -379,7 +379,7 @@ public class FilterTest extends SilentTestCase { assertTrue(!filter.match(message)); // next, tests with wildcard at the end of the string - filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'abcd_'")); + filter = FilterImpl.createFilter(SimpleString.of("MyString LIKE 'abcd_'")); // test match at end of string doPutStringProperty("MyString", "abcdf"); @@ -416,7 +416,7 @@ public class FilterTest extends SilentTestCase { // test match in middle of string // next, tests with wildcard in the middle of the string - filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'ab_df'")); + filter = FilterImpl.createFilter(SimpleString.of("MyString LIKE 'ab_df'")); // test match in the middle of string doPutStringProperty("MyString", "abcdf"); @@ -456,7 +456,7 @@ public class FilterTest extends SilentTestCase { @Test public void testNotLikeExpression() throws Exception { // Should evaluate to false when the property MyString is not set - filter = FilterImpl.createFilter(new SimpleString("NOT (MyString LIKE '%')")); + filter = FilterImpl.createFilter(SimpleString.of("NOT (MyString LIKE '%')")); assertFalse(filter.match(message)); } @@ -468,7 +468,7 @@ public class FilterTest extends SilentTestCase { // note many of the tests are similar to those for _ // first, some tests with the wildcard by itself - filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '%'")); + filter = FilterImpl.createFilter(SimpleString.of("MyString LIKE '%'")); assertFalse(filter.match(message)); // test match against single character @@ -487,7 +487,7 @@ public class FilterTest extends SilentTestCase { assertTrue(filter.match(message)); // next, tests with wildcard at the beginning of the string - filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '%bcdf'")); + filter = FilterImpl.createFilter(SimpleString.of("MyString LIKE '%bcdf'")); // test match with single character at beginning of string doPutStringProperty("MyString", "Xbcdf"); @@ -518,7 +518,7 @@ public class FilterTest extends SilentTestCase { assertTrue(filter.match(message)); // next, tests with wildcard at the end of the string - filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'abcd%'")); + filter = FilterImpl.createFilter(SimpleString.of("MyString LIKE 'abcd%'")); // test match of single character at end of string doPutStringProperty("MyString", "abcdf"); @@ -553,7 +553,7 @@ public class FilterTest extends SilentTestCase { assertTrue(filter.match(message)); // next, tests with wildcard in the middle of the string - filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'ab%df'")); + filter = FilterImpl.createFilter(SimpleString.of("MyString LIKE 'ab%df'")); // test match with single character in the middle of string doPutStringProperty("MyString", "abXdf"); @@ -605,7 +605,7 @@ public class FilterTest extends SilentTestCase { // wildcards of the current underlying RE engine, // GNU regexp. - filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'a^$b'")); + filter = FilterImpl.createFilter(SimpleString.of("MyString LIKE 'a^$b'")); assertFalse(filter.match(message)); doPutStringProperty("MyString", "a^$b"); @@ -613,67 +613,67 @@ public class FilterTest extends SilentTestCase { // this one has a double backslash since backslash // is interpreted specially by Java - filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'a\\dc'")); + filter = FilterImpl.createFilter(SimpleString.of("MyString LIKE 'a\\dc'")); doPutStringProperty("MyString", "a\\dc"); assertTrue(filter.match(message)); - filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'a.c'")); + filter = FilterImpl.createFilter(SimpleString.of("MyString LIKE 'a.c'")); doPutStringProperty("MyString", "abc"); assertTrue(!filter.match(message)); - filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '[abc]'")); + filter = FilterImpl.createFilter(SimpleString.of("MyString LIKE '[abc]'")); doPutStringProperty("MyString", "[abc]"); assertTrue(filter.match(message)); - filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '[^abc]'")); + filter = FilterImpl.createFilter(SimpleString.of("MyString LIKE '[^abc]'")); doPutStringProperty("MyString", "[^abc]"); assertTrue(filter.match(message)); - filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '[a-c]'")); + filter = FilterImpl.createFilter(SimpleString.of("MyString LIKE '[a-c]'")); doPutStringProperty("MyString", "[a-c]"); assertTrue(filter.match(message)); - filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '[:alpha]'")); + filter = FilterImpl.createFilter(SimpleString.of("MyString LIKE '[:alpha]'")); doPutStringProperty("MyString", "[:alpha]"); assertTrue(filter.match(message)); - filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '(abc)'")); + filter = FilterImpl.createFilter(SimpleString.of("MyString LIKE '(abc)'")); doPutStringProperty("MyString", "(abc)"); assertTrue(filter.match(message)); - filter = FilterImpl.createFilter(new SimpleString("MyString LIKE 'a|bc'")); + filter = FilterImpl.createFilter(SimpleString.of("MyString LIKE 'a|bc'")); doPutStringProperty("MyString", "a|bc"); assertTrue(filter.match(message)); - filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '(abc)?'")); + filter = FilterImpl.createFilter(SimpleString.of("MyString LIKE '(abc)?'")); doPutStringProperty("MyString", "(abc)?"); assertTrue(filter.match(message)); - filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '(abc)*'")); + filter = FilterImpl.createFilter(SimpleString.of("MyString LIKE '(abc)*'")); doPutStringProperty("MyString", "(abc)*"); assertTrue(filter.match(message)); - filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '(abc)+'")); + filter = FilterImpl.createFilter(SimpleString.of("MyString LIKE '(abc)+'")); doPutStringProperty("MyString", "(abc)+"); assertTrue(filter.match(message)); - filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '(abc){3}'")); + filter = FilterImpl.createFilter(SimpleString.of("MyString LIKE '(abc){3}'")); doPutStringProperty("MyString", "(abc){3}"); assertTrue(filter.match(message)); - filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '(abc){3,5}'")); + filter = FilterImpl.createFilter(SimpleString.of("MyString LIKE '(abc){3,5}'")); doPutStringProperty("MyString", "(abc){3,5}"); assertTrue(filter.match(message)); - filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '(abc){3,}'")); + filter = FilterImpl.createFilter(SimpleString.of("MyString LIKE '(abc){3,}'")); doPutStringProperty("MyString", "(abc){3,}"); assertTrue(filter.match(message)); - filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '(?=abc)'")); + filter = FilterImpl.createFilter(SimpleString.of("MyString LIKE '(?=abc)'")); doPutStringProperty("MyString", "(?=abc)"); assertTrue(filter.match(message)); - filter = FilterImpl.createFilter(new SimpleString("MyString LIKE '(?!abc)'")); + filter = FilterImpl.createFilter(SimpleString.of("MyString LIKE '(?!abc)'")); doPutStringProperty("MyString", "(?!abc)"); assertTrue(filter.match(message)); } @@ -698,14 +698,14 @@ public class FilterTest extends SilentTestCase { // } // // FilterParser parse = new FilterParser(); - // SimpleStringReader reader = new SimpleStringReader(new SimpleString(largeString)); + // SimpleStringReader reader = new SimpleStringReader(SimpleString.of(largeString)); // parse.ReInit(reader); // // the server would fail at doing this when HORNETQ-545 wasn't solved // parse.getNextToken(); // } private void doPutStringProperty(final String key, final String value) { - message.putStringProperty(new SimpleString(key), new SimpleString(value)); + message.putStringProperty(SimpleString.of(key), SimpleString.of(value)); } private void testInvalidFilter(final String filterString) throws Exception { diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/management/impl/openmbean/OpenTypeSupportTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/management/impl/openmbean/OpenTypeSupportTest.java index e5f7ad9d25..2e6db3bc09 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/management/impl/openmbean/OpenTypeSupportTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/management/impl/openmbean/OpenTypeSupportTest.java @@ -36,7 +36,7 @@ public class OpenTypeSupportTest { coreMessage.initBuffer(1024); coreMessage.setType(Message.TEXT_TYPE); - TextMessageUtil.writeBodyText(coreMessage.getBodyBuffer(), SimpleString.toSimpleString(bodyText)); + TextMessageUtil.writeBodyText(coreMessage.getBodyBuffer(), SimpleString.of(bodyText)); CompositeData cd = coreMessage.toCompositeData(256, 1); diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/paging/cursor/impl/ConcurrentAckTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/paging/cursor/impl/ConcurrentAckTest.java index 91b1ef3e64..81a68e6a06 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/paging/cursor/impl/ConcurrentAckTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/paging/cursor/impl/ConcurrentAckTest.java @@ -59,7 +59,7 @@ public class ConcurrentAckTest extends ServerTestBase { private void testConcurrentAddAckPaging(ScheduledExecutorService scheduledExecutorService, ExecutorService service) throws Throwable { AtomicInteger errors = new AtomicInteger(0); - PagingStoreImpl store = new PagingStoreImpl(SimpleString.toSimpleString("TEST"), scheduledExecutorService, 100L, Mockito.mock(PagingManager.class), new NullStorageManager(), Mockito.mock(SequentialFileFactory.class), Mockito.mock(PagingStoreFactory.class), SimpleString.toSimpleString("TEST"), new AddressSettings(), ArtemisExecutor.delegate(service), ArtemisExecutor.delegate(service), false); + PagingStoreImpl store = new PagingStoreImpl(SimpleString.of("TEST"), scheduledExecutorService, 100L, Mockito.mock(PagingManager.class), new NullStorageManager(), Mockito.mock(SequentialFileFactory.class), Mockito.mock(PagingStoreFactory.class), SimpleString.of("TEST"), new AddressSettings(), ArtemisExecutor.delegate(service), ArtemisExecutor.delegate(service), false); PageCursorProviderImpl pageCursorProvider = new PageCursorProviderImpl(store, new NullStorageManager()); PageSubscriptionImpl subscription = (PageSubscriptionImpl) pageCursorProvider.createSubscription(1, null, true); diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/QueueConfigTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/QueueConfigTest.java index 1f1b7cdf12..2dd8c4456c 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/QueueConfigTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/QueueConfigTest.java @@ -26,14 +26,14 @@ public class QueueConfigTest { @Test public void addressMustBeDefaultedToName() { - final QueueConfig queueConfig = QueueConfig.builderWith(1L, new SimpleString("queue_name")).build(); + final QueueConfig queueConfig = QueueConfig.builderWith(1L, SimpleString.of("queue_name")).build(); assertEquals(queueConfig.name(), queueConfig.address()); } @Test public void cannotAllowNullAddress() { assertThrows(IllegalStateException.class, () -> { - QueueConfig.builderWith(1L, new SimpleString("queue_name"), null); + QueueConfig.builderWith(1L, SimpleString.of("queue_name"), null); }); } @@ -47,7 +47,7 @@ public class QueueConfigTest { @Test public void cannotAllowNullNameWithAddress() { assertThrows(IllegalStateException.class, () -> { - QueueConfig.builderWith(1L, null, new SimpleString("queue_address")); + QueueConfig.builderWith(1L, null, SimpleString.of("queue_address")); }); } } diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/files/FileMoveManagerTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/files/FileMoveManagerTest.java index 02292585c0..535c623a90 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/files/FileMoveManagerTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/files/FileMoveManagerTest.java @@ -307,7 +307,7 @@ public class FileMoveManagerTest extends ArtemisTestCase { managerImpl.start(); - PagingStore store = managerImpl.getPageStore(new SimpleString("simple-test")); + PagingStore store = managerImpl.getPageStore(SimpleString.of("simple-test")); store.startPaging(); diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/group/impl/ClusteredResetMockTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/group/impl/ClusteredResetMockTest.java index 36e42f800b..e2ffb3f231 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/group/impl/ClusteredResetMockTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/group/impl/ClusteredResetMockTest.java @@ -73,7 +73,7 @@ import org.junit.jupiter.api.Test; */ public class ClusteredResetMockTest extends ServerTestBase { - public static final SimpleString ANYCLUSTER = SimpleString.toSimpleString("anycluster"); + public static final SimpleString ANYCLUSTER = SimpleString.of("anycluster"); @Test public void testMultipleSenders() throws Throwable { @@ -82,7 +82,7 @@ public class ClusteredResetMockTest extends ServerTestBase { ReusableLatch latchSends = new ReusableLatch(NUMBER_OF_SENDERS); FakeManagement fake = new FakeManagement(latchSends); - RemoteGroupingHandler handler = new RemoteGroupingHandler(fake, SimpleString.toSimpleString("tst1"), SimpleString.toSimpleString("tst2"), 50000, 499); + RemoteGroupingHandler handler = new RemoteGroupingHandler(fake, SimpleString.of("tst1"), SimpleString.of("tst2"), 50000, 499); handler.start(); Sender[] sn = new Sender[NUMBER_OF_SENDERS]; @@ -150,7 +150,7 @@ public class ClusteredResetMockTest extends ServerTestBase { Sender(String code, RemoteGroupingHandler handler) { super("Sender::" + code); - this.code = SimpleString.toSimpleString(code); + this.code = SimpleString.of(code); this.handler = handler; } diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/QueueImplTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/QueueImplTest.java index 346fabcb6f..dd24e803c3 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/QueueImplTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/QueueImplTest.java @@ -46,7 +46,7 @@ public class QueueImplTest { @Test public void deleteAllPagedReferencesTest() throws Exception { - SimpleString address = new SimpleString("test"); + SimpleString address = SimpleString.of("test"); AtomicInteger pageIteratorIndex = new AtomicInteger(0); PageIterator pageIterator = Mockito.mock(PageIterator.class); PageSubscription pageSubscription = Mockito.mock(PageSubscription.class); diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/RoutingContextTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/RoutingContextTest.java index 16df10cbc0..31ee0db827 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/RoutingContextTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/RoutingContextTest.java @@ -90,7 +90,7 @@ public class RoutingContextTest { @Override public SimpleString getName() { - return SimpleString.toSimpleString(name); + return SimpleString.of(name); } @Override @@ -862,7 +862,7 @@ public class RoutingContextTest { @Override public SimpleString getAddress() { - return SimpleString.toSimpleString(name); + return SimpleString.of(name); } @Override @@ -946,25 +946,25 @@ public class RoutingContextTest { RoutingContext context = new RoutingContextImpl(new TransactionImpl(new NullStorageManager())); assertFalse(context.isInternal()); - context.addQueue(SimpleString.toSimpleString("t1"), new FakeQueueForRoutingContextTest("t1", true, true)); + context.addQueue(SimpleString.of("t1"), new FakeQueueForRoutingContextTest("t1", true, true)); assertTrue(context.isInternal()); - context.addQueue(SimpleString.toSimpleString("t2"), new FakeQueueForRoutingContextTest("t2", false, true)); + context.addQueue(SimpleString.of("t2"), new FakeQueueForRoutingContextTest("t2", false, true)); assertFalse(context.isInternal()); - context.addQueue(SimpleString.toSimpleString("t3"), new FakeQueueForRoutingContextTest("t3", true, true)); + context.addQueue(SimpleString.of("t3"), new FakeQueueForRoutingContextTest("t3", true, true)); assertFalse(context.isInternal()); context.clear(); assertFalse(context.isInternal()); - context.addQueue(SimpleString.toSimpleString("t1"), new FakeQueueForRoutingContextTest("t1", true, true)); + context.addQueue(SimpleString.of("t1"), new FakeQueueForRoutingContextTest("t1", true, true)); assertTrue(context.isInternal()); - context.addQueue(SimpleString.toSimpleString("t2"), new FakeQueueForRoutingContextTest("t2", true, true)); + context.addQueue(SimpleString.of("t2"), new FakeQueueForRoutingContextTest("t2", true, true)); assertTrue(context.isInternal()); - context.addQueue(SimpleString.toSimpleString("t3"), new FakeQueueForRoutingContextTest("t3", true, true)); + context.addQueue(SimpleString.of("t3"), new FakeQueueForRoutingContextTest("t3", true, true)); assertTrue(context.isInternal()); } diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/management/ArtemisRbacMBeanServerBuilderTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/management/ArtemisRbacMBeanServerBuilderTest.java index 8086fc3095..1262fcf25a 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/management/ArtemisRbacMBeanServerBuilderTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/management/ArtemisRbacMBeanServerBuilderTest.java @@ -80,7 +80,7 @@ public class ArtemisRbacMBeanServerBuilderTest extends ServerTestBase { MBeanServer proxy = underTest.newMBeanServer("d", mbeanServer, mBeanServerDelegate); ArtemisRbacInvocationHandler handler = (ArtemisRbacInvocationHandler) Proxy.getInvocationHandler(proxy); handler.brokerDomain = "a.b"; - handler.rbacPrefix = SimpleString.toSimpleString("jmx"); + handler.rbacPrefix = SimpleString.of("jmx"); try { handler.addressFrom(null); @@ -90,15 +90,15 @@ public class ArtemisRbacMBeanServerBuilderTest extends ServerTestBase { SimpleString rbacAddress = handler.addressFrom(new ObjectName("java.lang", "type", "Runtime")); assertNotNull(rbacAddress); - assertEquals(0, rbacAddress.compareTo(SimpleString.toSimpleString("jmx.java.lang.Runtime"))); + assertEquals(0, rbacAddress.compareTo(SimpleString.of("jmx.java.lang.Runtime"))); rbacAddress = handler.addressFrom(new ObjectName("a.b", "type", "Runtime")); assertNotNull(rbacAddress); - assertEquals(0, rbacAddress.compareTo(SimpleString.toSimpleString("jmx"))); + assertEquals(0, rbacAddress.compareTo(SimpleString.of("jmx"))); rbacAddress = handler.addressFrom(new ObjectName("a.b", "broker", "bb")); assertNotNull(rbacAddress); - assertEquals(0, rbacAddress.compareTo(SimpleString.toSimpleString("jmx.broker"))); + assertEquals(0, rbacAddress.compareTo(SimpleString.of("jmx.broker"))); Hashtable attrs = new Hashtable<>(); attrs.put("broker", "bb"); @@ -107,17 +107,17 @@ public class ArtemisRbacMBeanServerBuilderTest extends ServerTestBase { attrs.put("name", "n"); rbacAddress = handler.addressFrom(new ObjectName("a.b", attrs)); assertNotNull(rbacAddress); - assertEquals(0, rbacAddress.compareTo(SimpleString.toSimpleString("jmx.c.n"))); + assertEquals(0, rbacAddress.compareTo(SimpleString.of("jmx.c.n"))); rbacAddress = handler.addressFrom(new ObjectName("a.b", attrs), "doIt"); assertNotNull(rbacAddress); - assertEquals(0, rbacAddress.compareTo(SimpleString.toSimpleString("jmx.c.n.doIt"))); + assertEquals(0, rbacAddress.compareTo(SimpleString.of("jmx.c.n.doIt"))); // non broker domain rbacAddress = handler.addressFrom(new ObjectName("j.l", attrs)); assertNotNull(rbacAddress); - assertEquals(0, rbacAddress.compareTo(SimpleString.toSimpleString("jmx.j.l.t.c.n"))); + assertEquals(0, rbacAddress.compareTo(SimpleString.of("jmx.j.l.t.c.n"))); // address attrs.clear(); @@ -127,7 +127,7 @@ public class ArtemisRbacMBeanServerBuilderTest extends ServerTestBase { attrs.put("component", "addresses"); rbacAddress = handler.addressFrom(new ObjectName("a.b", attrs), "opOnA"); assertNotNull(rbacAddress); - assertEquals(0, rbacAddress.compareTo(SimpleString.toSimpleString("jmx.address.a.opOnA"))); + assertEquals(0, rbacAddress.compareTo(SimpleString.of("jmx.address.a.opOnA"))); // queue attrs.clear(); @@ -140,7 +140,7 @@ public class ArtemisRbacMBeanServerBuilderTest extends ServerTestBase { rbacAddress = handler.addressFrom(new ObjectName("a.b", attrs), "opOnQ"); assertNotNull(rbacAddress); - assertEquals(0, rbacAddress.compareTo(SimpleString.toSimpleString("jmx.queue.q.opOnQ"))); + assertEquals(0, rbacAddress.compareTo(SimpleString.of("jmx.queue.q.opOnQ"))); // divert attrs.clear(); @@ -154,7 +154,7 @@ public class ArtemisRbacMBeanServerBuilderTest extends ServerTestBase { rbacAddress = handler.addressFrom(new ObjectName("a.b", attrs), "opOnDivert"); assertNotNull(rbacAddress); - assertEquals(0, rbacAddress.compareTo(SimpleString.toSimpleString("jmx.divert.d.opOnDivert"))); + assertEquals(0, rbacAddress.compareTo(SimpleString.of("jmx.divert.d.opOnDivert"))); } @@ -164,7 +164,7 @@ public class ArtemisRbacMBeanServerBuilderTest extends ServerTestBase { ArtemisRbacInvocationHandler handler = (ArtemisRbacInvocationHandler) Proxy.getInvocationHandler(proxy); handler.brokerDomain = ActiveMQDefaultConfiguration.getDefaultJmxDomain(); - handler.rbacPrefix = SimpleString.toSimpleString(ActiveMQDefaultConfiguration.getManagementRbacPrefix()); + handler.rbacPrefix = SimpleString.of(ActiveMQDefaultConfiguration.getManagementRbacPrefix()); for (Method m : ObjectNameBuilder.class.getDeclaredMethods() ) { if (Modifier.isPublic(m.getModifiers()) && ObjectName.class == m.getReturnType()) { diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImplTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImplTest.java index 9578e213ce..f2db2b01c8 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImplTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImplTest.java @@ -81,7 +81,7 @@ public class ManagementServiceImplTest { managementService.registerAcceptor(acceptor, transportConfig); managementService.getAttribute(ResourceNames.ACCEPTOR + transportConfig.getName(), "name", auth); - SimpleString expected = SimpleString.toSimpleString("mm.acceptor.a1.getName"); + SimpleString expected = SimpleString.of("mm.acceptor.a1.getName"); Mockito.verify(securityStore).check(Mockito.eq(expected), Mockito.eq(CheckType.VIEW), Mockito.any(SecurityAuth.class)); // address @@ -91,19 +91,19 @@ public class ManagementServiceImplTest { managementService.registerAddress(new AddressInfo(addressName)); managementService.getAttribute(ResourceNames.ADDRESS + addressName, "address", auth); - expected = SimpleString.toSimpleString("mm.address." + addressName + ".getAddress"); + expected = SimpleString.of("mm.address." + addressName + ".getAddress"); Mockito.verify(securityStore).check(Mockito.eq(expected), Mockito.eq(CheckType.VIEW), Mockito.any(SecurityAuth.class)); // isX needs UPDATE with view regexp above Mockito.clearInvocations(securityStore); managementService.getAttribute(ResourceNames.ADDRESS + addressName, "paging", auth); - expected = SimpleString.toSimpleString("mm.address." + addressName + ".isPaging"); + expected = SimpleString.of("mm.address." + addressName + ".isPaging"); Mockito.verify(securityStore).check(Mockito.eq(expected), Mockito.eq(CheckType.EDIT), Mockito.any(SecurityAuth.class)); // queue - final SimpleString queueName = SimpleString.toSimpleString("queueName"); + final SimpleString queueName = SimpleString.of("queueName"); Mockito.clearInvocations(securityStore); Queue queue = Mockito.mock(Queue.class); @@ -114,13 +114,13 @@ public class ManagementServiceImplTest { managementService.registerQueue(queue, new AddressInfo(queueName), storageManager); managementService.getAttribute(ResourceNames.QUEUE + queueName, "ringSize", auth); - expected = SimpleString.toSimpleString("mm.queue." + queueName + ".getRingSize"); + expected = SimpleString.of("mm.queue." + queueName + ".getRingSize"); Mockito.verify(securityStore).check(Mockito.eq(expected), Mockito.eq(CheckType.VIEW), Mockito.any(SecurityAuth.class)); Mockito.clearInvocations(securityStore); managementService.getAttribute(ResourceNames.QUEUE + queueName, "ID", auth); - expected = SimpleString.toSimpleString("mm.queue." + queueName + ".getID"); + expected = SimpleString.of("mm.queue." + queueName + ".getID"); Mockito.verify(securityStore).check(Mockito.eq(expected), Mockito.eq(CheckType.VIEW), Mockito.any(SecurityAuth.class)); } @@ -152,7 +152,7 @@ public class ManagementServiceImplTest { managementService.registerAcceptor(acceptor, transportConfig); managementService.invokeOperation(ResourceNames.ACCEPTOR + transportConfig.getName(), "getName", new Object[]{}, auth); - SimpleString expected = SimpleString.toSimpleString("$mm.acceptor.a1.getName"); + SimpleString expected = SimpleString.of("$mm.acceptor.a1.getName"); Mockito.verify(securityStore).check(Mockito.eq(expected), Mockito.eq(CheckType.VIEW), Mockito.any(SecurityAuth.class)); // address @@ -162,11 +162,11 @@ public class ManagementServiceImplTest { managementService.registerAddress(new AddressInfo(addressName)); managementService.invokeOperation(ResourceNames.ADDRESS + addressName, "getAddress", new Object[]{}, auth); - expected = SimpleString.toSimpleString("$mm.address." + addressName + ".getAddress"); + expected = SimpleString.of("$mm.address." + addressName + ".getAddress"); Mockito.verify(securityStore).check(Mockito.eq(expected), Mockito.eq(CheckType.VIEW), Mockito.any(SecurityAuth.class)); // queue - final SimpleString queueName = SimpleString.toSimpleString("queueName"); + final SimpleString queueName = SimpleString.of("queueName"); Mockito.clearInvocations(securityStore); Queue queue = Mockito.mock(Queue.class); @@ -177,14 +177,14 @@ public class ManagementServiceImplTest { managementService.registerQueue(queue, new AddressInfo(queueName), storageManager); managementService.invokeOperation(ResourceNames.QUEUE + queueName, "getRingSize", new Object[]{}, auth); - expected = SimpleString.toSimpleString("$mm.queue." + queueName + ".getRingSize"); + expected = SimpleString.of("$mm.queue." + queueName + ".getRingSize"); Mockito.verify(securityStore).check(Mockito.eq(expected), Mockito.eq(CheckType.VIEW), Mockito.any(SecurityAuth.class)); // update permission required on pause operation Mockito.clearInvocations(securityStore); managementService.invokeOperation(ResourceNames.QUEUE + queueName, "pause", new Object[]{}, auth); - expected = SimpleString.toSimpleString("$mm.queue." + queueName + ".pause"); + expected = SimpleString.of("$mm.queue." + queueName + ".pause"); Mockito.verify(securityStore).check(Mockito.eq(expected), Mockito.eq(CheckType.EDIT), Mockito.any(SecurityAuth.class)); } diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/settings/AddressSettingsTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/settings/AddressSettingsTest.java index d37a658ade..f3af43b96b 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/settings/AddressSettingsTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/settings/AddressSettingsTest.java @@ -75,8 +75,8 @@ public class AddressSettingsTest extends ServerTestBase { private void testSingleMerge(boolean copy) { AddressSettings addressSettings = new AddressSettings(); AddressSettings addressSettingsToMerge = new AddressSettings(); - SimpleString DLQ = new SimpleString("testDLQ"); - SimpleString exp = new SimpleString("testExpiryQueue"); + SimpleString DLQ = SimpleString.of("testDLQ"); + SimpleString exp = SimpleString.of("testExpiryQueue"); addressSettingsToMerge.setDeadLetterAddress(DLQ); addressSettingsToMerge.setExpiryAddress(exp); addressSettingsToMerge.setMaxDeliveryAttempts(1000); @@ -128,8 +128,8 @@ public class AddressSettingsTest extends ServerTestBase { private void testMultipleMerge(boolean copy) { AddressSettings addressSettings = new AddressSettings(); AddressSettings addressSettingsToMerge = new AddressSettings(); - SimpleString DLQ = new SimpleString("testDLQ"); - SimpleString exp = new SimpleString("testExpiryQueue"); + SimpleString DLQ = SimpleString.of("testDLQ"); + SimpleString exp = SimpleString.of("testExpiryQueue"); addressSettingsToMerge.setDeadLetterAddress(DLQ); addressSettingsToMerge.setExpiryAddress(exp); addressSettingsToMerge.setMaxDeliveryAttempts(1000); @@ -144,7 +144,7 @@ public class AddressSettingsTest extends ServerTestBase { } AddressSettings addressSettingsToMerge2 = new AddressSettings(); - SimpleString exp2 = new SimpleString("testExpiryQueue2"); + SimpleString exp2 = SimpleString.of("testExpiryQueue2"); addressSettingsToMerge2.setExpiryAddress(exp2); addressSettingsToMerge2.setMaxSizeBytes(2001); addressSettingsToMerge2.setRedeliveryDelay(2003); @@ -179,8 +179,8 @@ public class AddressSettingsTest extends ServerTestBase { private void testMultipleMergeAll(boolean copy) { AddressSettings addressSettings = new AddressSettings(); AddressSettings addressSettingsToMerge = new AddressSettings(); - SimpleString DLQ = new SimpleString("testDLQ"); - SimpleString exp = new SimpleString("testExpiryQueue"); + SimpleString DLQ = SimpleString.of("testDLQ"); + SimpleString exp = SimpleString.of("testExpiryQueue"); addressSettingsToMerge.setDeadLetterAddress(DLQ); addressSettingsToMerge.setExpiryAddress(exp); addressSettingsToMerge.setMaxSizeBytes(1001); @@ -194,8 +194,8 @@ public class AddressSettingsTest extends ServerTestBase { } AddressSettings addressSettingsToMerge2 = new AddressSettings(); - SimpleString exp2 = new SimpleString("testExpiryQueue2"); - SimpleString DLQ2 = new SimpleString("testDlq2"); + SimpleString exp2 = SimpleString.of("testExpiryQueue2"); + SimpleString DLQ2 = SimpleString.of("testDlq2"); addressSettingsToMerge2.setExpiryAddress(exp2); addressSettingsToMerge2.setDeadLetterAddress(DLQ2); addressSettingsToMerge2.setMaxDeliveryAttempts(2000); @@ -225,8 +225,8 @@ public class AddressSettingsTest extends ServerTestBase { @Test public void testToJSON() { AddressSettings addressSettings = new AddressSettings(); - SimpleString DLQ = new SimpleString("testDLQ"); - SimpleString exp = new SimpleString("testExpiryQueue"); + SimpleString DLQ = SimpleString.of("testDLQ"); + SimpleString exp = SimpleString.of("testExpiryQueue"); addressSettings.setDeadLetterAddress(DLQ); addressSettings.setExpiryAddress(exp); addressSettings.setMaxSizeBytes(1001); diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/SimpleStringTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/SimpleStringTest.java index c566bf1640..a2cac17e64 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/SimpleStringTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/SimpleStringTest.java @@ -46,12 +46,12 @@ public class SimpleStringTest { */ @Test public void testGetChar() { - SimpleString p1 = new SimpleString("foo"); - SimpleString p2 = new SimpleString("bar"); + SimpleString p1 = SimpleString.of("foo"); + SimpleString p2 = SimpleString.of("bar"); for (int i = 0; i < 1 << 16; i++) { String msg = "expecting " + i; char c = (char) i; - SimpleString s = new SimpleString(String.valueOf(c)); + SimpleString s = SimpleString.of(String.valueOf(c)); // test getChars(...) char[] c1 = new char[1]; @@ -66,7 +66,7 @@ public class SimpleStringTest { assertEquals(c, s2.charAt(1), msg); // test splitting with chars - SimpleString sSplit = new SimpleString("foo" + String.valueOf(c) + "bar"); + SimpleString sSplit = SimpleString.of("foo" + String.valueOf(c) + "bar"); SimpleString[] chunks = sSplit.split(c); SimpleString[] split1 = p1.split(c); SimpleString[] split2 = p2.split(c); @@ -86,7 +86,7 @@ public class SimpleStringTest { public void testString() throws Exception { final String str = "hello123ABC__524`16254`6125!%^$!%$!%$!%$!%!$%!$$!\uA324"; - SimpleString s = new SimpleString(str); + SimpleString s = SimpleString.of(str); assertEquals(str, s.toString()); @@ -94,32 +94,32 @@ public class SimpleStringTest { byte[] data = s.getData(); - SimpleString s2 = new SimpleString(data); + SimpleString s2 = SimpleString.of(data); assertEquals(str, s2.toString()); } @Test public void testStartsWith() throws Exception { - SimpleString s1 = new SimpleString("abcdefghi"); + SimpleString s1 = SimpleString.of("abcdefghi"); - assertTrue(s1.startsWith(new SimpleString("abc"))); + assertTrue(s1.startsWith(SimpleString.of("abc"))); - assertTrue(s1.startsWith(new SimpleString("abcdef"))); + assertTrue(s1.startsWith(SimpleString.of("abcdef"))); - assertTrue(s1.startsWith(new SimpleString("abcdefghi"))); + assertTrue(s1.startsWith(SimpleString.of("abcdefghi"))); - assertFalse(s1.startsWith(new SimpleString("abcdefghijklmn"))); + assertFalse(s1.startsWith(SimpleString.of("abcdefghijklmn"))); - assertFalse(s1.startsWith(new SimpleString("aardvark"))); + assertFalse(s1.startsWith(SimpleString.of("aardvark"))); - assertFalse(s1.startsWith(new SimpleString("z"))); + assertFalse(s1.startsWith(SimpleString.of("z"))); } @Test public void testCharSequence() throws Exception { String s = "abcdefghijkl"; - SimpleString s1 = new SimpleString(s); + SimpleString s1 = SimpleString.of(s); assertEquals('a', s1.charAt(0)); assertEquals('b', s1.charAt(1)); @@ -162,13 +162,13 @@ public class SimpleStringTest { assertEquals(ss, s1); ss = s1.subSequence(1, 4); - assertEquals(ss, new SimpleString("bcd")); + assertEquals(ss, SimpleString.of("bcd")); ss = s1.subSequence(5, 10); - assertEquals(ss, new SimpleString("fghij")); + assertEquals(ss, SimpleString.of("fghij")); ss = s1.subSequence(5, 12); - assertEquals(ss, new SimpleString("fghijkl")); + assertEquals(ss, SimpleString.of("fghijkl")); try { s1.subSequence(-1, 2); @@ -208,21 +208,21 @@ public class SimpleStringTest { @Test public void testEquals() throws Exception { - assertFalse(new SimpleString("abcdef").equals(new Object())); + assertFalse(SimpleString.of("abcdef").equals(new Object())); - assertFalse(new SimpleString("abcef").equals(null)); + assertFalse(SimpleString.of("abcef").equals(null)); - assertEquals(new SimpleString("abcdef"), new SimpleString("abcdef")); + assertEquals(SimpleString.of("abcdef"), SimpleString.of("abcdef")); - assertFalse(new SimpleString("abcdef").equals(new SimpleString("abggcdef"))); - assertFalse(new SimpleString("abcdef").equals(new SimpleString("ghijkl"))); + assertFalse(SimpleString.of("abcdef").equals(SimpleString.of("abggcdef"))); + assertFalse(SimpleString.of("abcdef").equals(SimpleString.of("ghijkl"))); } @Test public void testHashcode() throws Exception { - SimpleString str = new SimpleString("abcdef"); - SimpleString sameStr = new SimpleString("abcdef"); - SimpleString differentStr = new SimpleString("ghijk"); + SimpleString str = SimpleString.of("abcdef"); + SimpleString sameStr = SimpleString.of("abcdef"); + SimpleString differentStr = SimpleString.of("ghijk"); assertTrue(str.hashCode() == sameStr.hashCode()); assertFalse(str.hashCode() == differentStr.hashCode()); @@ -232,9 +232,9 @@ public class SimpleStringTest { public void testUnicode() throws Exception { String myString = "abcdef&^*&!^ghijkl\uB5E2\uCAC7\uB2BB\uB7DD\uB7C7\uB3A3\uBCE4\uB5A5"; - SimpleString s = new SimpleString(myString); + SimpleString s = SimpleString.of(myString); byte[] data = s.getData(); - s = new SimpleString(data); + s = SimpleString.of(data); assertEquals(myString, s.toString()); } @@ -243,18 +243,18 @@ public class SimpleStringTest { public void testUnicodeWithSurrogates() throws Exception { String myString = "abcdef&^*&!^ghijkl\uD900\uDD00"; - SimpleString s = new SimpleString(myString); + SimpleString s = SimpleString.of(myString); byte[] data = s.getData(); - s = new SimpleString(data); + s = SimpleString.of(data); assertEquals(myString, s.toString()); } @Test public void testSizeofString() throws Exception { - assertEquals(DataConstants.SIZE_INT, SimpleString.sizeofString(new SimpleString(""))); + assertEquals(DataConstants.SIZE_INT, SimpleString.sizeofString(SimpleString.of(""))); - SimpleString str = new SimpleString(RandomUtil.randomString()); + SimpleString str = SimpleString.of(RandomUtil.randomString()); assertEquals(DataConstants.SIZE_INT + str.getData().length, SimpleString.sizeofString(str)); } @@ -262,15 +262,15 @@ public class SimpleStringTest { public void testSizeofNullableString() throws Exception { assertEquals(1, SimpleString.sizeofNullableString(null)); - assertEquals(1 + DataConstants.SIZE_INT, SimpleString.sizeofNullableString(new SimpleString(""))); + assertEquals(1 + DataConstants.SIZE_INT, SimpleString.sizeofNullableString(SimpleString.of(""))); - SimpleString str = new SimpleString(RandomUtil.randomString()); + SimpleString str = SimpleString.of(RandomUtil.randomString()); assertEquals(1 + DataConstants.SIZE_INT + str.getData().length, SimpleString.sizeofNullableString(str)); } @Test public void testSplitNoDelimeter() throws Exception { - SimpleString s = new SimpleString("abcdefghi"); + SimpleString s = SimpleString.of("abcdefghi"); SimpleString[] strings = s.split('.'); assertNotNull(strings); assertEquals(strings.length, 1); @@ -279,31 +279,31 @@ public class SimpleStringTest { @Test public void testSplit1Delimeter() throws Exception { - SimpleString s = new SimpleString("abcd.efghi"); + SimpleString s = SimpleString.of("abcd.efghi"); SimpleString[] strings = s.split('.'); assertNotNull(strings); assertEquals(strings.length, 2); - assertEquals(strings[0], new SimpleString("abcd")); - assertEquals(strings[1], new SimpleString("efghi")); + assertEquals(strings[0], SimpleString.of("abcd")); + assertEquals(strings[1], SimpleString.of("efghi")); } @Test public void testSplitmanyDelimeters() throws Exception { - SimpleString s = new SimpleString("abcd.efghi.jklmn.opqrs.tuvw.xyz"); + SimpleString s = SimpleString.of("abcd.efghi.jklmn.opqrs.tuvw.xyz"); SimpleString[] strings = s.split('.'); assertNotNull(strings); assertEquals(strings.length, 6); - assertEquals(strings[0], new SimpleString("abcd")); - assertEquals(strings[1], new SimpleString("efghi")); - assertEquals(strings[2], new SimpleString("jklmn")); - assertEquals(strings[3], new SimpleString("opqrs")); - assertEquals(strings[4], new SimpleString("tuvw")); - assertEquals(strings[5], new SimpleString("xyz")); + assertEquals(strings[0], SimpleString.of("abcd")); + assertEquals(strings[1], SimpleString.of("efghi")); + assertEquals(strings[2], SimpleString.of("jklmn")); + assertEquals(strings[3], SimpleString.of("opqrs")); + assertEquals(strings[4], SimpleString.of("tuvw")); + assertEquals(strings[5], SimpleString.of("xyz")); } @Test public void testContains() { - SimpleString simpleString = new SimpleString("abcdefghijklmnopqrst"); + SimpleString simpleString = SimpleString.of("abcdefghijklmnopqrst"); assertFalse(simpleString.contains('.')); assertFalse(simpleString.contains('%')); assertFalse(simpleString.contains('8')); @@ -332,14 +332,14 @@ public class SimpleStringTest { @Test public void testConcat() { - SimpleString start = new SimpleString("abcdefg"); - SimpleString middle = new SimpleString("hijklmnop"); - SimpleString end = new SimpleString("qrstuvwxyz"); - assertEquals(start.concat(middle).concat(end), new SimpleString("abcdefghijklmnopqrstuvwxyz")); - assertEquals(start.concat('.').concat(end), new SimpleString("abcdefg.qrstuvwxyz")); + SimpleString start = SimpleString.of("abcdefg"); + SimpleString middle = SimpleString.of("hijklmnop"); + SimpleString end = SimpleString.of("qrstuvwxyz"); + assertEquals(start.concat(middle).concat(end), SimpleString.of("abcdefghijklmnopqrstuvwxyz")); + assertEquals(start.concat('.').concat(end), SimpleString.of("abcdefg.qrstuvwxyz")); // Testing concat of SimpleString with String for (int i = 0; i < 10; i++) { - assertEquals(new SimpleString("abcdefg-" + i), start.concat("-" + Integer.toString(i))); + assertEquals(SimpleString.of("abcdefg-" + i), start.concat("-" + Integer.toString(i))); } } @@ -355,9 +355,9 @@ public class SimpleStringTest { } String strvalue = buffer.toString(); - final int initialhash = new SimpleString(strvalue).hashCode(); + final int initialhash = SimpleString.of(strvalue).hashCode(); - final SimpleString value = new SimpleString(strvalue); + final SimpleString value = SimpleString.of(strvalue); int nThreads = 100; final CountDownLatch latch = new CountDownLatch(nThreads); @@ -407,7 +407,7 @@ public class SimpleStringTest { @Test public void testToSimpleStringPoolStringArgument() throws Exception { final String s = "pooled"; - final SimpleString ss = SimpleString.toSimpleString(s); + final SimpleString ss = SimpleString.of(s); final String s1 = ss.toString(); assertSame(s, s1, "SimpleString::toSimpleString is not pooling the given String"); } @@ -417,10 +417,10 @@ public class SimpleStringTest { final int capacity = 8; final int chars = Integer.toString(capacity).length(); final SimpleString.ByteBufSimpleStringPool pool = new SimpleString.ByteBufSimpleStringPool(capacity, chars); - final int bytes = new SimpleString(Integer.toString(capacity)).sizeof(); + final int bytes = SimpleString.of(Integer.toString(capacity)).sizeof(); final ByteBuf bb = Unpooled.buffer(bytes, bytes); for (int i = 0; i < capacity; i++) { - final SimpleString s = new SimpleString(Integer.toString(i)); + final SimpleString s = SimpleString.of(Integer.toString(i)); bb.resetWriterIndex(); SimpleString.writeSimpleString(bb, s); bb.resetReaderIndex(); @@ -433,7 +433,7 @@ public class SimpleStringTest { @Test public void testByteBufSimpleStringPoolTooLong() { - final SimpleString tooLong = new SimpleString("aa"); + final SimpleString tooLong = SimpleString.of("aa"); final ByteBuf bb = Unpooled.buffer(tooLong.sizeof(), tooLong.sizeof()); SimpleString.writeSimpleString(bb, tooLong); final SimpleString.ByteBufSimpleStringPool pool = new SimpleString.ByteBufSimpleStringPool(1, tooLong.length() - 1); 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 a6b7e615f0..3db8eaa577 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 @@ -91,7 +91,7 @@ public class ArtemisBrokerWrapper extends ArtemisBrokerBase { commonSettings = new AddressSettings(); addressSettingsMap.put(match, commonSettings); } - SimpleString dla = new SimpleString("ActiveMQ.DLQ"); + SimpleString dla = SimpleString.of("ActiveMQ.DLQ"); commonSettings.setDeadLetterAddress(dla); commonSettings.setExpiryAddress(dla); commonSettings.setAutoCreateQueues(true); @@ -260,7 +260,7 @@ public class ArtemisBrokerWrapper extends ArtemisBrokerBase { synchronized (testQueues) { SimpleString coreQ = testQueues.get(qname); if (coreQ == null) { - coreQ = new SimpleString(qname); + coreQ = SimpleString.of(qname); try { this.server.createQueue(new QueueConfiguration(coreQ).setDurable(false)); testQueues.put(qname, coreQ); @@ -282,7 +282,7 @@ public class ArtemisBrokerWrapper extends ArtemisBrokerBase { } else { qname = amq5Dest.getPhysicalName(); } - Binding binding = server.getPostOffice().getBinding(new SimpleString(qname)); + Binding binding = server.getPostOffice().getBinding(SimpleString.of(qname)); if (binding != null) { QueueImpl q = (QueueImpl) binding.getBindable(); count = q.getMessageCount(); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSConsumerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSConsumerTest.java index 40b388f239..f6a8be7464 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSConsumerTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSConsumerTest.java @@ -909,7 +909,7 @@ public class JMSConsumerTest extends JmsTestSupport { private QueueControl createQueueControl(String destName) throws Exception { ArtemisBrokerWrapper wrapper = (ArtemisBrokerWrapper) broker.getBroker(); MBeanServer beanServer = wrapper.getMbeanServer(); - SimpleString address = new SimpleString(destName); + SimpleString address = SimpleString.of(destName); ObjectName objName = ObjectNameBuilder.DEFAULT.getQueueObjectName(address, address, RoutingType.ANYCAST); return MBeanServerInvocationHandler.newProxyInstance(beanServer, objName, QueueControl.class, false); } diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueCompositeSendReceiveTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueCompositeSendReceiveTest.java index 14559337a2..5f7e322086 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueCompositeSendReceiveTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueCompositeSendReceiveTest.java @@ -118,7 +118,7 @@ public class JmsQueueCompositeSendReceiveTest extends JmsTopicSendReceiveTest { try (ServerLocator locator = ServerLocatorImpl.newLocator("tcp://localhost:61616"); ClientSessionFactory factory = locator.createSessionFactory(); ClientSession session = factory.createSession()) { - ClientSession.QueueQuery query = session.queueQuery(new SimpleString("TEST")); + ClientSession.QueueQuery query = session.queueQuery(SimpleString.of("TEST")); assertNotNull(query); assertEquals(data.length, query.getMessageCount()); } diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/OptimizedAckTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/OptimizedAckTest.java index 23de19fac5..15bd5f5396 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/OptimizedAckTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/OptimizedAckTest.java @@ -65,7 +65,7 @@ public class OptimizedAckTest extends TestSupport { MessageConsumer consumer = session.createConsumer(queue); //check queue delivering count is 10 ArtemisBrokerWrapper broker = (ArtemisBrokerWrapper) ArtemisBrokerHelper.getBroker().getBroker(); - Binding binding = broker.getServer().getPostOffice().getBinding(new SimpleString("test")); + Binding binding = broker.getServer().getPostOffice().getBinding(SimpleString.of("test")); final QueueImpl coreQueue = (QueueImpl) binding.getBindable(); assertTrue("delivering count is 10", Wait.waitFor(new Wait.Condition() { @@ -107,7 +107,7 @@ public class OptimizedAckTest extends TestSupport { //check queue delivering count is 10 ArtemisBrokerWrapper broker = (ArtemisBrokerWrapper) ArtemisBrokerHelper.getBroker().getBroker(); - Binding binding = broker.getServer().getPostOffice().getBinding(new SimpleString("test")); + Binding binding = broker.getServer().getPostOffice().getBinding(SimpleString.of("test")); final QueueImpl coreQueue = (QueueImpl) binding.getBindable(); assertTrue("prefetch full", Wait.waitFor(new Wait.Condition() { @@ -151,7 +151,7 @@ public class OptimizedAckTest extends TestSupport { MessageConsumer consumer = session.createConsumer(queue); ArtemisBrokerWrapper broker = (ArtemisBrokerWrapper) ArtemisBrokerHelper.getBroker().getBroker(); - Binding binding = broker.getServer().getPostOffice().getBinding(new SimpleString("test")); + Binding binding = broker.getServer().getPostOffice().getBinding(SimpleString.of("test")); final QueueImpl coreQueue = (QueueImpl) binding.getBindable(); assertTrue("prefetch full", Wait.waitFor(new Wait.Condition() { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/AMQ1925Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/AMQ1925Test.java index 9ba3156d0e..f83e9da55d 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/AMQ1925Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/AMQ1925Test.java @@ -157,7 +157,7 @@ public class AMQ1925Test extends OpenwireArtemisBaseTest implements ExceptionLis } private void assertQueueLength(int len) throws Exception, IOException { - QueueImpl queue = (QueueImpl) bs.getActiveMQServer().getPostOffice().getBinding(new SimpleString(QUEUE_NAME)).getBindable(); + QueueImpl queue = (QueueImpl) bs.getActiveMQServer().getPostOffice().getBinding(SimpleString.of(QUEUE_NAME)).getBindable(); if (len > queue.getMessageCount()) { //we wait for a moment as the tx might still in afterCommit stage (async op) Thread.sleep(5000); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerUnconsumedTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerUnconsumedTest.java index 3549baa6e1..02a0d442a2 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerUnconsumedTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerUnconsumedTest.java @@ -243,7 +243,7 @@ public class FailoverConsumerUnconsumedTest extends OpenwireArtemisBaseTest { testConsumers.add(new TestConsumer(consumerSession, destination, connection)); } - assureQueueMessages(0, new SimpleString(QUEUE_NAME)); + assureQueueMessages(0, SimpleString.of(QUEUE_NAME)); produceMessage(consumerSession, destination, maxConsumers * prefetch); diff --git a/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/MultiThreadRandomReattachTestBase.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/MultiThreadRandomReattachTestBase.java index 4ce24de3e7..5b65a59b4b 100644 --- a/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/MultiThreadRandomReattachTestBase.java +++ b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/MultiThreadRandomReattachTestBase.java @@ -63,7 +63,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt private final int NUM_THREADS = getNumThreads(); - protected static final SimpleString ADDRESS = new SimpleString("FailoverTestAddress"); + protected static final SimpleString ADDRESS = SimpleString.of("FailoverTestAddress"); protected ActiveMQServer server; @@ -258,7 +258,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt protected void doTestA(final ClientSessionFactory sf, final int threadNum, final ClientSession session2) throws Exception { - SimpleString subName = new SimpleString("sub" + threadNum); + SimpleString subName = SimpleString.of("sub" + threadNum); ClientSession session = addClientSession(sf.createSession(false, true, true)); @@ -312,7 +312,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt Set sessions = new HashSet<>(); for (int i = 0; i < numSessions; i++) { - SimpleString subName = new SimpleString(threadNum + "sub" + i); + SimpleString subName = SimpleString.of(threadNum + "sub" + i); ClientSession sessConsume = createAutoCommitSession(sf); @@ -365,7 +365,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt } for (int i = 0; i < numSessions; i++) { - SimpleString subName = new SimpleString(threadNum + "sub" + i); + SimpleString subName = SimpleString.of(threadNum + "sub" + i); s.deleteQueue(subName); } @@ -390,7 +390,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt Set sessions = new HashSet<>(); for (int i = 0; i < numSessions; i++) { - SimpleString subName = new SimpleString(threadNum + "sub" + i); + SimpleString subName = SimpleString.of(threadNum + "sub" + i); ClientSession sessConsume = createAutoCommitSession(sf); @@ -445,7 +445,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt } for (int i = 0; i < numSessions; i++) { - SimpleString subName = new SimpleString(threadNum + "sub" + i); + SimpleString subName = SimpleString.of(threadNum + "sub" + i); s.deleteQueue(subName); } @@ -472,7 +472,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt Set sessions = new HashSet<>(); for (int i = 0; i < numSessions; i++) { - SimpleString subName = new SimpleString(threadNum + "sub" + i); + SimpleString subName = SimpleString.of(threadNum + "sub" + i); ClientSession sessConsume = createTransactionalSession(sf); @@ -546,7 +546,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt } for (int i = 0; i < numSessions; i++) { - SimpleString subName = new SimpleString(threadNum + "sub" + i); + SimpleString subName = SimpleString.of(threadNum + "sub" + i); s.deleteQueue(subName); } @@ -572,7 +572,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt Set sessions = new HashSet<>(); for (int i = 0; i < numSessions; i++) { - SimpleString subName = new SimpleString(threadNum + " sub" + i); + SimpleString subName = SimpleString.of(threadNum + " sub" + i); ClientSession sessConsume = sf.createSession(false, false, false); sessConsume.addMetaData("data", RandomUtil.randomString()); @@ -671,7 +671,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt } for (int i = 0; i < numSessions; i++) { - SimpleString subName = new SimpleString(threadNum + " sub" + i); + SimpleString subName = SimpleString.of(threadNum + " sub" + i); s.deleteQueue(subName); } @@ -699,7 +699,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt Set sessions = new HashSet<>(); for (int i = 0; i < numSessions; i++) { - SimpleString subName = new SimpleString(threadNum + "sub" + i); + SimpleString subName = SimpleString.of(threadNum + "sub" + i); ClientSession sessConsume = sf.createSession(false, true, true); sessConsume.addMetaData("some-data", RandomUtil.randomString()); @@ -730,7 +730,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt } for (int i = 0; i < numSessions; i++) { - SimpleString subName = new SimpleString(threadNum + "sub" + i); + SimpleString subName = SimpleString.of(threadNum + "sub" + i); s.deleteQueue(subName); } @@ -756,7 +756,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt Set sessions = new HashSet<>(); for (int i = 0; i < numSessions; i++) { - SimpleString subName = new SimpleString(threadNum + "sub" + i); + SimpleString subName = SimpleString.of(threadNum + "sub" + i); ClientSession sessConsume = sf.createSession(false, true, true); sessConsume.addMetaData("data", RandomUtil.randomString()); @@ -789,7 +789,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt } for (int i = 0; i < numSessions; i++) { - SimpleString subName = new SimpleString(threadNum + "sub" + i); + SimpleString subName = SimpleString.of(threadNum + "sub" + i); s.deleteQueue(subName); } @@ -815,7 +815,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt Set sessions = new HashSet<>(); for (int i = 0; i < numSessions; i++) { - SimpleString subName = new SimpleString(threadNum + "sub" + i); + SimpleString subName = SimpleString.of(threadNum + "sub" + i); ClientSession sessConsume = sf.createSession(false, false, false); sessConsume.addMetaData("data", RandomUtil.randomString()); @@ -862,7 +862,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt } for (int i = 0; i < numSessions; i++) { - SimpleString subName = new SimpleString(threadNum + "sub" + i); + SimpleString subName = SimpleString.of(threadNum + "sub" + i); s.deleteQueue(subName); } @@ -888,7 +888,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt Set sessions = new HashSet<>(); for (int i = 0; i < numSessions; i++) { - SimpleString subName = new SimpleString(threadNum + "sub" + i); + SimpleString subName = SimpleString.of(threadNum + "sub" + i); ClientSession sessConsume = sf.createSession(false, false, false); sessConsume.addMetaData("data", RandomUtil.randomString()); @@ -937,7 +937,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt } for (int i = 0; i < numSessions; i++) { - SimpleString subName = new SimpleString(threadNum + "sub" + i); + SimpleString subName = SimpleString.of(threadNum + "sub" + i); s.deleteQueue(subName); } @@ -953,14 +953,14 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt ClientSession sessCreate = sf.createSession(false, true, true); sessCreate.addMetaData("data", RandomUtil.randomString()); - sessCreate.createQueue(new QueueConfiguration(new SimpleString(threadNum + ADDRESS.toString())).setAddress(ADDRESS).setDurable(false)); + sessCreate.createQueue(new QueueConfiguration(SimpleString.of(threadNum + ADDRESS.toString())).setAddress(ADDRESS).setDurable(false)); ClientSession sess = sf.createSession(false, true, true); sess.addMetaData("data", RandomUtil.randomString()); sess.start(); - ClientConsumer consumer = sess.createConsumer(new SimpleString(threadNum + ADDRESS.toString())); + ClientConsumer consumer = sess.createConsumer(SimpleString.of(threadNum + ADDRESS.toString())); ClientProducer producer = sess.createProducer(ADDRESS); @@ -975,7 +975,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt sess.close(); - sessCreate.deleteQueue(new SimpleString(threadNum + ADDRESS.toString())); + sessCreate.deleteQueue(SimpleString.of(threadNum + ADDRESS.toString())); sessCreate.close(); } @@ -984,14 +984,14 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt ClientSession sessCreate = sf.createSession(false, true, true); sessCreate.addMetaData("data", RandomUtil.randomString()); - sessCreate.createQueue(new QueueConfiguration(new SimpleString(threadNum + ADDRESS.toString())).setAddress(ADDRESS).setDurable(false)); + sessCreate.createQueue(new QueueConfiguration(SimpleString.of(threadNum + ADDRESS.toString())).setAddress(ADDRESS).setDurable(false)); ClientSession sess = sf.createSession(false, true, true); sess.addMetaData("data", RandomUtil.randomString()); sess.start(); - ClientConsumer consumer = sess.createConsumer(new SimpleString(threadNum + ADDRESS.toString())); + ClientConsumer consumer = sess.createConsumer(SimpleString.of(threadNum + ADDRESS.toString())); ClientProducer producer = sess.createProducer(ADDRESS); @@ -1006,7 +1006,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt sess.close(); - sessCreate.deleteQueue(new SimpleString(threadNum + ADDRESS.toString())); + sessCreate.deleteQueue(SimpleString.of(threadNum + ADDRESS.toString())); sessCreate.close(); } @@ -1015,17 +1015,17 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt ClientSession s = sf.createSession(false, false, false); s.addMetaData("data", RandomUtil.randomString()); - s.createQueue(new QueueConfiguration(new SimpleString(threadNum + ADDRESS.toString())).setAddress(ADDRESS).setDurable(false)); + s.createQueue(new QueueConfiguration(SimpleString.of(threadNum + ADDRESS.toString())).setAddress(ADDRESS).setDurable(false)); final int numConsumers = 100; for (int i = 0; i < numConsumers; i++) { - ClientConsumer consumer = s.createConsumer(new SimpleString(threadNum + ADDRESS.toString())); + ClientConsumer consumer = s.createConsumer(SimpleString.of(threadNum + ADDRESS.toString())); consumer.close(); } - s.deleteQueue(new SimpleString(threadNum + ADDRESS.toString())); + s.deleteQueue(SimpleString.of(threadNum + ADDRESS.toString())); s.close(); } @@ -1048,7 +1048,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(new QueueConfiguration(new SimpleString(threadNum + ADDRESS.toString())).setAddress(ADDRESS).setDurable(false)); + sessCreate.createQueue(new QueueConfiguration(SimpleString.of(threadNum + ADDRESS.toString())).setAddress(ADDRESS).setDurable(false)); ClientSession sess = sf.createSession(false, true, true); sess.addMetaData("data", RandomUtil.randomString()); @@ -1059,7 +1059,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt sess.stop(); - ClientConsumer consumer = sess.createConsumer(new SimpleString(threadNum + ADDRESS.toString())); + ClientConsumer consumer = sess.createConsumer(SimpleString.of(threadNum + ADDRESS.toString())); ClientProducer producer = sess.createProducer(ADDRESS); @@ -1080,7 +1080,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt sess.close(); - sessCreate.deleteQueue(new SimpleString(threadNum + ADDRESS.toString())); + sessCreate.deleteQueue(SimpleString.of(threadNum + ADDRESS.toString())); sessCreate.close(); } @@ -1088,13 +1088,13 @@ 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(new QueueConfiguration(new SimpleString(threadNum + ADDRESS.toString())).setAddress(ADDRESS).setDurable(false)); + sessCreate.createQueue(new QueueConfiguration(SimpleString.of(threadNum + ADDRESS.toString())).setAddress(ADDRESS).setDurable(false)); ClientSession sess = sf.createSession(false, true, true); sess.start(); - ClientConsumer consumer = sess.createConsumer(new SimpleString(threadNum + ADDRESS.toString())); + ClientConsumer consumer = sess.createConsumer(SimpleString.of(threadNum + ADDRESS.toString())); for (int i = 0; i < 100; i++) { assertNull(consumer.receiveImmediate()); @@ -1102,7 +1102,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt sess.close(); - sessCreate.deleteQueue(new SimpleString(threadNum + ADDRESS.toString())); + sessCreate.deleteQueue(SimpleString.of(threadNum + ADDRESS.toString())); sessCreate.close(); } @@ -1154,8 +1154,8 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt final int threadNum) throws Exception { for (int i = 0; i < numMessages; i++) { ClientMessage message = sessSend.createMessage(ActiveMQBytesMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); - message.putIntProperty(new SimpleString("threadnum"), threadNum); - message.putIntProperty(new SimpleString("count"), i); + message.putIntProperty(SimpleString.of("threadnum"), threadNum); + message.putIntProperty(SimpleString.of("count"), i); setBody(message); producer.send(message); } @@ -1180,8 +1180,8 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt assertNotNull(msg); - int tn = (Integer) msg.getObjectProperty(new SimpleString("threadnum")); - int cnt = (Integer) msg.getObjectProperty(new SimpleString("count")); + int tn = (Integer) msg.getObjectProperty(SimpleString.of("threadnum")); + int cnt = (Integer) msg.getObjectProperty(SimpleString.of("count")); Integer c = consumerCounts.get(tn); if (c == null) { @@ -1249,8 +1249,8 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt return; } - int threadNum = (Integer) message.getObjectProperty(new SimpleString("threadnum")); - int cnt = (Integer) message.getObjectProperty(new SimpleString("count")); + int threadNum = (Integer) message.getObjectProperty(SimpleString.of("threadnum")); + int cnt = (Integer) message.getObjectProperty(SimpleString.of("count")); Integer c = counts.get(threadNum); if (c == null) { diff --git a/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/RandomReattachTestBase.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/RandomReattachTestBase.java index 9ff55c9611..54203e04e7 100644 --- a/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/RandomReattachTestBase.java +++ b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/RandomReattachTestBase.java @@ -63,7 +63,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { private static final int RECEIVE_TIMEOUT = 10000; - private static final SimpleString ADDRESS = new SimpleString("FailoverTestAddress"); + private static final SimpleString ADDRESS = SimpleString.of("FailoverTestAddress"); private ActiveMQServer server; @@ -237,7 +237,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { Set sessions = new HashSet<>(); for (int i = 0; i < numSessions; i++) { - SimpleString subName = new SimpleString("sub" + i); + SimpleString subName = SimpleString.of("sub" + i); ClientSession sessConsume = sf.createSession(false, true, true); @@ -258,7 +258,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = sessSend.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); - message.putIntProperty(new SimpleString("count"), i); + message.putIntProperty(SimpleString.of("count"), i); producer.send(message); } @@ -274,7 +274,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { fail("Too many messages"); } - assertEquals(count, message.getObjectProperty(new SimpleString("count"))); + assertEquals(count, message.getObjectProperty(SimpleString.of("count"))); count++; @@ -314,7 +314,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { } for (int i = 0; i < numSessions; i++) { - SimpleString subName = new SimpleString("sub" + i); + SimpleString subName = SimpleString.of("sub" + i); s.deleteQueue(subName); } @@ -339,7 +339,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { Set sessions = new HashSet<>(); for (int i = 0; i < numSessions; i++) { - SimpleString subName = new SimpleString("sub" + i); + SimpleString subName = SimpleString.of("sub" + i); ClientSession sessConsume = sf.createSession(false, true, true); @@ -358,7 +358,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = sessSend.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); - message.putIntProperty(new SimpleString("count"), i); + message.putIntProperty(SimpleString.of("count"), i); producer.send(message); } @@ -378,7 +378,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { fail("Too many messages"); } - assertEquals(count, message.getObjectProperty(new SimpleString("count"))); + assertEquals(count, message.getObjectProperty(SimpleString.of("count"))); count++; @@ -413,7 +413,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { } for (int i = 0; i < numSessions; i++) { - SimpleString subName = new SimpleString("sub" + i); + SimpleString subName = SimpleString.of("sub" + i); s.deleteQueue(subName); } @@ -439,7 +439,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { Set sessions = new HashSet<>(); for (int i = 0; i < numSessions; i++) { - SimpleString subName = new SimpleString("sub" + i); + SimpleString subName = SimpleString.of("sub" + i); ClientSession sessConsume = sf.createSession(false, false, false); @@ -460,7 +460,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = sessSend.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); - message.putIntProperty(new SimpleString("count"), i); + message.putIntProperty(SimpleString.of("count"), i); producer.send(message); } @@ -468,7 +468,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = sessSend.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); - message.putIntProperty(new SimpleString("count"), i); + message.putIntProperty(SimpleString.of("count"), i); producer.send(message); } @@ -486,7 +486,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { fail("Too many messages, expected " + count); } - assertEquals(count, message.getObjectProperty(new SimpleString("count"))); + assertEquals(count, message.getObjectProperty(SimpleString.of("count"))); count++; @@ -554,7 +554,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { } for (int i = 0; i < numSessions; i++) { - SimpleString subName = new SimpleString("sub" + i); + SimpleString subName = SimpleString.of("sub" + i); s.deleteQueue(subName); } @@ -579,7 +579,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { Set sessions = new HashSet<>(); for (int i = 0; i < numSessions; i++) { - SimpleString subName = new SimpleString("sub" + i); + SimpleString subName = SimpleString.of("sub" + i); ClientSession sessConsume = sf.createSession(false, false, false); @@ -598,7 +598,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = sessSend.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); - message.putIntProperty(new SimpleString("count"), i); + message.putIntProperty(SimpleString.of("count"), i); producer.send(message); } @@ -606,7 +606,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = sessSend.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); - message.putIntProperty(new SimpleString("count"), i); + message.putIntProperty(SimpleString.of("count"), i); producer.send(message); } @@ -628,7 +628,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { fail("Too many messages, " + count); } - assertEquals(count, message.getObjectProperty(new SimpleString("count"))); + assertEquals(count, message.getObjectProperty(SimpleString.of("count"))); count++; @@ -689,7 +689,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { } for (int i = 0; i < numSessions; i++) { - SimpleString subName = new SimpleString("sub" + i); + SimpleString subName = SimpleString.of("sub" + i); s.deleteQueue(subName); } @@ -716,7 +716,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { Set sessions = new HashSet<>(); for (int i = 0; i < numSessions; i++) { - SimpleString subName = new SimpleString("sub" + i); + SimpleString subName = SimpleString.of("sub" + i); ClientSession sessConsume = sf.createSession(false, true, true); @@ -737,7 +737,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = sessSend.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); - message.putIntProperty(new SimpleString("count"), i); + message.putIntProperty(SimpleString.of("count"), i); producer.send(message); } @@ -747,7 +747,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { assertNotNull(msg); - assertEquals(i, msg.getObjectProperty(new SimpleString("count"))); + assertEquals(i, msg.getObjectProperty(SimpleString.of("count"))); msg.acknowledge(); } @@ -767,7 +767,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { } for (int i = 0; i < numSessions; i++) { - SimpleString subName = new SimpleString("sub" + i); + SimpleString subName = SimpleString.of("sub" + i); s.deleteQueue(subName); } @@ -792,7 +792,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { Set sessions = new HashSet<>(); for (int i = 0; i < numSessions; i++) { - SimpleString subName = new SimpleString("sub" + i); + SimpleString subName = SimpleString.of("sub" + i); ClientSession sessConsume = sf.createSession(false, true, true); @@ -811,7 +811,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = sessSend.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); - message.putIntProperty(new SimpleString("count"), i); + message.putIntProperty(SimpleString.of("count"), i); producer.send(message); } @@ -829,7 +829,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { assertNotNull(msg); - assertEquals(i, msg.getObjectProperty(new SimpleString("count"))); + assertEquals(i, msg.getObjectProperty(SimpleString.of("count"))); msg.acknowledge(); } @@ -849,7 +849,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { } for (int i = 0; i < numSessions; i++) { - SimpleString subName = new SimpleString("sub" + i); + SimpleString subName = SimpleString.of("sub" + i); s.deleteQueue(subName); } @@ -876,7 +876,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { Set sessions = new HashSet<>(); for (int i = 0; i < numSessions; i++) { - SimpleString subName = new SimpleString("sub" + i); + SimpleString subName = SimpleString.of("sub" + i); ClientSession sessConsume = sf.createSession(false, false, false); @@ -897,7 +897,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = sessSend.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); - message.putIntProperty(new SimpleString("count"), i); + message.putIntProperty(SimpleString.of("count"), i); producer.send(message); } @@ -905,7 +905,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = sessSend.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); - message.putIntProperty(new SimpleString("count"), i); + message.putIntProperty(SimpleString.of("count"), i); producer.send(message); } @@ -917,7 +917,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { assertNotNull(msg); - assertEquals(i, msg.getObjectProperty(new SimpleString("count"))); + assertEquals(i, msg.getObjectProperty(SimpleString.of("count"))); msg.acknowledge(); } @@ -939,7 +939,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { assertNotNull(msg); - assertEquals(i, msg.getObjectProperty(new SimpleString("count"))); + assertEquals(i, msg.getObjectProperty(SimpleString.of("count"))); msg.acknowledge(); } @@ -963,7 +963,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { } for (int i = 0; i < numSessions; i++) { - SimpleString subName = new SimpleString("sub" + i); + SimpleString subName = SimpleString.of("sub" + i); s.deleteQueue(subName); } @@ -988,7 +988,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { Set sessions = new HashSet<>(); for (int i = 0; i < numSessions; i++) { - SimpleString subName = new SimpleString("sub" + i); + SimpleString subName = SimpleString.of("sub" + i); ClientSession sessConsume = sf.createSession(false, false, false); @@ -1007,7 +1007,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = sessSend.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); - message.putIntProperty(new SimpleString("count"), i); + message.putIntProperty(SimpleString.of("count"), i); producer.send(message); } @@ -1015,7 +1015,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = sessSend.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); - message.putIntProperty(new SimpleString("count"), i); + message.putIntProperty(SimpleString.of("count"), i); producer.send(message); } @@ -1031,7 +1031,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { assertNotNull(msg); - assertEquals(i, msg.getObjectProperty(new SimpleString("count"))); + assertEquals(i, msg.getObjectProperty(SimpleString.of("count"))); msg.acknowledge(); } @@ -1055,7 +1055,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { assertNotNull(msg); - assertEquals(i, msg.getObjectProperty(new SimpleString("count"))); + assertEquals(i, msg.getObjectProperty(SimpleString.of("count"))); msg.acknowledge(); } @@ -1079,7 +1079,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { } for (int i = 0; i < numSessions; i++) { - SimpleString subName = new SimpleString("sub" + i); + SimpleString subName = SimpleString.of("sub" + i); s.deleteQueue(subName); } @@ -1180,7 +1180,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { protected void doTestN(final ClientSessionFactory sf) throws Exception { ClientSession sessCreate = sf.createSession(false, true, true); - sessCreate.createQueue(new QueueConfiguration(new SimpleString(ADDRESS.toString())).setAddress(ADDRESS).setDurable(false)); + sessCreate.createQueue(new QueueConfiguration(SimpleString.of(ADDRESS.toString())).setAddress(ADDRESS).setDurable(false)); ClientSession sess = sf.createSession(false, true, true); @@ -1190,7 +1190,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { sess.stop(); - ClientConsumer consumer = sess.createConsumer(new SimpleString(ADDRESS.toString())); + ClientConsumer consumer = sess.createConsumer(SimpleString.of(ADDRESS.toString())); ClientProducer producer = sess.createProducer(ADDRESS); @@ -1211,7 +1211,7 @@ public abstract class RandomReattachTestBase extends ActiveMQTestBase { sess.close(); - sessCreate.deleteQueue(new SimpleString(ADDRESS.toString())); + sessCreate.deleteQueue(SimpleString.of(ADDRESS.toString())); sessCreate.close(); } diff --git a/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/integration/largemessage/LargeMessageTestBase.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/integration/largemessage/LargeMessageTestBase.java index 34bf1c01aa..12cc924f44 100644 --- a/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/integration/largemessage/LargeMessageTestBase.java +++ b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/integration/largemessage/LargeMessageTestBase.java @@ -68,7 +68,7 @@ public abstract class LargeMessageTestBase extends ActiveMQTestBase { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - protected final SimpleString ADDRESS = new SimpleString("SimpleAddress"); + protected final SimpleString ADDRESS = SimpleString.of("SimpleAddress"); @@ -264,7 +264,7 @@ public abstract class LargeMessageTestBase extends ActiveMQTestBase { public void onMessage(final ClientMessage message) { try { if (delayDelivery > 0) { - long originalTime = (Long) message.getObjectProperty(new SimpleString("original-time")); + long originalTime = (Long) message.getObjectProperty(SimpleString.of("original-time")); assertTrue(System.currentTimeMillis() - originalTime >= delayDelivery, System.currentTimeMillis() - originalTime + "<" + delayDelivery); } @@ -278,7 +278,7 @@ public abstract class LargeMessageTestBase extends ActiveMQTestBase { // right now there is no guarantee of ordered delivered on multiple scheduledMessages with // the same // scheduled delivery time - assertEquals(msgCounter, ((Integer) message.getObjectProperty(new SimpleString("counter-message"))).intValue()); + assertEquals(msgCounter, ((Integer) message.getObjectProperty(SimpleString.of("counter-message"))).intValue()); } if (useStreamOnConsume) { @@ -351,7 +351,7 @@ public abstract class LargeMessageTestBase extends ActiveMQTestBase { assertNotNull(message); if (delayDelivery > 0) { - long originalTime = (Long) message.getObjectProperty(new SimpleString("original-time")); + long originalTime = (Long) message.getObjectProperty(SimpleString.of("original-time")); assertTrue(System.currentTimeMillis() - originalTime >= delayDelivery, System.currentTimeMillis() - originalTime + "<" + delayDelivery); } @@ -364,7 +364,7 @@ public abstract class LargeMessageTestBase extends ActiveMQTestBase { if (delayDelivery <= 0) { // right now there is no guarantee of ordered delivered on multiple scheduledMessages with the same // scheduled delivery time - assertEquals(i, ((Integer) message.getObjectProperty(new SimpleString("counter-message"))).intValue()); + assertEquals(i, ((Integer) message.getObjectProperty(SimpleString.of("counter-message"))).intValue()); } if (useStreamOnConsume) { @@ -486,10 +486,10 @@ public abstract class LargeMessageTestBase extends ActiveMQTestBase { } message.getBodyBuffer().writeBytes(bytes); } - message.putIntProperty(new SimpleString("counter-message"), i); + message.putIntProperty(SimpleString.of("counter-message"), i); if (delayDelivery > 0) { long time = System.currentTimeMillis(); - message.putLongProperty(new SimpleString("original-time"), time); + message.putLongProperty(SimpleString.of("original-time"), time); message.putLongProperty(Message.HDR_SCHEDULED_DELIVERY_TIME, time + delayDelivery); producer.send(message); diff --git a/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java index 2fee718a6c..d78a723ee1 100644 --- a/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java +++ b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java @@ -1938,7 +1938,7 @@ public abstract class ActiveMQTestBase extends ArtemisTestCase { bindingCount = 0; totConsumers = 0; - Bindings bindings = po.getBindingsForAddress(new SimpleString(address)); + Bindings bindings = po.getBindingsForAddress(SimpleString.of(address)); for (Binding binding : bindings.getBindings()) { if (binding.isConnected() && (binding instanceof LocalQueueBinding && local || binding instanceof RemoteQueueBinding && !local)) { @@ -1986,7 +1986,7 @@ public abstract class ActiveMQTestBase extends ArtemisTestCase { public void printBindings(ActiveMQServer server, String address) throws Exception { PostOffice po = server.getPostOffice(); - Bindings bindings = po.getBindingsForAddress(new SimpleString(address)); + Bindings bindings = po.getBindingsForAddress(SimpleString.of(address)); System.err.println("======================================================================="); System.err.println("Binding information for address = " + address + " for server " + server); @@ -2127,7 +2127,7 @@ public abstract class ActiveMQTestBase extends ArtemisTestCase { message.getBodyBuffer().writeString(UUID.randomUUID().toString()); - message.setAddress(new SimpleString("foo")); + message.setAddress(SimpleString.of("foo")); return message; } @@ -2230,7 +2230,7 @@ public abstract class ActiveMQTestBase extends ArtemisTestCase { final String address) throws Exception { ArrayList bindingsFound = new ArrayList<>(); - Bindings bindings = postOffice.getBindingsForAddress(new SimpleString(address)); + Bindings bindings = postOffice.getBindingsForAddress(SimpleString.of(address)); for (Binding binding : bindings.getBindings()) { if (binding instanceof LocalQueueBinding) { diff --git a/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/utils/RealServerTestBase.java b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/utils/RealServerTestBase.java index b25a5feea5..70fe9b2d4a 100644 --- a/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/utils/RealServerTestBase.java +++ b/tests/artemis-test-support/src/main/java/org/apache/activemq/artemis/utils/RealServerTestBase.java @@ -228,7 +228,7 @@ public class RealServerTestBase extends ActiveMQTestBase { try { JMXConnector connector = newJMXFactory(uri); - ObjectName objectQueueName = builder.getQueueObjectName(SimpleString.toSimpleString(address), SimpleString.toSimpleString(queueName), routingType); + ObjectName objectQueueName = builder.getQueueObjectName(SimpleString.of(address), SimpleString.of(queueName), routingType); QueueControl queueControl = MBeanServerInvocationHandler.newProxyInstance(connector.getMBeanServerConnection(), objectQueueName, QueueControl.class, false); queueControl.getMessagesAcknowledged(); // making one call diff --git a/tests/compatibility-tests/src/main/resources/hqsoak/artemisServer.groovy b/tests/compatibility-tests/src/main/resources/hqsoak/artemisServer.groovy index 65b56051f4..291cefcd3e 100644 --- a/tests/compatibility-tests/src/main/resources/hqsoak/artemisServer.groovy +++ b/tests/compatibility-tests/src/main/resources/hqsoak/artemisServer.groovy @@ -44,8 +44,8 @@ configuration.setSecurityEnabled(false); configuration.setPersistenceEnabled(true); try { if (!type.startsWith("ARTEMIS-1")) { - configuration.addAddressSetting("#", new AddressSettings().setAutoCreateAddresses(false).setDeadLetterAddress(SimpleString.toSimpleString("DLQ")) - .setExpiryAddress(SimpleString.toSimpleString("EXP"))); + configuration.addAddressSetting("#", new AddressSettings().setAutoCreateAddresses(false).setDeadLetterAddress(SimpleString.of("DLQ")) + .setExpiryAddress(SimpleString.of("EXP"))); if (globalMaxSize != null) { configuration.getAddressSettings().get("#").setPageSizeBytes(Long.parseLong(globalMaxSize)).setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE) configuration.setGlobalMaxSize(Long.parseLong(globalMaxSize)); @@ -64,6 +64,6 @@ server.setConfiguration(configuration); server.setJmsConfiguration(jmsConfiguration); server.start(); -AddressInfo info = new AddressInfo(SimpleString.toSimpleString("topic")).setAutoCreated(false).addRoutingType(RoutingType.MULTICAST); +AddressInfo info = new AddressInfo(SimpleString.of("topic")).setAutoCreated(false).addRoutingType(RoutingType.MULTICAST); server.activeMQServer.addAddressInfo(info); diff --git a/tests/compatibility-tests/src/main/resources/jmsReplyToQueue/artemisServer.groovy b/tests/compatibility-tests/src/main/resources/jmsReplyToQueue/artemisServer.groovy index 444eaf179c..95c167705f 100644 --- a/tests/compatibility-tests/src/main/resources/jmsReplyToQueue/artemisServer.groovy +++ b/tests/compatibility-tests/src/main/resources/jmsReplyToQueue/artemisServer.groovy @@ -46,8 +46,8 @@ server.setConfiguration(configuration); server.setJmsConfiguration(jmsConfiguration); server.start(); -server.getActiveMQServer().addAddressInfo(new AddressInfo(SimpleString.toSimpleString(queueAddress), RoutingType.ANYCAST)); -server.getActiveMQServer().createQueue(SimpleString.toSimpleString(queueAddress), RoutingType.ANYCAST, SimpleString.toSimpleString(queueAddress), null, true, false); +server.getActiveMQServer().addAddressInfo(new AddressInfo(SimpleString.of(queueAddress), RoutingType.ANYCAST)); +server.getActiveMQServer().createQueue(SimpleString.of(queueAddress), RoutingType.ANYCAST, SimpleString.of(queueAddress), null, true, false); -server.getActiveMQServer().addAddressInfo(new AddressInfo(SimpleString.toSimpleString(replyQueueAddress), RoutingType.ANYCAST)); -server.getActiveMQServer().createQueue(SimpleString.toSimpleString(replyQueueAddress), RoutingType.ANYCAST, SimpleString.toSimpleString(replyQueueAddress), null, true, false); +server.getActiveMQServer().addAddressInfo(new AddressInfo(SimpleString.of(replyQueueAddress), RoutingType.ANYCAST)); +server.getActiveMQServer().createQueue(SimpleString.of(replyQueueAddress), RoutingType.ANYCAST, SimpleString.of(replyQueueAddress), null, true, false); diff --git a/tests/compatibility-tests/src/main/resources/jmsReplyToTempQueue/artemisServer.groovy b/tests/compatibility-tests/src/main/resources/jmsReplyToTempQueue/artemisServer.groovy index 2b06830f1c..fb190d7be8 100644 --- a/tests/compatibility-tests/src/main/resources/jmsReplyToTempQueue/artemisServer.groovy +++ b/tests/compatibility-tests/src/main/resources/jmsReplyToTempQueue/artemisServer.groovy @@ -45,5 +45,5 @@ server.setConfiguration(configuration); server.setJmsConfiguration(jmsConfiguration); server.start(); -server.getActiveMQServer().addAddressInfo(new AddressInfo(SimpleString.toSimpleString(queueAddress), RoutingType.ANYCAST)); -server.getActiveMQServer().createQueue(SimpleString.toSimpleString(queueAddress), RoutingType.ANYCAST, SimpleString.toSimpleString(queueAddress), null, true, false); +server.getActiveMQServer().addAddressInfo(new AddressInfo(SimpleString.of(queueAddress), RoutingType.ANYCAST)); +server.getActiveMQServer().createQueue(SimpleString.of(queueAddress), RoutingType.ANYCAST, SimpleString.of(queueAddress), null, true, false); diff --git a/tests/compatibility-tests/src/main/resources/jmsReplyToTempTopic/artemisServer.groovy b/tests/compatibility-tests/src/main/resources/jmsReplyToTempTopic/artemisServer.groovy index 9e85473889..1bd1cac058 100644 --- a/tests/compatibility-tests/src/main/resources/jmsReplyToTempTopic/artemisServer.groovy +++ b/tests/compatibility-tests/src/main/resources/jmsReplyToTempTopic/artemisServer.groovy @@ -46,7 +46,7 @@ server.setConfiguration(configuration); server.setJmsConfiguration(jmsConfiguration); server.start(); -server.getActiveMQServer().addAddressInfo(new AddressInfo(SimpleString.toSimpleString(queueAddress), RoutingType.ANYCAST)); -server.getActiveMQServer().createQueue(SimpleString.toSimpleString(queueAddress), RoutingType.ANYCAST, SimpleString.toSimpleString(queueAddress), null, true, false); +server.getActiveMQServer().addAddressInfo(new AddressInfo(SimpleString.of(queueAddress), RoutingType.ANYCAST)); +server.getActiveMQServer().createQueue(SimpleString.of(queueAddress), RoutingType.ANYCAST, SimpleString.of(queueAddress), null, true, false); -server.getActiveMQServer().addAddressInfo(new AddressInfo(SimpleString.toSimpleString(replyTopicAddress), RoutingType.MULTICAST)); +server.getActiveMQServer().addAddressInfo(new AddressInfo(SimpleString.of(replyTopicAddress), RoutingType.MULTICAST)); diff --git a/tests/compatibility-tests/src/main/resources/jmsReplyToTopic/artemisServer.groovy b/tests/compatibility-tests/src/main/resources/jmsReplyToTopic/artemisServer.groovy index 37a6aa0c95..bf8a1351e3 100644 --- a/tests/compatibility-tests/src/main/resources/jmsReplyToTopic/artemisServer.groovy +++ b/tests/compatibility-tests/src/main/resources/jmsReplyToTopic/artemisServer.groovy @@ -45,5 +45,5 @@ server.setConfiguration(configuration); server.setJmsConfiguration(jmsConfiguration); server.start(); -server.getActiveMQServer().addAddressInfo(new AddressInfo(SimpleString.toSimpleString(queueAddress), RoutingType.ANYCAST)); -server.getActiveMQServer().createQueue(SimpleString.toSimpleString(queueAddress), RoutingType.ANYCAST, SimpleString.toSimpleString(queueAddress), null, true, false); +server.getActiveMQServer().addAddressInfo(new AddressInfo(SimpleString.of(queueAddress), RoutingType.ANYCAST)); +server.getActiveMQServer().createQueue(SimpleString.of(queueAddress), RoutingType.ANYCAST, SimpleString.of(queueAddress), null, true, false); diff --git a/tests/compatibility-tests/src/main/resources/journalcompatibility/forcepaging.groovy b/tests/compatibility-tests/src/main/resources/journalcompatibility/forcepaging.groovy index 76e5f0dbff..5f48530843 100644 --- a/tests/compatibility-tests/src/main/resources/journalcompatibility/forcepaging.groovy +++ b/tests/compatibility-tests/src/main/resources/journalcompatibility/forcepaging.groovy @@ -2,7 +2,6 @@ package journalcompatibility import org.apache.activemq.artemis.api.core.SimpleString import org.apache.activemq.artemis.core.server.Queue -import org.apache.activemq.artemis.tests.compatibility.GroovyRun /* * Licensed to the Apache Software Foundation (ASF) under one or more diff --git a/tests/compatibility-tests/src/main/resources/oldAddressSpace/artemisServer.groovy b/tests/compatibility-tests/src/main/resources/oldAddressSpace/artemisServer.groovy index b398546639..bf54c40152 100644 --- a/tests/compatibility-tests/src/main/resources/oldAddressSpace/artemisServer.groovy +++ b/tests/compatibility-tests/src/main/resources/oldAddressSpace/artemisServer.groovy @@ -48,8 +48,8 @@ AddressSettings addressSettings = new AddressSettings(); addressSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK) .setMaxSizeBytes(10 * 1024) .setPageSizeBytes(1024) - .setDeadLetterAddress(SimpleString.toSimpleString("DLA")) - .setExpiryAddress(SimpleString.toSimpleString("Expiry")); + .setDeadLetterAddress(SimpleString.of("DLA")) + .setExpiryAddress(SimpleString.of("Expiry")); if (!(type.startsWith("ARTEMIS-1") || type.startsWith("HORNETQ"))) { addressSettings.setAutoCreateAddresses(false); @@ -61,8 +61,8 @@ addressSettings = new AddressSettings(); addressSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE) .setMaxSizeBytes(1024 * 1024 * 1024) .setPageSizeBytes(1024) - .setDeadLetterAddress(SimpleString.toSimpleString("DLA")) - .setExpiryAddress(SimpleString.toSimpleString("Expiry")); + .setDeadLetterAddress(SimpleString.of("DLA")) + .setExpiryAddress(SimpleString.of("Expiry")); if (!(type.startsWith("ARTEMIS-1") || type.startsWith("HORNETQ"))) { addressSettings.setAutoCreateAddresses(false); @@ -82,8 +82,8 @@ server.start(); if (type.startsWith("ARTEMIS-1") || type.startsWith("HORNETQ")) { server.getJMSServerManager().createQueue(true, queueName, null, true, null); } else { - server.getActiveMQServer().addAddressInfo(new AddressInfo(SimpleString.toSimpleString(queueAddress), RoutingType.ANYCAST)); - server.getActiveMQServer().createQueue(SimpleString.toSimpleString(queueAddress), RoutingType.ANYCAST, SimpleString.toSimpleString(queueAddress), null, true, false); + server.getActiveMQServer().addAddressInfo(new AddressInfo(SimpleString.of(queueAddress), RoutingType.ANYCAST)); + server.getActiveMQServer().createQueue(SimpleString.of(queueAddress), RoutingType.ANYCAST, SimpleString.of(queueAddress), null, true, false); - server.getActiveMQServer().addAddressInfo(new AddressInfo(SimpleString.toSimpleString(topicAddress), RoutingType.MULTICAST)); + server.getActiveMQServer().addAddressInfo(new AddressInfo(SimpleString.of(topicAddress), RoutingType.MULTICAST)); } diff --git a/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/OldOpenWireTest.java b/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/OldOpenWireTest.java index fe6f28ea2f..fe5cf574af 100644 --- a/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/OldOpenWireTest.java +++ b/tests/compatibility-tests/src/test/java/org/apache/activemq/artemis/tests/compatibility/OldOpenWireTest.java @@ -59,7 +59,7 @@ public class OldOpenWireTest extends ClasspathBase { server.getActiveMQServer().addAddressInfo(new AddressInfo("DLQ").addRoutingType(RoutingType.ANYCAST)); server.getActiveMQServer().createQueue(new QueueConfiguration("DLQ").setDurable(true).setRoutingType(RoutingType.ANYCAST)); - server.getActiveMQServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setDeadLetterAddress(SimpleString.toSimpleString("DLQ"))); + server.getActiveMQServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setDeadLetterAddress(SimpleString.of("DLQ"))); } @AfterEach diff --git a/tests/db-tests/src/test/java/org/apache/activemq/artemis/tests/db/paging/PagingTest.java b/tests/db-tests/src/test/java/org/apache/activemq/artemis/tests/db/paging/PagingTest.java index 0c2b4ed561..40b5315863 100644 --- a/tests/db-tests/src/test/java/org/apache/activemq/artemis/tests/db/paging/PagingTest.java +++ b/tests/db-tests/src/test/java/org/apache/activemq/artemis/tests/db/paging/PagingTest.java @@ -138,7 +138,7 @@ public class PagingTest extends ParameterDBTestBase { protected static final int PAGE_SIZE = 10 * 1024; static final int MESSAGE_SIZE = 1024; // 1k static final int LARGE_MESSAGE_SIZE = 100 * 1024; - static final SimpleString ADDRESS = new SimpleString("TestADDRESS"); + static final SimpleString ADDRESS = SimpleString.of("TestADDRESS"); private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); protected ServerLocator locator; protected ActiveMQServer server; @@ -1095,8 +1095,8 @@ public class PagingTest extends ParameterDBTestBase { producer.close(); session.close(); - Queue queue = server.locateQueue(new SimpleString(PagingTest.ADDRESS + "Queue")); - Queue originalQueue = server.locateQueue(new SimpleString(PagingTest.ADDRESS + "QueueOriginal")); + Queue queue = server.locateQueue(SimpleString.of(PagingTest.ADDRESS + "Queue")); + Queue originalQueue = server.locateQueue(SimpleString.of(PagingTest.ADDRESS + "QueueOriginal")); Wait.assertEquals(numberOfMessages * 4, queue::getMessageCount); Wait.assertEquals(0, originalQueue::getMessageCount); @@ -1147,7 +1147,7 @@ public class PagingTest extends ParameterDBTestBase { bodyLocal.writeBytes(body); - message.putIntProperty(new SimpleString("id"), i); + message.putIntProperty(SimpleString.of("id"), i); producer.send(message); } @@ -1575,7 +1575,7 @@ public class PagingTest extends ParameterDBTestBase { server = createServer(true, config, PagingTest.PAGE_SIZE, PagingTest.PAGE_MAX, -1, -1); server.start(); - AddressSettings defaultSetting = new AddressSettings().setPageSizeBytes(PAGE_SIZE).setMaxSizeBytes(0).setExpiryAddress(new SimpleString("EXP")).setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE).setMaxReadPageBytes(-1).setMaxReadPageMessages(-1); + AddressSettings defaultSetting = new AddressSettings().setPageSizeBytes(PAGE_SIZE).setMaxSizeBytes(0).setExpiryAddress(SimpleString.of("EXP")).setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE).setMaxReadPageBytes(-1).setMaxReadPageMessages(-1); server.getAddressSettingsRepository().clear(); server.getAddressSettingsRepository().addMatch("#", defaultSetting); @@ -1592,7 +1592,7 @@ public class PagingTest extends ParameterDBTestBase { session.createQueue(new QueueConfiguration("EXP")); Queue queue1 = server.locateQueue(ADDRESS); - Queue qEXP = server.locateQueue(new SimpleString("EXP")); + Queue qEXP = server.locateQueue(SimpleString.of("EXP")); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -1837,7 +1837,7 @@ public class PagingTest extends ParameterDBTestBase { server.start(); - SimpleString queue = new SimpleString("testPurge:" + RandomUtil.randomString()); + SimpleString queue = SimpleString.of("testPurge:" + RandomUtil.randomString()); server.addAddressInfo(new AddressInfo(queue, RoutingType.ANYCAST)); QueueImpl purgeQueue = (QueueImpl) server.createQueue(new QueueConfiguration(queue).setRoutingType(RoutingType.ANYCAST).setMaxConsumers(1).setPurgeOnNoConsumers(false).setAutoCreateAddress(false)); @@ -1910,7 +1910,7 @@ public class PagingTest extends ParameterDBTestBase { bodyLocal.writeBytes(body); - message.putIntProperty(new SimpleString("id"), i); + message.putIntProperty(SimpleString.of("id"), i); producer.send(message); } @@ -2084,7 +2084,7 @@ public class PagingTest extends ParameterDBTestBase { bodyLocal.writeBytes(body); - message.putIntProperty(new SimpleString("id"), i); + message.putIntProperty(SimpleString.of("id"), i); producer.send(message); @@ -2150,7 +2150,7 @@ public class PagingTest extends ParameterDBTestBase { bodyLocal.writeBytes(body); - message.putIntProperty(new SimpleString("id"), i); + message.putIntProperty(SimpleString.of("id"), i); producer.send(message); if (i % 10 == 0) { @@ -2262,7 +2262,7 @@ public class PagingTest extends ParameterDBTestBase { bodyLocal.writeBytes(body); - message.putIntProperty(new SimpleString("id"), i); + message.putIntProperty(SimpleString.of("id"), i); producer.send(message); if (i % messagesPerTX == 0) { @@ -2315,8 +2315,8 @@ public class PagingTest extends ParameterDBTestBase { ClientConsumer cons2 = sess.createConsumer("q2"); assertNull(cons2.receiveImmediate()); - Queue q1 = server.locateQueue(new SimpleString("q1")); - Queue q2 = server.locateQueue(new SimpleString("q2")); + Queue q1 = server.locateQueue(SimpleString.of("q1")); + Queue q2 = server.locateQueue(SimpleString.of("q2")); q1.getPageSubscription().cleanupEntries(false); q2.getPageSubscription().cleanupEntries(false); @@ -2473,7 +2473,7 @@ public class PagingTest extends ParameterDBTestBase { ClientSession session = sf.createSession(false, false, false); session.createQueue(new QueueConfiguration(PagingTest.ADDRESS)); - session.createQueue(new QueueConfiguration(PagingTest.ADDRESS.concat("-invalid")).setAddress(PagingTest.ADDRESS).setFilterString(new SimpleString(Filter.GENERIC_IGNORED_FILTER))); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS.concat("-invalid")).setAddress(PagingTest.ADDRESS).setFilterString(SimpleString.of(Filter.GENERIC_IGNORED_FILTER))); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -2488,7 +2488,7 @@ public class PagingTest extends ParameterDBTestBase { bodyLocal.writeBytes(body); - message.putIntProperty(new SimpleString("id"), i); + message.putIntProperty(SimpleString.of("id"), i); producer.send(message); if (i % 10 == 0) { @@ -2615,7 +2615,7 @@ public class PagingTest extends ParameterDBTestBase { bodyLocal.writeBytes(body); - message.putIntProperty(new SimpleString("id"), i); + message.putIntProperty(SimpleString.of("id"), i); producer.send(message); } @@ -2787,7 +2787,7 @@ public class PagingTest extends ParameterDBTestBase { bodyLocal.writeBytes(body); - message.putIntProperty(new SimpleString("id"), i); + message.putIntProperty(SimpleString.of("id"), i); producer.send(message); } @@ -2889,7 +2889,7 @@ public class PagingTest extends ParameterDBTestBase { bodyLocal.writeBytes(body); - message.putIntProperty(new SimpleString("id"), i); + message.putIntProperty(SimpleString.of("id"), i); producer.send(message); } @@ -3011,7 +3011,7 @@ public class PagingTest extends ParameterDBTestBase { for (int i = 0; i < 10; i++) { message = session.createMessage(true); message.getBodyBuffer().writeBytes(body); - message.putIntProperty(new SimpleString("id"), i); + message.putIntProperty(SimpleString.of("id"), i); // Consume messages to force an eventual out of order delivery if (i == 5) { @@ -3026,7 +3026,7 @@ public class PagingTest extends ParameterDBTestBase { consumer.close(); } - Integer messageID = (Integer) message.getObjectProperty(new SimpleString("id")); + Integer messageID = (Integer) message.getObjectProperty(SimpleString.of("id")); assertNotNull(messageID); assertEquals(messageID.intValue(), i); @@ -3046,7 +3046,7 @@ public class PagingTest extends ParameterDBTestBase { assertNotNull(message); - Integer messageID = (Integer) message.getObjectProperty(new SimpleString("id")); + Integer messageID = (Integer) message.getObjectProperty(SimpleString.of("id")); assertNotNull(messageID); assertEquals(messageID.intValue(), i, "message received out of order"); @@ -3094,7 +3094,7 @@ public class PagingTest extends ParameterDBTestBase { ClientMessage firstMessage = sessionTransacted.createMessage(IS_DURABLE_MESSAGE); firstMessage.getBodyBuffer().writeBytes(body); - firstMessage.putIntProperty(new SimpleString("id"), 0); + firstMessage.putIntProperty(SimpleString.of("id"), 0); producerTransacted.send(firstMessage); @@ -3129,7 +3129,7 @@ public class PagingTest extends ParameterDBTestBase { for (int i = 1; i < 10; i++) { message = session.createMessage(true); message.getBodyBuffer().writeBytes(body); - message.putIntProperty(new SimpleString("id"), i); + message.putIntProperty(SimpleString.of("id"), i); // Consume messages to force an eventual out of order delivery if (i == 5) { @@ -3148,7 +3148,7 @@ public class PagingTest extends ParameterDBTestBase { consumer.close(); } - Integer messageID = (Integer) message.getObjectProperty(new SimpleString("id")); + Integer messageID = (Integer) message.getObjectProperty(SimpleString.of("id")); assertNotNull(messageID); assertEquals(messageID.intValue(), i); @@ -3168,7 +3168,7 @@ public class PagingTest extends ParameterDBTestBase { assertNotNull(message); - Integer messageID = (Integer) message.getObjectProperty(new SimpleString("id")); + Integer messageID = (Integer) message.getObjectProperty(SimpleString.of("id")); assertNotNull(messageID); assertEquals(i, messageID.intValue(), "message received out of order"); @@ -3218,9 +3218,9 @@ public class PagingTest extends ParameterDBTestBase { for (int i = 0; i < MAX_TX; i++) { ClientMessage message = sessionNonTX.createMessage(true); message.getBodyBuffer().writeBytes(body); - message.putIntProperty(new SimpleString("id"), i); - message.putStringProperty(new SimpleString("tst"), new SimpleString("i=" + i)); - message.putStringProperty(new SimpleString("TX"), "true"); + message.putIntProperty(SimpleString.of("id"), i); + message.putStringProperty(SimpleString.of("tst"), SimpleString.of("i=" + i)); + message.putStringProperty(SimpleString.of("TX"), "true"); producerTransacted.send(message); @@ -3228,8 +3228,8 @@ public class PagingTest extends ParameterDBTestBase { logger.debug("Sending"); for (int j = 0; j < 10; j++) { ClientMessage msgSend = sessionNonTX.createMessage(true); - msgSend.putStringProperty(new SimpleString("tst"), new SimpleString("i=" + i + ", j=" + j)); - msgSend.putStringProperty(new SimpleString("TX"), "false"); + msgSend.putStringProperty(SimpleString.of("tst"), SimpleString.of("i=" + i + ", j=" + j)); + msgSend.putStringProperty(SimpleString.of("TX"), "false"); msgSend.getBodyBuffer().writeBytes(new byte[20 * 1024]); producerNonTransacted.send(msgSend); } @@ -3259,7 +3259,7 @@ public class PagingTest extends ParameterDBTestBase { assertNotNull(message); - Integer messageID = (Integer) message.getObjectProperty(new SimpleString("id")); + Integer messageID = (Integer) message.getObjectProperty(SimpleString.of("id")); assertNotNull(messageID); assertEquals(i, messageID.intValue(), "message received out of order"); @@ -3497,7 +3497,7 @@ public class PagingTest extends ParameterDBTestBase { message = session.createMessage(true); message.getBodyBuffer().writeBytes(body); - message.putIntProperty(new SimpleString("id"), i); + message.putIntProperty(SimpleString.of("id"), i); PagingStore store = server.getPagingManager().getPageStore(PagingTest.ADDRESS); @@ -3590,7 +3590,7 @@ public class PagingTest extends ParameterDBTestBase { bodyLocal.writeInt(j); } - message.putIntProperty(new SimpleString("id"), i); + message.putIntProperty(SimpleString.of("id"), i); producer.send(message); } @@ -3637,7 +3637,7 @@ public class PagingTest extends ParameterDBTestBase { bodyLocal.writeBytes(new byte[100 * 4]); - message.putIntProperty(new SimpleString("id"), i); + message.putIntProperty(SimpleString.of("id"), i); producer.send(message); session.commit(); @@ -3652,7 +3652,7 @@ public class PagingTest extends ParameterDBTestBase { bodyLocal.writeBytes(new byte[100 * 4]); - message.putIntProperty(new SimpleString("id"), i); + message.putIntProperty(SimpleString.of("id"), i); producer.send(message); } @@ -3666,7 +3666,7 @@ public class PagingTest extends ParameterDBTestBase { PageCursorProviderTestAccessor.cleanup(queue.getPagingStore().getCursorProvider()); consumerSession.start(); - ClientConsumer consumer = consumerSession.createConsumer(ADDRESS, SimpleString.toSimpleString("id > 0")); + ClientConsumer consumer = consumerSession.createConsumer(ADDRESS, SimpleString.of("id > 0")); for (int i = 0; i < 19; i++) { ClientMessage messageRec = consumer.receive(5000); logger.debug("msg::{}", messageRec); @@ -3760,7 +3760,7 @@ public class PagingTest extends ParameterDBTestBase { bodyLocal.writeBytes(new byte[100 * 4]); - message.putIntProperty(new SimpleString("idi"), i); + message.putIntProperty(SimpleString.of("idi"), i); producer.send(message); session.commit(); @@ -3806,7 +3806,7 @@ public class PagingTest extends ParameterDBTestBase { bodyLocal.writeBytes(new byte[100 * 4]); - message.putIntProperty(new SimpleString("newid"), i); + message.putIntProperty(SimpleString.of("newid"), i); producer.send(message); session.commit(); @@ -3865,7 +3865,7 @@ public class PagingTest extends ParameterDBTestBase { bodyLocal.writeBytes(new byte[1024]); - message.putIntProperty(new SimpleString("id"), i); + message.putIntProperty(SimpleString.of("id"), i); producer.send(message); } @@ -4152,7 +4152,7 @@ public class PagingTest extends ParameterDBTestBase { ClientSession session = sf.createSession(null, null, false, !transacted, true, false, 0); for (int i = 0; i < NUMBER_OF_BINDINGS; i++) { - session.createQueue(new QueueConfiguration(new SimpleString("someQueue" + i)).setAddress(PagingTest.ADDRESS).setDurable(true)); + session.createQueue(new QueueConfiguration(SimpleString.of("someQueue" + i)).setAddress(PagingTest.ADDRESS).setDurable(true)); } ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -4188,7 +4188,7 @@ public class PagingTest extends ParameterDBTestBase { for (int msg = 0; msg < NUMBER_OF_MESSAGES; msg++) { for (int i = 0; i < NUMBER_OF_BINDINGS; i++) { - ClientConsumer consumer = session.createConsumer(new SimpleString("someQueue" + i)); + ClientConsumer consumer = session.createConsumer(SimpleString.of("someQueue" + i)); ClientMessage message2 = consumer.receive(PagingTest.RECEIVE_TIMEOUT); @@ -4206,7 +4206,7 @@ public class PagingTest extends ParameterDBTestBase { session.close(); for (int i = 0; i < NUMBER_OF_BINDINGS; i++) { - Queue queue = (Queue) server.getPostOffice().getBinding(new SimpleString("someQueue" + i)).getBindable(); + Queue queue = (Queue) server.getPostOffice().getBinding(SimpleString.of("someQueue" + i)).getBindable(); assertEquals(0, getMessageCount(queue), "Queue someQueue" + i + " was supposed to be empty"); assertEquals(0, queue.getDeliveringCount(), "Queue someQueue" + i + " was supposed to be empty"); @@ -4283,8 +4283,8 @@ public class PagingTest extends ParameterDBTestBase { @TestTemplate public void testPagingOneDestinationOnly() throws Exception { - SimpleString PAGED_ADDRESS = new SimpleString("paged"); - SimpleString NON_PAGED_ADDRESS = new SimpleString("non-paged"); + SimpleString PAGED_ADDRESS = SimpleString.of("paged"); + SimpleString NON_PAGED_ADDRESS = SimpleString.of("non-paged"); Configuration configuration = createDefaultInVMConfig(); @@ -4369,7 +4369,7 @@ public class PagingTest extends ParameterDBTestBase { @TestTemplate public void testSimplePaging() throws Exception { - SimpleString PAGED_ADDRESS = new SimpleString("paged"); + SimpleString PAGED_ADDRESS = SimpleString.of("paged"); Configuration configuration = createDefaultInVMConfig(); @@ -4450,7 +4450,7 @@ public class PagingTest extends ParameterDBTestBase { int NQUEUES = 2; for (int i = 0; i < NQUEUES; i++) { - session.createQueue(new QueueConfiguration(PagingTest.ADDRESS.concat("=" + i)).setAddress(PagingTest.ADDRESS).setFilterString(new SimpleString("propTest=" + i)).setDurable(true)); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS.concat("=" + i)).setAddress(PagingTest.ADDRESS).setFilterString(SimpleString.of("propTest=" + i)).setDurable(true)); } ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -4613,7 +4613,7 @@ public class PagingTest extends ParameterDBTestBase { session.createQueue(new QueueConfiguration(PagingTest.ADDRESS.concat("=2")).setAddress(PagingTest.ADDRESS)); // A queue with an impossible filter - session.createQueue(new QueueConfiguration(PagingTest.ADDRESS.concat("-3")).setAddress(PagingTest.ADDRESS).setFilterString(new SimpleString("nothing='something'"))); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS.concat("-3")).setAddress(PagingTest.ADDRESS).setFilterString(SimpleString.of("nothing='something'"))); PagingStore store = server.getPagingManager().getPageStore(ADDRESS); @@ -4768,7 +4768,7 @@ public class PagingTest extends ParameterDBTestBase { Configuration config = createDefaultInVMConfig().setThreadPoolMaxSize(10).setJournalSyncNonTransactional(false); Map settings = new HashMap<>(); - AddressSettings dla = new AddressSettings().setMaxDeliveryAttempts(2).setDeadLetterAddress(new SimpleString("DLA")).setRedeliveryDelay(0).setMaxReadPageBytes(-1); + AddressSettings dla = new AddressSettings().setMaxDeliveryAttempts(2).setDeadLetterAddress(SimpleString.of("DLA")).setRedeliveryDelay(0).setMaxReadPageBytes(-1); settings.put(ADDRESS.toString(), dla); server = createServer(true, config, PagingTest.PAGE_SIZE, PagingTest.PAGE_MAX, -1, -1, settings); @@ -4797,7 +4797,7 @@ public class PagingTest extends ParameterDBTestBase { PagingStore pgStoreAddress = server.getPagingManager().getPageStore(ADDRESS); pgStoreAddress.startPaging(); - PagingStore pgStoreDLA = server.getPagingManager().getPageStore(new SimpleString("DLA")); + PagingStore pgStoreDLA = server.getPagingManager().getPageStore(SimpleString.of("DLA")); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); @@ -4972,7 +4972,7 @@ public class PagingTest extends ParameterDBTestBase { Configuration config = createDefaultInVMConfig().setMessageExpiryScanPeriod(500).setJournalSyncNonTransactional(false); Map settings = new HashMap<>(); - AddressSettings dla = new AddressSettings().setMaxDeliveryAttempts(5).setDeadLetterAddress(new SimpleString("DLA")).setExpiryAddress(new SimpleString("DLA")).setMaxReadPageBytes(-1); + AddressSettings dla = new AddressSettings().setMaxDeliveryAttempts(5).setDeadLetterAddress(SimpleString.of("DLA")).setExpiryAddress(SimpleString.of("DLA")).setMaxReadPageBytes(-1); settings.put(ADDRESS.toString(), dla); server = createServer(true, config, PagingTest.PAGE_SIZE, PagingTest.PAGE_MAX, -1, -1, settings); @@ -5279,7 +5279,7 @@ public class PagingTest extends ParameterDBTestBase { Wait.assertEquals(3, q::getMessageCount); // send a message with a dup ID that should fail b/c the address is full - SimpleString dupID1 = new SimpleString("abcdefg"); + SimpleString dupID1 = SimpleString.of("abcdefg"); message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID1.getData()); message.putStringProperty("key", dupID1.toString()); @@ -5358,7 +5358,7 @@ public class PagingTest extends ParameterDBTestBase { 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 queue = server.locateQueue(SimpleString.of("Q1")); queue.getPageSubscription().getPagingStore().startPaging(); ClientProducer prod = session.createProducer("Q"); @@ -5450,7 +5450,7 @@ public class PagingTest extends ParameterDBTestBase { final int MESSAGE_SIZE = 300; final byte[] bodyWrite = new byte[MESSAGE_SIZE]; - Queue serverQueue = server.locateQueue(new SimpleString("Q1")); + Queue serverQueue = server.locateQueue(SimpleString.of("Q1")); PagingStore pageStore = serverQueue.getPageSubscription().getPagingStore(); ClientProducer producer = session.createProducer(ADDRESS); @@ -5953,7 +5953,7 @@ public class PagingTest extends ParameterDBTestBase { session.createQueue(new QueueConfiguration("Q1")); session.createQueue(new QueueConfiguration("Q2")); - PagingStore store = server.getPagingManager().getPageStore(new SimpleString("Q1")); + PagingStore store = server.getPagingManager().getPageStore(SimpleString.of("Q1")); ClientProducer prod = session.createProducer("Q1"); @@ -5982,9 +5982,9 @@ public class PagingTest extends ParameterDBTestBase { } session.commit(); - Queue queue = server.locateQueue(new SimpleString("Q1")); + Queue queue = server.locateQueue(SimpleString.of("Q1")); - queue.moveReferences(10, (Filter) null, new SimpleString("Q2"), false, server.getPostOffice().getBinding(new SimpleString("Q2"))); + queue.moveReferences(10, (Filter) null, SimpleString.of("Q2"), false, server.getPostOffice().getBinding(SimpleString.of("Q2"))); waitForNotPaging(store); @@ -6020,7 +6020,7 @@ public class PagingTest extends ParameterDBTestBase { assertNull(cons.receiveImmediate()); - waitForNotPaging(server.locateQueue(new SimpleString("Q2"))); + waitForNotPaging(server.locateQueue(SimpleString.of("Q2"))); session.close(); sf.close(); @@ -6261,8 +6261,8 @@ public class PagingTest extends ParameterDBTestBase { ClientSessionFactory sf = locator.createSessionFactory(); ClientSession session = sf.createSession(false, false, false); - 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"))); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS.concat("=1")).setAddress(PagingTest.ADDRESS).setFilterString(SimpleString.of("destQ=1 or both=true"))); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS.concat("=2")).setAddress(PagingTest.ADDRESS).setFilterString(SimpleString.of("destQ=2 or both=true"))); PagingStore store = server.getPagingManager().getPageStore(ADDRESS); Queue queue = server.locateQueue(PagingTest.ADDRESS.concat("=1")); queue.getPageSubscription().getPagingStore().startPaging(); @@ -6334,8 +6334,8 @@ public class PagingTest extends ParameterDBTestBase { ClientSession session = sf.createSession(false, false, false); - 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"))); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS.concat("=1")).setAddress(PagingTest.ADDRESS).setFilterString(SimpleString.of("destQ=1"))); + session.createQueue(new QueueConfiguration(PagingTest.ADDRESS.concat("=2")).setAddress(PagingTest.ADDRESS).setFilterString(SimpleString.of("destQ=2"))); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); ClientConsumer consumer1 = session.createConsumer(PagingTest.ADDRESS.concat("=1")); diff --git a/tests/integration-tests-isolated/src/test/java/org/apache/activemq/artemis/tests/integration/isolated/security/JmxSecurityTest.java b/tests/integration-tests-isolated/src/test/java/org/apache/activemq/artemis/tests/integration/isolated/security/JmxSecurityTest.java index f452089a55..c31532d951 100644 --- a/tests/integration-tests-isolated/src/test/java/org/apache/activemq/artemis/tests/integration/isolated/security/JmxSecurityTest.java +++ b/tests/integration-tests-isolated/src/test/java/org/apache/activemq/artemis/tests/integration/isolated/security/JmxSecurityTest.java @@ -111,7 +111,7 @@ public class JmxSecurityTest { AddressControl addressControl = JMX.newMBeanProxy( ManagementFactory.getPlatformMBeanServer(), - ObjectNameBuilder.DEFAULT.getAddressObjectName(SimpleString.toSimpleString("activemq.notifications")), AddressControl.class, false); + ObjectNameBuilder.DEFAULT.getAddressObjectName(SimpleString.of("activemq.notifications")), AddressControl.class, false); try { addressControl.sendMessage(null, 1, "hi", false, null, null); @@ -137,7 +137,7 @@ public class JmxSecurityTest { AddressControl addressControl = JMX.newMBeanProxy( ManagementFactory.getPlatformMBeanServer(), - ObjectNameBuilder.DEFAULT.getAddressObjectName(SimpleString.toSimpleString("activemq.notifications")), AddressControl.class, false); + ObjectNameBuilder.DEFAULT.getAddressObjectName(SimpleString.of("activemq.notifications")), AddressControl.class, false); long unRoutedMessageCount = addressControl.getUnRoutedMessageCount(); assertEquals(0L, unRoutedMessageCount); @@ -168,7 +168,7 @@ public class JmxSecurityTest { QueueControl queueControl = JMX.newMBeanProxy( ManagementFactory.getPlatformMBeanServer(), - ObjectNameBuilder.DEFAULT.getQueueObjectName(SimpleString.toSimpleString("Q1"), SimpleString.toSimpleString("Q1"), RoutingType.ANYCAST), QueueControl.class, false); + ObjectNameBuilder.DEFAULT.getQueueObjectName(SimpleString.of("Q1"), SimpleString.of("Q1"), RoutingType.ANYCAST), QueueControl.class, false); queueControl.getDurableMessageCount(); queueControl.browse(); @@ -273,9 +273,9 @@ public class JmxSecurityTest { @Test public void testQueueAuthorization() throws Exception { - final SimpleString ADDRESS = new SimpleString("address"); - final SimpleString QUEUE_A = new SimpleString("a"); - final SimpleString QUEUE_B = new SimpleString("b"); + final SimpleString ADDRESS = SimpleString.of("address"); + final SimpleString QUEUE_A = SimpleString.of("a"); + final SimpleString QUEUE_B = SimpleString.of("b"); Set aRoles = new HashSet<>(); aRoles.add(new Role(QUEUE_A.toString(), false, true, true, false, false, false, false, false, true, false, true, false)); diff --git a/tests/integration-tests-isolated/src/test/java/org/apache/activemq/artemis/tests/integration/isolated/security/LDAPSecurityTest.java b/tests/integration-tests-isolated/src/test/java/org/apache/activemq/artemis/tests/integration/isolated/security/LDAPSecurityTest.java index c76ceaa0f5..1f91b32c23 100644 --- a/tests/integration-tests-isolated/src/test/java/org/apache/activemq/artemis/tests/integration/isolated/security/LDAPSecurityTest.java +++ b/tests/integration-tests-isolated/src/test/java/org/apache/activemq/artemis/tests/integration/isolated/security/LDAPSecurityTest.java @@ -170,9 +170,9 @@ public class LDAPSecurityTest extends AbstractLdapTestUnit { @Test public void testJAASSecurityManagerAuthorizationNegative() throws Exception { - final SimpleString ADDRESS = new SimpleString("address"); - final SimpleString DURABLE_QUEUE = new SimpleString("durableQueue"); - final SimpleString NON_DURABLE_QUEUE = new SimpleString("nonDurableQueue"); + final SimpleString ADDRESS = SimpleString.of("address"); + final SimpleString DURABLE_QUEUE = SimpleString.of("durableQueue"); + final SimpleString NON_DURABLE_QUEUE = SimpleString.of("nonDurableQueue"); Set roles = new HashSet<>(); roles.add(new Role("programmers", false, false, false, false, false, false, false, false, false, false, false, false)); @@ -256,9 +256,9 @@ public class LDAPSecurityTest extends AbstractLdapTestUnit { @Test public void testJAASSecurityManagerAuthorizationPositive() throws Exception { - final SimpleString ADDRESS = new SimpleString("address"); - final SimpleString DURABLE_QUEUE = new SimpleString("durableQueue"); - final SimpleString NON_DURABLE_QUEUE = new SimpleString("nonDurableQueue"); + final SimpleString ADDRESS = SimpleString.of("address"); + final SimpleString DURABLE_QUEUE = SimpleString.of("durableQueue"); + final SimpleString NON_DURABLE_QUEUE = SimpleString.of("nonDurableQueue"); Set roles = new HashSet<>(); roles.add(new Role("admins", true, true, true, true, true, true, true, true, true, true, false, false)); diff --git a/tests/integration-tests-isolated/src/test/java/org/apache/activemq/artemis/tests/integration/isolated/security/LegacyLDAPSecuritySettingPluginListenerTest.java b/tests/integration-tests-isolated/src/test/java/org/apache/activemq/artemis/tests/integration/isolated/security/LegacyLDAPSecuritySettingPluginListenerTest.java index 7343d3e08e..80c0490abd 100644 --- a/tests/integration-tests-isolated/src/test/java/org/apache/activemq/artemis/tests/integration/isolated/security/LegacyLDAPSecuritySettingPluginListenerTest.java +++ b/tests/integration-tests-isolated/src/test/java/org/apache/activemq/artemis/tests/integration/isolated/security/LegacyLDAPSecuritySettingPluginListenerTest.java @@ -313,7 +313,7 @@ public class LegacyLDAPSecuritySettingPluginListenerTest extends AbstractLdapTes 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)); + ClientProducer producer = session.createProducer(SimpleString.of(queue)); try { producer.send(session.createMessage(true)); diff --git a/tests/integration-tests-isolated/src/test/java/org/apache/activemq/artemis/tests/integration/isolated/security/LegacyLDAPSecuritySettingPluginTest.java b/tests/integration-tests-isolated/src/test/java/org/apache/activemq/artemis/tests/integration/isolated/security/LegacyLDAPSecuritySettingPluginTest.java index 0b4eefda52..669ca2df40 100644 --- a/tests/integration-tests-isolated/src/test/java/org/apache/activemq/artemis/tests/integration/isolated/security/LegacyLDAPSecuritySettingPluginTest.java +++ b/tests/integration-tests-isolated/src/test/java/org/apache/activemq/artemis/tests/integration/isolated/security/LegacyLDAPSecuritySettingPluginTest.java @@ -167,8 +167,8 @@ public class LegacyLDAPSecuritySettingPluginTest extends AbstractLdapTestUnit { @Test public void testPluginAuthorizationNegative() throws Exception { - final SimpleString ADDRESS = new SimpleString("queue2"); - final SimpleString QUEUE = new SimpleString("queue2"); + final SimpleString ADDRESS = SimpleString.of("queue2"); + final SimpleString QUEUE = SimpleString.of("queue2"); server.start(); server.createQueue(new QueueConfiguration(QUEUE).setAddress(ADDRESS).setRoutingType(RoutingType.ANYCAST)); @@ -239,8 +239,8 @@ public class LegacyLDAPSecuritySettingPluginTest extends AbstractLdapTestUnit { @Test public void testPluginAuthorizationPositive() throws Exception { - final SimpleString ADDRESS = new SimpleString("queue1"); - final SimpleString QUEUE = new SimpleString("queue1"); + final SimpleString ADDRESS = SimpleString.of("queue1"); + final SimpleString QUEUE = SimpleString.of("queue1"); server.start(); @@ -343,7 +343,7 @@ public class LegacyLDAPSecuritySettingPluginTest extends AbstractLdapTestUnit { server.start(); // The address needs to exist already otherwise the "admin" permission is required to create it - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("topic1"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("topic1"), RoutingType.MULTICAST)); ConnectionFactory cf = new ActiveMQConnectionFactory("vm://0"); try (Connection connection = cf.createConnection("third", "secret")) { 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 214a3e66cb..77d16a31f4 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 @@ -78,7 +78,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { private ActiveMQServer server; - private final SimpleString propKey = new SimpleString("propkey"); + private final SimpleString propKey = SimpleString.of("propkey"); private final int cacheSize = 10; @@ -88,7 +88,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { session.start(); - final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); + final SimpleString queueName = SimpleString.of("DuplicateDetectionTestQueue"); session.createQueue(new QueueConfiguration(queueName).setDurable(false)); @@ -102,7 +102,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { assertEquals(0, message2.getObjectProperty(propKey)); message = createMessage(session, 1); - SimpleString dupID = new SimpleString("abcdefg"); + SimpleString dupID = SimpleString.of("abcdefg"); message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID.getData()); producer.send(message); message2 = consumer.receive(1000); @@ -123,7 +123,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { // Now try with a different id message = createMessage(session, 4); - SimpleString dupID2 = new SimpleString("hijklmnop"); + SimpleString dupID2 = SimpleString.of("hijklmnop"); message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID2.getData()); producer.send(message); message2 = consumer.receive(1000); @@ -158,7 +158,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { session.start(); - final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); + final SimpleString queueName = SimpleString.of("DuplicateDetectionTestQueue"); session.createQueue(new QueueConfiguration(queueName).setDurable(false)); @@ -172,14 +172,14 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { assertEquals(0, message2.getObjectProperty(propKey)); message = createMessage(session, 1); - SimpleString dupID = new SimpleString("abcdefg"); + SimpleString dupID = SimpleString.of("abcdefg"); message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID.getData()); producer.send(message); message2 = consumer.receive(1000); assertEquals(1, message2.getObjectProperty(propKey)); message = createMessage(session, 2); - SimpleString dupID1 = new SimpleString("abcdefg1"); + SimpleString dupID1 = SimpleString.of("abcdefg1"); message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID1.getData()); producer.send(message); message2 = consumer.receive(1000); @@ -198,7 +198,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { assertEquals(4, message2.getObjectProperty(propKey)); message = createMessage(session, 5); - SimpleString dupID2 = new SimpleString("hijklmnop"); + SimpleString dupID2 = SimpleString.of("hijklmnop"); message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID2.getData()); producer.send(message); message2 = consumer.receive(1000); @@ -266,10 +266,10 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { assertEquals(0, ((PostOfficeImpl) server.getPostOffice()).getDuplicateIDCaches().size()); - final SimpleString addressName = new SimpleString("DuplicateDetectionTestAddress"); + final SimpleString addressName = SimpleString.of("DuplicateDetectionTestAddress"); for (int i = 0; i < TEST_SIZE; i++) { - final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue_" + i); + final SimpleString queueName = SimpleString.of("DuplicateDetectionTestQueue_" + i); session.createQueue(new QueueConfiguration(queueName).setAddress(addressName).setDurable(!temporary).setTemporary(temporary)); @@ -278,7 +278,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { ClientConsumer consumer = session.createConsumer(queueName); ClientMessage message = createMessage(session, 1); - SimpleString dupID = new SimpleString("abcdefg"); + SimpleString dupID = SimpleString.of("abcdefg"); message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID.getData()); producer.send(message); ClientMessage message2 = consumer.receive(1000); @@ -336,14 +336,14 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { session.start(); - final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); + final SimpleString queueName = SimpleString.of("DuplicateDetectionTestQueue"); session.createQueue(new QueueConfiguration(queueName)); ClientProducer producer = session.createProducer(queueName); for (int i = 0; i < TEST_SIZE; i++) { ClientMessage message = session.createMessage(true); - message.putStringProperty(Message.HDR_DUPLICATE_DETECTION_ID, SimpleString.toSimpleString("DUPL-" + i)); + message.putStringProperty(Message.HDR_DUPLICATE_DETECTION_ID, SimpleString.of("DUPL-" + i)); producer.send(message); } session.commit(); @@ -370,7 +370,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { // will send the last 50 again for (int i = TEST_SIZE - 50; i < TEST_SIZE; i++) { ClientMessage message = session.createMessage(true); - message.putStringProperty(Message.HDR_DUPLICATE_DETECTION_ID, SimpleString.toSimpleString("DUPL-" + i)); + message.putStringProperty(Message.HDR_DUPLICATE_DETECTION_ID, SimpleString.of("DUPL-" + i)); producer.send(message); } @@ -389,7 +389,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { session.start(); - final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); + final SimpleString queueName = SimpleString.of("DuplicateDetectionTestQueue"); session.createQueue(new QueueConfiguration(queueName).setDurable(false)); @@ -403,7 +403,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { assertEquals(0, message2.getObjectProperty(propKey)); message = createMessage(session, 1); - SimpleString dupID = new SimpleString("abcdefg"); + SimpleString dupID = SimpleString.of("abcdefg"); message.putStringProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID); producer.send(message); message2 = consumer.receive(1000); @@ -424,7 +424,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { // Now try with a different id message = createMessage(session, 4); - SimpleString dupID2 = new SimpleString("hijklmnop"); + SimpleString dupID2 = SimpleString.of("hijklmnop"); message.putStringProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID2); producer.send(message); message2 = consumer.receive(1000); @@ -449,11 +449,11 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { session.start(); - final SimpleString queueName1 = new SimpleString("DuplicateDetectionTestQueue1"); + final SimpleString queueName1 = SimpleString.of("DuplicateDetectionTestQueue1"); - final SimpleString queueName2 = new SimpleString("DuplicateDetectionTestQueue2"); + final SimpleString queueName2 = SimpleString.of("DuplicateDetectionTestQueue2"); - final SimpleString queueName3 = new SimpleString("DuplicateDetectionTestQueue3"); + final SimpleString queueName3 = SimpleString.of("DuplicateDetectionTestQueue3"); session.createQueue(new QueueConfiguration(queueName1).setDurable(false)); @@ -471,7 +471,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { ClientConsumer consumer3 = session.createConsumer(queueName3); for (int i = 0; i < cacheSize; i++) { - SimpleString dupID = new SimpleString("dupID" + i); + SimpleString dupID = SimpleString.of("dupID" + i); ClientMessage message = createMessage(session, i); @@ -496,7 +496,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { logger.debug("Now sending more"); for (int i = 0; i < cacheSize; i++) { - SimpleString dupID = new SimpleString("dupID" + i); + SimpleString dupID = SimpleString.of("dupID" + i); ClientMessage message = createMessage(session, i); @@ -515,7 +515,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { assertNull(message); for (int i = 0; i < cacheSize; i++) { - SimpleString dupID = new SimpleString("dupID2-" + i); + SimpleString dupID = SimpleString.of("dupID2-" + i); message = createMessage(session, i); @@ -539,7 +539,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { } for (int i = 0; i < cacheSize; i++) { - SimpleString dupID = new SimpleString("dupID2-" + i); + SimpleString dupID = SimpleString.of("dupID2-" + i); message = createMessage(session, i); @@ -560,7 +560,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { // Should be able to send the first lot again now - since the second lot pushed the // first lot out of the cache for (int i = 0; i < cacheSize; i++) { - SimpleString dupID = new SimpleString("dupID" + i); + SimpleString dupID = SimpleString.of("dupID" + i); message = createMessage(session, i); @@ -590,10 +590,10 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { final int addressIdCacheSize = 1; final int globalIdCacheSize = 2; - final SimpleString dupIDOne = new SimpleString("1"); - final SimpleString dupIDTwo = new SimpleString("2"); - final SimpleString globalSettingsQueueName = new SimpleString("GlobalIdCacheSizeQueue"); - final SimpleString addressSettingsQueueName = new SimpleString("AddressIdCacheSizeQueue"); + final SimpleString dupIDOne = SimpleString.of("1"); + final SimpleString dupIDTwo = SimpleString.of("2"); + final SimpleString globalSettingsQueueName = SimpleString.of("GlobalIdCacheSizeQueue"); + final SimpleString addressSettingsQueueName = SimpleString.of("AddressIdCacheSizeQueue"); AddressSettings testAddressSettings = new AddressSettings(); testAddressSettings.setIDCacheSize(addressIdCacheSize); @@ -671,14 +671,14 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { session.start(); - final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); + final SimpleString queueName = SimpleString.of("DuplicateDetectionTestQueue"); session.createQueue(new QueueConfiguration(queueName).setDurable(false)); ClientProducer producer = session.createProducer(queueName); ClientMessage message = createMessage(session, 0); - SimpleString dupID = new SimpleString("abcdefg"); + SimpleString dupID = SimpleString.of("abcdefg"); message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID.getData()); producer.send(message); @@ -713,7 +713,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { session.start(); - final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); + final SimpleString queueName = SimpleString.of("DuplicateDetectionTestQueue"); session.createQueue(new QueueConfiguration(queueName).setDurable(false)); @@ -722,7 +722,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { ClientConsumer consumer = session.createConsumer(queueName); ClientMessage message = createMessage(session, 0); - SimpleString dupID = new SimpleString("abcdefg"); + SimpleString dupID = SimpleString.of("abcdefg"); message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID.getData()); producer.send(message); @@ -749,7 +749,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { session.start(); - final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); + final SimpleString queueName = SimpleString.of("DuplicateDetectionTestQueue"); session.createQueue(new QueueConfiguration(queueName).setDurable(false)); @@ -758,12 +758,12 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { ClientConsumer consumer = session.createConsumer(queueName); ClientMessage message = createMessage(session, 0); - SimpleString dupID1 = new SimpleString("abcdefg"); + SimpleString dupID1 = SimpleString.of("abcdefg"); message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID1.getData()); producer.send(message); message = createMessage(session, 1); - SimpleString dupID2 = new SimpleString("hijklmno"); + SimpleString dupID2 = SimpleString.of("hijklmno"); message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID2.getData()); producer.send(message); @@ -801,7 +801,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { session.start(); - final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); + final SimpleString queueName = SimpleString.of("DuplicateDetectionTestQueue"); session.createQueue(new QueueConfiguration(queueName).setDurable(false)); @@ -810,7 +810,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { ClientConsumer consumer = session.createConsumer(queueName); ClientMessage message = createMessage(session, 0); - SimpleString dupID1 = new SimpleString("abcdefg"); + SimpleString dupID1 = SimpleString.of("abcdefg"); message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID1.getData()); message.putStringProperty("key", dupID1.toString()); producer.send(message); @@ -839,9 +839,9 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { session.start(); - final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); + final SimpleString queueName = SimpleString.of("DuplicateDetectionTestQueue"); - final SimpleString queue2 = new SimpleString("queue2"); + final SimpleString queue2 = SimpleString.of("queue2"); session.createQueue(new QueueConfiguration(queueName).setDurable(false)); @@ -850,7 +850,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { ClientProducer producer = session.createProducer(queueName); ClientMessage message = createMessage(session, 0); - SimpleString dupID = new SimpleString("abcdefg"); + SimpleString dupID = SimpleString.of("abcdefg"); message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID.getData()); producer.send(message); @@ -921,14 +921,14 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { session.start(); - final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); + final SimpleString queueName = SimpleString.of("DuplicateDetectionTestQueue"); session.createQueue(new QueueConfiguration(queueName).setDurable(false)); ClientProducer producer = session.createProducer(queueName); ClientMessage message = createMessage(session, 0); - SimpleString dupID = new SimpleString("abcdefg"); + SimpleString dupID = SimpleString.of("abcdefg"); message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID.getData()); producer.send(message); @@ -990,14 +990,14 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { session.start(); - final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); + final SimpleString queueName = SimpleString.of("DuplicateDetectionTestQueue"); session.createQueue(new QueueConfiguration(queueName).setDurable(false)); ClientProducer producer = session.createProducer(queueName); ClientMessage message = createMessage(session, 0); - SimpleString dupID = new SimpleString("abcdefg"); + SimpleString dupID = SimpleString.of("abcdefg"); message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID.getData()); producer.send(message); @@ -1061,14 +1061,14 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { session.start(); - final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); + final SimpleString queueName = SimpleString.of("DuplicateDetectionTestQueue"); session.createQueue(new QueueConfiguration(queueName).setDurable(false)); ClientProducer producer = session.createProducer(queueName); ClientMessage message = createMessage(session, 0); - SimpleString dupID = new SimpleString("abcdefg"); + SimpleString dupID = SimpleString.of("abcdefg"); message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID.getData()); producer.send(message); @@ -1131,14 +1131,14 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { session.start(); - final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); + final SimpleString queueName = SimpleString.of("DuplicateDetectionTestQueue"); session.createQueue(new QueueConfiguration(queueName).setDurable(false)); ClientProducer producer = session.createProducer(queueName); ClientMessage message = createMessage(session, 0); - SimpleString dupID = new SimpleString("abcdefg"); + SimpleString dupID = SimpleString.of("abcdefg"); message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID.getData()); producer.send(message); @@ -1193,14 +1193,14 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { session.start(); - final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); + final SimpleString queueName = SimpleString.of("DuplicateDetectionTestQueue"); session.createQueue(new QueueConfiguration(queueName)); ClientProducer producer = session.createProducer(queueName); ClientMessage message = createMessage(session, 0); - SimpleString dupID = new SimpleString("abcdefg"); + SimpleString dupID = SimpleString.of("abcdefg"); message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID.getData()); producer.send(message); @@ -1271,14 +1271,14 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { session.start(); - final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); + final SimpleString queueName = SimpleString.of("DuplicateDetectionTestQueue"); session.createQueue(new QueueConfiguration(queueName).setDurable(false)); ClientProducer producer = session.createProducer(queueName); ClientMessage message = createMessage(session, 0); - SimpleString dupID = new SimpleString("abcdefg"); + SimpleString dupID = SimpleString.of("abcdefg"); message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID.getData()); producer.send(message); @@ -1362,7 +1362,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { session.start(); - final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); + final SimpleString queueName = SimpleString.of("DuplicateDetectionTestQueue"); session.createQueue(new QueueConfiguration(queueName).setDurable(false)); @@ -1371,14 +1371,14 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { ClientConsumer consumer = session.createConsumer(queueName); ClientMessage message = createMessage(session, 1); - SimpleString dupID = new SimpleString("abcdefg"); + SimpleString dupID = SimpleString.of("abcdefg"); message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID.getData()); producer.send(message); ClientMessage message2 = consumer.receive(1000); assertEquals(1, message2.getObjectProperty(propKey)); message = createMessage(session, 2); - SimpleString dupID2 = new SimpleString("hijklmnopqr"); + SimpleString dupID2 = SimpleString.of("hijklmnopqr"); message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID2.getData()); producer.send(message); message2 = consumer.receive(1000); @@ -1437,7 +1437,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { session.start(); - final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); + final SimpleString queueName = SimpleString.of("DuplicateDetectionTestQueue"); session.createQueue(new QueueConfiguration(queueName).setDurable(false)); @@ -1447,7 +1447,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { for (int i = 0; i < theCacheSize; i++) { ClientMessage message = createMessage(session, i); - SimpleString dupID = new SimpleString("abcdefg" + i); + SimpleString dupID = SimpleString.of("abcdefg" + i); message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID.getData()); producer.send(message); ClientMessage message2 = consumer.receive(1000); @@ -1478,7 +1478,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { for (int i = 0; i < theCacheSize; i++) { ClientMessage message = createMessage(session, i); - SimpleString dupID = new SimpleString("abcdefg" + i); + SimpleString dupID = SimpleString.of("abcdefg" + i); message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID.getData()); producer.send(message); ClientMessage message2 = consumer.receiveImmediate(); @@ -1502,7 +1502,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { session.start(); - final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); + final SimpleString queueName = SimpleString.of("DuplicateDetectionTestQueue"); session.createQueue(new QueueConfiguration(queueName).setDurable(false)); @@ -1511,14 +1511,14 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { ClientConsumer consumer = session.createConsumer(queueName); ClientMessage message = createMessage(session, 1); - SimpleString dupID = new SimpleString("abcdefg"); + SimpleString dupID = SimpleString.of("abcdefg"); message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID.getData()); producer.send(message); ClientMessage message2 = consumer.receive(1000); assertEquals(1, message2.getObjectProperty(propKey)); message = createMessage(session, 2); - SimpleString dupID2 = new SimpleString("hijklmnopqr"); + SimpleString dupID2 = SimpleString.of("hijklmnopqr"); message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID2.getData()); producer.send(message); message2 = consumer.receive(1000); @@ -1575,7 +1575,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { session.start(); - final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); + final SimpleString queueName = SimpleString.of("DuplicateDetectionTestQueue"); session.createQueue(new QueueConfiguration(queueName).setDurable(false)); @@ -1584,7 +1584,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { ClientConsumer consumer = session.createConsumer(queueName); ClientMessage message = createMessage(session, 1); - SimpleString dupID = new SimpleString("abcdefg"); + SimpleString dupID = SimpleString.of("abcdefg"); message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID.getData()); producer.send(message); session.commit(); @@ -1592,7 +1592,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { assertEquals(1, message2.getObjectProperty(propKey)); message = createMessage(session, 2); - SimpleString dupID2 = new SimpleString("hijklmnopqr"); + SimpleString dupID2 = SimpleString.of("hijklmnopqr"); message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID2.getData()); producer.send(message); session.commit(); @@ -1643,7 +1643,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { session.start(); - final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); + final SimpleString queueName = SimpleString.of("DuplicateDetectionTestQueue"); session.createQueue(new QueueConfiguration(queueName).setDurable(false)); @@ -1652,7 +1652,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { ClientConsumer consumer = session.createConsumer(queueName); ClientMessage message = createMessage(session, 1); - SimpleString dupID = new SimpleString("abcdefg"); + SimpleString dupID = SimpleString.of("abcdefg"); message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID.getData()); producer.send(message); session.commit(); @@ -1662,7 +1662,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { assertEquals(1, message2.getObjectProperty(propKey)); message = createMessage(session, 2); - SimpleString dupID2 = new SimpleString("hijklmnopqr"); + SimpleString dupID2 = SimpleString.of("hijklmnopqr"); message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID2.getData()); producer.send(message); session.commit(); @@ -1744,7 +1744,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { session.start(); - final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); + final SimpleString queueName = SimpleString.of("DuplicateDetectionTestQueue"); session.createQueue(new QueueConfiguration(queueName).setDurable(false)); @@ -1753,12 +1753,12 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { ClientConsumer consumer = session.createConsumer(queueName); ClientMessage message = createMessage(session, 1); - SimpleString dupID = new SimpleString("abcdefg"); + SimpleString dupID = SimpleString.of("abcdefg"); message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID.getData()); producer.send(message); message = createMessage(session, 2); - SimpleString dupID2 = new SimpleString("hijklmnopqr"); + SimpleString dupID2 = SimpleString.of("hijklmnopqr"); message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID2.getData()); producer.send(message); @@ -1825,19 +1825,19 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { session.start(); - final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); + final SimpleString queueName = SimpleString.of("DuplicateDetectionTestQueue"); session.createQueue(new QueueConfiguration(queueName).setDurable(false)); ClientProducer producer = session.createProducer(queueName); ClientMessage message = createMessage(session, 1); - SimpleString dupID = new SimpleString("abcdefg"); + SimpleString dupID = SimpleString.of("abcdefg"); message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID.getData()); producer.send(message); message = createMessage(session, 2); - SimpleString dupID2 = new SimpleString("hijklmnopqr"); + SimpleString dupID2 = SimpleString.of("hijklmnopqr"); message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID2.getData()); producer.send(message); @@ -1904,7 +1904,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { session.start(); - final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue"); + final SimpleString queueName = SimpleString.of("DuplicateDetectionTestQueue"); session.createQueue(new QueueConfiguration(queueName).setDurable(false)); @@ -1913,12 +1913,12 @@ public class DuplicateDetectionTest extends ActiveMQTestBase { ClientConsumer consumer = session.createConsumer(queueName); ClientMessage message = createMessage(session, 1); - SimpleString dupID = new SimpleString("abcdefg"); + SimpleString dupID = SimpleString.of("abcdefg"); message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID.getData()); producer.send(message); message = createMessage(session, 2); - SimpleString dupID2 = new SimpleString("hijklmnopqr"); + SimpleString dupID2 = SimpleString.of("hijklmnopqr"); message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID2.getData()); producer.send(message); 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 8ef179b699..df60f28d26 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 @@ -53,7 +53,7 @@ public class AddressConfigTest extends ActiveMQTestBase { server.createQueue(new QueueConfiguration("myQueue").setAddress("myAddress")); server.stop(); server.start(); - AddressInfo addressInfo = server.getAddressInfo(SimpleString.toSimpleString("myAddress")); + AddressInfo addressInfo = server.getAddressInfo(SimpleString.of("myAddress")); assertNotNull(addressInfo); Set routingTypeSet = new HashSet<>(); @@ -68,7 +68,7 @@ public class AddressConfigTest extends ActiveMQTestBase { long id = addressInfo.getId(); server.stop(); server.start(); - addressInfo = server.getAddressInfo(SimpleString.toSimpleString("myAddress")); + addressInfo = server.getAddressInfo(SimpleString.of("myAddress")); assertNotNull(addressInfo); routingTypeSet = new HashSet<>(); routingTypeSet.add(RoutingType.MULTICAST); 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 883e6cb6dd..421290a8c2 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 @@ -68,7 +68,7 @@ public class AddressingTest extends ActiveMQTestBase { @Test public void testMulticastRouting() throws Exception { - SimpleString sendAddress = new SimpleString("test.address"); + SimpleString sendAddress = SimpleString.of("test.address"); List testAddresses = Arrays.asList("test.address", "test.#", "test.*"); @@ -76,12 +76,12 @@ public class AddressingTest extends ActiveMQTestBase { // For each address, create 2 Queues with the same address, assert both queues receive message - AddressInfo addressInfo = new AddressInfo(new SimpleString(consumeAddress)); + AddressInfo addressInfo = new AddressInfo(SimpleString.of(consumeAddress)); addressInfo.addRoutingType(RoutingType.MULTICAST); server.addOrUpdateAddressInfo(addressInfo); - 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)); + Queue q1 = server.createQueue(new QueueConfiguration(SimpleString.of(consumeAddress + ".1")).setAddress(SimpleString.of(consumeAddress)).setRoutingType(RoutingType.MULTICAST)); + Queue q2 = server.createQueue(new QueueConfiguration(SimpleString.of(consumeAddress + ".2")).setAddress(SimpleString.of(consumeAddress)).setRoutingType(RoutingType.MULTICAST)); ClientSession session = sessionFactory.createSession(); session.start(); @@ -106,14 +106,14 @@ public class AddressingTest extends ActiveMQTestBase { @Test public void testDynamicMulticastRouting() throws Exception { - SimpleString sendAddress = new SimpleString("test.address"); + SimpleString sendAddress = SimpleString.of("test.address"); AddressInfo addressInfo = new AddressInfo(sendAddress); addressInfo.addRoutingType(RoutingType.MULTICAST); server.addOrUpdateAddressInfo(addressInfo); - Queue q1 = server.createQueue(new QueueConfiguration(new SimpleString("1.test.address")).setAddress("test.address").setRoutingType(RoutingType.MULTICAST)); - Queue q2 = server.createQueue(new QueueConfiguration(new SimpleString("2.test.#")).setAddress("test.#").setRoutingType(RoutingType.MULTICAST)); + Queue q1 = server.createQueue(new QueueConfiguration(SimpleString.of("1.test.address")).setAddress("test.address").setRoutingType(RoutingType.MULTICAST)); + Queue q2 = server.createQueue(new QueueConfiguration(SimpleString.of("2.test.#")).setAddress("test.#").setRoutingType(RoutingType.MULTICAST)); ClientSession session = sessionFactory.createSession(); session.start(); @@ -133,7 +133,7 @@ public class AddressingTest extends ActiveMQTestBase { assertNotNull(consumer2.receive(2000)); // add in a new wildcard producer, bindings version will be incremented - Queue q3 = server.createQueue(new QueueConfiguration(new SimpleString("3.test.*")).setAddress("test.*").setRoutingType(RoutingType.MULTICAST)); + Queue q3 = server.createQueue(new QueueConfiguration(SimpleString.of("3.test.*")).setAddress("test.*").setRoutingType(RoutingType.MULTICAST)); ClientConsumer consumer3 = session.createConsumer(q3.getName()); producer.send(m); @@ -150,7 +150,7 @@ public class AddressingTest extends ActiveMQTestBase { @Test public void testAnycastRouting() throws Exception { - SimpleString sendAddress = new SimpleString("test.address"); + SimpleString sendAddress = SimpleString.of("test.address"); List testAddresses = Arrays.asList("test.address", "test.#", "test.*"); @@ -158,12 +158,12 @@ public class AddressingTest extends ActiveMQTestBase { // For each address, create 2 Queues with the same address, assert one queue receive message - AddressInfo addressInfo = new AddressInfo(new SimpleString(consumeAddress)); + AddressInfo addressInfo = new AddressInfo(SimpleString.of(consumeAddress)); addressInfo.addRoutingType(RoutingType.ANYCAST); server.addOrUpdateAddressInfo(addressInfo); - 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)); + Queue q1 = server.createQueue(new QueueConfiguration(SimpleString.of(consumeAddress + ".1")).setAddress(SimpleString.of(consumeAddress)).setRoutingType(RoutingType.ANYCAST).setMaxConsumers(Queue.MAX_CONSUMERS_UNLIMITED)); + Queue q2 = server.createQueue(new QueueConfiguration(SimpleString.of(consumeAddress + ".2")).setAddress(SimpleString.of(consumeAddress)).setRoutingType(RoutingType.ANYCAST).setMaxConsumers(Queue.MAX_CONSUMERS_UNLIMITED)); ClientSession session = sessionFactory.createSession(); session.start(); @@ -191,7 +191,7 @@ public class AddressingTest extends ActiveMQTestBase { @Test public void testAnycastRoutingRoundRobin() throws Exception { - SimpleString address = new SimpleString("test.address"); + SimpleString address = SimpleString.of("test.address"); AddressInfo addressInfo = new AddressInfo(address); addressInfo.addRoutingType(RoutingType.ANYCAST); @@ -242,15 +242,15 @@ public class AddressingTest extends ActiveMQTestBase { @Test public void testMulticastRoutingBackwardsCompat() throws Exception { - SimpleString sendAddress = new SimpleString("test.address"); + SimpleString sendAddress = SimpleString.of("test.address"); List testAddresses = Arrays.asList("test.address", "test.#", "test.*"); for (String consumeAddress : testAddresses) { // For each address, create 2 Queues with the same address, assert both queues receive message - 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)); + Queue q1 = server.createQueue(new QueueConfiguration(SimpleString.of(consumeAddress + ".1")).setAddress(SimpleString.of(consumeAddress)).setRoutingType(RoutingType.MULTICAST)); + Queue q2 = server.createQueue(new QueueConfiguration(SimpleString.of(consumeAddress + ".2")).setAddress(SimpleString.of(consumeAddress)).setRoutingType(RoutingType.MULTICAST)); ClientSession session = sessionFactory.createSession(); session.start(); @@ -274,8 +274,8 @@ public class AddressingTest extends ActiveMQTestBase { @Test public void testPurgeOnNoConsumersTrue() throws Exception { - SimpleString address = new SimpleString("test.address"); - SimpleString queueName = SimpleString.toSimpleString(UUID.randomUUID().toString()); + SimpleString address = SimpleString.of("test.address"); + SimpleString queueName = SimpleString.of(UUID.randomUUID().toString()); server.createQueue(new QueueConfiguration(queueName).setAddress(address).setRoutingType(RoutingType.ANYCAST).setMaxConsumers(1).setPurgeOnNoConsumers(true)); Queue queue = server.locateQueue(queueName); assertNotNull(queue); @@ -304,8 +304,8 @@ public class AddressingTest extends ActiveMQTestBase { @Test public void testPurgeOnNoConsumersFalse() throws Exception { - SimpleString address = new SimpleString("test.address"); - SimpleString queueName = SimpleString.toSimpleString(UUID.randomUUID().toString()); + SimpleString address = SimpleString.of("test.address"); + SimpleString queueName = SimpleString.of(UUID.randomUUID().toString()); server.createQueue(new QueueConfiguration(queueName).setAddress(address).setRoutingType(RoutingType.ANYCAST).setMaxConsumers(1)); assertNotNull(server.locateQueue(queueName)); ClientSession session = sessionFactory.createSession(); @@ -319,10 +319,10 @@ public class AddressingTest extends ActiveMQTestBase { @Test public void testQueueEnabledDisabled() throws Exception { - SimpleString address = new SimpleString("test.address"); - SimpleString defaultQueue = SimpleString.toSimpleString(UUID.randomUUID().toString()); - SimpleString enabledQueue = SimpleString.toSimpleString(UUID.randomUUID().toString()); - SimpleString disabledQueue = SimpleString.toSimpleString(UUID.randomUUID().toString()); + SimpleString address = SimpleString.of("test.address"); + SimpleString defaultQueue = SimpleString.of(UUID.randomUUID().toString()); + SimpleString enabledQueue = SimpleString.of(UUID.randomUUID().toString()); + SimpleString disabledQueue = SimpleString.of(UUID.randomUUID().toString()); //Validate default is enabled, and check that queues enabled receive messages and disabled do not on same address. @@ -374,8 +374,8 @@ public class AddressingTest extends ActiveMQTestBase { @Test public void testLimitOnMaxConsumers() throws Exception { - SimpleString address = new SimpleString("test.address"); - SimpleString queueName = SimpleString.toSimpleString(UUID.randomUUID().toString()); + SimpleString address = SimpleString.of("test.address"); + SimpleString queueName = SimpleString.of(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(new QueueConfiguration(queueName).setAddress(address).setMaxConsumers(0).setPurgeOnNoConsumers(purgeOnNoConsumers)); @@ -400,8 +400,8 @@ public class AddressingTest extends ActiveMQTestBase { @Test public void testUnlimitedMaxConsumers() throws Exception { int noConsumers = 50; - SimpleString address = new SimpleString("test.address"); - SimpleString queueName = SimpleString.toSimpleString(UUID.randomUUID().toString()); + SimpleString address = SimpleString.of("test.address"); + SimpleString queueName = SimpleString.of(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(new QueueConfiguration(queueName).setAddress(address).setMaxConsumers(Queue.MAX_CONSUMERS_UNLIMITED).setPurgeOnNoConsumers(purgeOnNoConsumers)); @@ -416,10 +416,10 @@ public class AddressingTest extends ActiveMQTestBase { @Test public void testEmptyRoutingTypes() throws Exception { - server.addOrUpdateAddressInfo(new AddressInfo(SimpleString.toSimpleString("xy"))); + server.addOrUpdateAddressInfo(new AddressInfo(SimpleString.of("xy"))); server.stop(); server.start(); - server.addOrUpdateAddressInfo(new AddressInfo(SimpleString.toSimpleString("xy"))); + server.addOrUpdateAddressInfo(new AddressInfo(SimpleString.of("xy"))); server.stop(); } } 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 5f7aac0bdd..64745c3e08 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 @@ -46,7 +46,7 @@ import org.slf4j.LoggerFactory; public class AnycastTest extends ActiveMQTestBase { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - private SimpleString baseAddress = new SimpleString("anycast.address"); + private SimpleString baseAddress = SimpleString.of("anycast.address"); private AddressInfo addressInfo; 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 62e91683e0..2415711b98 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 @@ -48,7 +48,7 @@ import java.util.concurrent.TimeUnit; public class MulticastTest extends ActiveMQTestBase { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - private SimpleString baseAddress = new SimpleString("multicast.address"); + private SimpleString baseAddress = SimpleString.of("multicast.address"); private AddressInfo addressInfo; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/addressing/SendDLQNoRouteTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/addressing/SendDLQNoRouteTest.java index 71ed2e59d1..7e32c483dc 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/addressing/SendDLQNoRouteTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/addressing/SendDLQNoRouteTest.java @@ -47,13 +47,13 @@ public class SendDLQNoRouteTest extends ActiveMQTestBase { @Timeout(20) public void testDLQNoRoute() throws Exception { AddressSettings addressSettings = new AddressSettings().setSendToDLAOnNoRoute(true); - addressSettings.setDeadLetterAddress(SimpleString.toSimpleString("DLA")); + addressSettings.setDeadLetterAddress(SimpleString.of("DLA")); server.getAddressSettingsRepository().addMatch("#", addressSettings); - AddressInfo info = new AddressInfo(SimpleString.toSimpleString("info")).addRoutingType(RoutingType.MULTICAST); + AddressInfo info = new AddressInfo(SimpleString.of("info")).addRoutingType(RoutingType.MULTICAST); server.addAddressInfo(info); - AddressInfo dla = new AddressInfo(SimpleString.toSimpleString("DLA")).addRoutingType(RoutingType.MULTICAST); + AddressInfo dla = new AddressInfo(SimpleString.of("DLA")).addRoutingType(RoutingType.MULTICAST); server.addAddressInfo(dla); 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 c7627b4377..a2c4cc4593 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 @@ -63,7 +63,7 @@ public class TwoWaysRemoveAddressTest extends ActiveMQTestBase { for (int i = 0; i < retries; i++) { logger.debug("Removed queue on thread 1 ::{}", i); server.createQueue(new QueueConfiguration("queueName_1_" + i).setAddress("address_1_" + i).setRoutingType(RoutingType.ANYCAST)); - server.destroyQueue(SimpleString.toSimpleString("queueName_1_" + i)); + server.destroyQueue(SimpleString.of("queueName_1_" + i)); } } catch (Throwable e) { logger.warn(e.getMessage(), e); @@ -82,7 +82,7 @@ public class TwoWaysRemoveAddressTest extends ActiveMQTestBase { for (int i = 0; i < retries; i++) { logger.debug("Removed queue on thread 2 ::{}", i); server.createQueue(new QueueConfiguration("queueName_2_" + i).setAddress("address_2_" + i).setRoutingType(RoutingType.ANYCAST)); - server.removeAddressInfo(SimpleString.toSimpleString("address_2_" + i), null, true); + server.removeAddressInfo(SimpleString.of("address_2_" + i), null, true); } } catch (Throwable e) { logger.warn(e.getMessage(), e); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpAnonymousRelayTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpAnonymousRelayTest.java index 228378bca5..830eeb5dcb 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpAnonymousRelayTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpAnonymousRelayTest.java @@ -94,13 +94,13 @@ public class AmqpAnonymousRelayTest extends AmqpClientTestSupport { message.setAddress(queueName); message.setText(getTestName()); - AddressQueryResult addressQueryResult = server.addressQuery(SimpleString.toSimpleString(queueName)); + AddressQueryResult addressQueryResult = server.addressQuery(SimpleString.of(queueName)); assertFalse(addressQueryResult.isExists()); sender.send(message); sender.close(); - addressQueryResult = server.addressQuery(SimpleString.toSimpleString(queueName)); + addressQueryResult = server.addressQuery(SimpleString.of(queueName)); assertTrue(addressQueryResult.isExists()); assertTrue(addressQueryResult.getRoutingTypes().contains(RoutingType.ANYCAST)); assertTrue(addressQueryResult.isAutoCreated()); @@ -138,12 +138,12 @@ public class AmqpAnonymousRelayTest extends AmqpClientTestSupport { message.setAddress(topicName); message.setText("creating-topic-address"); - AddressQueryResult addressQueryResult = server.addressQuery(SimpleString.toSimpleString(topicName)); + AddressQueryResult addressQueryResult = server.addressQuery(SimpleString.of(topicName)); assertFalse(addressQueryResult.isExists()); sender.send(message); - addressQueryResult = server.addressQuery(SimpleString.toSimpleString(topicName)); + addressQueryResult = server.addressQuery(SimpleString.of(topicName)); assertTrue(addressQueryResult.isExists()); assertTrue(addressQueryResult.getRoutingTypes().contains(RoutingType.MULTICAST)); assertTrue(addressQueryResult.isAutoCreated()); @@ -199,13 +199,13 @@ public class AmqpAnonymousRelayTest extends AmqpClientTestSupport { message.setAddress(queueName); message.setText(getTestName()); - AddressQueryResult addressQueryResult = server.addressQuery(SimpleString.toSimpleString(queueName)); + AddressQueryResult addressQueryResult = server.addressQuery(SimpleString.of(queueName)); assertFalse(addressQueryResult.isExists()); sender.send(message); sender.close(); - addressQueryResult = server.addressQuery(SimpleString.toSimpleString(queueName)); + addressQueryResult = server.addressQuery(SimpleString.of(queueName)); assertTrue(addressQueryResult.isExists()); assertTrue(addressQueryResult.getRoutingTypes().contains(RoutingType.ANYCAST)); assertTrue(addressQueryResult.isAutoCreated()); @@ -244,12 +244,12 @@ public class AmqpAnonymousRelayTest extends AmqpClientTestSupport { message.setAddress(topicName); message.setText("creating-topic-address"); - AddressQueryResult addressQueryResult = server.addressQuery(SimpleString.toSimpleString(topicName)); + AddressQueryResult addressQueryResult = server.addressQuery(SimpleString.of(topicName)); assertFalse(addressQueryResult.isExists()); sender.send(message); - addressQueryResult = server.addressQuery(SimpleString.toSimpleString(topicName)); + addressQueryResult = server.addressQuery(SimpleString.of(topicName)); assertTrue(addressQueryResult.isExists()); assertTrue(addressQueryResult.getRoutingTypes().contains(RoutingType.MULTICAST)); assertTrue(addressQueryResult.isAutoCreated()); 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 9535e06ea1..936a1fb0a5 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 @@ -114,10 +114,10 @@ public class AmqpBridgeApplicationPropertiesTest extends AmqpClientTestSupport { server0.getConfiguration().addDivertConfiguration(customNotificationsDivert); server1.getConfiguration().addDivertConfiguration(frameworkNotificationsDivert); - customNotificationQueue = SimpleString.toSimpleString("*.Provider.*.Agent.*.CustomNotification"); - frameworkNotificationsQueue = SimpleString.toSimpleString("FrameworkNotifications"); - bridgeNotificationsQueue = SimpleString.toSimpleString("BridgeNotifications"); - notificationsQueue = SimpleString.toSimpleString("Notifications"); + customNotificationQueue = SimpleString.of("*.Provider.*.Agent.*.CustomNotification"); + frameworkNotificationsQueue = SimpleString.of("FrameworkNotifications"); + bridgeNotificationsQueue = SimpleString.of("BridgeNotifications"); + notificationsQueue = SimpleString.of("Notifications"); server0.start(); server1.start(); 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 97f69de315..48f84a3735 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 @@ -123,10 +123,10 @@ public class AmqpBridgeClusterRedistributionTest extends AmqpClientTestSupport { server1.getConfiguration().addDivertConfiguration(frameworkNotificationsDivertServer1); server2.getConfiguration().addDivertConfiguration(frameworkNotificationsDivertServer2); - customNotificationQueue = SimpleString.toSimpleString("*.Provider.*.Agent.*.CustomNotification"); - frameworkNotificationsQueue = SimpleString.toSimpleString("FrameworkNotifications"); - bridgeNotificationsQueue = SimpleString.toSimpleString("BridgeNotifications"); - notificationsQueue = SimpleString.toSimpleString("Notifications"); + customNotificationQueue = SimpleString.of("*.Provider.*.Agent.*.CustomNotification"); + frameworkNotificationsQueue = SimpleString.of("FrameworkNotifications"); + bridgeNotificationsQueue = SimpleString.of("BridgeNotifications"); + notificationsQueue = SimpleString.of("Notifications"); setupClusterConnection("cluster-1->2", "", MessageLoadBalancingType.ON_DEMAND, 1, true, 1, 2); setupClusterConnection("cluster-2->1", "", MessageLoadBalancingType.ON_DEMAND, 1, true, 2, 1); 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 2fca3e7d75..b7b6c0d13c 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 @@ -159,8 +159,8 @@ public class AmqpClientTestSupport extends AmqpTestSupport { addressSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE); addressSettings.setAutoCreateQueues(isAutoCreateQueues()); addressSettings.setAutoCreateAddresses(isAutoCreateAddresses()); - addressSettings.setDeadLetterAddress(SimpleString.toSimpleString(getDeadLetterAddress())); - addressSettings.setExpiryAddress(SimpleString.toSimpleString(getDeadLetterAddress())); + addressSettings.setDeadLetterAddress(SimpleString.of(getDeadLetterAddress())); + addressSettings.setExpiryAddress(SimpleString.of(getDeadLetterAddress())); server.getConfiguration().getAddressSettings().put("#", addressSettings); Set acceptors = server.getConfiguration().getAcceptorConfigurations(); @@ -175,20 +175,20 @@ public class AmqpClientTestSupport extends AmqpTestSupport { @Override protected void createAddressAndQueues(ActiveMQServer server) throws Exception { // Default Queue - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(getQueueName()), RoutingType.ANYCAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of(getQueueName()), RoutingType.ANYCAST)); server.createQueue(new QueueConfiguration(getQueueName()).setRoutingType(RoutingType.ANYCAST)); // Default DLQ - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(getDeadLetterAddress()), RoutingType.ANYCAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of(getDeadLetterAddress()), RoutingType.ANYCAST)); server.createQueue(new QueueConfiguration(getDeadLetterAddress()).setRoutingType(RoutingType.ANYCAST)); // Default Topic - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(getTopicName()), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of(getTopicName()), RoutingType.MULTICAST)); 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.addAddressInfo(new AddressInfo(SimpleString.of(getQueueName(i)), RoutingType.ANYCAST)); server.createQueue(new QueueConfiguration(getQueueName(i)).setRoutingType(RoutingType.ANYCAST)); } } @@ -232,7 +232,7 @@ public class AmqpClientTestSupport extends AmqpTestSupport { } public Queue getProxyToQueue(String queueName) { - return server.locateQueue(SimpleString.toSimpleString(queueName)); + return server.locateQueue(SimpleString.of(queueName)); } public String getTestName() { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpDurableReceiverReconnectWithMulticastPrefixTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpDurableReceiverReconnectWithMulticastPrefixTest.java index b1ab8daaaa..b4b6a733b1 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpDurableReceiverReconnectWithMulticastPrefixTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpDurableReceiverReconnectWithMulticastPrefixTest.java @@ -204,7 +204,7 @@ public class AmqpDurableReceiverReconnectWithMulticastPrefixTest extends JMSClie } private Queue lookupSubscriptionQueue() { - Binding binding = server.getPostOffice().getBinding(new SimpleString(getContainerID() + "." + getSubscriptionName())); + Binding binding = server.getPostOffice().getBinding(SimpleString.of(getContainerID() + "." + getSubscriptionName())); if (binding != null && binding instanceof LocalQueueBinding) { return ((LocalQueueBinding) binding).getQueue(); } @@ -213,6 +213,6 @@ public class AmqpDurableReceiverReconnectWithMulticastPrefixTest extends JMSClie } private AddressQueryResult getProxyToAddress(String addressName) throws Exception { - return server.addressQuery(SimpleString.toSimpleString(addressName)); + return server.addressQuery(SimpleString.of(addressName)); } } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpDurableReceiverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpDurableReceiverTest.java index 1dcade2b1b..6d9cd9a228 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpDurableReceiverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpDurableReceiverTest.java @@ -365,7 +365,7 @@ public class AmqpDurableReceiverTest extends AmqpClientTestSupport { } public String lookupSubscription() { - Binding binding = server.getPostOffice().getBinding(new SimpleString(getContainerID() + "." + getSubscriptionName())); + Binding binding = server.getPostOffice().getBinding(SimpleString.of(getContainerID() + "." + getSubscriptionName())); if (binding != null) { return binding.getAddress().toString(); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpExpiredMessageTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpExpiredMessageTest.java index 2472f57cc6..72ecd0ff0f 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpExpiredMessageTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpExpiredMessageTest.java @@ -705,8 +705,8 @@ public class AmqpExpiredMessageTest extends AmqpClientTestSupport { addressSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE); addressSettings.setAutoCreateQueues(isAutoCreateQueues()); addressSettings.setAutoCreateAddresses(isAutoCreateAddresses()); - addressSettings.setDeadLetterAddress(SimpleString.toSimpleString(getDeadLetterAddress())); - addressSettings.setExpiryAddress(SimpleString.toSimpleString(getDeadLetterAddress())); + addressSettings.setDeadLetterAddress(SimpleString.of(getDeadLetterAddress())); + addressSettings.setExpiryAddress(SimpleString.of(getDeadLetterAddress())); addressSettings.setExpiryDelay(1000L); server.getAddressSettingsRepository().clear(); @@ -766,8 +766,8 @@ public class AmqpExpiredMessageTest extends AmqpClientTestSupport { addressSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE); addressSettings.setAutoCreateQueues(isAutoCreateQueues()); addressSettings.setAutoCreateAddresses(isAutoCreateAddresses()); - addressSettings.setDeadLetterAddress(SimpleString.toSimpleString(getDeadLetterAddress())); - addressSettings.setExpiryAddress(SimpleString.toSimpleString(getDeadLetterAddress())); + addressSettings.setDeadLetterAddress(SimpleString.of(getDeadLetterAddress())); + addressSettings.setExpiryAddress(SimpleString.of(getDeadLetterAddress())); addressSettings.setExpiryDelay(1000L); server.getAddressSettingsRepository().clear(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpFlowControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpFlowControlTest.java index 6e36163fbc..28f13dcee4 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpFlowControlTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpFlowControlTest.java @@ -104,7 +104,7 @@ public class AmqpFlowControlTest extends JMSClientTestSupport { AmqpConnection connection = addConnection(client.connect()); try { - AddressControl addressControl = ManagementControlHelper.createAddressControl(SimpleString.toSimpleString(getQueueName()), mBeanServer); + AddressControl addressControl = ManagementControlHelper.createAddressControl(SimpleString.of(getQueueName()), mBeanServer); addressControl.block(); AmqpSession session = connection.createSession(); final AmqpSender sender = session.createSender(getQueueName()); @@ -148,7 +148,7 @@ public class AmqpFlowControlTest extends JMSClientTestSupport { // This should be -1. A single message is buffered in the client, and 0 credit has been allocated. assertTrue(sender.getSender().getCredit() == -1); - long addressSize = server.getPagingManager().getPageStore(new SimpleString(getQueueName())).getAddressSize(); + long addressSize = server.getPagingManager().getPageStore(SimpleString.of(getQueueName())).getAddressSize(); assertTrue(addressSize >= MAX_SIZE_BYTES && addressSize <= MAX_SIZE_BYTES_REJECT_THRESHOLD); } finally { connection.close(); @@ -174,7 +174,7 @@ public class AmqpFlowControlTest extends JMSClientTestSupport { assertTrue(e instanceof ResourceAllocationException); assertTrue(e.getMessage().contains("resource-limit-exceeded")); - long addressSize = server.getPagingManager().getPageStore(new SimpleString(getQueueName())).getAddressSize(); + long addressSize = server.getPagingManager().getPageStore(SimpleString.of(getQueueName())).getAddressSize(); assertTrue(addressSize >= MAX_SIZE_BYTES_REJECT_THRESHOLD); } @@ -189,7 +189,7 @@ public class AmqpFlowControlTest extends JMSClientTestSupport { final CountDownLatch running = new CountDownLatch(1); final CountDownLatch done = new CountDownLatch(1); - AddressControl addressControl = ManagementControlHelper.createAddressControl(SimpleString.toSimpleString(getQueueName()), mBeanServer); + AddressControl addressControl = ManagementControlHelper.createAddressControl(SimpleString.of(getQueueName()), mBeanServer); assertTrue(addressControl.block(), "blocked ok"); 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 f302095419..c4f637d22c 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 @@ -56,12 +56,12 @@ public class AmqpFullyQualifiedNameTest extends JMSClientTestSupport { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - private SimpleString anycastAddress = new SimpleString("address.anycast"); - private SimpleString multicastAddress = new SimpleString("address.multicast"); + private SimpleString anycastAddress = SimpleString.of("address.anycast"); + private SimpleString multicastAddress = SimpleString.of("address.multicast"); - private SimpleString anycastQ1 = new SimpleString("q1"); - private SimpleString anycastQ2 = new SimpleString("q2"); - private SimpleString anycastQ3 = new SimpleString("q3"); + private SimpleString anycastQ1 = SimpleString.of("q1"); + private SimpleString anycastQ2 = SimpleString.of("q2"); + private SimpleString anycastQ3 = SimpleString.of("q3"); private ServerLocator locator; @@ -211,7 +211,7 @@ public class AmqpFullyQualifiedNameTest extends JMSClientTestSupport { //however we can test query functionality public void testTopic() throws Exception { - SimpleString queueName = new SimpleString("someAddress"); + SimpleString queueName = SimpleString.of("someAddress"); server.createQueue(new QueueConfiguration(queueName).setAddress(multicastAddress).setDurable(false)); Connection connection = createConnection(false); @@ -258,8 +258,8 @@ public class AmqpFullyQualifiedNameTest extends JMSClientTestSupport { @Test public void testQueueConsumerReceiveTopicUsingFQQN() throws Exception { - SimpleString queueName1 = new SimpleString("sub.queue1"); - SimpleString queueName2 = new SimpleString("sub.queue2"); + SimpleString queueName1 = SimpleString.of("sub.queue1"); + SimpleString queueName2 = SimpleString.of("sub.queue2"); server.createQueue(new QueueConfiguration(queueName1).setAddress(multicastAddress).setDurable(false)); server.createQueue(new QueueConfiguration(queueName2).setAddress(multicastAddress).setDurable(false)); Connection connection = createConnection(false); @@ -383,7 +383,7 @@ public class AmqpFullyQualifiedNameTest extends JMSClientTestSupport { Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); //::queue ok! - String specialName = CompositeAddress.toFullyQualified(new SimpleString(""), anycastQ1).toString(); + String specialName = CompositeAddress.toFullyQualified(SimpleString.of(""), anycastQ1).toString(); javax.jms.Queue q1 = session.createQueue(specialName); session.createConsumer(q1); } catch (InvalidDestinationException e) { 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 b76a17733a..9cb6b588ac 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 @@ -70,7 +70,7 @@ public class AmqpMessageDivertsTest extends AmqpClientTestSupport implements Tra public void runQueueReceiverReadMessageWithDivert(String routingType) throws Exception { final String forwardingAddress = getQueueName() + "Divert"; - final SimpleString simpleForwardingAddress = SimpleString.toSimpleString(forwardingAddress); + final SimpleString simpleForwardingAddress = SimpleString.of(forwardingAddress); server.createQueue(new QueueConfiguration(simpleForwardingAddress).setRoutingType(RoutingType.ANYCAST)); server.getActiveMQServerControl().createDivert("name", "routingName", getQueueName(), forwardingAddress, true, null, null, routingType); @@ -107,7 +107,7 @@ public class AmqpMessageDivertsTest extends AmqpClientTestSupport implements Tra public void testDivertTransformerWithProperties(boolean rebootServer) throws Exception { divertCount.set(0); final String forwardingAddress = getQueueName() + "Divert"; - final SimpleString simpleForwardingAddress = SimpleString.toSimpleString(forwardingAddress); + final SimpleString simpleForwardingAddress = SimpleString.of(forwardingAddress); server.createQueue(new QueueConfiguration(simpleForwardingAddress).setRoutingType(RoutingType.ANYCAST)); server.getActiveMQServerControl().createDivert("name", "routingName", getQueueName(), forwardingAddress, true, null, AmqpMessageDivertsTest.class.getName(), 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 3b7079bd93..6532a09798 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 @@ -71,8 +71,8 @@ public class AmqpMessageRoutingTest extends JMSClientTestSupport { sendMessages(ANYCAST_PREFIX + addressA, 1); - Wait.assertEquals(1, () -> (server.locateQueue(SimpleString.toSimpleString(queueA)).getMessageCount() + server.locateQueue(SimpleString.toSimpleString(queueB)).getMessageCount())); - Wait.assertEquals(0, server.locateQueue(SimpleString.toSimpleString(queueC))::getMessageCount); + Wait.assertEquals(1, () -> (server.locateQueue(SimpleString.of(queueA)).getMessageCount() + server.locateQueue(SimpleString.of(queueB)).getMessageCount())); + Wait.assertEquals(0, server.locateQueue(SimpleString.of(queueC))::getMessageCount); } @Test @@ -91,8 +91,8 @@ public class AmqpMessageRoutingTest extends JMSClientTestSupport { sendMessages(addressA, 1, RoutingType.ANYCAST); - Wait.assertEquals(1, () -> (server.locateQueue(SimpleString.toSimpleString(queueA)).getMessageCount() + server.locateQueue(SimpleString.toSimpleString(queueB)).getMessageCount())); - Wait.assertEquals(0, server.locateQueue(SimpleString.toSimpleString(queueC))::getMessageCount); + Wait.assertEquals(1, () -> (server.locateQueue(SimpleString.of(queueA)).getMessageCount() + server.locateQueue(SimpleString.of(queueB)).getMessageCount())); + Wait.assertEquals(0, server.locateQueue(SimpleString.of(queueC))::getMessageCount); } @Test @@ -111,8 +111,8 @@ public class AmqpMessageRoutingTest extends JMSClientTestSupport { sendMessages(MULTICAST_PREFIX + addressA, 1); - Wait.assertEquals(0, server.locateQueue(SimpleString.toSimpleString(queueA))::getMessageCount); - Wait.assertEquals(2, () -> (server.locateQueue(SimpleString.toSimpleString(queueC)).getMessageCount() + server.locateQueue(SimpleString.toSimpleString(queueB)).getMessageCount())); + Wait.assertEquals(0, server.locateQueue(SimpleString.of(queueA))::getMessageCount); + Wait.assertEquals(2, () -> (server.locateQueue(SimpleString.of(queueC)).getMessageCount() + server.locateQueue(SimpleString.of(queueB)).getMessageCount())); } @Test @@ -131,8 +131,8 @@ public class AmqpMessageRoutingTest extends JMSClientTestSupport { sendMessages(addressA, 1, RoutingType.MULTICAST); - Wait.assertEquals(0, server.locateQueue(SimpleString.toSimpleString(queueA))::getMessageCount); - Wait.assertEquals(2, () -> (server.locateQueue(SimpleString.toSimpleString(queueC)).getMessageCount() + server.locateQueue(SimpleString.toSimpleString(queueB)).getMessageCount())); + Wait.assertEquals(0, server.locateQueue(SimpleString.of(queueA))::getMessageCount); + Wait.assertEquals(2, () -> (server.locateQueue(SimpleString.of(queueC)).getMessageCount() + server.locateQueue(SimpleString.of(queueB)).getMessageCount())); } /** @@ -148,7 +148,7 @@ public class AmqpMessageRoutingTest extends JMSClientTestSupport { // Create Address with both ANYCAST and MULTICAST enabled String testAddress = "testRoutingExclusivity-mixed-mode"; - SimpleString ssTestAddress = new SimpleString(testAddress); + SimpleString ssTestAddress = SimpleString.of(testAddress); AddressInfo addressInfo = new AddressInfo(ssTestAddress); addressInfo.addRoutingType(RoutingType.MULTICAST); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpNonDurableReceiverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpNonDurableReceiverTest.java index ba9ddfd9dc..4c2c755bef 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpNonDurableReceiverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpNonDurableReceiverTest.java @@ -46,7 +46,7 @@ public class AmqpNonDurableReceiverTest extends AmqpClientTestSupport { AmqpSession session = connection.createSession(); - SimpleString simpleTopicName = SimpleString.toSimpleString(getTopicName()); + SimpleString simpleTopicName = SimpleString.of(getTopicName()); final int bindingsBefore = server.getPostOffice().getBindingsForAddress(simpleTopicName).getBindings().size(); 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 fcad7f3ccb..4a19a04c78 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 @@ -55,7 +55,7 @@ public class AmqpPurgeOnNoConsumersTest extends AmqpClientTestSupport { public void testQueueReceiverReadMessage() throws Exception { AmqpConnection connection = null; String queue = "purgeQueue"; - SimpleString ssQueue = new SimpleString(queue); + SimpleString ssQueue = SimpleString.of(queue); server.addAddressInfo(new AddressInfo(ssQueue, RoutingType.ANYCAST)); server.createQueue(new QueueConfiguration(ssQueue).setRoutingType(RoutingType.ANYCAST).setMaxConsumers(1).setPurgeOnNoConsumers(true).setAutoCreateAddress(false)); @@ -112,7 +112,7 @@ public class AmqpPurgeOnNoConsumersTest extends AmqpClientTestSupport { @Timeout(60) public void testPurgeQueueCoreRollback() throws Exception { String queue = "purgeQueue"; - SimpleString ssQueue = new SimpleString(queue); + SimpleString ssQueue = SimpleString.of(queue); server.addAddressInfo(new AddressInfo(ssQueue, RoutingType.ANYCAST)); server.createQueue(new QueueConfiguration(ssQueue).setRoutingType(RoutingType.ANYCAST).setMaxConsumers(1).setPurgeOnNoConsumers(true).setAutoCreateAddress(false)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpReceiverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpReceiverTest.java index ca71f8a754..c23f8ec7ce 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpReceiverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpReceiverTest.java @@ -252,7 +252,7 @@ public class AmqpReceiverTest extends AmqpClientTestSupport { @Test @Timeout(60) public void testClientIdIsSetInSubscriptionList() throws Exception { - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("mytopic"), RoutingType.ANYCAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("mytopic"), RoutingType.ANYCAST)); AmqpClient client = createAmqpClient(); AmqpConnection connection = addConnection(client.connect()); @@ -268,7 +268,7 @@ public class AmqpReceiverTest extends AmqpClientTestSupport { source.setAddress("mytopic"); session.createReceiver(source, "testSub"); - SimpleString fo = new SimpleString("testClient.testSub:mytopic"); + SimpleString fo = SimpleString.of("testClient.testSub:mytopic"); assertNotNull(server.locateQueue(fo)); } catch (Exception e) { @@ -288,7 +288,7 @@ public class AmqpReceiverTest extends AmqpClientTestSupport { AmqpSession session = connection.createSession(); AmqpReceiver receiver = session.createReceiver(getQueueName()); - server.destroyQueue(new SimpleString(getQueueName()), null, false, true); + server.destroyQueue(SimpleString.of(getQueueName()), null, false, true); Wait.assertTrue("Receiver should have closed", receiver::isClosed); } finally { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpScheduledMessageTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpScheduledMessageTest.java index 055fdad6d1..bfde25b076 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpScheduledMessageTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpScheduledMessageTest.java @@ -93,7 +93,7 @@ public class AmqpScheduledMessageTest extends AmqpClientTestSupport { final Queue queueView = getProxyToQueue(getQueueName()); assertNotNull(queueView); - final SimpleString queueNameSS = SimpleString.toSimpleString(getQueueName()); + final SimpleString queueNameSS = SimpleString.of(getQueueName()); PagingStore targetPagingStore = server.getPagingManager().getPageStore(queueNameSS); assertNotNull(targetPagingStore); 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 67f42b5878..66594aab54 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 @@ -1163,8 +1163,8 @@ public class AmqpSendReceiveTest extends AmqpClientTestSupport { public void testSendingAndReceivingToQueueWithDifferentAddressAndQueueName() throws Exception { String queueName = "TestQueueName"; String address = "TestAddress"; - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(address), RoutingType.ANYCAST)); - server.createQueue(new QueueConfiguration(new SimpleString(queueName)).setAddress(new SimpleString(address)).setRoutingType(RoutingType.ANYCAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of(address), RoutingType.ANYCAST)); + server.createQueue(new QueueConfiguration(SimpleString.of(queueName)).setAddress(SimpleString.of(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/AmqpSenderRoutingTypeTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpSenderRoutingTypeTest.java index 1f2306caf9..8fdddd0487 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpSenderRoutingTypeTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpSenderRoutingTypeTest.java @@ -65,7 +65,7 @@ public class AmqpSenderRoutingTypeTest extends JMSClientTestSupport { try (ActiveMQConnection coreConnection = (ActiveMQConnection) createCoreConnection(); ClientSession clientSession = coreConnection.getSessionFactory().createSession()) { RoutingType addressRoutingType = RoutingType.MULTICAST; - SimpleString address = SimpleString.toSimpleString("myTopic_" + UUID.randomUUID().toString()); + SimpleString address = SimpleString.of("myTopic_" + UUID.randomUUID().toString()); clientSession.createAddress(address, addressRoutingType, false); ClientSession.AddressQuery addressQuery = clientSession.addressQuery(address); assertTrue(addressQuery.isExists()); @@ -93,7 +93,7 @@ public class AmqpSenderRoutingTypeTest extends JMSClientTestSupport { assertEquals(RoutingType.ANYCAST, defaultRoutingType); try (ActiveMQConnection coreConnection = (ActiveMQConnection) createCoreConnection(); ClientSession clientSession = coreConnection.getSessionFactory().createSession()) { - SimpleString address = SimpleString.toSimpleString("myTopic_" + UUID.randomUUID().toString()); + SimpleString address = SimpleString.of("myTopic_" + UUID.randomUUID().toString()); ClientSession.AddressQuery addressQuery = clientSession.addressQuery(address); assertFalse(addressQuery.isExists()); assertTrue(addressQuery.getQueueNames().isEmpty()); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AutoCreateWithDefaultRoutingTypesTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AutoCreateWithDefaultRoutingTypesTest.java index 8886d84b13..ee995798db 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AutoCreateWithDefaultRoutingTypesTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AutoCreateWithDefaultRoutingTypesTest.java @@ -364,6 +364,6 @@ public class AutoCreateWithDefaultRoutingTypesTest extends JMSClientTestSupport } public AddressQueryResult getProxyToAddress(String addressName) throws Exception { - return server.addressQuery(SimpleString.toSimpleString(addressName)); + return server.addressQuery(SimpleString.of(addressName)); } } 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 13aff6df8f..d4446fd4c6 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 @@ -41,9 +41,9 @@ import org.junit.jupiter.api.Timeout; public class BrokerDefinedAnycastConsumerTest extends AmqpClientTestSupport { - SimpleString address = new SimpleString("testAddress"); - SimpleString queue1 = new SimpleString("queue1"); - SimpleString queue2 = new SimpleString("queue2"); + SimpleString address = SimpleString.of("testAddress"); + SimpleString queue1 = SimpleString.of("queue1"); + SimpleString queue2 = SimpleString.of("queue2"); @Override protected boolean isAutoCreateQueues() { 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 ef6082eff1..6cef553cfb 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 @@ -40,9 +40,9 @@ import org.junit.jupiter.api.Timeout; public class BrokerDefinedMulticastConsumerTest extends AmqpClientTestSupport { - SimpleString address = new SimpleString("testAddress"); - SimpleString queue1 = new SimpleString("queue1"); - SimpleString queue2 = new SimpleString("queue2"); + SimpleString address = SimpleString.of("testAddress"); + SimpleString queue1 = SimpleString.of("queue1"); + SimpleString queue2 = SimpleString.of("queue2"); @Override protected boolean isAutoCreateQueues() { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/ClientDefinedAnycastConsumerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/ClientDefinedAnycastConsumerTest.java index e7d24328ba..538bd3424e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/ClientDefinedAnycastConsumerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/ClientDefinedAnycastConsumerTest.java @@ -40,7 +40,7 @@ import org.junit.jupiter.api.Timeout; public class ClientDefinedAnycastConsumerTest extends AmqpClientTestSupport { - SimpleString address = new SimpleString("testAddress"); + SimpleString address = SimpleString.of("testAddress"); @Test @Timeout(60) 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 26c783207d..c0bb19414c 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 @@ -42,7 +42,7 @@ import org.junit.jupiter.api.Timeout; public class ClientDefinedMultiConsumerTest extends AmqpClientTestSupport { - SimpleString address = new SimpleString("testAddress"); + SimpleString address = SimpleString.of("testAddress"); @Test @Timeout(60) @@ -64,15 +64,15 @@ public class ClientDefinedMultiConsumerTest extends AmqpClientTestSupport { assertNotNull(amqpMessage); amqpMessage = receiver2.receive(5, TimeUnit.SECONDS); assertNotNull(amqpMessage); - assertEquals(2, ((QueueImpl)server.getPostOffice().getBinding(SimpleString.toSimpleString("myClientId.mySub:shared-volatile")).getBindable()).getConsumerCount()); + assertEquals(2, ((QueueImpl)server.getPostOffice().getBinding(SimpleString.of("myClientId.mySub:shared-volatile")).getBindable()).getConsumerCount()); receiver.close(); - assertNotNull(server.getPostOffice().getBinding(SimpleString.toSimpleString("myClientId.mySub:shared-volatile"))); + assertNotNull(server.getPostOffice().getBinding(SimpleString.of("myClientId.mySub:shared-volatile"))); receiver2.close(); //check its been deleted Wait.waitFor(new Wait.Condition() { @Override public boolean isSatisfied() throws Exception { - return server.getPostOffice().getBinding(SimpleString.toSimpleString("myClientId.mySub:shared-volatile")) == null; + return server.getPostOffice().getBinding(SimpleString.of("myClientId.mySub:shared-volatile")) == null; } }, 1000); connection.close(); @@ -99,12 +99,12 @@ public class ClientDefinedMultiConsumerTest extends AmqpClientTestSupport { assertNotNull(amqpMessage); amqpMessage = receiver2.receive(5, TimeUnit.SECONDS); assertNotNull(amqpMessage); - assertEquals(2, ((QueueImpl)server.getPostOffice().getBinding(SimpleString.toSimpleString("myClientId.mySub:shared-volatile")).getBindable()).getConsumerCount()); + assertEquals(2, ((QueueImpl)server.getPostOffice().getBinding(SimpleString.of("myClientId.mySub:shared-volatile")).getBindable()).getConsumerCount()); receiver.close(); - assertNotNull(server.getPostOffice().getBinding(SimpleString.toSimpleString("myClientId.mySub:shared-volatile"))); + assertNotNull(server.getPostOffice().getBinding(SimpleString.of("myClientId.mySub:shared-volatile"))); receiver2.close(); //check its **Hasn't** been deleted - assertNotNull(server.getPostOffice().getBinding(SimpleString.toSimpleString("myClientId.mySub:shared-volatile"))); + assertNotNull(server.getPostOffice().getBinding(SimpleString.of("myClientId.mySub:shared-volatile"))); connection.close(); } @@ -128,14 +128,14 @@ public class ClientDefinedMultiConsumerTest extends AmqpClientTestSupport { assertNotNull(amqpMessage); amqpMessage = receiver2.receive(5, TimeUnit.SECONDS); assertNotNull(amqpMessage); - assertEquals(2, ((QueueImpl)server.getPostOffice().getBinding(SimpleString.toSimpleString("myClientId.mySub:shared-volatile")).getBindable()).getConsumerCount()); - assertNotNull(server.getPostOffice().getBinding(SimpleString.toSimpleString("myClientId.mySub:shared-volatile"))); + assertEquals(2, ((QueueImpl)server.getPostOffice().getBinding(SimpleString.of("myClientId.mySub:shared-volatile")).getBindable()).getConsumerCount()); + assertNotNull(server.getPostOffice().getBinding(SimpleString.of("myClientId.mySub:shared-volatile"))); //check its been deleted connection.close(); Wait.waitFor(new Wait.Condition() { @Override public boolean isSatisfied() throws Exception { - return server.getPostOffice().getBinding(SimpleString.toSimpleString("myClientId.mySub:shared-volatile")) == null; + return server.getPostOffice().getBinding(SimpleString.of("myClientId.mySub:shared-volatile")) == null; } }, 1000); } @@ -160,15 +160,15 @@ public class ClientDefinedMultiConsumerTest extends AmqpClientTestSupport { assertNotNull(amqpMessage); amqpMessage = receiver2.receive(5, TimeUnit.SECONDS); assertNotNull(amqpMessage); - assertEquals(2, ((QueueImpl)server.getPostOffice().getBinding(SimpleString.toSimpleString("mySub:shared-volatile:global")).getBindable()).getConsumerCount()); + assertEquals(2, ((QueueImpl)server.getPostOffice().getBinding(SimpleString.of("mySub:shared-volatile:global")).getBindable()).getConsumerCount()); receiver.close(); - assertNotNull(server.getPostOffice().getBinding(SimpleString.toSimpleString("mySub:shared-volatile:global"))); + assertNotNull(server.getPostOffice().getBinding(SimpleString.of("mySub:shared-volatile:global"))); receiver2.close(); //check its been deleted Wait.waitFor(new Wait.Condition() { @Override public boolean isSatisfied() throws Exception { - return server.getPostOffice().getBinding(SimpleString.toSimpleString("mySub:shared-volatile:global")) == null; + return server.getPostOffice().getBinding(SimpleString.of("mySub:shared-volatile:global")) == null; } }, 1000); connection.close(); @@ -194,12 +194,12 @@ public class ClientDefinedMultiConsumerTest extends AmqpClientTestSupport { assertNotNull(amqpMessage); amqpMessage = receiver2.receive(5, TimeUnit.SECONDS); assertNotNull(amqpMessage); - assertEquals(2, ((QueueImpl)server.getPostOffice().getBinding(SimpleString.toSimpleString("myClientId.mySub")).getBindable()).getConsumerCount()); + assertEquals(2, ((QueueImpl)server.getPostOffice().getBinding(SimpleString.of("myClientId.mySub")).getBindable()).getConsumerCount()); receiver.close(); - assertNotNull(server.getPostOffice().getBinding(SimpleString.toSimpleString("myClientId.mySub"))); + assertNotNull(server.getPostOffice().getBinding(SimpleString.of("myClientId.mySub"))); receiver2.close(); //check its been deleted - assertNull(server.getPostOffice().getBinding(SimpleString.toSimpleString("myClientId.mySub"))); + assertNull(server.getPostOffice().getBinding(SimpleString.of("myClientId.mySub"))); connection.close(); } @@ -223,22 +223,22 @@ public class ClientDefinedMultiConsumerTest extends AmqpClientTestSupport { assertNotNull(amqpMessage); amqpMessage = receiver2.receive(5, TimeUnit.SECONDS); assertNotNull(amqpMessage); - assertEquals(2, ((QueueImpl)server.getPostOffice().getBinding(SimpleString.toSimpleString("myClientId.mySub")).getBindable()).getConsumerCount()); + assertEquals(2, ((QueueImpl)server.getPostOffice().getBinding(SimpleString.of("myClientId.mySub")).getBindable()).getConsumerCount()); connection.close(); connection = addConnection(client.connect("myClientId")); session = connection.createSession(); - assertNotNull(server.getPostOffice().getBinding(SimpleString.toSimpleString("myClientId.mySub"))); + assertNotNull(server.getPostOffice().getBinding(SimpleString.of("myClientId.mySub"))); receiver = session.createMulticastReceiver(source, "myReceiverID", "mySub"); receiver2 = session.createMulticastReceiver(source, "myReceiverID", "mySub|2"); receiver.close(); - assertNotNull(server.getPostOffice().getBinding(SimpleString.toSimpleString("myClientId.mySub"))); + assertNotNull(server.getPostOffice().getBinding(SimpleString.of("myClientId.mySub"))); receiver2.close(); //check its been deleted - assertNull(server.getPostOffice().getBinding(SimpleString.toSimpleString("myClientId.mySub"))); + assertNull(server.getPostOffice().getBinding(SimpleString.of("myClientId.mySub"))); connection.close(); } @@ -262,22 +262,22 @@ public class ClientDefinedMultiConsumerTest extends AmqpClientTestSupport { assertNotNull(amqpMessage); amqpMessage = receiver2.receive(5, TimeUnit.SECONDS); assertNotNull(amqpMessage); - assertEquals(2, ((QueueImpl)server.getPostOffice().getBinding(SimpleString.toSimpleString("myClientId.mySub")).getBindable()).getConsumerCount()); + assertEquals(2, ((QueueImpl)server.getPostOffice().getBinding(SimpleString.of("myClientId.mySub")).getBindable()).getConsumerCount()); connection.close(); connection = addConnection(client.connect("myClientId")); session = connection.createSession(); - assertNotNull(server.getPostOffice().getBinding(SimpleString.toSimpleString("myClientId.mySub"))); + assertNotNull(server.getPostOffice().getBinding(SimpleString.of("myClientId.mySub"))); receiver = session.createDurableReceiver(null, "mySub"); receiver2 = session.createDurableReceiver(null, "mySub|2"); receiver.close(); - assertNotNull(server.getPostOffice().getBinding(SimpleString.toSimpleString("myClientId.mySub"))); + assertNotNull(server.getPostOffice().getBinding(SimpleString.of("myClientId.mySub"))); receiver2.close(); //check its been deleted - assertNull(server.getPostOffice().getBinding(SimpleString.toSimpleString("myClientId.mySub"))); + assertNull(server.getPostOffice().getBinding(SimpleString.of("myClientId.mySub"))); connection.close(); } @@ -301,12 +301,12 @@ public class ClientDefinedMultiConsumerTest extends AmqpClientTestSupport { assertNotNull(amqpMessage); amqpMessage = receiver2.receive(5, TimeUnit.SECONDS); assertNotNull(amqpMessage); - assertEquals(2, ((QueueImpl)server.getPostOffice().getBinding(SimpleString.toSimpleString("mySub:global")).getBindable()).getConsumerCount()); + assertEquals(2, ((QueueImpl)server.getPostOffice().getBinding(SimpleString.of("mySub:global")).getBindable()).getConsumerCount()); receiver.close(); - assertNotNull(server.getPostOffice().getBinding(SimpleString.toSimpleString("mySub:global"))); + assertNotNull(server.getPostOffice().getBinding(SimpleString.of("mySub:global"))); receiver2.close(); //check its been deleted - assertNull(server.getPostOffice().getBinding(SimpleString.toSimpleString("mySub:global"))); + assertNull(server.getPostOffice().getBinding(SimpleString.of("mySub:global"))); connection.close(); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/DLQAfterExpiredMessageTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/DLQAfterExpiredMessageTest.java index 9a81b7b40d..f73cb3c41b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/DLQAfterExpiredMessageTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/DLQAfterExpiredMessageTest.java @@ -56,24 +56,24 @@ public class DLQAfterExpiredMessageTest extends AmqpClientTestSupport { @Override protected void createAddressAndQueues(ActiveMQServer server) throws Exception { // Default Queue - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(getQueueName()), RoutingType.ANYCAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of(getQueueName()), RoutingType.ANYCAST)); server.createQueue(new QueueConfiguration(getQueueName()).setRoutingType(RoutingType.ANYCAST)); // Default DLQ - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(getDeadLetterAddress()), RoutingType.ANYCAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of(getDeadLetterAddress()), RoutingType.ANYCAST)); server.createQueue(new QueueConfiguration(getDeadLetterAddress()).setRoutingType(RoutingType.ANYCAST)); // Expiry - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(getExpiryQueue()), RoutingType.ANYCAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of(getExpiryQueue()), RoutingType.ANYCAST)); server.createQueue(new QueueConfiguration(getExpiryQueue()).setRoutingType(RoutingType.ANYCAST)); // Default Topic - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(getTopicName()), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of(getTopicName()), RoutingType.MULTICAST)); 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.addAddressInfo(new AddressInfo(SimpleString.of(getQueueName(i)), RoutingType.ANYCAST)); server.createQueue(new QueueConfiguration(getQueueName(i)).setRoutingType(RoutingType.ANYCAST)); } } @@ -86,8 +86,8 @@ public class DLQAfterExpiredMessageTest extends AmqpClientTestSupport { addressSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE); addressSettings.setAutoCreateQueues(isAutoCreateQueues()); addressSettings.setAutoCreateAddresses(isAutoCreateAddresses()); - addressSettings.setDeadLetterAddress(SimpleString.toSimpleString(getDeadLetterAddress())); - addressSettings.setExpiryAddress(SimpleString.toSimpleString(getExpiryQueue())); + addressSettings.setDeadLetterAddress(SimpleString.of(getDeadLetterAddress())); + addressSettings.setExpiryAddress(SimpleString.of(getExpiryQueue())); addressSettings.setMaxDeliveryAttempts(1); server.getConfiguration().getAddressSettings().put("#", addressSettings); server.getConfiguration().getAddressSettings().put(getExpiryQueue(), addressSettings); 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 b556fff67d..d2d3050c68 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 @@ -45,7 +45,7 @@ import org.junit.jupiter.api.extension.ExtendWith; @ExtendWith(ParameterizedTestExtension.class) public class ExtremeCancelsTest extends JMSClientTestSupport { - private SimpleString anycastAddress = new SimpleString("theQueue"); + private SimpleString anycastAddress = SimpleString.of("theQueue"); @Override diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSDurableConsumerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSDurableConsumerTest.java index d0ea8c032a..150a93679d 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSDurableConsumerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSDurableConsumerTest.java @@ -287,7 +287,7 @@ public class JMSDurableConsumerTest extends JMSClientTestSupport { @TestTemplate @Timeout(30) public void testDurableConsumerWithSelectorChange() throws Exception { - SimpleString qName = new SimpleString("foo.SharedConsumer"); + SimpleString qName = SimpleString.of("foo.SharedConsumer"); Connection connection = createConnection("foo", true); 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/JMSTopicConsumerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSTopicConsumerTest.java index 239b87f14c..237a9b594b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSTopicConsumerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSTopicConsumerTest.java @@ -85,7 +85,7 @@ public class JMSTopicConsumerTest extends JMSClientTestSupport { public void testSendAndReceiveOnAutoCreatedTopic() throws Exception { Connection connection = createConnection("myClientId"); String topicName = UUID.randomUUID().toString(); - SimpleString simpleTopicName = SimpleString.toSimpleString(topicName); + SimpleString simpleTopicName = SimpleString.of(topicName); try { TopicSession session = (TopicSession) connection.createSession(false, Session.AUTO_ACKNOWLEDGE); @@ -127,7 +127,7 @@ public class JMSTopicConsumerTest extends JMSClientTestSupport { ConnectionFactory cf = new JmsConnectionFactory(getBrokerQpidJMSConnectionURI()); JMSContext context = cf.createContext(); String topicName = UUID.randomUUID().toString(); - SimpleString simpleTopicName = SimpleString.toSimpleString(topicName); + SimpleString simpleTopicName = SimpleString.of(topicName); try { Topic topic = context.createTopic(topicName); @@ -212,9 +212,9 @@ public class JMSTopicConsumerTest extends JMSClientTestSupport { myDurSub = session.createDurableSubscriber(topic, "myDurSub"); myDurSub.close(); - assertNotNull(server.getPostOffice().getBinding(new SimpleString("myClientId.myDurSub"))); + assertNotNull(server.getPostOffice().getBinding(SimpleString.of("myClientId.myDurSub"))); session.unsubscribe("myDurSub"); - assertNull(server.getPostOffice().getBinding(new SimpleString("myClientId.myDurSub"))); + assertNull(server.getPostOffice().getBinding(SimpleString.of("myClientId.myDurSub"))); session.close(); connection.close(); } finally { @@ -231,12 +231,12 @@ public class JMSTopicConsumerTest extends JMSClientTestSupport { Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Topic topic = session.createTopic(getTopicName()); MessageConsumer myDurSub = session.createSharedDurableConsumer(topic, "myDurSub"); - assertTrue(server.getPostOffice().getBinding(new SimpleString("myClientId.myDurSub")) != null); + assertTrue(server.getPostOffice().getBinding(SimpleString.of("myClientId.myDurSub")) != null); myDurSub.close(); session.unsubscribe("myDurSub"); session.close(); connection.close(); - assertTrue(server.getPostOffice().getBinding(new SimpleString("myClientId.myDurSub")) == null); + assertTrue(server.getPostOffice().getBinding(SimpleString.of("myClientId.myDurSub")) == null); } finally { connection.close(); } @@ -253,7 +253,7 @@ public class JMSTopicConsumerTest extends JMSClientTestSupport { Topic topic = session.createTopic(getTopicName()); MessageConsumer myDurSub = session.createSharedDurableConsumer(topic, "myDurSub"); MessageConsumer myDurSub2 = session2.createSharedDurableConsumer(topic, "myDurSub"); - assertTrue(server.getPostOffice().getBinding(new SimpleString("myClientId.myDurSub")) != null); + assertTrue(server.getPostOffice().getBinding(SimpleString.of("myClientId.myDurSub")) != null); myDurSub.close(); try { session.unsubscribe("myDurSub"); @@ -265,7 +265,7 @@ public class JMSTopicConsumerTest extends JMSClientTestSupport { session.unsubscribe("myDurSub"); session.close(); connection.close(); - assertTrue(server.getPostOffice().getBinding(new SimpleString("myClientId.myDurSub")) == null); + assertTrue(server.getPostOffice().getBinding(SimpleString.of("myClientId.myDurSub")) == null); } finally { connection.close(); } @@ -280,12 +280,12 @@ public class JMSTopicConsumerTest extends JMSClientTestSupport { Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Topic topic = session.createTopic(getTopicName()); MessageConsumer myDurSub = session.createSharedDurableConsumer(topic, "myDurSub"); - assertTrue(server.getPostOffice().getBinding(new SimpleString("myDurSub:global")) != null); + assertTrue(server.getPostOffice().getBinding(SimpleString.of("myDurSub:global")) != null); myDurSub.close(); session.unsubscribe("myDurSub"); session.close(); connection.close(); - assertTrue(server.getPostOffice().getBinding(new SimpleString("myDurSub:global")) == null); + assertTrue(server.getPostOffice().getBinding(SimpleString.of("myDurSub:global")) == null); } finally { connection.close(); } @@ -303,17 +303,17 @@ public class JMSTopicConsumerTest extends JMSClientTestSupport { Topic topic = session.createTopic(getTopicName()); MessageConsumer myDurSub = session.createSharedDurableConsumer(topic, "myDurSub"); MessageConsumer myDurSub2 = session2.createSharedDurableConsumer(topic, "myDurSub"); - assertTrue(server.getPostOffice().getBinding(new SimpleString("myDurSub:global")) != null); + assertTrue(server.getPostOffice().getBinding(SimpleString.of("myDurSub:global")) != null); myDurSub.close(); session.unsubscribe("myDurSub"); session.close(); connection.close(); - assertTrue(server.getPostOffice().getBinding(new SimpleString("myDurSub:global")) != null); + assertTrue(server.getPostOffice().getBinding(SimpleString.of("myDurSub:global")) != null); myDurSub2.close(); session2.unsubscribe("myDurSub"); session2.close(); connection2.close(); - assertTrue(server.getPostOffice().getBinding(new SimpleString("myDurSub:global")) == null); + assertTrue(server.getPostOffice().getBinding(SimpleString.of("myDurSub:global")) == null); } finally { connection.close(); } @@ -330,7 +330,7 @@ public class JMSTopicConsumerTest extends JMSClientTestSupport { TopicSubscriber myNonDurSub = session.createSubscriber(topic); assertNotNull(myNonDurSub); - Bindings bindingsForAddress = server.getPostOffice().getBindingsForAddress(new SimpleString(getTopicName())); + Bindings bindingsForAddress = server.getPostOffice().getBindingsForAddress(SimpleString.of(getTopicName())); assertEquals(2, bindingsForAddress.getBindings().size()); session.close(); @@ -344,7 +344,7 @@ public class JMSTopicConsumerTest extends JMSClientTestSupport { connection.close(); latch.await(5, TimeUnit.SECONDS); - bindingsForAddress = server.getPostOffice().getBindingsForAddress(new SimpleString(getTopicName())); + bindingsForAddress = server.getPostOffice().getBindingsForAddress(SimpleString.of(getTopicName())); assertEquals(1, bindingsForAddress.getBindings().size()); } finally { connection.close(); 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 ccd5899a58..f6d0e91e21 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 @@ -42,8 +42,8 @@ public class JMSTransactedRedeliveryBugTest extends JMSClientTestSupport { private static final String INITIAL_QUEUE_NAME = "InitialQueue"; private static final String FINAL_QUEUE_NAME = "FinalQueue"; - private static final SimpleString INITIAL_QUEUE_SS = new SimpleString(INITIAL_QUEUE_NAME); - private static final SimpleString FINAL_QUEUE_SS = new SimpleString(FINAL_QUEUE_NAME); + private static final SimpleString INITIAL_QUEUE_SS = SimpleString.of(INITIAL_QUEUE_NAME); + private static final SimpleString FINAL_QUEUE_SS = SimpleString.of(FINAL_QUEUE_NAME); @Override protected void addConfiguration(ActiveMQServer server) { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMXManagementTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMXManagementTest.java index b1e6c35c1a..4e4606272f 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMXManagementTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMXManagementTest.java @@ -55,7 +55,7 @@ public class JMXManagementTest extends JMSClientTestSupport { @Test public void testListDeliveringMessages() throws Exception { - SimpleString queue = new SimpleString(getQueueName()); + SimpleString queue = SimpleString.of(getQueueName()); Connection connection1 = createConnection(); Connection connection2 = createConnection(); @@ -135,7 +135,7 @@ public class JMXManagementTest extends JMSClientTestSupport { sender.send(message); session.commit(); - SimpleString queue = new SimpleString(getQueueName()); + SimpleString queue = SimpleString.of(getQueueName()); QueueControl queueControl = createManagementControl(queue, queue); String firstMessageAsJSON = queueControl.getFirstMessageAsJSON(); assertNotNull(firstMessageAsJSON); @@ -178,7 +178,7 @@ public class JMXManagementTest extends JMSClientTestSupport { sender.send(message); session.commit(); - SimpleString queue = new SimpleString(getQueueName()); + SimpleString queue = SimpleString.of(getQueueName()); QueueControl queueControl = createManagementControl(queue, queue); String firstMessageAsJSON = queueControl.getFirstMessageAsJSON(); assertNotNull(firstMessageAsJSON); @@ -214,12 +214,12 @@ public class JMXManagementTest extends JMSClientTestSupport { sender.send(message); session.commit(); - PagingStore targetPagingStore = server.getPagingManager().getPageStore(SimpleString.toSimpleString(getQueueName())); + PagingStore targetPagingStore = server.getPagingManager().getPageStore(SimpleString.of(getQueueName())); assertNotNull(targetPagingStore); assertTrue(targetPagingStore.getAddressSize() > 0); - SimpleString queue = new SimpleString(getQueueName()); + SimpleString queue = SimpleString.of(getQueueName()); QueueControl queueControl = createManagementControl(queue, queue); Wait.assertEquals(2, queueControl::getMessageCount); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/ParseAppMultiThread.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/ParseAppMultiThread.java index 812c8033be..50c88c00f2 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/ParseAppMultiThread.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/ParseAppMultiThread.java @@ -46,7 +46,7 @@ public class ParseAppMultiThread { for (int i = 0; i < 10; i++) { map.put("stuff" + i, "value" + i); // just filling stuff } - AMQPStandardMessage originalMessage = AMQPStandardMessage.createMessage(1, 0, SimpleString.toSimpleString("duh"), null, null, null, null, map, null, null); + AMQPStandardMessage originalMessage = AMQPStandardMessage.createMessage(1, 0, SimpleString.of("duh"), null, null, null, null, map, null, null); // doing a round trip that would be made through persistence @@ -77,7 +77,7 @@ public class ParseAppMultiThread { Runnable r = () -> { try { barrier.await(); - assertEquals(randomStr, amqpStandardMessage.getObjectProperty(SimpleString.toSimpleString("color"))); + assertEquals(randomStr, amqpStandardMessage.getObjectProperty(SimpleString.of("color"))); } catch (Throwable e) { e.printStackTrace(); errors.incrementAndGet(); @@ -92,7 +92,7 @@ public class ParseAppMultiThread { t.join(); } - assertEquals(randomStr, amqpStandardMessage.getObjectPropertyForFilter(SimpleString.toSimpleString("color"))); + assertEquals(randomStr, amqpStandardMessage.getObjectPropertyForFilter(SimpleString.of("color"))); assertEquals(0, errors.get()); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/QueueAutoCreationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/QueueAutoCreationTest.java index 10332b83e6..77babcfd00 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/QueueAutoCreationTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/QueueAutoCreationTest.java @@ -105,7 +105,7 @@ public class QueueAutoCreationTest extends JMSClientTestSupport { protected Queue createAddressOnlyAndFakeQueue(final String queueName) throws Exception { - SimpleString address = SimpleString.toSimpleString(queueName); + SimpleString address = SimpleString.of(queueName); clientSession.createAddress(address, RoutingType.ANYCAST, false); return new ActiveMQQueue(queueName); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/TopicDurableTests.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/TopicDurableTests.java index 4d44c2019a..2a00b56896 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/TopicDurableTests.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/TopicDurableTests.java @@ -181,7 +181,7 @@ public class TopicDurableTests extends JMSClientTestSupport { //TEAR-DOWN-E // ensure the topic is auto-deleted before continuing to the next iteration - Wait.assertTrue(() -> server.getAddressInfo(SimpleString.toSimpleString("jmsTopic")) == null, 2000, 100); + Wait.assertTrue(() -> server.getAddressInfo(SimpleString.of("jmsTopic")) == null, 2000, 100); } } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPBridgeTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPBridgeTest.java index 11f741f7b0..b8ab5f2c8f 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPBridgeTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPBridgeTest.java @@ -89,7 +89,7 @@ public class AMQPBridgeTest extends AmqpClientTestSupport { public void internalTransferPush(String queueName, boolean deferCreation, boolean restartBC) throws Exception { server.setIdentity("targetServer"); server.start(); - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(queueName), RoutingType.ANYCAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of(queueName), RoutingType.ANYCAST)); server.createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST)); server_2 = createServer(AMQP_PORT_2, false); @@ -179,7 +179,7 @@ public class AMQPBridgeTest extends AmqpClientTestSupport { server.start(); - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("TEST"), RoutingType.ANYCAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("TEST"), RoutingType.ANYCAST)); server.createQueue(new QueueConfiguration("TEST").setRoutingType(RoutingType.ANYCAST)); server_2 = createServer(AMQP_PORT_2, false); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPFederationAddressPolicyTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPFederationAddressPolicyTest.java index 5dbd608731..e36c8c8ac6 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPFederationAddressPolicyTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPFederationAddressPolicyTest.java @@ -219,7 +219,7 @@ public class AMQPFederationAddressPolicyTest extends AmqpClientTestSupport { .setAddress("test") .setAutoCreated(false)); - Wait.assertTrue(() -> server.queueQuery(SimpleString.toSimpleString("test")).isExists()); + Wait.assertTrue(() -> server.queueQuery(SimpleString.of("test")).isExists()); final ConnectionFactory factory = CFUtil.createConnectionFactory("AMQP", "tcp://localhost:" + AMQP_PORT); @@ -240,8 +240,8 @@ public class AMQPFederationAddressPolicyTest extends AmqpClientTestSupport { // This should trigger the federation consumer to be shutdown as the statically defined queue // should be the only remaining demand on the address. logger.info("Removing Queues from federated address to eliminate demand"); - server.destroyQueue(SimpleString.toSimpleString("test")); - Wait.assertFalse(() -> server.queueQuery(SimpleString.toSimpleString("test")).isExists()); + server.destroyQueue(SimpleString.of("test")); + Wait.assertFalse(() -> server.queueQuery(SimpleString.of("test")).isExists()); peer.waitForScriptToComplete(5, TimeUnit.SECONDS); peer.expectClose(); @@ -292,7 +292,7 @@ public class AMQPFederationAddressPolicyTest extends AmqpClientTestSupport { server.getConfiguration().addAMQPConnection(amqpConnection); server.start(); - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("test"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("test"), RoutingType.MULTICAST)); final Map expectedSourceProperties = new HashMap<>(); expectedSourceProperties.put(ADDRESS_AUTO_DELETE, true); @@ -368,7 +368,7 @@ public class AMQPFederationAddressPolicyTest extends AmqpClientTestSupport { server.getConfiguration().addAMQPConnection(amqpConnection); server.start(); - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("test"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("test"), RoutingType.MULTICAST)); final Map expectedSourceProperties = new HashMap<>(); expectedSourceProperties.put(ADDRESS_AUTO_DELETE, true); @@ -457,7 +457,7 @@ public class AMQPFederationAddressPolicyTest extends AmqpClientTestSupport { server.getConfiguration().addAMQPConnection(amqpConnection); server.start(); - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("test"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("test"), RoutingType.MULTICAST)); final String expectedJMSFilter = generateAddressFilter(1); final Symbol jmsSelectorKey = Symbol.valueOf("jms-selector"); @@ -607,7 +607,7 @@ public class AMQPFederationAddressPolicyTest extends AmqpClientTestSupport { server.getConfiguration().addAMQPConnection(amqpConnection); server.start(); - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("test"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("test"), RoutingType.MULTICAST)); final Map expectedSourceProperties = new HashMap<>(); expectedSourceProperties.put(ADDRESS_AUTO_DELETE, false); @@ -687,7 +687,7 @@ public class AMQPFederationAddressPolicyTest extends AmqpClientTestSupport { server.getConfiguration().addAMQPConnection(amqpConnection); server.start(); - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("test"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("test"), RoutingType.MULTICAST)); final Map expectedSourceProperties = new HashMap<>(); expectedSourceProperties.put(ADDRESS_AUTO_DELETE, false); @@ -774,7 +774,7 @@ public class AMQPFederationAddressPolicyTest extends AmqpClientTestSupport { server.getConfiguration().addAMQPConnection(amqpConnection); server.start(); - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("test"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("test"), RoutingType.MULTICAST)); final Map expectedSourceProperties = new HashMap<>(); expectedSourceProperties.put(ADDRESS_AUTO_DELETE, false); @@ -849,7 +849,7 @@ public class AMQPFederationAddressPolicyTest extends AmqpClientTestSupport { server.getConfiguration().addAMQPConnection(amqpConnection); server.start(); - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("test"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("test"), RoutingType.MULTICAST)); peer.waitForScriptToComplete(5, TimeUnit.SECONDS); peer.expectAttach().ofReceiver() @@ -872,7 +872,7 @@ public class AMQPFederationAddressPolicyTest extends AmqpClientTestSupport { peer.waitForScriptToComplete(5, TimeUnit.SECONDS); peer.expectDetach().respond(); - server.removeAddressInfo(SimpleString.toSimpleString("test"), null, true); + server.removeAddressInfo(SimpleString.of("test"), null, true); peer.waitForScriptToComplete(5, TimeUnit.SECONDS); } @@ -946,7 +946,7 @@ public class AMQPFederationAddressPolicyTest extends AmqpClientTestSupport { server.getConfiguration().addAMQPConnection(amqpConnection); server.start(); server.deployDivert(divertConfig); - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("test"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("test"), RoutingType.MULTICAST)); final Map expectedSourceProperties = new HashMap<>(); expectedSourceProperties.put(ADDRESS_AUTO_DELETE, false); @@ -1029,7 +1029,7 @@ public class AMQPFederationAddressPolicyTest extends AmqpClientTestSupport { server.getConfiguration().addAMQPConnection(amqpConnection); server.start(); server.deployDivert(divertConfig); - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("test"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("test"), RoutingType.MULTICAST)); final Map expectedSourceProperties = new HashMap<>(); expectedSourceProperties.put(ADDRESS_AUTO_DELETE, false); @@ -1120,7 +1120,7 @@ public class AMQPFederationAddressPolicyTest extends AmqpClientTestSupport { server.getConfiguration().addAMQPConnection(amqpConnection); server.start(); server.deployDivert(divertConfig); - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("test"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("test"), RoutingType.MULTICAST)); final Map expectedSourceProperties = new HashMap<>(); expectedSourceProperties.put(ADDRESS_AUTO_DELETE, false); @@ -1210,7 +1210,7 @@ public class AMQPFederationAddressPolicyTest extends AmqpClientTestSupport { server.deployDivert(divertConfig); // Current implementation requires the source address exist on the local broker before it // will attempt to federate it from the remote. - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("source"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("source"), RoutingType.MULTICAST)); final Map expectedSourceProperties = new HashMap<>(); expectedSourceProperties.put(ADDRESS_AUTO_DELETE, false); @@ -1300,7 +1300,7 @@ public class AMQPFederationAddressPolicyTest extends AmqpClientTestSupport { server.deployDivert(divertConfig); // Current implementation requires the source address exist on the local broker before it // will attempt to federate it from the remote. - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("source"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("source"), RoutingType.MULTICAST)); final Map expectedSourceProperties = new HashMap<>(); expectedSourceProperties.put(ADDRESS_AUTO_DELETE, false); @@ -1387,7 +1387,7 @@ public class AMQPFederationAddressPolicyTest extends AmqpClientTestSupport { server.getConfiguration().addAMQPConnection(amqpConnection); server.start(); server.deployDivert(divertConfig); - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("source"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("source"), RoutingType.MULTICAST)); final Map expectedSourceProperties = new HashMap<>(); expectedSourceProperties.put(ADDRESS_AUTO_DELETE, false); @@ -1418,7 +1418,7 @@ public class AMQPFederationAddressPolicyTest extends AmqpClientTestSupport { peer.waitForScriptToComplete(5, TimeUnit.SECONDS); peer.expectDetach().respond(); - server.destroyDivert(SimpleString.toSimpleString("test-divert")); + server.destroyDivert(SimpleString.of("test-divert")); peer.waitForScriptToComplete(5, TimeUnit.SECONDS); peer.close(); @@ -1470,7 +1470,7 @@ public class AMQPFederationAddressPolicyTest extends AmqpClientTestSupport { server.getConfiguration().addAMQPConnection(amqpConnection); server.start(); server.deployDivert(divertConfig); - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("test"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("test"), RoutingType.MULTICAST)); final Map expectedSourceProperties = new HashMap<>(); expectedSourceProperties.put(ADDRESS_AUTO_DELETE, false); @@ -1507,7 +1507,7 @@ public class AMQPFederationAddressPolicyTest extends AmqpClientTestSupport { consumer1.close(); consumer2.close(); - server.destroyDivert(SimpleString.toSimpleString("test-divert")); + server.destroyDivert(SimpleString.of("test-divert")); peer.waitForScriptToComplete(5, TimeUnit.SECONDS); peer.expectDetach().respond(); @@ -1554,7 +1554,7 @@ public class AMQPFederationAddressPolicyTest extends AmqpClientTestSupport { server.getConfiguration().addAMQPConnection(amqpConnection); server.start(); - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("test"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("test"), RoutingType.MULTICAST)); peer.waitForScriptToComplete(5, TimeUnit.SECONDS); peer.expectAttach().ofReceiver() @@ -2204,7 +2204,7 @@ public class AMQPFederationAddressPolicyTest extends AmqpClientTestSupport { server.getConfiguration().addAMQPConnection(amqpConnection); server.start(); - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("test"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("test"), RoutingType.MULTICAST)); peer.waitForScriptToComplete(5, TimeUnit.SECONDS); peer.expectAttach().ofReceiver() @@ -2284,7 +2284,7 @@ public class AMQPFederationAddressPolicyTest extends AmqpClientTestSupport { server.getConfiguration().addAMQPConnection(amqpConnection); server.start(); - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("test"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("test"), RoutingType.MULTICAST)); peer.waitForScriptToComplete(5, TimeUnit.SECONDS); @@ -2503,7 +2503,7 @@ public class AMQPFederationAddressPolicyTest extends AmqpClientTestSupport { .setAddress("test") .setAutoCreated(false)); - Wait.assertTrue(() -> server.queueQuery(SimpleString.toSimpleString("test")).isExists()); + Wait.assertTrue(() -> server.queueQuery(SimpleString.of("test")).isExists()); final ConnectionFactory factory = CFUtil.createConnectionFactory("AMQP", "tcp://localhost:" + AMQP_PORT); @@ -2568,8 +2568,8 @@ public class AMQPFederationAddressPolicyTest extends AmqpClientTestSupport { // This should trigger the federation consumer to be shutdown as the statically defined queue // should be the only remaining demand on the address. logger.info("Removing Queues from federated address to eliminate demand"); - server.destroyQueue(SimpleString.toSimpleString("test")); - Wait.assertFalse(() -> server.queueQuery(SimpleString.toSimpleString("test")).isExists()); + server.destroyQueue(SimpleString.of("test")); + Wait.assertFalse(() -> server.queueQuery(SimpleString.of("test")).isExists()); peer.waitForScriptToComplete(5, TimeUnit.SECONDS); peer.expectClose(); @@ -2614,8 +2614,8 @@ public class AMQPFederationAddressPolicyTest extends AmqpClientTestSupport { server.start(); // Configure addresses and divert for the test - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("test"), RoutingType.MULTICAST)); - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("target"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("test"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("target"), RoutingType.MULTICAST)); server.deployDivert(divert); // Create demand on the addresses so that on start federation should happen @@ -2730,10 +2730,10 @@ public class AMQPFederationAddressPolicyTest extends AmqpClientTestSupport { server.start(); // Configure addresses and divert for the test - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("test"), RoutingType.MULTICAST)); - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("target1"), RoutingType.MULTICAST)); - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("target2"), RoutingType.MULTICAST)); - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("target3"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("test"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("target1"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("target2"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("target3"), RoutingType.MULTICAST)); server.deployDivert(divert1); server.deployDivert(divert2); @@ -2791,12 +2791,12 @@ public class AMQPFederationAddressPolicyTest extends AmqpClientTestSupport { peer.waitForScriptToComplete(5, TimeUnit.SECONDS); - server.destroyDivert(SimpleString.toSimpleString(divert1.getName())); + server.destroyDivert(SimpleString.of(divert1.getName())); peer.waitForScriptToComplete(5, TimeUnit.SECONDS); peer.expectDetach().respond(); - server.destroyDivert(SimpleString.toSimpleString(divert2.getName())); + server.destroyDivert(SimpleString.of(divert2.getName())); peer.waitForScriptToComplete(5, TimeUnit.SECONDS); @@ -2866,8 +2866,8 @@ public class AMQPFederationAddressPolicyTest extends AmqpClientTestSupport { server.start(); // Configure addresses and divert for the test - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("test"), RoutingType.MULTICAST)); - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("target"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("test"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("target"), RoutingType.MULTICAST)); server.deployDivert(divert); server.registerBrokerPlugin(federationPlugin); @@ -3118,7 +3118,7 @@ public class AMQPFederationAddressPolicyTest extends AmqpClientTestSupport { peer.expectTransfer().withPayload(payloadMatcher).accept(); // Address added event // Manually add the address and a queue binding to create local demand. - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("test"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("test"), RoutingType.MULTICAST)); server.createQueue(new QueueConfiguration("test").setRoutingType(RoutingType.MULTICAST) .setAddress("test") .setAutoCreated(false)); @@ -3316,7 +3316,7 @@ public class AMQPFederationAddressPolicyTest extends AmqpClientTestSupport { @Timeout(20) public void testRemoteBrokerClosesFederationReceiverAfterAddressRemoved() throws Exception { server.start(); - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("test"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("test"), RoutingType.MULTICAST)); try (ProtonTestClient peer = new ProtonTestClient()) { scriptFederationConnectToRemote(peer, "test", true, true); @@ -3345,7 +3345,7 @@ public class AMQPFederationAddressPolicyTest extends AmqpClientTestSupport { peer.expectDetach().withError(AmqpError.RESOURCE_DELETED.toString()); // Force remove consumers from the address should indicate the resource was deleted. - server.removeAddressInfo(SimpleString.toSimpleString("test"), null, true); + server.removeAddressInfo(SimpleString.of("test"), null, true); peer.waitForScriptToComplete(5, TimeUnit.SECONDS); @@ -3363,14 +3363,14 @@ public class AMQPFederationAddressPolicyTest extends AmqpClientTestSupport { // has been added once more and it could restore the previous federation state. peer.expectTransfer().withPayload(payloadMatcher).withSettled(true); - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("test"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("test"), RoutingType.MULTICAST)); peer.waitForScriptToComplete(5, TimeUnit.SECONDS); // This time removing and restoring should generate no traffic as there was not // another federation receiver added. - server.removeAddressInfo(SimpleString.toSimpleString("test"), null, true); - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("test"), RoutingType.MULTICAST)); + server.removeAddressInfo(SimpleString.of("test"), null, true); + server.addAddressInfo(new AddressInfo(SimpleString.of("test"), RoutingType.MULTICAST)); peer.waitForScriptToComplete(5, TimeUnit.SECONDS); peer.expectClose(); @@ -3418,7 +3418,7 @@ public class AMQPFederationAddressPolicyTest extends AmqpClientTestSupport { server.getConfiguration().addAMQPConnection(amqpConnection); server.start(); - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("test"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("test"), RoutingType.MULTICAST)); peer.waitForScriptToComplete(5, TimeUnit.SECONDS); @@ -3529,7 +3529,7 @@ public class AMQPFederationAddressPolicyTest extends AmqpClientTestSupport { server.getConfiguration().addAMQPConnection(amqpConnection); server.registerBrokerPlugin(federationPlugin); server.start(); - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("test"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("test"), RoutingType.MULTICAST)); peer.waitForScriptToComplete(5, TimeUnit.SECONDS); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPFederationBrokerPliuginTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPFederationBrokerPliuginTest.java index 0132f1558f..e35bccdb1b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPFederationBrokerPliuginTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPFederationBrokerPliuginTest.java @@ -149,8 +149,8 @@ public class AMQPFederationBrokerPliuginTest extends AmqpClientTestSupport { connectionR.start(); // Demand on local address should trigger receiver on remote. - Wait.assertTrue(() -> server.addressQuery(SimpleString.toSimpleString("test")).isExists()); - Wait.assertTrue(() -> remoteServer.addressQuery(SimpleString.toSimpleString("test")).isExists()); + Wait.assertTrue(() -> server.addressQuery(SimpleString.of("test")).isExists()); + Wait.assertTrue(() -> remoteServer.addressQuery(SimpleString.of("test")).isExists()); Wait.assertTrue(() -> federationPlugin.beforeCreateConsumerCapture.get() != null); Wait.assertTrue(() -> federationPlugin.afterCreateConsumerCapture.get() != null); @@ -236,7 +236,7 @@ public class AMQPFederationBrokerPliuginTest extends AmqpClientTestSupport { connectionR.start(); // Demand on local address should trigger receiver on remote. - Wait.assertTrue(() -> server.queueQuery(SimpleString.toSimpleString("test")).isExists()); + Wait.assertTrue(() -> server.queueQuery(SimpleString.of("test")).isExists()); Wait.assertTrue(() -> federationPlugin.beforeCreateConsumerCapture.get() != null); Wait.assertTrue(() -> federationPlugin.afterCreateConsumerCapture.get() != null); @@ -323,7 +323,7 @@ public class AMQPFederationBrokerPliuginTest extends AmqpClientTestSupport { connectionR.start(); // Demand on local address should not trigger receiver on remote. - Wait.assertTrue(() -> server.addressQuery(SimpleString.toSimpleString("test")).isExists()); + Wait.assertTrue(() -> server.addressQuery(SimpleString.of("test")).isExists()); final MessageProducer producerR = sessionR.createProducer(topic); final TextMessage message = sessionR.createTextMessage("Hello World"); @@ -395,7 +395,7 @@ public class AMQPFederationBrokerPliuginTest extends AmqpClientTestSupport { connectionR.start(); // Demand on local address should not trigger receiver on remote. - Wait.assertTrue(() -> server.queueQuery(SimpleString.toSimpleString("test")).isExists()); + Wait.assertTrue(() -> server.queueQuery(SimpleString.of("test")).isExists()); final MessageProducer producerR = sessionR.createProducer(queue); final TextMessage message = sessionR.createTextMessage("Hello World"); @@ -456,7 +456,7 @@ public class AMQPFederationBrokerPliuginTest extends AmqpClientTestSupport { server.start(); server.deployDivert(divert); // Currently the address must exist on the local before we will federate from the remote - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("source"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("source"), RoutingType.MULTICAST)); final ConnectionFactory factoryLocal = CFUtil.createConnectionFactory("AMQP", "tcp://localhost:" + SERVER_PORT); final ConnectionFactory factoryRemote = CFUtil.createConnectionFactory("AMQP", "tcp://localhost:" + SERVER_PORT_REMOTE); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPFederationConfigurationReloadTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPFederationConfigurationReloadTest.java index 5600b683b3..303942742b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPFederationConfigurationReloadTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPFederationConfigurationReloadTest.java @@ -131,7 +131,7 @@ public class AMQPFederationConfigurationReloadTest extends AmqpClientTestSupport server.getConfiguration().addAMQPConnection(amqpConnection); server.start(); - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("test"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("test"), RoutingType.MULTICAST)); final Map expectedSourceProperties = new HashMap<>(); expectedSourceProperties.put(ADDRESS_AUTO_DELETE, true); @@ -231,7 +231,7 @@ public class AMQPFederationConfigurationReloadTest extends AmqpClientTestSupport server.getConfiguration().addAMQPConnection(amqpConnection); server.start(); - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("test"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("test"), RoutingType.MULTICAST)); final Map expectedSourceProperties = new HashMap<>(); expectedSourceProperties.put(ADDRESS_AUTO_DELETE, true); @@ -358,7 +358,7 @@ public class AMQPFederationConfigurationReloadTest extends AmqpClientTestSupport server.getConfiguration().addAMQPConnection(amqpConnection); server.start(); - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("test"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("test"), RoutingType.MULTICAST)); final Map expectedSourceProperties = new HashMap<>(); expectedSourceProperties.put(ADDRESS_AUTO_DELETE, true); @@ -448,7 +448,7 @@ public class AMQPFederationConfigurationReloadTest extends AmqpClientTestSupport server.getConfiguration().addAMQPConnection(amqpConnection); server.start(); - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("test"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("test"), RoutingType.MULTICAST)); final Map expectedSourceProperties = new HashMap<>(); expectedSourceProperties.put(ADDRESS_AUTO_DELETE, true); @@ -579,7 +579,7 @@ public class AMQPFederationConfigurationReloadTest extends AmqpClientTestSupport latch.await(10, TimeUnit.SECONDS); // Demand on local address should trigger receiver on remote. - Wait.assertTrue(() -> server.addressQuery(SimpleString.toSimpleString("address1")).isExists()); + Wait.assertTrue(() -> server.addressQuery(SimpleString.of("address1")).isExists()); final TextMessage message = session.createTextMessage("test"); @@ -596,11 +596,11 @@ public class AMQPFederationConfigurationReloadTest extends AmqpClientTestSupport latch.await(10, TimeUnit.SECONDS); // Demand on local address should trigger receiver on remote. - Wait.assertTrue(() -> server.addressQuery(SimpleString.toSimpleString("address2")).isExists()); + Wait.assertTrue(() -> server.addressQuery(SimpleString.of("address2")).isExists()); // Should arrive on the original federated Address and the now added address // but we need to await the federation being setup and a binding added. - Wait.assertTrue(() -> server.bindingQuery(SimpleString.toSimpleString("address2")).getQueueNames().size() > 0); + Wait.assertTrue(() -> server.bindingQuery(SimpleString.of("address2")).getQueueNames().size() > 0); address1Producer.send(message); address2Producer.send(message); @@ -661,7 +661,7 @@ public class AMQPFederationConfigurationReloadTest extends AmqpClientTestSupport final MessageProducer queue2Producer = serverSession.createProducer(queue2); // Demand on local queue should trigger receiver on remote. - Wait.assertTrue(() -> server.queueQuery(SimpleString.toSimpleString("queue1")).isExists()); + Wait.assertTrue(() -> server.queueQuery(SimpleString.of("queue1")).isExists()); final TextMessage message = session.createTextMessage("test"); @@ -672,7 +672,7 @@ public class AMQPFederationConfigurationReloadTest extends AmqpClientTestSupport // currently federated. Wait.assertTrue(() -> - embeddedActiveMQ.getActiveMQServer().queueQuery(SimpleString.toSimpleString("queue1")).getMessageCount() == 1); + embeddedActiveMQ.getActiveMQServer().queueQuery(SimpleString.of("queue1")).getMessageCount() == 1); assertNotNull(queue1Consumer.receiveNoWait()); assertNull(queue2Consumer.receiveNoWait()); @@ -684,16 +684,16 @@ public class AMQPFederationConfigurationReloadTest extends AmqpClientTestSupport latch.await(10, TimeUnit.SECONDS); // Demand on local queue should trigger receiver on remote. - Wait.assertTrue(() -> server.queueQuery(SimpleString.toSimpleString("queue2")).isExists()); + Wait.assertTrue(() -> server.queueQuery(SimpleString.of("queue2")).isExists()); // Should arrive on the original federated Queue and the updated Queue as it is now federated queue1Producer.send(message); Wait.assertTrue(() -> - embeddedActiveMQ.getActiveMQServer().queueQuery(SimpleString.toSimpleString("queue1")).getMessageCount() == 1); + embeddedActiveMQ.getActiveMQServer().queueQuery(SimpleString.of("queue1")).getMessageCount() == 1); Wait.assertTrue(() -> - embeddedActiveMQ.getActiveMQServer().queueQuery(SimpleString.toSimpleString("queue2")).getMessageCount() == 1); + embeddedActiveMQ.getActiveMQServer().queueQuery(SimpleString.of("queue2")).getMessageCount() == 1); assertNotNull(queue1Consumer.receiveNoWait()); assertNotNull(queue2Consumer.receiveNoWait()); @@ -748,8 +748,8 @@ public class AMQPFederationConfigurationReloadTest extends AmqpClientTestSupport latch.await(10, TimeUnit.SECONDS); // Demand on local address should trigger receiver on remote. - Wait.assertTrue(() -> server.addressQuery(SimpleString.toSimpleString("address1")).isExists()); - Wait.assertTrue(() -> server.queueQuery(SimpleString.toSimpleString("queue1")).isExists()); + Wait.assertTrue(() -> server.addressQuery(SimpleString.of("address1")).isExists()); + Wait.assertTrue(() -> server.queueQuery(SimpleString.of("queue1")).isExists()); final TextMessage message = session.createTextMessage("test"); @@ -770,7 +770,7 @@ public class AMQPFederationConfigurationReloadTest extends AmqpClientTestSupport // The original address consumer should have gone away and not returned when the federation // connection was recreated. - Wait.assertTrue(() -> server.bindingQuery(SimpleString.toSimpleString("address2")).getQueueNames().size() == 0); + Wait.assertTrue(() -> server.bindingQuery(SimpleString.of("address2")).getQueueNames().size() == 0); } finally { embeddedActiveMQ.stop(); @@ -831,8 +831,8 @@ public class AMQPFederationConfigurationReloadTest extends AmqpClientTestSupport final MessageProducer queue2Producer = serverSession.createProducer(queue2); // Demand on local queue should trigger receiver on remote. - Wait.assertTrue(() -> server.queueQuery(SimpleString.toSimpleString("queue1")).isExists()); - Wait.assertTrue(() -> server.queueQuery(SimpleString.toSimpleString("queue2")).isExists()); + Wait.assertTrue(() -> server.queueQuery(SimpleString.of("queue1")).isExists()); + Wait.assertTrue(() -> server.queueQuery(SimpleString.of("queue2")).isExists()); final TextMessage message = session.createTextMessage("test"); @@ -841,7 +841,7 @@ public class AMQPFederationConfigurationReloadTest extends AmqpClientTestSupport // Should get message sent to the single federated queue Wait.assertTrue(() -> - embeddedActiveMQ.getActiveMQServer().queueQuery(SimpleString.toSimpleString("queue1")).getMessageCount() == 1); + embeddedActiveMQ.getActiveMQServer().queueQuery(SimpleString.of("queue1")).getMessageCount() == 1); assertNotNull(queue1Consumer.receiveNoWait()); assertNull(queue2Consumer.receiveNoWait()); @@ -853,17 +853,17 @@ public class AMQPFederationConfigurationReloadTest extends AmqpClientTestSupport latch.await(10, TimeUnit.SECONDS); // Demand on local queue should trigger receiver on remote. - Wait.assertTrue(() -> server.queueQuery(SimpleString.toSimpleString("queue1")).isExists()); - Wait.assertTrue(() -> server.queueQuery(SimpleString.toSimpleString("queue2")).isExists()); + Wait.assertTrue(() -> server.queueQuery(SimpleString.of("queue1")).isExists()); + Wait.assertTrue(() -> server.queueQuery(SimpleString.of("queue2")).isExists()); // Send another message to the originally federated queue queue1Producer.send(message); // Should arrive on the federated Queues now that the broker configuration has been reloaded. Wait.assertTrue(() -> - embeddedActiveMQ.getActiveMQServer().queueQuery(SimpleString.toSimpleString("queue1")).getMessageCount() == 1); + embeddedActiveMQ.getActiveMQServer().queueQuery(SimpleString.of("queue1")).getMessageCount() == 1); Wait.assertTrue(() -> - embeddedActiveMQ.getActiveMQServer().queueQuery(SimpleString.toSimpleString("queue2")).getMessageCount() == 1); + embeddedActiveMQ.getActiveMQServer().queueQuery(SimpleString.of("queue2")).getMessageCount() == 1); assertNotNull(queue1Consumer.receiveNoWait()); assertNotNull(queue2Consumer.receiveNoWait()); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPFederationQueuePolicyTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPFederationQueuePolicyTest.java index 95da3bbe06..acf503a008 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPFederationQueuePolicyTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPFederationQueuePolicyTest.java @@ -665,7 +665,7 @@ public class AMQPFederationQueuePolicyTest extends AmqpClientTestSupport { peer.waitForScriptToComplete(5, TimeUnit.SECONDS); peer.expectDetach().respond(); - server.destroyQueue(SimpleString.toSimpleString("test"), null, false, true); + server.destroyQueue(SimpleString.of("test"), null, false, true); peer.waitForScriptToComplete(5, TimeUnit.SECONDS); } @@ -2820,7 +2820,7 @@ public class AMQPFederationQueuePolicyTest extends AmqpClientTestSupport { peer.expectFlow().withLinkCredit(10); peer.start(); - final SimpleString queueName = SimpleString.toSimpleString("test"); + final SimpleString queueName = SimpleString.of("test"); final URI remoteURI = peer.getServerURI(); logger.info("Test started, peer listening on: {}", remoteURI); @@ -3379,7 +3379,7 @@ public class AMQPFederationQueuePolicyTest extends AmqpClientTestSupport { peer.expectTransfer().withPayload(payloadMatcher).accept(); // Address added event // Manually add the address and a queue binding to create local demand. - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("test"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("test"), RoutingType.MULTICAST)); server.createQueue(new QueueConfiguration("test").setRoutingType(RoutingType.MULTICAST) .setAddress("test") .setAutoCreated(false)); @@ -3602,7 +3602,7 @@ public class AMQPFederationQueuePolicyTest extends AmqpClientTestSupport { peer.expectDetach().withError(AmqpError.RESOURCE_DELETED.toString()); // Force remove consumers from the queue should indicate the resource was deleted. - server.destroyQueue(SimpleString.toSimpleString("test"), null, false, true); + server.destroyQueue(SimpleString.of("test"), null, false, true); peer.waitForScriptToComplete(5, TimeUnit.SECONDS); @@ -3629,7 +3629,7 @@ public class AMQPFederationQueuePolicyTest extends AmqpClientTestSupport { // This time removing and restoring should generate no traffic as there was not // another federation receiver added. - server.destroyQueue(SimpleString.toSimpleString("test"), null, false, true); + server.destroyQueue(SimpleString.of("test"), null, false, true); server.createQueue(new QueueConfiguration("test").setRoutingType(RoutingType.ANYCAST) .setAddress("test") .setAutoCreated(false)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPFederationServerToServerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPFederationServerToServerTest.java index e76a5f90c1..24a8ccf605 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPFederationServerToServerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPFederationServerToServerTest.java @@ -167,12 +167,12 @@ public class AMQPFederationServerToServerTest extends AmqpClientTestSupport { connectionR.start(); // Demand on local address should trigger receiver on remote. - Wait.assertTrue(() -> server.addressQuery(SimpleString.toSimpleString("test")).isExists()); - Wait.assertTrue(() -> remoteServer.addressQuery(SimpleString.toSimpleString("test")).isExists()); + Wait.assertTrue(() -> server.addressQuery(SimpleString.of("test")).isExists()); + Wait.assertTrue(() -> remoteServer.addressQuery(SimpleString.of("test")).isExists()); // Captures state of JMS consumers and federation consumers attached on each node - Wait.assertTrue(() -> server.bindingQuery(SimpleString.toSimpleString("test"), false).getQueueNames().size() >= 1); - Wait.assertTrue(() -> remoteServer.bindingQuery(SimpleString.toSimpleString("test"), false).getQueueNames().size() >= 1); + Wait.assertTrue(() -> server.bindingQuery(SimpleString.of("test"), false).getQueueNames().size() >= 1); + Wait.assertTrue(() -> remoteServer.bindingQuery(SimpleString.of("test"), false).getQueueNames().size() >= 1); final MessageProducer producerR = sessionR.createProducer(topic); final TextMessage message = sessionR.createTextMessage("Hello World"); @@ -233,7 +233,7 @@ public class AMQPFederationServerToServerTest extends AmqpClientTestSupport { server.start(); server.deployDivert(divert); // Currently the address must exist on the local before we will federate from the remote - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("source"), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("source"), RoutingType.MULTICAST)); final ConnectionFactory factoryLocal = CFUtil.createConnectionFactory(clientProtocol, "tcp://localhost:" + SERVER_PORT); final ConnectionFactory factoryRemote = CFUtil.createConnectionFactory(clientProtocol, "tcp://localhost:" + SERVER_PORT_REMOTE); @@ -253,11 +253,11 @@ public class AMQPFederationServerToServerTest extends AmqpClientTestSupport { connectionR.start(); // Demand on local address should trigger receiver on remote. - Wait.assertTrue(() -> remoteServer.addressQuery(SimpleString.toSimpleString("source")).isExists()); + Wait.assertTrue(() -> remoteServer.addressQuery(SimpleString.of("source")).isExists()); // Captures state of JMS consumers and federation consumers attached on each node - Wait.assertTrue(() -> server.bindingQuery(SimpleString.toSimpleString("target"), false).getQueueNames().size() >= 1); - Wait.assertTrue(() -> remoteServer.bindingQuery(SimpleString.toSimpleString("source"), false).getQueueNames().size() >= 1); + Wait.assertTrue(() -> server.bindingQuery(SimpleString.of("target"), false).getQueueNames().size() >= 1); + Wait.assertTrue(() -> remoteServer.bindingQuery(SimpleString.of("source"), false).getQueueNames().size() >= 1); final MessageProducer producerR = sessionR.createProducer(source); final TextMessage message = sessionR.createTextMessage("Hello World"); @@ -327,7 +327,7 @@ public class AMQPFederationServerToServerTest extends AmqpClientTestSupport { connectionR.start(); // Demand on local queue should trigger receiver on remote. - Wait.assertTrue(() -> server.queueQuery(SimpleString.toSimpleString("test")).isExists()); + Wait.assertTrue(() -> server.queueQuery(SimpleString.of("test")).isExists()); final MessageProducer producerR = sessionR.createProducer(queue); final TextMessage message = sessionR.createTextMessage("Hello World"); @@ -397,12 +397,12 @@ public class AMQPFederationServerToServerTest extends AmqpClientTestSupport { connectionR.start(); // Demand on local address should trigger receiver on remote. - Wait.assertTrue(() -> server.addressQuery(SimpleString.toSimpleString("test")).isExists()); - Wait.assertTrue(() -> remoteServer.addressQuery(SimpleString.toSimpleString("test")).isExists()); + Wait.assertTrue(() -> server.addressQuery(SimpleString.of("test")).isExists()); + Wait.assertTrue(() -> remoteServer.addressQuery(SimpleString.of("test")).isExists()); // Captures state of JMS consumers and federation consumers attached on each node - Wait.assertTrue(() -> server.bindingQuery(SimpleString.toSimpleString("test"), false).getQueueNames().size() >= 1); - Wait.assertTrue(() -> remoteServer.bindingQuery(SimpleString.toSimpleString("test"), false).getQueueNames().size() >= 1); + Wait.assertTrue(() -> server.bindingQuery(SimpleString.of("test"), false).getQueueNames().size() >= 1); + Wait.assertTrue(() -> remoteServer.bindingQuery(SimpleString.of("test"), false).getQueueNames().size() >= 1); final MessageProducer producerL = sessionL.createProducer(topic); final TextMessage message = sessionL.createTextMessage("Hello World"); @@ -472,7 +472,7 @@ public class AMQPFederationServerToServerTest extends AmqpClientTestSupport { connectionR.start(); // Demand on remote queue should trigger receiver on remote. - Wait.assertTrue(() -> remoteServer.queueQuery(SimpleString.toSimpleString("test")).isExists()); + Wait.assertTrue(() -> remoteServer.queueQuery(SimpleString.of("test")).isExists()); final MessageProducer producerL = sessionL.createProducer(queue); final TextMessage message = sessionL.createTextMessage("Hello World"); @@ -533,7 +533,7 @@ public class AMQPFederationServerToServerTest extends AmqpClientTestSupport { // Currently the address must exist on the local before we will federate from the remote // and in this case since we are instructing the remote to federate from us the address must // exist on the remote for that to happen. - remoteServer.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("source"), RoutingType.MULTICAST)); + remoteServer.addAddressInfo(new AddressInfo(SimpleString.of("source"), RoutingType.MULTICAST)); server.getConfiguration().addAMQPConnection(amqpConnection); server.start(); @@ -555,11 +555,11 @@ public class AMQPFederationServerToServerTest extends AmqpClientTestSupport { connectionR.start(); // Demand on local address should trigger receiver on remote. - Wait.assertTrue(() -> server.addressQuery(SimpleString.toSimpleString("source")).isExists()); + Wait.assertTrue(() -> server.addressQuery(SimpleString.of("source")).isExists()); // Captures state of JMS consumers and federation consumers attached on each node - Wait.assertTrue(() -> server.bindingQuery(SimpleString.toSimpleString("source"), false).getQueueNames().size() >= 1); - Wait.assertTrue(() -> remoteServer.bindingQuery(SimpleString.toSimpleString("target"), false).getQueueNames().size() >= 1); + Wait.assertTrue(() -> server.bindingQuery(SimpleString.of("source"), false).getQueueNames().size() >= 1); + Wait.assertTrue(() -> remoteServer.bindingQuery(SimpleString.of("target"), false).getQueueNames().size() >= 1); final MessageProducer producerL = sessionL.createProducer(source); final TextMessage message = sessionL.createTextMessage("Hello World"); @@ -645,12 +645,12 @@ public class AMQPFederationServerToServerTest extends AmqpClientTestSupport { connectionR.start(); // Demand on local address should trigger receiver on remote. - Wait.assertTrue(() -> server.addressQuery(SimpleString.toSimpleString("test")).isExists()); - Wait.assertTrue(() -> remoteServer.addressQuery(SimpleString.toSimpleString("test")).isExists()); + Wait.assertTrue(() -> server.addressQuery(SimpleString.of("test")).isExists()); + Wait.assertTrue(() -> remoteServer.addressQuery(SimpleString.of("test")).isExists()); // Captures state of JMS consumers and federation consumers attached on each node - Wait.assertTrue(() -> server.bindingQuery(SimpleString.toSimpleString("test"), false).getQueueNames().size() >= 1); - Wait.assertTrue(() -> remoteServer.bindingQuery(SimpleString.toSimpleString("test"), false).getQueueNames().size() >= 1); + Wait.assertTrue(() -> server.bindingQuery(SimpleString.of("test"), false).getQueueNames().size() >= 1); + Wait.assertTrue(() -> remoteServer.bindingQuery(SimpleString.of("test"), false).getQueueNames().size() >= 1); final MessageProducer producerR = sessionR.createProducer(topic); final BytesMessage message = sessionR.createBytesMessage(); @@ -745,8 +745,8 @@ public class AMQPFederationServerToServerTest extends AmqpClientTestSupport { connectionR.start(); // Demand on local address should trigger receiver on remote. - Wait.assertTrue(() -> server.queueQuery(SimpleString.toSimpleString("test")).isExists()); - Wait.assertTrue(() -> remoteServer.queueQuery(SimpleString.toSimpleString("test")).isExists()); + Wait.assertTrue(() -> server.queueQuery(SimpleString.of("test")).isExists()); + Wait.assertTrue(() -> remoteServer.queueQuery(SimpleString.of("test")).isExists()); final MessageProducer producerR = sessionR.createProducer(queue); final BytesMessage message = sessionR.createBytesMessage(); @@ -795,7 +795,7 @@ public class AMQPFederationServerToServerTest extends AmqpClientTestSupport { remoteServer2 = createServer(SERVER2_PORT_REMOTE, false); final String ADDRESS_NAME = "target"; - final SimpleString ADDRESS_NAME_SS = SimpleString.toSimpleString(ADDRESS_NAME); + final SimpleString ADDRESS_NAME_SS = SimpleString.of(ADDRESS_NAME); final AMQPFederationAddressPolicyElement localAddressPolicy = new AMQPFederationAddressPolicyElement(); localAddressPolicy.setName("two-hop-policy"); @@ -1022,8 +1022,8 @@ public class AMQPFederationServerToServerTest extends AmqpClientTestSupport { connectionR.start(); // Demand on local address should trigger receiver on remote. - Wait.assertTrue(() -> server.queueQuery(SimpleString.toSimpleString("test")).isExists()); - Wait.assertTrue(() -> remoteServer.queueQuery(SimpleString.toSimpleString("test")).isExists()); + Wait.assertTrue(() -> server.queueQuery(SimpleString.of("test")).isExists()); + Wait.assertTrue(() -> remoteServer.queueQuery(SimpleString.of("test")).isExists()); final MessageProducer producerR = sessionR.createProducer(sessionR.createQueue("test")); final BytesMessage message = sessionR.createBytesMessage(); @@ -1113,7 +1113,7 @@ public class AMQPFederationServerToServerTest extends AmqpClientTestSupport { connectionR.start(); // Demand on local queue should trigger receiver on remote. - Wait.assertTrue(() -> server.queueQuery(SimpleString.toSimpleString("test")).isExists()); + Wait.assertTrue(() -> server.queueQuery(SimpleString.of("test")).isExists()); final MessageProducer producerR = sessionR.createProducer(queue); @@ -1223,7 +1223,7 @@ public class AMQPFederationServerToServerTest extends AmqpClientTestSupport { connectionL.start(); connectionR.start(); - final SimpleString addressName = SimpleString.toSimpleString("test"); + final SimpleString addressName = SimpleString.of("test"); Wait.assertTrue(() -> server.addressQuery(addressName).isExists()); Wait.assertTrue(() -> remoteServer.addressQuery(addressName).isExists()); @@ -1342,7 +1342,7 @@ public class AMQPFederationServerToServerTest extends AmqpClientTestSupport { connectionL.start(); connectionR.start(); - final SimpleString addressName = SimpleString.toSimpleString("test"); + final SimpleString addressName = SimpleString.of("test"); Wait.assertTrue(() -> server.addressQuery(addressName).isExists()); Wait.assertTrue(() -> remoteServer.addressQuery(addressName).isExists()); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPRedistributeClusterTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPRedistributeClusterTest.java index 0e174d13eb..cb4567f44f 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPRedistributeClusterTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPRedistributeClusterTest.java @@ -77,7 +77,7 @@ public class AMQPRedistributeClusterTest extends AmqpTestSupport { private static final String QUEUE_NAME = "REDIST_QUEUE"; private static final String TOPIC_NAME = "REDIST_TOPIC"; - private static final SimpleString TOPIC_NAME_SIMPLE_STRING = SimpleString.toSimpleString("REDIST_TOPIC"); + private static final SimpleString TOPIC_NAME_SIMPLE_STRING = SimpleString.of("REDIST_TOPIC"); protected static final int A_1_PORT = 5673; protected static final int A_2_PORT = 5674; @@ -121,7 +121,7 @@ public class AMQPRedistributeClusterTest extends AmqpTestSupport { server.getConfiguration().addClusterConfiguration(clusterConfiguration); if (mirrorPort > 0) { - server.getConfiguration().addAMQPConnection(new AMQPBrokerConnectConfiguration("myMirror" + mirrorPort, "tcp://localhost:" + mirrorPort).setReconnectAttempts(-1).setRetryInterval(100).addConnectionElement(new AMQPMirrorBrokerConnectionElement().setDurable(true).setMirrorSNF(new SimpleString(mirrorName(mirrorPort))))); + server.getConfiguration().addAMQPConnection(new AMQPBrokerConnectConfiguration("myMirror" + mirrorPort, "tcp://localhost:" + mirrorPort).setReconnectAttempts(-1).setRetryInterval(100).addConnectionElement(new AMQPMirrorBrokerConnectionElement().setDurable(true).setMirrorSNF(SimpleString.of(mirrorName(mirrorPort))))); } return server; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPReplicaTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPReplicaTest.java index 2055b534b1..2fb808a1a4 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPReplicaTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPReplicaTest.java @@ -171,12 +171,12 @@ public class AMQPReplicaTest extends AmqpClientTestSupport { try (AssertionLoggerHandler loggerHandler = new AssertionLoggerHandler()) { // Adding some PostAck event that will never be found on the target for an expiry - org.apache.activemq.artemis.api.core.Message message = AMQPMirrorMessageFactory.createMessage(mirrorQueue.getAddress().toString(), SimpleString.toSimpleString("sometest"), SimpleString.toSimpleString("sometest"), AMQPMirrorControllerSource.POST_ACK, "0000", 3333L, AckReason.EXPIRED).setDurable(true); + org.apache.activemq.artemis.api.core.Message message = AMQPMirrorMessageFactory.createMessage(mirrorQueue.getAddress().toString(), SimpleString.of("sometest"), SimpleString.of("sometest"), AMQPMirrorControllerSource.POST_ACK, "0000", 3333L, AckReason.EXPIRED).setDurable(true); message.setMessageID(server_2.getStorageManager().generateID()); server_2.getPostOffice().route(message, false); // Adding some PostAck event that will never be found on the target for a regular ack - message = AMQPMirrorMessageFactory.createMessage(mirrorQueue.getAddress().toString(), SimpleString.toSimpleString("sometest"), SimpleString.toSimpleString("sometest"), AMQPMirrorControllerSource.POST_ACK, "0000", 3334L, AckReason.NORMAL).setDurable(true); + message = AMQPMirrorMessageFactory.createMessage(mirrorQueue.getAddress().toString(), SimpleString.of("sometest"), SimpleString.of("sometest"), AMQPMirrorControllerSource.POST_ACK, "0000", 3334L, AckReason.NORMAL).setDurable(true); message.setMessageID(server_2.getStorageManager().generateID()); server_2.getPostOffice().route(message, false); @@ -235,7 +235,7 @@ public class AMQPReplicaTest extends AmqpClientTestSupport { private void doSendCreateQueueTestImpl(boolean sendCreate) throws Exception { server.start(); - final SimpleString ADDRESS_NAME = SimpleString.toSimpleString("address"); + final SimpleString ADDRESS_NAME = SimpleString.of("address"); server_2 = createServer(AMQP_PORT_2, false); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPScheduledCoreOverBrokerConnectTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPScheduledCoreOverBrokerConnectTest.java index e47c9e961e..f698ba10a1 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPScheduledCoreOverBrokerConnectTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPScheduledCoreOverBrokerConnectTest.java @@ -60,7 +60,7 @@ public class AMQPScheduledCoreOverBrokerConnectTest extends AmqpClientTestSuppor String queueName = "withScheduled"; server.setIdentity("targetServer"); server.start(); - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(queueName), RoutingType.ANYCAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of(queueName), RoutingType.ANYCAST)); server.createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST)); server_2 = createServer(AMQP_PORT_2, false); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AckManagerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AckManagerTest.java index 51703574da..89f81fd898 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AckManagerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AckManagerTest.java @@ -92,7 +92,7 @@ public class AckManagerTest extends ActiveMQTestBase { String protocol = "AMQP"; - SimpleString TOPIC_NAME = SimpleString.toSimpleString("tp" + RandomUtil.randomString()); + SimpleString TOPIC_NAME = SimpleString.of("tp" + RandomUtil.randomString()); server1.addAddressInfo(new AddressInfo(TOPIC_NAME).addRoutingType(RoutingType.MULTICAST)); @@ -300,7 +300,7 @@ public class AckManagerTest extends ActiveMQTestBase { String protocol = "AMQP"; - SimpleString TOPIC_NAME = SimpleString.toSimpleString("tp" + RandomUtil.randomString()); + SimpleString TOPIC_NAME = SimpleString.of("tp" + RandomUtil.randomString()); server1.addAddressInfo(new AddressInfo(TOPIC_NAME).addRoutingType(RoutingType.MULTICAST)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/BrokerInSyncTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/BrokerInSyncTest.java index 9c4b1b4520..f2e26d3a86 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/BrokerInSyncTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/BrokerInSyncTest.java @@ -262,7 +262,7 @@ public class BrokerInSyncTest extends AmqpClientTestSupport { server.getConfiguration().addAMQPConnection(amqpConnection); } - server.getConfiguration().addAddressSetting("#", new AddressSettings().setExpiryAddress(SimpleString.toSimpleString("expiryQueue"))); + server.getConfiguration().addAddressSetting("#", new AddressSettings().setExpiryAddress(SimpleString.of("expiryQueue"))); server.getConfiguration().addAddressConfiguration(new CoreAddressConfiguration().setName("expiryQueue")); server.getConfiguration().addQueueConfiguration(new QueueConfiguration("expiryQueue").setRoutingType(RoutingType.ANYCAST)); @@ -288,7 +288,7 @@ public class BrokerInSyncTest extends AmqpClientTestSupport { server_2.getConfiguration().addAMQPConnection(amqpConnection); } - server_2.getConfiguration().addAddressSetting("#", new AddressSettings().setExpiryAddress(SimpleString.toSimpleString("expiryQueue"))); + server_2.getConfiguration().addAddressSetting("#", new AddressSettings().setExpiryAddress(SimpleString.of("expiryQueue"))); server_2.start(); @@ -366,7 +366,7 @@ public class BrokerInSyncTest extends AmqpClientTestSupport { server.getConfiguration().addAMQPConnection(amqpConnection); } - server.getConfiguration().addAddressSetting("#", new AddressSettings().setDeadLetterAddress(SimpleString.toSimpleString("deadLetterQueue")).setMaxDeliveryAttempts(2)); + server.getConfiguration().addAddressSetting("#", new AddressSettings().setDeadLetterAddress(SimpleString.of("deadLetterQueue")).setMaxDeliveryAttempts(2)); server.getConfiguration().addAddressConfiguration(new CoreAddressConfiguration().setName("deadLetterQueue")); server.getConfiguration().addQueueConfiguration(new QueueConfiguration("deadLetterQueue").setRoutingType(RoutingType.ANYCAST)); @@ -388,7 +388,7 @@ public class BrokerInSyncTest extends AmqpClientTestSupport { server_2.getConfiguration().addAMQPConnection(amqpConnection); } - server_2.getConfiguration().addAddressSetting("#", new AddressSettings().setDeadLetterAddress(SimpleString.toSimpleString("deadLetterQueue")).setMaxDeliveryAttempts(2)); + server_2.getConfiguration().addAddressSetting("#", new AddressSettings().setDeadLetterAddress(SimpleString.of("deadLetterQueue")).setMaxDeliveryAttempts(2)); server_2.start(); @@ -455,7 +455,7 @@ public class BrokerInSyncTest extends AmqpClientTestSupport { @Override public SimpleString getFilterString() { - return SimpleString.toSimpleString("Test"); + return SimpleString.of("Test"); } }); @@ -482,7 +482,7 @@ public class BrokerInSyncTest extends AmqpClientTestSupport { server.getConfiguration().addAMQPConnection(amqpConnection); } - server.getConfiguration().addAddressSetting("#", new AddressSettings().setDeadLetterAddress(SimpleString.toSimpleString("deadLetterQueue")).setMaxDeliveryAttempts(2)); + server.getConfiguration().addAddressSetting("#", new AddressSettings().setDeadLetterAddress(SimpleString.of("deadLetterQueue")).setMaxDeliveryAttempts(2)); server.getConfiguration().addAddressConfiguration(new CoreAddressConfiguration().setName("deadLetterQueue")); server.getConfiguration().addQueueConfiguration(new QueueConfiguration("deadLetterQueue").setRoutingType(RoutingType.ANYCAST)); @@ -504,7 +504,7 @@ public class BrokerInSyncTest extends AmqpClientTestSupport { server_2.getConfiguration().addAMQPConnection(amqpConnection); } - server_2.getConfiguration().addAddressSetting("#", new AddressSettings().setDeadLetterAddress(SimpleString.toSimpleString("deadLetterQueue")).setMaxDeliveryAttempts(2)); + server_2.getConfiguration().addAddressSetting("#", new AddressSettings().setDeadLetterAddress(SimpleString.of("deadLetterQueue")).setMaxDeliveryAttempts(2)); server_2.start(); @@ -522,7 +522,7 @@ public class BrokerInSyncTest extends AmqpClientTestSupport { server.createQueue(new QueueConfiguration(getQueueName()).setDurable(true).setRoutingType(RoutingType.ANYCAST)); Wait.assertTrue(() -> server_2.locateQueue(getQueueName()) != null, 5000); - assertTrue(server_2.getAddressInfo(SimpleString.toSimpleString(internalQueueName)) == null); + assertTrue(server_2.getAddressInfo(SimpleString.of(internalQueueName)) == null); assertTrue(server_2.locateQueue(internalQueueName) == null); assertEquals(messagesAddedOnS2, to1.getMessagesAdded()); @@ -546,7 +546,7 @@ public class BrokerInSyncTest extends AmqpClientTestSupport { server.getConfiguration().addAMQPConnection(amqpConnection); } - server.getConfiguration().addAddressSetting("#", new AddressSettings().setDeadLetterAddress(SimpleString.toSimpleString("deadLetterQueue")).setMaxDeliveryAttempts(2)); + server.getConfiguration().addAddressSetting("#", new AddressSettings().setDeadLetterAddress(SimpleString.of("deadLetterQueue")).setMaxDeliveryAttempts(2)); server.getConfiguration().addAddressConfiguration(new CoreAddressConfiguration().setName("deadLetterQueue")); server.getConfiguration().addQueueConfiguration(new QueueConfiguration("deadLetterQueue").setRoutingType(RoutingType.ANYCAST)); @@ -573,7 +573,7 @@ public class BrokerInSyncTest extends AmqpClientTestSupport { server_2.getConfiguration().addAMQPConnection(amqpConnection); } - server_2.getConfiguration().addAddressSetting("#", new AddressSettings().setDeadLetterAddress(SimpleString.toSimpleString("deadLetterQueue")).setMaxDeliveryAttempts(2)); + server_2.getConfiguration().addAddressSetting("#", new AddressSettings().setDeadLetterAddress(SimpleString.of("deadLetterQueue")).setMaxDeliveryAttempts(2)); server_2.start(); org.apache.activemq.artemis.core.server.Queue lvqQueue1 = locateQueueWithWait(server, lvqName); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/MirrorControllerBasicTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/MirrorControllerBasicTest.java index 867db453f8..ed682011dc 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/MirrorControllerBasicTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/MirrorControllerBasicTest.java @@ -97,7 +97,7 @@ public class MirrorControllerBasicTest extends ActiveMQTestBase { server.addAddressInfo(new AddressInfo("test").addRoutingType(RoutingType.ANYCAST)); server.createQueue(new QueueConfiguration("test").setAddress("test").setRoutingType(RoutingType.ANYCAST)); - Message message = AMQPMirrorMessageFactory.createMessage("test", SimpleString.toSimpleString("ad1"), SimpleString.toSimpleString("qu1"), "test", "someUID", "body-test", AckReason.KILLED); + Message message = AMQPMirrorMessageFactory.createMessage("test", SimpleString.of("ad1"), SimpleString.of("qu1"), "test", "someUID", "body-test", AckReason.KILLED); AMQPMirrorControllerSource.routeMirrorCommand(server, message); AmqpClient client = new AmqpClient(new URI("tcp://localhost:61616"), null, null); 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 3aee0efef1..78a2b08103 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 @@ -79,7 +79,7 @@ public class AmqpReplicatedLargeMessageTest extends AmqpReplicatedTestSupport { } public SimpleString getQueueName() { - return SimpleString.toSimpleString("replicatedTest"); + return SimpleString.of("replicatedTest"); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/largemessages/SimpleStreamingLargeMessageTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/largemessages/SimpleStreamingLargeMessageTest.java index 491ee418d1..b732415408 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/largemessages/SimpleStreamingLargeMessageTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/largemessages/SimpleStreamingLargeMessageTest.java @@ -341,7 +341,7 @@ public class SimpleStreamingLargeMessageTest extends AmqpClientTestSupport { session.commit(); - Queue queue = server.locateQueue(SimpleString.toSimpleString(getQueueName())); + Queue queue = server.locateQueue(SimpleString.of(getQueueName())); Wait.assertEquals(1, queue::getMessageCount); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/paging/AmqpMaxReadPagingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/paging/AmqpMaxReadPagingTest.java index 2dadd5a537..369ce4bd81 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/paging/AmqpMaxReadPagingTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/paging/AmqpMaxReadPagingTest.java @@ -97,7 +97,7 @@ public class AmqpMaxReadPagingTest extends AmqpClientTestSupport { if (receiver.getPrefetchSize() > 10) { logger.warn("Receiver has an unexpected size of {} elements on the client buffer", receiver.getPrefetchSize()); } - PagingStore pagingStore = server.getPagingManager().getPageStore(SimpleString.toSimpleString(getQueueName())); + PagingStore pagingStore = server.getPagingManager().getPageStore(SimpleString.of(getQueueName())); assertTrue(pagingStore.isPaging()); assertTrue(receiver.getPrefetchSize() <= 10); // we should not have more than page-read messages diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/paging/AmqpPagingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/paging/AmqpPagingTest.java index 89a8a6d07e..9a41b04b62 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/paging/AmqpPagingTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/paging/AmqpPagingTest.java @@ -105,7 +105,7 @@ public class AmqpPagingTest extends AmqpClientTestSupport { sender.close(); final Queue queueView = getProxyToQueue(getQueueName()); Wait.assertEquals(MSG_COUNT, queueView::getMessageCount); - PagingStore pagingStore = server.getPagingManager().getPageStore(SimpleString.toSimpleString(getQueueName())); + PagingStore pagingStore = server.getPagingManager().getPageStore(SimpleString.of(getQueueName())); assertTrue(pagingStore.isPaging()); final long pageCacheMaxSize = server.getConfiguration().getAddressSettings().get("#").getPageCacheMaxSize(); assertThat("the size of the messages or the number of messages isn't enough", @@ -157,7 +157,7 @@ public class AmqpPagingTest extends AmqpClientTestSupport { } sender.send(message); - PagingStore pagingStore = server.getPagingManager().getPageStore(SimpleString.toSimpleString(getQueueName())); + PagingStore pagingStore = server.getPagingManager().getPageStore(SimpleString.of(getQueueName())); // verify page usage reflects data + 2*application properties (encoded and decoded) assertTrue(Wait.waitFor(() -> { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/bridge/BridgeRetryFullFailureTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/bridge/BridgeRetryFullFailureTest.java index c10bbf2a27..4c6fe5beb2 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/bridge/BridgeRetryFullFailureTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/bridge/BridgeRetryFullFailureTest.java @@ -78,8 +78,8 @@ public class BridgeRetryFullFailureTest extends ActiveMQTestBase { @Test public void testFullServer() throws Exception { - SimpleString source = SimpleString.toSimpleString("source"); - SimpleString destination = SimpleString.toSimpleString("destination"); + SimpleString source = SimpleString.of("source"); + SimpleString destination = SimpleString.of("destination"); server0.createQueue(new QueueConfiguration(source).setRoutingType(RoutingType.ANYCAST)); Queue queueServer1 = server1.createQueue(new QueueConfiguration(destination).setRoutingType(RoutingType.ANYCAST)); 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 688d9ead18..a3fb3d27d2 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 @@ -132,8 +132,8 @@ public class BridgeRoutingTest extends ActiveMQTestBase { ComponentConfigurationRoutingType bridgeRoutingType, long sleepTime, int destinationMessageCount) throws Exception { - SimpleString source = SimpleString.toSimpleString("source"); - SimpleString destination = SimpleString.toSimpleString("destination"); + SimpleString source = SimpleString.of("source"); + SimpleString destination = SimpleString.of("destination"); int concurrency = 2; server0.createQueue(new QueueConfiguration(source).setRoutingType(sourceRoutingType)); 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 5e472f2ae4..c6fa3bd79b 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 @@ -76,7 +76,7 @@ public class AddressCommandTest extends JMSTestBase { command.setMulticast(true); command.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error))); checkExecutionPassed(command); - AddressInfo addressInfo = server.getAddressInfo(new SimpleString(address)); + AddressInfo addressInfo = server.getAddressInfo(SimpleString.of(address)); assertNotNull(addressInfo); assertTrue(addressInfo.getRoutingTypes().contains(RoutingType.ANYCAST)); assertTrue(addressInfo.getRoutingTypes().contains(RoutingType.MULTICAST)); @@ -89,7 +89,7 @@ public class AddressCommandTest extends JMSTestBase { command.setName(address); command.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error))); checkExecutionPassed(command); - assertNotNull(server.getAddressInfo(new SimpleString(address))); + assertNotNull(server.getAddressInfo(SimpleString.of(address))); command.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error))); checkExecutionFailure(command, "Address already exists"); @@ -101,13 +101,13 @@ public class AddressCommandTest extends JMSTestBase { CreateAddress command = new CreateAddress(); command.setName(address); command.execute(new ActionContext()); - assertNotNull(server.getAddressInfo(new SimpleString(address))); + assertNotNull(server.getAddressInfo(SimpleString.of(address))); DeleteAddress deleteAddress = new DeleteAddress(); deleteAddress.setName(address); deleteAddress.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error))); checkExecutionPassed(deleteAddress); - assertNull(server.getAddressInfo(new SimpleString(address))); + assertNull(server.getAddressInfo(SimpleString.of(address))); } @Test @@ -122,10 +122,10 @@ public class AddressCommandTest extends JMSTestBase { @Test public void testFailDeleteAddressWhenExistsQueues() throws Exception { final String addressName = "address"; - final SimpleString addressSimpleString = new SimpleString(addressName); + final SimpleString addressSimpleString = SimpleString.of(addressName); final AddressInfo addressInfo = new AddressInfo(addressSimpleString, EnumSet.of(RoutingType.ANYCAST, RoutingType.MULTICAST)); server.addAddressInfo(addressInfo); - server.createQueue(new QueueConfiguration(new SimpleString("queue1")).setAddress(addressSimpleString).setRoutingType(RoutingType.MULTICAST)); + server.createQueue(new QueueConfiguration(SimpleString.of("queue1")).setAddress(addressSimpleString).setRoutingType(RoutingType.MULTICAST)); final DeleteAddress deleteAddress = new DeleteAddress(); deleteAddress.setName(addressName); @@ -136,11 +136,11 @@ public class AddressCommandTest extends JMSTestBase { @Test public void testForceDeleteAddressWhenExistsQueues() throws Exception { final String addressName = "address"; - final SimpleString addressSimpleString = new SimpleString(addressName); + final SimpleString addressSimpleString = SimpleString.of(addressName); final String queueName = "queue1"; final AddressInfo addressInfo = new AddressInfo(addressSimpleString, EnumSet.of(RoutingType.ANYCAST, RoutingType.MULTICAST)); server.addAddressInfo(addressInfo); - Queue queue = server.createQueue(new QueueConfiguration(new SimpleString(queueName)).setAddress(addressSimpleString).setRoutingType(RoutingType.MULTICAST)); + Queue queue = server.createQueue(new QueueConfiguration(SimpleString.of(queueName)).setAddress(addressSimpleString).setRoutingType(RoutingType.MULTICAST)); ServerLocator locator = ActiveMQClient.createServerLocator("tcp://127.0.0.1:61616"); ClientSessionFactory csf = locator.createSessionFactory(); ClientSession session = csf.createSession(); @@ -162,7 +162,7 @@ public class AddressCommandTest extends JMSTestBase { CreateAddress command = new CreateAddress(); command.setName(address); command.execute(new ActionContext()); - assertNotNull(server.getAddressInfo(new SimpleString(address))); + assertNotNull(server.getAddressInfo(SimpleString.of(address))); ShowAddress showAddress = new ShowAddress(); showAddress.setName(address); @@ -183,11 +183,11 @@ public class AddressCommandTest extends JMSTestBase { public void testShowAddressBindings() throws Exception { // Create bindings - SimpleString address = new SimpleString("address"); + SimpleString address = SimpleString.of("address"); server.addAddressInfo(new AddressInfo(address, RoutingType.MULTICAST)); - 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)); + server.createQueue(new QueueConfiguration(SimpleString.of("queue1")).setAddress(address).setRoutingType(RoutingType.MULTICAST)); + server.createQueue(new QueueConfiguration(SimpleString.of("queue2")).setAddress(address).setRoutingType(RoutingType.MULTICAST)); + server.createQueue(new QueueConfiguration(SimpleString.of("queue3")).setAddress(address).setRoutingType(RoutingType.MULTICAST)); DivertConfiguration divertConfiguration = new DivertConfiguration(); divertConfiguration.setName(address.toString()); @@ -204,7 +204,7 @@ public class AddressCommandTest extends JMSTestBase { @Test public void testUpdateAddressRoutingTypes() throws Exception { final String addressName = "address"; - final SimpleString address = new SimpleString(addressName); + final SimpleString address = SimpleString.of(addressName); server.addAddressInfo(new AddressInfo(address, RoutingType.ANYCAST)); final UpdateAddress updateAddress = new UpdateAddress(); @@ -231,10 +231,10 @@ public class AddressCommandTest extends JMSTestBase { @Test public void testFailUpdateAddressRoutingTypesWhenExistsQueues() throws Exception { final String addressName = "address"; - final SimpleString addressSimpleString = new SimpleString(addressName); + final SimpleString addressSimpleString = SimpleString.of(addressName); final AddressInfo addressInfo = new AddressInfo(addressSimpleString, EnumSet.of(RoutingType.ANYCAST, RoutingType.MULTICAST)); server.addAddressInfo(addressInfo); - server.createQueue(new QueueConfiguration(new SimpleString("queue1")).setAddress(addressSimpleString).setRoutingType(RoutingType.MULTICAST)); + server.createQueue(new QueueConfiguration(SimpleString.of("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 18e8ca0847..0f73387a5d 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 @@ -79,7 +79,7 @@ public class QueueCommandTest extends JMSTestBase { command.setAnycast(false); command.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error))); checkExecutionFailure(command, "AMQ229203"); - assertFalse(server.queueQuery(new SimpleString(queueName)).isExists()); + assertFalse(server.queueQuery(SimpleString.of(queueName)).isExists()); } @Test @@ -92,12 +92,12 @@ public class QueueCommandTest extends JMSTestBase { command.setAnycast(false); command.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error))); checkExecutionPassed(command); - assertNotNull(server.getAddressInfo(new SimpleString(queueName))); + assertNotNull(server.getAddressInfo(SimpleString.of(queueName))); - Queue queue = server.locateQueue(new SimpleString(queueName)); + Queue queue = server.locateQueue(SimpleString.of(queueName)); assertEquals(-1, queue.getMaxConsumers()); assertFalse(queue.isPurgeOnNoConsumers()); - assertTrue(server.queueQuery(new SimpleString(queueName)).isExists()); + assertTrue(server.queueQuery(SimpleString.of(queueName)).isExists()); } @Test @@ -112,16 +112,16 @@ public class QueueCommandTest extends JMSTestBase { command.setAnycast(false); command.setAddress(address); - server.addOrUpdateAddressInfo(new AddressInfo(new SimpleString(address), RoutingType.MULTICAST)); + server.addOrUpdateAddressInfo(new AddressInfo(SimpleString.of(address), RoutingType.MULTICAST)); command.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error))); checkExecutionPassed(command); - assertNotNull(server.getAddressInfo(new SimpleString(address))); + assertNotNull(server.getAddressInfo(SimpleString.of(address))); - Queue queue = server.locateQueue(new SimpleString(queueName)); + Queue queue = server.locateQueue(SimpleString.of(queueName)); assertEquals(-1, queue.getMaxConsumers()); assertFalse(queue.isPurgeOnNoConsumers()); - assertTrue(server.queueQuery(new SimpleString(queueName)).isExists()); + assertTrue(server.queueQuery(SimpleString.of(queueName)).isExists()); } @Test @@ -138,9 +138,9 @@ public class QueueCommandTest extends JMSTestBase { command.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error))); checkExecutionPassed(command); - Queue queue = server.locateQueue(new SimpleString(queueName)); + Queue queue = server.locateQueue(SimpleString.of(queueName)); assertNotNull(queue); - assertEquals(new SimpleString(filerString), queue.getFilter().getFilterString()); + assertEquals(SimpleString.of(filerString), queue.getFilter().getFilterString()); } @Test @@ -161,7 +161,7 @@ public class QueueCommandTest extends JMSTestBase { @Test public void testDeleteCoreQueue() throws Exception { - SimpleString queueName = new SimpleString("deleteQueue"); + SimpleString queueName = SimpleString.of("deleteQueue"); CreateQueue command = new CreateQueue(); command.setName(queueName.toString()); @@ -181,7 +181,7 @@ public class QueueCommandTest extends JMSTestBase { @Test public void testDeleteQueueDoesNotExist() throws Exception { - SimpleString queueName = new SimpleString("deleteQueue"); + SimpleString queueName = SimpleString.of("deleteQueue"); DeleteQueue delete = new DeleteQueue(); delete.setName(queueName.toString()); @@ -193,7 +193,7 @@ public class QueueCommandTest extends JMSTestBase { @Test public void testDeleteQueueWithConsumersFails() throws Exception { - SimpleString queueName = new SimpleString("deleteQueue"); + SimpleString queueName = SimpleString.of("deleteQueue"); CreateQueue command = new CreateQueue(); command.setName(queueName.toString()); @@ -213,7 +213,7 @@ public class QueueCommandTest extends JMSTestBase { @Test public void testDeleteQueueWithConsumersFailsAndRemoveConsumersTrue() throws Exception { - SimpleString queueName = new SimpleString("deleteQueue"); + SimpleString queueName = SimpleString.of("deleteQueue"); CreateQueue command = new CreateQueue(); command.setName(queueName.toString()); @@ -234,7 +234,7 @@ public class QueueCommandTest extends JMSTestBase { @Test public void testAutoDeleteAddress() throws Exception { - SimpleString queueName = new SimpleString("deleteQueue"); + SimpleString queueName = SimpleString.of("deleteQueue"); CreateQueue command = new CreateQueue(); command.setName(queueName.toString()); @@ -260,9 +260,9 @@ public class QueueCommandTest extends JMSTestBase { @Test public void testUpdateCoreQueue() throws Exception { final String queueName = "updateQueue"; - final SimpleString queueNameString = new SimpleString(queueName); + final SimpleString queueNameString = SimpleString.of(queueName); final String addressName = "address"; - final SimpleString addressSimpleString = new SimpleString(addressName); + final SimpleString addressSimpleString = SimpleString.of(addressName); final int oldMaxConsumers = -1; final RoutingType oldRoutingType = RoutingType.MULTICAST; final boolean oldPurgeOnNoConsumers = false; @@ -292,9 +292,9 @@ public class QueueCommandTest extends JMSTestBase { @Test public void testUpdateCoreQueueCannotChangeRoutingType() throws Exception { final String queueName = "updateQueue"; - final SimpleString queueNameString = new SimpleString(queueName); + final SimpleString queueNameString = SimpleString.of(queueName); final String addressName = "address"; - final SimpleString addressSimpleString = new SimpleString(addressName); + final SimpleString addressSimpleString = SimpleString.of(addressName); final int oldMaxConsumers = 10; final RoutingType oldRoutingType = RoutingType.MULTICAST; final boolean oldPurgeOnNoConsumers = false; @@ -322,9 +322,9 @@ public class QueueCommandTest extends JMSTestBase { @Test public void testUpdateCoreQueueCannotLowerMaxConsumers() throws Exception { final String queueName = "updateQueue"; - final SimpleString queueNameString = new SimpleString(queueName); + final SimpleString queueNameString = SimpleString.of(queueName); final String addressName = "address"; - final SimpleString addressSimpleString = new SimpleString(addressName); + final SimpleString addressSimpleString = SimpleString.of(addressName); final int oldMaxConsumers = 2; final RoutingType oldRoutingType = RoutingType.MULTICAST; final boolean oldPurgeOnNoConsumers = false; @@ -349,7 +349,7 @@ public class QueueCommandTest extends JMSTestBase { @Test public void testUpdateCoreQueueDoesNotExist() throws Exception { - SimpleString queueName = new SimpleString("updateQueue"); + SimpleString queueName = SimpleString.of("updateQueue"); UpdateQueue updateQueue = new UpdateQueue(); updateQueue.setName(queueName.toString()); @@ -361,7 +361,7 @@ public class QueueCommandTest extends JMSTestBase { @Test public void testPurgeQueue() throws Exception { - SimpleString queueName = new SimpleString("purgeQueue"); + SimpleString queueName = SimpleString.of("purgeQueue"); CreateQueue command = new CreateQueue(); command.setName(queueName.toString()); @@ -377,7 +377,7 @@ public class QueueCommandTest extends JMSTestBase { @Test public void testPurgeQueueDoesNotExist() throws Exception { - SimpleString queueName = new SimpleString("purgeQueue"); + SimpleString queueName = SimpleString.of("purgeQueue"); PurgeQueue purge = new PurgeQueue(); purge.setName(queueName.toString()); 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 c56b3b3fed..e1f06a57d8 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 @@ -40,13 +40,13 @@ public class AckBatchSizeTest extends ActiveMQTestBase { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - public final SimpleString addressA = new SimpleString("addressA"); + public final SimpleString addressA = SimpleString.of("addressA"); - public final SimpleString queueA = new SimpleString("queueA"); + public final SimpleString queueA = SimpleString.of("queueA"); - public final SimpleString queueB = new SimpleString("queueB"); + public final SimpleString queueB = SimpleString.of("queueB"); - public final SimpleString queueC = new SimpleString("queueC"); + public final SimpleString queueC = SimpleString.of("queueC"); /*ackbatchSize tests*/ 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 29727ddf0c..c32c5aa67a 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 @@ -59,13 +59,13 @@ public class AcknowledgeTest extends ActiveMQTestBase { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - public final SimpleString addressA = new SimpleString("addressA"); + public final SimpleString addressA = SimpleString.of("addressA"); - public final SimpleString queueA = new SimpleString("queueA"); + public final SimpleString queueA = SimpleString.of("queueA"); - public final SimpleString queueB = new SimpleString("queueB"); + public final SimpleString queueB = SimpleString.of("queueB"); - public final SimpleString queueC = new SimpleString("queueC"); + public final SimpleString queueC = SimpleString.of("queueC"); @Test public void testReceiveAckLastMessageOnly() throws Exception { 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 abbdec839f..b5d4f35354 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 @@ -37,33 +37,33 @@ import org.junit.jupiter.api.Test; public class AddressSettingsTest extends ActiveMQTestBase { - private final SimpleString addressA = new SimpleString("addressA"); + private final SimpleString addressA = SimpleString.of("addressA"); - private final SimpleString addressA2 = new SimpleString("add.addressA"); + private final SimpleString addressA2 = SimpleString.of("add.addressA"); - private final SimpleString addressB = new SimpleString("addressB"); + private final SimpleString addressB = SimpleString.of("addressB"); - private final SimpleString addressB2 = new SimpleString("add.addressB"); + private final SimpleString addressB2 = SimpleString.of("add.addressB"); - private final SimpleString addressC = new SimpleString("addressC"); + private final SimpleString addressC = SimpleString.of("addressC"); - private final SimpleString queueA = new SimpleString("queueA"); + private final SimpleString queueA = SimpleString.of("queueA"); - private final SimpleString queueB = new SimpleString("queueB"); + private final SimpleString queueB = SimpleString.of("queueB"); - private final SimpleString queueC = new SimpleString("queueC"); + private final SimpleString queueC = SimpleString.of("queueC"); - private final SimpleString dlaA = new SimpleString("dlaA"); + private final SimpleString dlaA = SimpleString.of("dlaA"); - private final SimpleString dlqA = new SimpleString("dlqA"); + private final SimpleString dlqA = SimpleString.of("dlqA"); - private final SimpleString dlaB = new SimpleString("dlaB"); + private final SimpleString dlaB = SimpleString.of("dlaB"); - private final SimpleString dlqB = new SimpleString("dlqB"); + private final SimpleString dlqB = SimpleString.of("dlqB"); - private final SimpleString dlaC = new SimpleString("dlaC"); + private final SimpleString dlaC = SimpleString.of("dlaC"); - private final SimpleString dlqC = new SimpleString("dlqC"); + private final SimpleString dlqC = SimpleString.of("dlqC"); @Test public void testSimpleHierarchyWithDLA() throws Exception { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoCreateJmsDestinationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoCreateJmsDestinationTest.java index e42dd7e7b4..78934048be 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoCreateJmsDestinationTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoCreateJmsDestinationTest.java @@ -261,7 +261,7 @@ public class AutoCreateJmsDestinationTest extends JMSTestBase { Message m = messageConsumer.receive(500); assertNull(m); - Queue q = (Queue) server.getPostOffice().getBinding(new SimpleString(QUEUE_NAME)).getBindable(); + Queue q = (Queue) server.getPostOffice().getBinding(SimpleString.of(QUEUE_NAME)).getBindable(); assertEquals(0, q.getMessageCount()); assertEquals(0, q.getMessagesAdded()); connection.close(); @@ -283,7 +283,7 @@ public class AutoCreateJmsDestinationTest extends JMSTestBase { Message m = messageConsumer.receive(500); assertNull(m); - Queue q = (Queue) server.getPostOffice().getBinding(new SimpleString(queueName)).getBindable(); + Queue q = (Queue) server.getPostOffice().getBinding(SimpleString.of(queueName)).getBindable(); assertEquals(0, q.getMessageCount()); assertEquals(0, q.getMessagesAdded()); connection.close(); @@ -331,7 +331,7 @@ public class AutoCreateJmsDestinationTest extends JMSTestBase { assertNotNull(server.getManagementService().getResource(ResourceNames.ADDRESS + "test")); - assertNotNull(server.locateQueue(SimpleString.toSimpleString("myClientID.myDurableSub"))); + assertNotNull(server.locateQueue(SimpleString.of("myClientID.myDurableSub"))); } @Test diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoCreateTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoCreateTest.java index 8a4081f73f..d4acd14cd1 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoCreateTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoCreateTest.java @@ -60,8 +60,8 @@ import java.lang.invoke.MethodHandles; public class AutoCreateTest extends ActiveMQTestBase { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - public final SimpleString addressA = new SimpleString("addressA"); - public final SimpleString queueA = new SimpleString("queueA"); + public final SimpleString addressA = SimpleString.of("addressA"); + public final SimpleString queueA = SimpleString.of("queueA"); private ActiveMQServer server; @@ -162,7 +162,7 @@ public class AutoCreateTest extends ActiveMQTestBase { connection.start(); } - AddressInfo info = server.getPostOffice().getAddressInfo(SimpleString.toSimpleString(QUEUE_NAME)); + AddressInfo info = server.getPostOffice().getAddressInfo(SimpleString.of(QUEUE_NAME)); assertNotNull(info); assertTrue(info.isAutoCreated()); @@ -188,7 +188,7 @@ public class AutoCreateTest extends ActiveMQTestBase { AddressInfo info = new AddressInfo(ADDRESS_NAME).addRoutingType(RoutingType.MULTICAST).setAutoCreated(true); server.getPostOffice().addAddressInfo(info); - info = server.getPostOffice().getAddressInfo(SimpleString.toSimpleString(ADDRESS_NAME)); + info = server.getPostOffice().getAddressInfo(SimpleString.of(ADDRESS_NAME)); ConnectionFactory cf = CFUtil.createConnectionFactory("core", "tcp://localhost:61616"); try (Connection connection = cf.createConnection()) { @@ -226,7 +226,7 @@ public class AutoCreateTest extends ActiveMQTestBase { AddressInfo info = new AddressInfo(ADDRESS_NAME).addRoutingType(RoutingType.MULTICAST).setAutoCreated(true); server.getPostOffice().addAddressInfo(info); - info = server.getPostOffice().getAddressInfo(SimpleString.toSimpleString(ADDRESS_NAME)); + info = server.getPostOffice().getAddressInfo(SimpleString.of(ADDRESS_NAME)); ConnectionFactory cf = CFUtil.createConnectionFactory("core", "tcp://localhost:61616"); try (Connection connection = cf.createConnection()) { @@ -272,7 +272,7 @@ public class AutoCreateTest extends ActiveMQTestBase { connection.start(); } - AddressInfo info = server.getPostOffice().getAddressInfo(SimpleString.toSimpleString(QUEUE_NAME)); + AddressInfo info = server.getPostOffice().getAddressInfo(SimpleString.of(QUEUE_NAME)); assertNotNull(info); assertTrue(info.isAutoCreated()); @@ -308,7 +308,7 @@ public class AutoCreateTest extends ActiveMQTestBase { connection.start(); } - AddressInfo info = server.getPostOffice().getAddressInfo(SimpleString.toSimpleString(QUEUE_NAME)); + AddressInfo info = server.getPostOffice().getAddressInfo(SimpleString.of(QUEUE_NAME)); assertNotNull(info); assertTrue(info.isAutoCreated()); @@ -369,7 +369,7 @@ public class AutoCreateTest extends ActiveMQTestBase { connection.start(); } - AddressInfo info = server.getPostOffice().getAddressInfo(SimpleString.toSimpleString(QUEUE_NAME)); + AddressInfo info = server.getPostOffice().getAddressInfo(SimpleString.of(QUEUE_NAME)); assertNotNull(info); assertTrue(info.isAutoCreated()); @@ -393,11 +393,11 @@ public class AutoCreateTest extends ActiveMQTestBase { producer.send(topic, session.createTextMessage(randomString)); } - info = server.getPostOffice().getAddressInfo(SimpleString.toSimpleString(QUEUE_NAME)); + info = server.getPostOffice().getAddressInfo(SimpleString.of(QUEUE_NAME)); assertNotNull(info); assertTrue(info.isAutoCreated()); - info = server.getPostOffice().getAddressInfo(SimpleString.toSimpleString(TOPIC_NAME)); + info = server.getPostOffice().getAddressInfo(SimpleString.of(TOPIC_NAME)); assertNotNull(info); assertTrue(info.isAutoCreated()); @@ -412,11 +412,11 @@ public class AutoCreateTest extends ActiveMQTestBase { assertTrue(loggerHandler.matchText("AMQ224113.*" + TOPIC_NAME)); } - info = server.getPostOffice().getAddressInfo(SimpleString.toSimpleString(QUEUE_NAME)); + info = server.getPostOffice().getAddressInfo(SimpleString.of(QUEUE_NAME)); assertNotNull(info); assertTrue(info.isAutoCreated()); - info = server.getPostOffice().getAddressInfo(SimpleString.toSimpleString(TOPIC_NAME)); + info = server.getPostOffice().getAddressInfo(SimpleString.of(TOPIC_NAME)); assertNull(info); { // just a namespace 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 b35ea67693..d6ff557d9d 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 @@ -47,8 +47,8 @@ import org.junit.jupiter.api.Test; public class AutoDeleteAddressTest extends ActiveMQTestBase { - public final SimpleString addressA = new SimpleString("addressA"); - public final SimpleString queueA = new SimpleString("queueA"); + public final SimpleString addressA = SimpleString.of("addressA"); + public final SimpleString queueA = SimpleString.of("queueA"); private ServerLocator locator; private ActiveMQServer server; @@ -133,15 +133,15 @@ public class AutoDeleteAddressTest extends ActiveMQTestBase { assertTrue(latch.await(2, TimeUnit.SECONDS)); for (String address : addresses) { - assertNotNull(server.getAddressInfo(SimpleString.toSimpleString(address))); - Wait.assertTrue(() -> Arrays.asList(server.getPagingManager().getStoreNames()).contains(SimpleString.toSimpleString(address)), 2000, 100); + assertNotNull(server.getAddressInfo(SimpleString.of(address))); + Wait.assertTrue(() -> Arrays.asList(server.getPagingManager().getStoreNames()).contains(SimpleString.of(address)), 2000, 100); } PostOfficeTestAccessor.sweepAndReapAddresses((PostOfficeImpl) server.getPostOffice()); for (String address : addresses) { - assertNull(server.getAddressInfo(SimpleString.toSimpleString(address))); - Wait.assertFalse(() -> Arrays.asList(server.getPagingManager().getStoreNames()).contains(SimpleString.toSimpleString(address)), 2000, 100); + assertNull(server.getAddressInfo(SimpleString.of(address))); + Wait.assertFalse(() -> Arrays.asList(server.getPagingManager().getStoreNames()).contains(SimpleString.of(address)), 2000, 100); } consumerSession.close(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoDeleteCreatedQueueTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoDeleteCreatedQueueTest.java index 43e0443c67..aa3a68e6f8 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoDeleteCreatedQueueTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoDeleteCreatedQueueTest.java @@ -34,9 +34,9 @@ import org.junit.jupiter.api.Test; public class AutoDeleteCreatedQueueTest extends ActiveMQTestBase { - public final SimpleString addressA = new SimpleString("addressA"); - public final SimpleString queueA = new SimpleString("queueA"); - public final SimpleString queueConfigurationManaged = new SimpleString("queueConfigurationManaged"); + public final SimpleString addressA = SimpleString.of("addressA"); + public final SimpleString queueA = SimpleString.of("queueA"); + public final SimpleString queueConfigurationManaged = SimpleString.of("queueConfigurationManaged"); private ServerLocator locator; private ActiveMQServer server; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoDeleteJmsDestinationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoDeleteJmsDestinationTest.java index 54a307717c..dc2f5ff419 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoDeleteJmsDestinationTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoDeleteJmsDestinationTest.java @@ -75,14 +75,14 @@ public class AutoDeleteJmsDestinationTest extends JMSTestBase { } Wait.waitFor(() -> { - Binding binding = server.getPostOffice().getBinding(new SimpleString("test")); + Binding binding = server.getPostOffice().getBinding(SimpleString.of("test")); if (binding == null) { return false; } return binding.getBindable() != null; }); // ensure the queue is still there - Queue q = (Queue) server.getPostOffice().getBinding(new SimpleString("test")).getBindable(); + Queue q = (Queue) server.getPostOffice().getBinding(SimpleString.of("test")).getBindable(); Wait.assertEquals(1, q::getMessageCount); assertEquals(numMessages, q.getMessagesAdded()); @@ -94,11 +94,11 @@ public class AutoDeleteJmsDestinationTest extends JMSTestBase { connection.close(); - SimpleString qname = new SimpleString("test"); + SimpleString qname = SimpleString.of("test"); Wait.waitFor(() -> server.getPostOffice().getBinding(qname) == null); // ensure the queue was removed - assertNull(server.getPostOffice().getBinding(new SimpleString("test"))); + assertNull(server.getPostOffice().getBinding(SimpleString.of("test"))); // make sure the JMX control was removed for the JMS queue assertNull(server.getManagementService().getResource("test")); @@ -139,7 +139,7 @@ public class AutoDeleteJmsDestinationTest extends JMSTestBase { session.close(); // ensure the queue is still there - Queue q = (Queue) server.getPostOffice().getBinding(new SimpleString("test")).getBindable(); + Queue q = (Queue) server.getPostOffice().getBinding(SimpleString.of("test")).getBindable(); assertEquals(1, q.getMessageCount()); assertEquals(numMessages, q.getMessagesAdded()); @@ -151,7 +151,7 @@ public class AutoDeleteJmsDestinationTest extends JMSTestBase { connection.close(); // ensure the queue was not removed - assertNotNull(server.getPostOffice().getBinding(new SimpleString("test"))); + assertNotNull(server.getPostOffice().getBinding(SimpleString.of("test"))); } @Test @@ -181,7 +181,7 @@ public class AutoDeleteJmsDestinationTest extends JMSTestBase { connection.close(); - SimpleString qName = new SimpleString("test"); + SimpleString qName = SimpleString.of("test"); Wait.waitFor(() -> server.locateQueue(qName) == null); // ensure the topic was removed assertNull(server.locateQueue(qName)); @@ -193,7 +193,7 @@ public class AutoDeleteJmsDestinationTest extends JMSTestBase { @Test public void testAutoDeleteTopicNegative() throws Exception { final int numMessages = 100; - final SimpleString addressName = new SimpleString("test"); + final SimpleString addressName = SimpleString.of("test"); server.getAddressSettingsRepository().addMatch(addressName.toString(), new AddressSettings().setAutoDeleteAddresses(false)); Connection connection = cf.createConnection(); @@ -255,7 +255,7 @@ public class AutoDeleteJmsDestinationTest extends JMSTestBase { connection.close(); // ensure the topic was removed - assertNull(server.locateQueue(new SimpleString("test"))); + assertNull(server.locateQueue(SimpleString.of("test"))); // make sure the JMX control was removed for the JMS topic assertNull(server.getManagementService().getResource("test")); 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 eb1e10c1fd..94f65d292f 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 @@ -38,8 +38,8 @@ import org.junit.jupiter.api.Test; public class AutoDeleteQueueTest extends ActiveMQTestBase { - public final SimpleString addressA = new SimpleString("addressA"); - public final SimpleString queueA = new SimpleString("queueA"); + public final SimpleString addressA = SimpleString.of("addressA"); + public final SimpleString queueA = SimpleString.of("queueA"); private ServerLocator locator; private ActiveMQServer server; 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 ff627e65b1..b6e499d9c1 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 @@ -38,15 +38,15 @@ import org.junit.jupiter.api.Test; public class AutogroupIdTest extends ActiveMQTestBase { - public final SimpleString addressA = new SimpleString("addressA"); + public final SimpleString addressA = SimpleString.of("addressA"); - public final SimpleString queueA = new SimpleString("queueA"); + public final SimpleString queueA = SimpleString.of("queueA"); - public final SimpleString queueB = new SimpleString("queueB"); + public final SimpleString queueB = SimpleString.of("queueB"); - public final SimpleString queueC = new SimpleString("queueC"); + public final SimpleString queueC = SimpleString.of("queueC"); - private final SimpleString groupTestQ = new SimpleString("testGroupQueue"); + private final SimpleString groupTestQ = SimpleString.of("testGroupQueue"); private ActiveMQServer server; 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 ee89650463..f87a3d4b5e 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 @@ -40,15 +40,15 @@ import org.junit.jupiter.api.Test; public class CommitRollbackTest extends ActiveMQTestBase { - public final SimpleString addressA = new SimpleString("addressA"); + public final SimpleString addressA = SimpleString.of("addressA"); - public final SimpleString addressB = new SimpleString("addressB"); + public final SimpleString addressB = SimpleString.of("addressB"); - public final SimpleString queueA = new SimpleString("queueA"); + public final SimpleString queueA = SimpleString.of("queueA"); - public final SimpleString queueB = new SimpleString("queueB"); + public final SimpleString queueB = SimpleString.of("queueB"); - public final SimpleString queueC = new SimpleString("queueC"); + public final SimpleString queueC = SimpleString.of("queueC"); @Test public void testReceiveWithCommit() throws Exception { 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 bf9ffabfa6..39cb2061c7 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 @@ -46,7 +46,7 @@ public class ConcurrentCreateDeleteProduceTest extends ActiveMQTestBase { volatile boolean running = true; - private final SimpleString ADDRESS = new SimpleString("ADQUEUE"); + private final SimpleString ADDRESS = SimpleString.of("ADQUEUE"); AtomicInteger sequence = new AtomicInteger(0); private ActiveMQServer server; 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 1549b38564..5c9b6f7afa 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 @@ -38,9 +38,9 @@ public class ConsumerRoundRobinTest extends ActiveMQTestBase { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - public final SimpleString addressA = new SimpleString("addressA"); + public final SimpleString addressA = SimpleString.of("addressA"); - public final SimpleString queueA = new SimpleString("queueA"); + public final SimpleString queueA = SimpleString.of("queueA"); @Test public void testConsumersRoundRobinCorrectly() throws Exception { 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 244bdd759e..1a95f98db9 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 @@ -45,7 +45,7 @@ public class ConsumerStuckTest extends ActiveMQTestBase { private ActiveMQServer server; - private final SimpleString QUEUE = new SimpleString("ConsumerTestQueue"); + private final SimpleString QUEUE = SimpleString.of("ConsumerTestQueue"); protected boolean isNetty() { return true; 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 6db56fe6b4..e7ae27005c 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 @@ -117,7 +117,7 @@ public class ConsumerTest extends ActiveMQTestBase { private final boolean netty; private ActiveMQServer server; - private final SimpleString QUEUE = new SimpleString("ConsumerTestQueue"); + private final SimpleString QUEUE = SimpleString.of("ConsumerTestQueue"); private ServerLocator locator; @@ -254,7 +254,7 @@ public class ConsumerTest extends ActiveMQTestBase { return; } - assertNull(server.getAddressInfo(SimpleString.toSimpleString("topic"))); + assertNull(server.getAddressInfo(SimpleString.of("topic"))); ConnectionFactory factorySend = createFactory(2); Connection connection = factorySend.createConnection(); @@ -272,8 +272,8 @@ public class ConsumerTest extends ActiveMQTestBase { connection.close(); } - assertNotNull(server.getAddressInfo(SimpleString.toSimpleString("topic"))); - assertEquals(RoutingType.MULTICAST, server.getAddressInfo(SimpleString.toSimpleString("topic")).getRoutingType()); + assertNotNull(server.getAddressInfo(SimpleString.of("topic"))); + assertEquals(RoutingType.MULTICAST, server.getAddressInfo(SimpleString.of("topic")).getRoutingType()); assertEquals(0, server.getTotalMessageCount()); } @@ -294,7 +294,7 @@ public class ConsumerTest extends ActiveMQTestBase { private void testAutoCreate(int protocol) throws Throwable { - final SimpleString thisQueue = SimpleString.toSimpleString("ThisQueue"); + final SimpleString thisQueue = SimpleString.of("ThisQueue"); if (!isNetty()) { // no need to run the test, there's no AMQP support return; @@ -334,7 +334,7 @@ public class ConsumerTest extends ActiveMQTestBase { return; } - assertNull(server.getAddressInfo(SimpleString.toSimpleString("queue"))); + assertNull(server.getAddressInfo(SimpleString.of("queue"))); ConnectionFactory factory = createFactory(2); JMSContext context = factory.createContext("admin", "admin", Session.AUTO_ACKNOWLEDGE); @@ -375,7 +375,7 @@ public class ConsumerTest extends ActiveMQTestBase { return; } - assertNull(server.getAddressInfo(SimpleString.toSimpleString("queue"))); + assertNull(server.getAddressInfo(SimpleString.of("queue"))); ConnectionFactory factorySend = createFactory(2); Connection connection = factorySend.createConnection(); @@ -397,8 +397,8 @@ public class ConsumerTest extends ActiveMQTestBase { connection.close(); } - Wait.assertTrue(() -> server.getAddressInfo(SimpleString.toSimpleString("queue")) == null); - Wait.assertTrue(() -> server.locateQueue(SimpleString.toSimpleString("queue")) == null); + Wait.assertTrue(() -> server.getAddressInfo(SimpleString.of("queue")) == null); + Wait.assertTrue(() -> server.locateQueue(SimpleString.of("queue")) == null); Wait.assertEquals(0, server::getTotalMessageCount); } @@ -935,7 +935,7 @@ public class ConsumerTest extends ActiveMQTestBase { final Set sessions = new ConcurrentHashSet<>(); final AtomicInteger errors = new AtomicInteger(0); - final SimpleString QUEUE_RESPONSE = SimpleString.toSimpleString("QUEUE_RESPONSE"); + final SimpleString QUEUE_RESPONSE = SimpleString.of("QUEUE_RESPONSE"); final int numberOfSessions = 50; final int numberOfMessages = 10; @@ -1286,7 +1286,7 @@ public class ConsumerTest extends ActiveMQTestBase { @TestTemplate public void testConsumerXpathSelector() throws Exception { - final SimpleString BODY = SimpleString.toSimpleString("b"); + final SimpleString BODY = SimpleString.of("b"); ClientSessionFactory sf = createSessionFactory(locator); ClientSession session = sf.createSession(false, true, false, true); @@ -1295,7 +1295,7 @@ public class ConsumerTest extends ActiveMQTestBase { ClientMessage message = session.createMessage(false); message.setType(Message.TEXT_TYPE); - message.getBodyBuffer().writeNullableSimpleString(SimpleString.toSimpleString("wrong")); + message.getBodyBuffer().writeNullableSimpleString(SimpleString.of("wrong")); producer.send(message); message = session.createMessage(false); message.setType(Message.TEXT_TYPE); 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 46b2c970f7..1a705420ba 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 @@ -65,9 +65,9 @@ public class ConsumerWindowSizeTest extends ActiveMQTestBase { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - private final SimpleString addressA = new SimpleString("addressA"); + private final SimpleString addressA = SimpleString.of("addressA"); - private final SimpleString queueA = new SimpleString("queueA"); + private final SimpleString queueA = SimpleString.of("queueA"); private final int TIMEOUT = 5; @@ -699,7 +699,7 @@ public class ConsumerWindowSizeTest extends ActiveMQTestBase { session2.start(); - SimpleString ADDRESS = new SimpleString("some-queue"); + SimpleString ADDRESS = SimpleString.of("some-queue"); session1.createQueue(new QueueConfiguration(ADDRESS)); @@ -842,7 +842,7 @@ public class ConsumerWindowSizeTest extends ActiveMQTestBase { session1.start(); - SimpleString ADDRESS = new SimpleString("some-queue"); + SimpleString ADDRESS = SimpleString.of("some-queue"); session1.createQueue(new QueueConfiguration(ADDRESS)); @@ -943,7 +943,7 @@ public class ConsumerWindowSizeTest extends ActiveMQTestBase { session = sf.createSession(false, false, false); - SimpleString ADDRESS = new SimpleString("some-queue"); + SimpleString ADDRESS = SimpleString.of("some-queue"); session.createQueue(new QueueConfiguration(ADDRESS)); @@ -1016,7 +1016,7 @@ public class ConsumerWindowSizeTest extends ActiveMQTestBase { session = sf.createSession(false, true, true); - SimpleString ADDRESS = new SimpleString("some-queue"); + SimpleString ADDRESS = SimpleString.of("some-queue"); session.createQueue(new QueueConfiguration(ADDRESS)); @@ -1158,7 +1158,7 @@ public class ConsumerWindowSizeTest extends ActiveMQTestBase { session = sf.createSession(false, true, true); - SimpleString ADDRESS = new SimpleString("some-queue"); + SimpleString ADDRESS = SimpleString.of("some-queue"); session.createQueue(new QueueConfiguration(ADDRESS)); @@ -1296,7 +1296,7 @@ public class ConsumerWindowSizeTest extends ActiveMQTestBase { sessionA = sf.createSession(false, true, true); - SimpleString ADDRESS = new SimpleString("some-queue"); + SimpleString ADDRESS = SimpleString.of("some-queue"); sessionA.createQueue(new QueueConfiguration(ADDRESS)); 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 4d17e23ebb..5bb79ac0f8 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 @@ -113,7 +113,7 @@ public class CoreClientTest extends ActiveMQTestBase { } private void testCoreClient(final boolean netty, ServerLocator serverLocator) throws Exception { - final SimpleString QUEUE = new SimpleString("CoreClientTestQueue"); + final SimpleString QUEUE = SimpleString.of("CoreClientTestQueue"); ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(createDefaultConfig(netty), false)); 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 b29130c16b..e82e4b52a4 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 @@ -48,7 +48,7 @@ public class CreateQueueIdempotentTest extends ActiveMQTestBase { @Test public void testSequentialCreateQueueIdempotency() throws Exception { - final SimpleString QUEUE = new SimpleString("SequentialCreateQueueIdempotency"); + final SimpleString QUEUE = SimpleString.of("SequentialCreateQueueIdempotency"); ServerLocator locator = createInVMNonHALocator(); @@ -121,7 +121,7 @@ public class CreateQueueIdempotentTest extends ActiveMQTestBase { locator = createInVMNonHALocator(); ClientSessionFactory sf = createSessionFactory(locator); session = sf.createSession(false, true, true); - final SimpleString QUEUE = new SimpleString(queueName); + final SimpleString QUEUE = SimpleString.of(queueName); session.createQueue(new QueueConfiguration(QUEUE)); queuesCreated.incrementAndGet(); } catch (ActiveMQQueueExistsException qne) { 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 c7769f3109..d771aa1947 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 @@ -48,12 +48,12 @@ 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"); - public final SimpleString queueB = new SimpleString("queueB"); - public final SimpleString queueC = new SimpleString("queueC"); - public final SimpleString queueD = new SimpleString("queueD"); + public final SimpleString addressA = SimpleString.of("addressA"); + public final SimpleString addressB = SimpleString.of("addressB"); + public final SimpleString queueA = SimpleString.of("queueA"); + public final SimpleString queueB = SimpleString.of("queueB"); + public final SimpleString queueC = SimpleString.of("queueC"); + public final SimpleString queueD = SimpleString.of("queueD"); private ServerLocator locator; private ActiveMQServer server; 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 173b615e7a..fed9530552 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 @@ -60,12 +60,12 @@ public class DeadLetterAddressTest extends ActiveMQTestBase { @Test public void testBasicSend() throws Exception { - SimpleString dla = new SimpleString("DLA"); - SimpleString qName = new SimpleString("q1"); - SimpleString adName = new SimpleString("ad1"); + SimpleString dla = SimpleString.of("DLA"); + SimpleString qName = SimpleString.of("q1"); + SimpleString adName = SimpleString.of("ad1"); AddressSettings addressSettings = new AddressSettings().setMaxDeliveryAttempts(1).setDeadLetterAddress(dla); server.getAddressSettingsRepository().addMatch(adName.toString(), addressSettings); - SimpleString dlq = new SimpleString("DLQ1"); + SimpleString dlq = SimpleString.of("DLQ1"); clientSession.createQueue(new QueueConfiguration(dlq).setAddress(dla).setDurable(false)); clientSession.createQueue(new QueueConfiguration(qName).setAddress(adName).setDurable(false)); ClientProducer producer = clientSession.createProducer(adName); @@ -98,13 +98,13 @@ public class DeadLetterAddressTest extends ActiveMQTestBase { long fdBaseline = ((UnixOperatingSystemMXBean) os).getOpenFileDescriptorCount(); final int SIZE = 2 * 1024; - SimpleString dla = new SimpleString("DLA"); - SimpleString qName = new SimpleString("q1"); - SimpleString adName = new SimpleString("ad1"); + SimpleString dla = SimpleString.of("DLA"); + SimpleString qName = SimpleString.of("q1"); + SimpleString adName = SimpleString.of("ad1"); AddressSettings addressSettings = new AddressSettings().setMaxDeliveryAttempts(1).setDeadLetterAddress(dla); server.getAddressSettingsRepository().addMatch(adName.toString(), addressSettings); - SimpleString dlq = new SimpleString("DLQ1"); + SimpleString dlq = SimpleString.of("DLQ1"); 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++) { @@ -130,11 +130,11 @@ public class DeadLetterAddressTest extends ActiveMQTestBase { // HORNETQ- 1084 @Test public void testBasicSendWithDLAButNoBinding() throws Exception { - SimpleString dla = new SimpleString("DLA"); - SimpleString qName = new SimpleString("q1"); + SimpleString dla = SimpleString.of("DLA"); + SimpleString qName = SimpleString.of("q1"); AddressSettings addressSettings = new AddressSettings().setMaxDeliveryAttempts(1).setDeadLetterAddress(dla); server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings); - //SimpleString dlq = new SimpleString("DLQ1"); + //SimpleString dlq = SimpleString.of("DLQ1"); //clientSession.createQueue(new QueueConfiguration(dlq).setAddress(dla).setDurable(false)); clientSession.createQueue(new QueueConfiguration(qName).setDurable(false)); ClientProducer producer = clientSession.createProducer(qName); @@ -156,11 +156,11 @@ public class DeadLetterAddressTest extends ActiveMQTestBase { @Test public void testBasicSend2times() throws Exception { - SimpleString dla = new SimpleString("DLA"); - SimpleString qName = new SimpleString("q1"); + SimpleString dla = SimpleString.of("DLA"); + SimpleString qName = SimpleString.of("q1"); AddressSettings addressSettings = new AddressSettings().setMaxDeliveryAttempts(2).setDeadLetterAddress(dla); server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings); - SimpleString dlq = new SimpleString("DLQ1"); + SimpleString dlq = SimpleString.of("DLQ1"); clientSession.createQueue(new QueueConfiguration(dlq).setAddress(dla).setDurable(false)); clientSession.createQueue(new QueueConfiguration(qName).setDurable(false)); ClientProducer producer = clientSession.createProducer(qName); @@ -191,11 +191,11 @@ public class DeadLetterAddressTest extends ActiveMQTestBase { @Test public void testReceiveWithListeners() throws Exception { - SimpleString dla = new SimpleString("DLA"); - SimpleString qName = new SimpleString("q1"); + SimpleString dla = SimpleString.of("DLA"); + SimpleString qName = SimpleString.of("q1"); AddressSettings addressSettings = new AddressSettings().setMaxDeliveryAttempts(2).setDeadLetterAddress(dla); server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings); - SimpleString dlq = new SimpleString("DLQ1"); + SimpleString dlq = SimpleString.of("DLQ1"); clientSession.createQueue(new QueueConfiguration(dlq).setAddress(dla).setDurable(false)); clientSession.createQueue(new QueueConfiguration(qName).setDurable(false)); ClientProducer producer = clientSession.createProducer(qName); @@ -240,12 +240,12 @@ public class DeadLetterAddressTest extends ActiveMQTestBase { @Test public void testBasicSendToMultipleQueues() throws Exception { - SimpleString dla = new SimpleString("DLA"); - SimpleString qName = new SimpleString("q1"); + SimpleString dla = SimpleString.of("DLA"); + SimpleString qName = SimpleString.of("q1"); AddressSettings addressSettings = new AddressSettings().setMaxDeliveryAttempts(1).setDeadLetterAddress(dla); server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings); - SimpleString dlq = new SimpleString("DLQ1"); - SimpleString dlq2 = new SimpleString("DLQ2"); + SimpleString dlq = SimpleString.of("DLQ1"); + SimpleString dlq2 = SimpleString.of("DLQ2"); 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)); @@ -278,7 +278,7 @@ public class DeadLetterAddressTest extends ActiveMQTestBase { @Test public void testBasicSendToNoQueue() throws Exception { - SimpleString qName = new SimpleString("q1"); + SimpleString qName = SimpleString.of("q1"); AddressSettings addressSettings = new AddressSettings().setMaxDeliveryAttempts(1); server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings); clientSession.createQueue(new QueueConfiguration(qName).setDurable(false)); @@ -301,11 +301,11 @@ public class DeadLetterAddressTest extends ActiveMQTestBase { public void testHeadersSet() throws Exception { final int MAX_DELIVERIES = 16; final int NUM_MESSAGES = 5; - SimpleString dla = new SimpleString("DLA"); - SimpleString qName = new SimpleString("q1"); + SimpleString dla = SimpleString.of("DLA"); + SimpleString qName = SimpleString.of("q1"); AddressSettings addressSettings = new AddressSettings().setMaxDeliveryAttempts(MAX_DELIVERIES).setDeadLetterAddress(dla); server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings); - SimpleString dlq = new SimpleString("DLQ1"); + SimpleString dlq = SimpleString.of("DLQ1"); clientSession.createQueue(new QueueConfiguration(dlq).setAddress(dla).setDurable(false)); clientSession.createQueue(new QueueConfiguration(qName).setDurable(false)); ServerLocator locator = createInVMNonHALocator(); @@ -453,7 +453,7 @@ public class DeadLetterAddressTest extends ActiveMQTestBase { int defaultDeliveryAttempt = 3; int specificeDeliveryAttempt = defaultDeliveryAttempt + 1; - SimpleString address = new SimpleString("prefix.address"); + SimpleString address = SimpleString.of("prefix.address"); SimpleString queue = RandomUtil.randomSimpleString(); SimpleString defaultDeadLetterAddress = RandomUtil.randomSimpleString(); SimpleString defaultDeadLetterQueue = RandomUtil.randomSimpleString(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/DeleteAddressTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/DeleteAddressTest.java index 7238c1a9e7..5e2da37796 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/DeleteAddressTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/DeleteAddressTest.java @@ -68,7 +68,7 @@ public class DeleteAddressTest extends ActiveMQTestBase { private void localServer(boolean autoCreate) throws Exception { server = createServer(false, true); - AddressSettings settings = new AddressSettings().setAutoDeleteAddresses(autoCreate).setAutoCreateAddresses(autoCreate).setAutoCreateQueues(autoCreate).setAutoDeleteQueues(autoCreate).setDeadLetterAddress(SimpleString.toSimpleString("DLQ")).setSendToDLAOnNoRoute(true); + AddressSettings settings = new AddressSettings().setAutoDeleteAddresses(autoCreate).setAutoCreateAddresses(autoCreate).setAutoCreateQueues(autoCreate).setAutoDeleteQueues(autoCreate).setDeadLetterAddress(SimpleString.of("DLQ")).setSendToDLAOnNoRoute(true); server.start(); server.createQueue(new QueueConfiguration("DLQ").setRoutingType(RoutingType.ANYCAST)); server.getAddressSettingsRepository().addMatch(getName() + "*", settings); @@ -137,7 +137,7 @@ public class DeleteAddressTest extends ActiveMQTestBase { org.apache.activemq.artemis.core.server.Queue serverQueue = server.locateQueue(ADDRESS_NAME); Wait.assertEquals(0, serverQueue::getConsumerCount); - server.destroyQueue(SimpleString.toSimpleString(ADDRESS_NAME)); + server.destroyQueue(SimpleString.of(ADDRESS_NAME)); boolean exception = false; try { @@ -239,7 +239,7 @@ public class DeleteAddressTest extends ActiveMQTestBase { session.commit(); - Bindings bindings = server.getPostOffice().lookupBindingsForAddress(SimpleString.toSimpleString(ADDRESS_NAME)); + Bindings bindings = server.getPostOffice().lookupBindingsForAddress(SimpleString.of(ADDRESS_NAME)); for (Binding b : bindings.getBindings()) { if (b instanceof LocalQueueBinding) { Wait.assertEquals(0, () -> ((LocalQueueBinding)b).getQueue().getConsumerCount()); @@ -250,7 +250,7 @@ public class DeleteAddressTest extends ActiveMQTestBase { producer.send(session.createTextMessage(dlqText)); session.commit(); - server.removeAddressInfo(SimpleString.toSimpleString(ADDRESS_NAME), null); + server.removeAddressInfo(SimpleString.of(ADDRESS_NAME), null); try { logger.debug("Sending good bye message"); 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 edd9ca2ca9..bb5cdb2a7d 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 @@ -42,13 +42,13 @@ import org.junit.jupiter.api.Test; public class DeliveryOrderTest extends ActiveMQTestBase { - public final SimpleString addressA = new SimpleString("addressA"); + public final SimpleString addressA = SimpleString.of("addressA"); - public final SimpleString queueA = new SimpleString("queueA"); + public final SimpleString queueA = SimpleString.of("queueA"); - public final SimpleString queueB = new SimpleString("queueB"); + public final SimpleString queueB = SimpleString.of("queueB"); - public final SimpleString queueC = new SimpleString("queueC"); + public final SimpleString queueC = SimpleString.of("queueC"); private ServerLocator locator; 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 26ade44f9a..79f7593207 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 @@ -52,7 +52,7 @@ public class ExpireTestOnRestartTest extends ActiveMQTestBase { public void setUp() throws Exception { super.setUp(); server = createServer(true); - AddressSettings setting = new AddressSettings().setExpiryAddress(SimpleString.toSimpleString("exp")).setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE).setPageSizeBytes(100 * 1024).setMaxSizeBytes(200 * 1024).setMaxReadPageBytes(-1).setMaxReadPageMessages(-1); + AddressSettings setting = new AddressSettings().setExpiryAddress(SimpleString.of("exp")).setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE).setPageSizeBytes(100 * 1024).setMaxSizeBytes(200 * 1024).setMaxReadPageBytes(-1).setMaxReadPageMessages(-1); server.getConfiguration().setJournalSyncNonTransactional(false); server.getConfiguration().setMessageExpiryScanPeriod(-1); server.getConfiguration().setJournalSyncTransactional(false); @@ -99,7 +99,7 @@ public class ExpireTestOnRestartTest extends ActiveMQTestBase { server.start(); - Queue queue = server.locateQueue(SimpleString.toSimpleString("test")); + Queue queue = server.locateQueue(SimpleString.of("test")); factory = locator.createSessionFactory(); session = factory.createSession(false, false); 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 2566fde2f1..4535cc0cf2 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 @@ -52,10 +52,10 @@ public class ExpiryAddressTest extends ActiveMQTestBase { @Test public void testBasicSend() throws Exception { - SimpleString ea = new SimpleString("EA"); - SimpleString adSend = new SimpleString("a1"); - SimpleString qName = new SimpleString("q1"); - SimpleString eq = new SimpleString("EA1"); + SimpleString ea = SimpleString.of("EA"); + SimpleString adSend = SimpleString.of("a1"); + SimpleString qName = SimpleString.of("q1"); + SimpleString eq = SimpleString.of("EA1"); AddressSettings addressSettings = new AddressSettings().setExpiryAddress(ea); server.getAddressSettingsRepository().addMatch("#", addressSettings); clientSession.createQueue(new QueueConfiguration(eq).setAddress(ea).setDurable(false)); @@ -86,10 +86,10 @@ public class ExpiryAddressTest extends ActiveMQTestBase { @Test public void testExpireSingleMessage() throws Exception { - SimpleString ea = new SimpleString("EA"); - SimpleString adSend = new SimpleString("a1"); - SimpleString qName = new SimpleString("q1"); - SimpleString eq = new SimpleString("EA1"); + SimpleString ea = SimpleString.of("EA"); + SimpleString adSend = SimpleString.of("a1"); + SimpleString qName = SimpleString.of("q1"); + SimpleString eq = SimpleString.of("EA1"); AddressSettings addressSettings = new AddressSettings().setExpiryAddress(ea); server.getAddressSettingsRepository().addMatch("#", addressSettings); clientSession.createQueue(new QueueConfiguration(eq).setAddress(ea).setDurable(false)); @@ -132,17 +132,17 @@ public class ExpiryAddressTest extends ActiveMQTestBase { @Test public void testBasicSendWithRetroActiveAddressSettings() throws Exception { // apply "original" address settings - SimpleString expiryAddress1 = new SimpleString("expiryAddress1"); - SimpleString qName = new SimpleString("q1"); - SimpleString expiryQueue1 = new SimpleString("expiryQueue1"); + SimpleString expiryAddress1 = SimpleString.of("expiryAddress1"); + SimpleString qName = SimpleString.of("q1"); + SimpleString expiryQueue1 = SimpleString.of("expiryQueue1"); AddressSettings addressSettings = new AddressSettings().setExpiryAddress(expiryAddress1); server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings); 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"); + SimpleString expiryAddress2 = SimpleString.of("expiryAddress2"); + SimpleString expiryQueue2 = SimpleString.of("expiryQueue2"); addressSettings = new AddressSettings().setExpiryAddress(expiryAddress2); server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings); clientSession.createQueue(new QueueConfiguration(expiryQueue2).setAddress(expiryAddress2).setDurable(false)); @@ -181,10 +181,10 @@ public class ExpiryAddressTest extends ActiveMQTestBase { @Test public void testBasicSendToMultipleQueues() throws Exception { - SimpleString ea = new SimpleString("EA"); - SimpleString qName = new SimpleString("q1"); - SimpleString eq = new SimpleString("EQ1"); - SimpleString eq2 = new SimpleString("EQ2"); + SimpleString ea = SimpleString.of("EA"); + SimpleString qName = SimpleString.of("q1"); + SimpleString eq = SimpleString.of("EQ1"); + SimpleString eq2 = SimpleString.of("EQ2"); AddressSettings addressSettings = new AddressSettings().setExpiryAddress(ea); server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings); clientSession.createQueue(new QueueConfiguration(eq).setAddress(ea).setDurable(false)); @@ -239,10 +239,10 @@ public class ExpiryAddressTest extends ActiveMQTestBase { @Test public void testBasicSendToNoQueue() throws Exception { - SimpleString ea = new SimpleString("EA"); - SimpleString qName = new SimpleString("q1"); - SimpleString eq = new SimpleString("EQ1"); - SimpleString eq2 = new SimpleString("EQ2"); + SimpleString ea = SimpleString.of("EA"); + SimpleString qName = SimpleString.of("q1"); + SimpleString eq = SimpleString.of("EQ1"); + SimpleString eq2 = SimpleString.of("EQ2"); 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)); @@ -261,11 +261,11 @@ public class ExpiryAddressTest extends ActiveMQTestBase { @Test public void testHeadersSet() throws Exception { final int NUM_MESSAGES = 5; - SimpleString ea = new SimpleString("DLA"); - SimpleString qName = new SimpleString("q1"); + SimpleString ea = SimpleString.of("DLA"); + SimpleString qName = SimpleString.of("q1"); AddressSettings addressSettings = new AddressSettings().setExpiryAddress(ea); server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings); - SimpleString eq = new SimpleString("EA1"); + SimpleString eq = SimpleString.of("EA1"); clientSession.createQueue(new QueueConfiguration(eq).setAddress(ea).setDurable(false)); clientSession.createQueue(new QueueConfiguration(qName).setDurable(false)); ServerLocator locator1 = createInVMNonHALocator(); @@ -311,9 +311,9 @@ public class ExpiryAddressTest extends ActiveMQTestBase { @Test public void testExpireWithDefaultAddressSettings() throws Exception { - SimpleString ea = new SimpleString("EA"); - SimpleString qName = new SimpleString("q1"); - SimpleString eq = new SimpleString("EA1"); + SimpleString ea = SimpleString.of("EA"); + SimpleString qName = SimpleString.of("q1"); + SimpleString eq = SimpleString.of("EA1"); AddressSettings addressSettings = new AddressSettings().setExpiryAddress(ea); server.getAddressSettingsRepository().setDefault(addressSettings); clientSession.createQueue(new QueueConfiguration(eq).setAddress(ea).setDurable(false)); @@ -339,9 +339,9 @@ public class ExpiryAddressTest extends ActiveMQTestBase { @Test public void testExpireWithWildcardAddressSettings() throws Exception { - SimpleString ea = new SimpleString("EA"); - SimpleString qName = new SimpleString("q1"); - SimpleString eq = new SimpleString("EA1"); + SimpleString ea = SimpleString.of("EA"); + SimpleString qName = SimpleString.of("q1"); + SimpleString eq = SimpleString.of("EA1"); AddressSettings addressSettings = new AddressSettings().setExpiryAddress(ea); server.getAddressSettingsRepository().addMatch("*", addressSettings); clientSession.createQueue(new QueueConfiguration(eq).setAddress(ea).setDurable(false)); @@ -367,7 +367,7 @@ public class ExpiryAddressTest extends ActiveMQTestBase { @Test public void testExpireWithOverridenSublevelAddressSettings() throws Exception { - SimpleString address = new SimpleString("prefix.address"); + SimpleString address = SimpleString.of("prefix.address"); SimpleString queue = RandomUtil.randomSimpleString(); SimpleString defaultExpiryAddress = RandomUtil.randomSimpleString(); SimpleString defaultExpiryQueue = RandomUtil.randomSimpleString(); 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 84cce59296..68baeccc5d 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 @@ -57,11 +57,11 @@ public class ExpiryLargeMessageTest extends ActiveMQTestBase { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - final SimpleString EXPIRY = new SimpleString("my-expiry"); + final SimpleString EXPIRY = SimpleString.of("my-expiry"); - final SimpleString DLQ = new SimpleString("my-DLQ"); + final SimpleString DLQ = SimpleString.of("my-DLQ"); - final SimpleString MY_QUEUE = new SimpleString("MY-QUEUE"); + final SimpleString MY_QUEUE = SimpleString.of("MY-QUEUE"); final int messageSize = 10 * 1024; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ForceDeleteQueue.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ForceDeleteQueue.java index 0626dc9fc2..18d41d240d 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ForceDeleteQueue.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ForceDeleteQueue.java @@ -85,7 +85,7 @@ public class ForceDeleteQueue extends ActiveMQTestBase { @TestTemplate public void testForceDelete() throws Exception { - SimpleString queueName = SimpleString.toSimpleString("testForceDelete"); + SimpleString queueName = SimpleString.of("testForceDelete"); server.addAddressInfo(new AddressInfo(queueName, RoutingType.ANYCAST)); server.createQueue(queueName, RoutingType.ANYCAST, queueName, null, true, false); 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 c3af58ec3d..fb06e86b5c 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 @@ -46,17 +46,17 @@ public class FullQualifiedQueueTest extends ActiveMQTestBase { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - private SimpleString anycastAddress = new SimpleString("address.anycast"); - private SimpleString multicastAddress = new SimpleString("address.multicast"); - private SimpleString mixedAddress = new SimpleString("address.mixed"); + private SimpleString anycastAddress = SimpleString.of("address.anycast"); + private SimpleString multicastAddress = SimpleString.of("address.multicast"); + private SimpleString mixedAddress = SimpleString.of("address.mixed"); - private SimpleString anycastQ1 = new SimpleString("q1"); - private SimpleString anycastQ2 = new SimpleString("q2"); - private SimpleString anycastQ3 = new SimpleString("q3"); + private SimpleString anycastQ1 = SimpleString.of("q1"); + private SimpleString anycastQ2 = SimpleString.of("q2"); + private SimpleString anycastQ3 = SimpleString.of("q3"); - private SimpleString multicastQ1 = new SimpleString("q4"); - private SimpleString multicastQ2 = new SimpleString("q5"); - private SimpleString multicastQ3 = new SimpleString("q6"); + private SimpleString multicastQ1 = SimpleString.of("q4"); + private SimpleString multicastQ2 = SimpleString.of("q5"); + private SimpleString multicastQ3 = SimpleString.of("q6"); private ActiveMQServer server; private ServerLocator locator; @@ -256,7 +256,7 @@ public class FullQualifiedQueueTest extends ActiveMQTestBase { sendMessages(session, producer, 1); //::queue - ClientConsumer consumer1 = session.createConsumer(CompositeAddress.toFullyQualified(new SimpleString(""), anycastQ1)); + ClientConsumer consumer1 = session.createConsumer(CompositeAddress.toFullyQualified(SimpleString.of(""), anycastQ1)); session.start(); ClientMessage m = consumer1.receive(2000); @@ -268,7 +268,7 @@ public class FullQualifiedQueueTest extends ActiveMQTestBase { try { //queue:: - session.createConsumer(CompositeAddress.toFullyQualified(anycastQ1, new SimpleString(""))); + session.createConsumer(CompositeAddress.toFullyQualified(anycastQ1, SimpleString.of(""))); fail("should get exception"); } catch (ActiveMQNonExistentQueueException e) { //expected. @@ -276,7 +276,7 @@ public class FullQualifiedQueueTest extends ActiveMQTestBase { try { //:: - session.createConsumer(CompositeAddress.toFullyQualified(new SimpleString(""), new SimpleString(""))); + session.createConsumer(CompositeAddress.toFullyQualified(SimpleString.of(""), SimpleString.of(""))); fail("should get exception"); } catch (ActiveMQNonExistentQueueException e) { //expected. 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 9dfe8da933..220ad85f77 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 @@ -95,7 +95,7 @@ public class HangConsumerTest extends ActiveMQTestBase { private ActiveMQServer server; - private final SimpleString QUEUE = new SimpleString("ConsumerTestQueue"); + private final SimpleString QUEUE = SimpleString.of("ConsumerTestQueue"); private Queue queue; @@ -431,7 +431,7 @@ public class HangConsumerTest extends ActiveMQTestBase { public void testDuplicateDestinationsOnTopic() throws Exception { try { for (int i = 0; i < 5; i++) { - if (server.locateQueue(SimpleString.toSimpleString("tt")) == null) { + if (server.locateQueue(SimpleString.of("tt")) == null) { server.createQueue(new QueueConfiguration("tt").setRoutingType(RoutingType.ANYCAST).setFilterString(Filter.GENERIC_IGNORED_FILTER)); } @@ -599,7 +599,7 @@ public class HangConsumerTest extends ActiveMQTestBase { Map prefixes, String securityDomain, boolean isLegacyProducer) throws Exception { - return new ServerSessionImpl(name, username, password, validatedUser, minLargeMessageSize, autoCommitSends, autoCommitAcks, preAcknowledge, getConfiguration().isPersistDeliveryCountBeforeDelivery(), xa, connection, getStorageManager(), getPostOffice(), getResourceManager(), getSecurityStore(), getManagementService(), this, getConfiguration().getManagementAddress(), defaultAddress == null ? null : new SimpleString(defaultAddress), new MyCallback(callback), context, getPagingManager(), prefixes, securityDomain, isLegacyProducer); + return new ServerSessionImpl(name, username, password, validatedUser, minLargeMessageSize, autoCommitSends, autoCommitAcks, preAcknowledge, getConfiguration().isPersistDeliveryCountBeforeDelivery(), xa, connection, getStorageManager(), getPostOffice(), getResourceManager(), getSecurityStore(), getManagementService(), this, getConfiguration().getManagementAddress(), defaultAddress == null ? null : SimpleString.of(defaultAddress), new MyCallback(callback), context, getPagingManager(), prefixes, securityDomain, isLegacyProducer); } } 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 e3e5256a9f..a2d7d2cc2c 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 @@ -51,7 +51,7 @@ public class HeuristicXATest extends ActiveMQTestBase { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - final SimpleString ADDRESS = new SimpleString("ADDRESS"); + final SimpleString ADDRESS = SimpleString.of("ADDRESS"); final String body = "this is the body"; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/IngressTimestampTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/IngressTimestampTest.java index ce73261ab4..1730f38d22 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/IngressTimestampTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/IngressTimestampTest.java @@ -57,7 +57,7 @@ import org.junit.jupiter.api.extension.ExtendWith; public class IngressTimestampTest extends ActiveMQTestBase { private ActiveMQServer server; - private final SimpleString QUEUE = new SimpleString("ConsumerTestQueue"); + private final SimpleString QUEUE = SimpleString.of("ConsumerTestQueue"); @Parameters(name = "restart={0}, large={1}") public static Collection parameters() { 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 4d70007ad6..650219606c 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 @@ -224,7 +224,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase { server.start(); - SimpleString jmsAddress = new SimpleString("Test"); + SimpleString jmsAddress = SimpleString.of("Test"); server.createQueue(new QueueConfiguration(jmsAddress).setRoutingType(RoutingType.ANYCAST)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/InvalidCoreClientTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/InvalidCoreClientTest.java index dd85c500c9..61e1cfdca5 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/InvalidCoreClientTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/InvalidCoreClientTest.java @@ -53,7 +53,7 @@ import org.junit.jupiter.api.Test; public class InvalidCoreClientTest extends ActiveMQTestBase { private final Map addressSettings = new HashMap<>(); - private final SimpleString atestq = new SimpleString("BasicXaTestq"); + private final SimpleString atestq = SimpleString.of("BasicXaTestq"); private ActiveMQServer messagingService; private ClientSession clientSession; private ClientSessionFactory sessionFactory; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JMSOrderTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JMSOrderTest.java index de3aad0374..8784f91b1f 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JMSOrderTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JMSOrderTest.java @@ -78,7 +78,7 @@ public class JMSOrderTest extends JMSTestBase { @Override protected void extraServerConfig(ActiveMQServer server) { if (exclusive) { - server.getConfiguration().getAddressSettings().put("#", new AddressSettings().setAutoCreateQueues(true).setAutoCreateAddresses(true).setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ")).setDefaultExclusiveQueue(true)); + server.getConfiguration().getAddressSettings().put("#", new AddressSettings().setAutoCreateQueues(true).setAutoCreateAddresses(true).setDeadLetterAddress(SimpleString.of("ActiveMQ.DLQ")).setDefaultExclusiveQueue(true)); } } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JMSPagingFileDeleteTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JMSPagingFileDeleteTest.java index 944feacb7f..8025ab66e6 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JMSPagingFileDeleteTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JMSPagingFileDeleteTest.java @@ -116,7 +116,7 @@ public class JMSPagingFileDeleteTest extends JMSTestBase { } logger.debug("Sent {} messages.", JMSPagingFileDeleteTest.MESSAGE_NUM); - pagingStore = server.getPagingManager().getPageStore(new SimpleString("topic1")); + pagingStore = server.getPagingManager().getPageStore(SimpleString.of("topic1")); printPageStoreInfo(pagingStore); assertTrue(pagingStore.isPaging()); @@ -164,7 +164,7 @@ public class JMSPagingFileDeleteTest extends JMSTestBase { } logger.debug("Sent {} messages.", JMSPagingFileDeleteTest.MESSAGE_NUM); - pagingStore = server.getPagingManager().getPageStore(new SimpleString("topic1")); + pagingStore = server.getPagingManager().getPageStore(SimpleString.of("topic1")); printPageStoreInfo(pagingStore); assertTrue(pagingStore.isPaging()); @@ -183,7 +183,7 @@ public class JMSPagingFileDeleteTest extends JMSTestBase { assertNotNull(message2); } - pagingStore = server.getPagingManager().getPageStore(new SimpleString("topic1")); + pagingStore = server.getPagingManager().getPageStore(SimpleString.of("topic1")); long timeout = System.currentTimeMillis() + 5000; while (timeout > System.currentTimeMillis() && pagingStore.isPaging()) { Thread.sleep(100); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JMSTransactionTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JMSTransactionTest.java index 966fc1c8cf..7c8cbcd51a 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JMSTransactionTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JMSTransactionTest.java @@ -88,7 +88,7 @@ public class JMSTransactionTest extends JMSTestBase { session.commit(); Wait.assertEquals(messages, sentMessages::get); - org.apache.activemq.artemis.core.server.Queue queueView = server.locateQueue(SimpleString.toSimpleString(queueName)); + org.apache.activemq.artemis.core.server.Queue queueView = server.locateQueue(SimpleString.of(queueName)); Wait.assertEquals(messages, queueView::getMessageCount); } } 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 4a3ebbbb19..1d087d2f95 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 @@ -136,15 +136,15 @@ public class JmsNettyNioStressTest extends ActiveMQTestBase { // create the 2 queues used in the test ClientSessionFactory sf = locator.createSessionFactory(transpConf); ClientSession session = sf.createTransactedSession(); - session.createAddress(SimpleString.toSimpleString("queue"), RoutingType.ANYCAST, false); - session.createAddress(SimpleString.toSimpleString("queue2"), RoutingType.ANYCAST, false); + session.createAddress(SimpleString.of("queue"), RoutingType.ANYCAST, false); + session.createAddress(SimpleString.of("queue2"), RoutingType.ANYCAST, false); - assertTrue(session.addressQuery(SimpleString.toSimpleString("queue")).isExists()); - assertTrue(session.addressQuery(SimpleString.toSimpleString("queue2")).isExists()); + assertTrue(session.addressQuery(SimpleString.of("queue")).isExists()); + assertTrue(session.addressQuery(SimpleString.of("queue2")).isExists()); session.createQueue(new QueueConfiguration("queue").setRoutingType(RoutingType.ANYCAST)); session.createQueue(new QueueConfiguration("queue2").setRoutingType(RoutingType.ANYCAST)); - assertTrue(session.addressQuery(SimpleString.toSimpleString("queue")).isExists()); - assertTrue(session.addressQuery(SimpleString.toSimpleString("queue2")).isExists()); + assertTrue(session.addressQuery(SimpleString.of("queue")).isExists()); + assertTrue(session.addressQuery(SimpleString.of("queue2")).isExists()); session.commit(); sf.close(); session.close(); 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 ce8b91e478..5aabeddd43 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 @@ -50,7 +50,7 @@ public class JournalCrashTest extends SpawnedTestBase { private ClientSessionFactory factory; - private final SimpleString QUEUE = new SimpleString("queue"); + private final SimpleString QUEUE = SimpleString.of("queue"); private ServerLocator locator; @@ -100,7 +100,7 @@ public class JournalCrashTest extends SpawnedTestBase { for (int i = start; i < end; i++) { ClientMessage msg = session.createMessage(true); - msg.putIntProperty(new SimpleString("key"), i); + msg.putIntProperty(SimpleString.of("key"), i); msg.getBodyBuffer().writeUTF("message " + i); prod.send(msg); } @@ -130,7 +130,7 @@ public class JournalCrashTest extends SpawnedTestBase { msg.acknowledge(); - assertEquals(i, msg.getObjectProperty(new SimpleString("key"))); + assertEquals(i, msg.getObjectProperty(SimpleString.of("key"))); } } } 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 5022e771f9..491759d6ee 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 @@ -578,9 +578,9 @@ public class LargeMessageCompressTest extends LargeMessageTest { @TestTemplate public void testLargeMessageCompressionLevel() throws Exception { - SimpleString address1 = new SimpleString("address1"); - SimpleString address2 = new SimpleString("address2"); - SimpleString address3 = new SimpleString("address3"); + SimpleString address1 = SimpleString.of("address1"); + SimpleString address2 = SimpleString.of("address2"); + SimpleString address3 = SimpleString.of("address3"); ActiveMQServer server = createServer(true, true); server.start(); 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 5eca653556..6cb56580b5 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 @@ -274,7 +274,7 @@ public class LargeMessageTest extends LargeMessageTestBase { server.createQueue(new QueueConfiguration(DIVERTED)); - server.getAddressSettingsRepository().addMatch(DIVERTED, new AddressSettings().setExpiryDelay(250L).setExpiryAddress(SimpleString.toSimpleString(DIVERTED + "Expiry")).setAutoCreateExpiryResources(true)); + server.getAddressSettingsRepository().addMatch(DIVERTED, new AddressSettings().setExpiryDelay(250L).setExpiryAddress(SimpleString.of(DIVERTED + "Expiry")).setAutoCreateExpiryResources(true)); server.deployDivert(new DivertConfiguration().setName("myDivert").setAddress(ADDRESS.toString()).setForwardingAddress(DIVERTED).setExclusive(true)); @@ -561,7 +561,7 @@ public class LargeMessageTest extends LargeMessageTestBase { bodyLocal.writeBytes(body); - message.putIntProperty(new SimpleString("id"), i); + message.putIntProperty(SimpleString.of("id"), i); producer.send(message); if (i % 1000 == 0) { @@ -810,8 +810,8 @@ public class LargeMessageTest extends LargeMessageTestBase { @TestTemplate public void testDLQAlmostLarge() throws Exception { - SimpleString addressName = SimpleString.toSimpleString("SomewhatHugeNameToBeUsedxxxxxxxxxxxxxxxxxxxiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); - SimpleString dlqName = SimpleString.toSimpleString("DLQ" + addressName.toString()); + SimpleString addressName = SimpleString.of("SomewhatHugeNameToBeUsedxxxxxxxxxxxxxxxxxxxiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); + SimpleString dlqName = SimpleString.of("DLQ" + addressName.toString()); ClientSession session = null; @@ -1652,7 +1652,7 @@ public class LargeMessageTest extends LargeMessageTestBase { server.start(); - SimpleString[] queue = new SimpleString[]{new SimpleString("queue1"), new SimpleString("queue2")}; + SimpleString[] queue = new SimpleString[]{SimpleString.of("queue1"), SimpleString.of("queue2")}; ClientSessionFactory sf = addSessionFactory(createSessionFactory(locator)); @@ -1719,7 +1719,7 @@ public class LargeMessageTest extends LargeMessageTestBase { server.start(); - SimpleString[] queue = new SimpleString[]{new SimpleString("queue1"), new SimpleString("queue2")}; + SimpleString[] queue = new SimpleString[]{SimpleString.of("queue1"), SimpleString.of("queue2")}; ClientSessionFactory sf = addSessionFactory(createSessionFactory(locator)); @@ -2567,7 +2567,7 @@ public class LargeMessageTest extends LargeMessageTestBase { for (int i = 0; i < NUMBER_OF_MESSAGES; i++) { ClientMessage msg = session.createMessage(true); msg.setBodyInputStream(ActiveMQTestBase.createFakeLargeStream(SIZE)); - msg.putIntProperty(new SimpleString("key"), i); + msg.putIntProperty(SimpleString.of("key"), i); producer.send(msg); logger.debug("Sent msg {}", i); @@ -2587,7 +2587,7 @@ public class LargeMessageTest extends LargeMessageTestBase { ClientMessage msg = consumer.receive(50000); assertNotNull(msg); - assertEquals(i, msg.getObjectProperty(new SimpleString("key"))); + assertEquals(i, msg.getObjectProperty(SimpleString.of("key"))); msg.acknowledge(); } @@ -2940,7 +2940,7 @@ public class LargeMessageTest extends LargeMessageTestBase { assumeTrue(os instanceof UnixOperatingSystemMXBean); - final SimpleString MY_QUEUE = new SimpleString("MY-QUEUE"); + final SimpleString MY_QUEUE = SimpleString.of("MY-QUEUE"); final int numberOfMessages = 30; ActiveMQServer server = createServer(true, 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 de568e45a0..a78683a9bf 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 @@ -47,9 +47,9 @@ public class MessageConcurrencyTest extends ActiveMQTestBase { private ActiveMQServer server; - private final SimpleString ADDRESS = new SimpleString("MessageConcurrencyTestAddress"); + private final SimpleString ADDRESS = SimpleString.of("MessageConcurrencyTestAddress"); - private final SimpleString QUEUE_NAME = new SimpleString("MessageConcurrencyTestQueue"); + private final SimpleString QUEUE_NAME = SimpleString.of("MessageConcurrencyTestQueue"); private ServerLocator locator; 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 7617a425e5..5348f7b172 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 @@ -37,7 +37,7 @@ public class MessageCounterTest extends ActiveMQTestBase { private ActiveMQServer server; - private final SimpleString QUEUE = new SimpleString("ConsumerTestQueue"); + private final SimpleString QUEUE = SimpleString.of("ConsumerTestQueue"); private ServerLocator locator; 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 f8326d6e72..48f7fa1509 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 @@ -45,7 +45,7 @@ public class MessageGroupingConnectionFactoryTest extends ActiveMQTestBase { private ClientSession clientSession; - private final SimpleString qName = new SimpleString("MessageGroupingTestQueue"); + private final SimpleString qName = SimpleString.of("MessageGroupingTestQueue"); @Test public void testBasicGroupingUsingConnection() throws Exception { 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 6e2b2c6c16..e87e77dc39 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 @@ -61,7 +61,7 @@ public class MessageGroupingTest extends ActiveMQTestBase { private ClientSessionFactory clientSessionFactory; - private final SimpleString qName = new SimpleString("MessageGroupingTestQueue"); + private final SimpleString qName = SimpleString.of("MessageGroupingTestQueue"); private ServerLocator locator; @Test @@ -153,7 +153,7 @@ public class MessageGroupingTest extends ActiveMQTestBase { ClientConsumer consumer2 = clientSession.createConsumer(qName); clientSession.start(); - SimpleString groupId = new SimpleString("grp1"); + SimpleString groupId = SimpleString.of("grp1"); int numMessages = 100; for (int i = 0; i < numMessages; i++) { ClientMessage message = createTextMessage(clientSession, "m" + i); @@ -183,8 +183,8 @@ public class MessageGroupingTest extends ActiveMQTestBase { //need to wait a bit or consumers might be busy Thread.sleep(200); - SimpleString groupId = new SimpleString("grp1"); - SimpleString groupId2 = new SimpleString("grp2"); + SimpleString groupId = SimpleString.of("grp1"); + SimpleString groupId2 = SimpleString.of("grp2"); int numMessages = 100; for (int i = 0; i < numMessages; i++) { ClientMessage message = createTextMessage(clientSession, "m" + i); @@ -219,8 +219,8 @@ public class MessageGroupingTest extends ActiveMQTestBase { if (directDelivery) { clientSession.start(); } - SimpleString groupId = new SimpleString("grp1"); - SimpleString groupId2 = new SimpleString("grp2"); + SimpleString groupId = SimpleString.of("grp1"); + SimpleString groupId2 = SimpleString.of("grp2"); int numMessages = 100; for (int i = 0; i < numMessages; i++) { ClientMessage message = createTextMessage(clientSession, "m" + i); @@ -260,8 +260,8 @@ public class MessageGroupingTest extends ActiveMQTestBase { //Wait a bit otherwise consumers might be busy Thread.sleep(200); - SimpleString groupId = new SimpleString("grp1"); - SimpleString groupId2 = new SimpleString("grp2"); + SimpleString groupId = SimpleString.of("grp1"); + SimpleString groupId2 = SimpleString.of("grp2"); int numMessages = 100; for (int i = 0; i < numMessages; i++) { ClientMessage message = createTextMessage(clientSession, "m" + i); @@ -313,8 +313,8 @@ public class MessageGroupingTest extends ActiveMQTestBase { //need to wait a bit or consumers might be busy Thread.sleep(200); - SimpleString groupId = new SimpleString("grp1"); - SimpleString groupId2 = new SimpleString("grp2"); + SimpleString groupId = SimpleString.of("grp1"); + SimpleString groupId2 = SimpleString.of("grp2"); int numMessages = 100; for (int i = 0; i < numMessages; i++) { ClientMessage message = createTextMessage(clientSession, "m" + i); @@ -379,8 +379,8 @@ public class MessageGroupingTest extends ActiveMQTestBase { Xid xid = new XidImpl("bq".getBytes(), 4, "gtid".getBytes()); clientSession.start(xid, XAResource.TMNOFLAGS); - SimpleString groupId = new SimpleString("grp1"); - SimpleString groupId2 = new SimpleString("grp2"); + SimpleString groupId = SimpleString.of("grp1"); + SimpleString groupId2 = SimpleString.of("grp2"); int numMessages = 100; for (int i = 0; i < numMessages; i++) { ClientMessage message = createTextMessage(clientSession, "m" + i); @@ -433,8 +433,8 @@ public class MessageGroupingTest extends ActiveMQTestBase { Xid xid = new XidImpl("bq".getBytes(), 4, "gtid".getBytes()); clientSession.start(xid, XAResource.TMNOFLAGS); - SimpleString groupId = new SimpleString("grp1"); - SimpleString groupId2 = new SimpleString("grp2"); + SimpleString groupId = SimpleString.of("grp1"); + SimpleString groupId2 = SimpleString.of("grp2"); int numMessages = 100; for (int i = 0; i < numMessages; i++) { ClientMessage message = createTextMessage(clientSession, "m" + i); @@ -498,8 +498,8 @@ public class MessageGroupingTest extends ActiveMQTestBase { ClientConsumer consumer2 = clientSession.createConsumer(qName); clientSession.start(); - SimpleString groupId = new SimpleString("grp1"); - SimpleString groupId2 = new SimpleString("grp2"); + SimpleString groupId = SimpleString.of("grp1"); + SimpleString groupId2 = SimpleString.of("grp2"); int numMessages = 4; for (int i = 0; i < numMessages; i++) { ClientMessage message = createTextMessage(clientSession, "m" + i); 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 8ccdabb53a..3b4c4e9ffe 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 @@ -42,7 +42,7 @@ public class MessageHandlerTest extends ActiveMQTestBase { private ActiveMQServer server; - private final SimpleString QUEUE = new SimpleString("ConsumerTestQueue"); + private final SimpleString QUEUE = SimpleString.of("ConsumerTestQueue"); private ServerLocator locator; @@ -130,7 +130,7 @@ public class MessageHandlerTest extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = createTextMessage(session, "m" + i); - message.putIntProperty(new SimpleString("i"), i); + message.putIntProperty(SimpleString.of("i"), i); producer.send(message); } @@ -219,7 +219,7 @@ public class MessageHandlerTest extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = createTextMessage(session, "m" + i); - message.putIntProperty(new SimpleString("i"), i); + message.putIntProperty(SimpleString.of("i"), i); producer.send(message); } @@ -298,7 +298,7 @@ public class MessageHandlerTest extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = createTextMessage(session, "m" + i); - message.putIntProperty(new SimpleString("i"), i); + message.putIntProperty(SimpleString.of("i"), i); producer.send(message); } 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 eabbfcc424..59689f8e50 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 @@ -39,7 +39,7 @@ import org.junit.jupiter.api.Test; public class MessageRateTest extends ActiveMQTestBase { - private final SimpleString ADDRESS = new SimpleString("ADDRESS"); + private final SimpleString ADDRESS = SimpleString.of("ADDRESS"); private ServerLocator locator; 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 7999bfa47f..6c06617a4b 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 @@ -47,7 +47,7 @@ public class MixRoutingTest extends SingleServerTestBase { @Test public void testMix() throws Exception { - SimpleString queueName = SimpleString.toSimpleString(getName()); + SimpleString queueName = SimpleString.of(getName()); server.createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST)); ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(); Connection connection = factory.createConnection(); @@ -93,7 +93,7 @@ public class MixRoutingTest extends SingleServerTestBase { @Test public void testMix2() throws Exception { - SimpleString queueName = SimpleString.toSimpleString(getName()); + SimpleString queueName = SimpleString.of(getName()); server.createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST)); ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(); Connection connection = factory.createConnection(); @@ -143,8 +143,8 @@ public class MixRoutingTest extends SingleServerTestBase { @Test public void testMixWithTopics() throws Exception { - SimpleString queueName = SimpleString.toSimpleString(getName()); - SimpleString topicName = SimpleString.toSimpleString("topic" + getName()); + SimpleString queueName = SimpleString.of(getName()); + SimpleString topicName = SimpleString.of("topic" + getName()); AddressInfo info = new AddressInfo(topicName, RoutingType.MULTICAST); server.addAddressInfo(info); server.createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MultipleProducersTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MultipleProducersTest.java index bc8c4a5605..fe762e8241 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MultipleProducersTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MultipleProducersTest.java @@ -45,11 +45,11 @@ public class MultipleProducersTest extends JMSTestBase { public Queue queueTwo = null; public Session session = null; - public SimpleString dlq = new SimpleString("DLQ"); - public SimpleString expiryQueue = new SimpleString("ExpiryQueue"); + public SimpleString dlq = SimpleString.of("DLQ"); + public SimpleString expiryQueue = SimpleString.of("ExpiryQueue"); - public SimpleString queueOneName = new SimpleString("queueOne"); - public SimpleString queueTwoName = new SimpleString("queueTwo"); + public SimpleString queueOneName = SimpleString.of("queueOne"); + public SimpleString queueTwoName = SimpleString.of("queueTwo"); public QueueControl control = null; public long queueOneMsgCount = 0; public long queueTwoMsgCount = 0; 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 8774bbd808..845835dddb 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 @@ -263,7 +263,7 @@ public class MultipleThreadFilterOneTest extends ActiveMQTestBase { } } - waitForNotPaging(server.locateQueue(new SimpleString("Q1"))); + waitForNotPaging(server.locateQueue(SimpleString.of("Q1"))); } finally { server.stop(); 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 4cedd0f175..be48cb2892 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 @@ -46,11 +46,11 @@ public class NewDeadLetterAddressTest extends ActiveMQTestBase { @Test public void testSendToDLAWhenNoRoute() throws Exception { - SimpleString dla = new SimpleString("DLA"); - SimpleString address = new SimpleString("empty_address"); + SimpleString dla = SimpleString.of("DLA"); + SimpleString address = SimpleString.of("empty_address"); AddressSettings addressSettings = new AddressSettings().setDeadLetterAddress(dla).setSendToDLAOnNoRoute(true); server.getAddressSettingsRepository().addMatch(address.toString(), addressSettings); - SimpleString dlq = new SimpleString("DLQ1"); + SimpleString dlq = SimpleString.of("DLQ1"); clientSession.createQueue(new QueueConfiguration(dlq).setAddress(dla).setDurable(false)); ClientProducer producer = clientSession.createProducer(address); producer.send(createTextMessage(clientSession, "heyho!")); 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 49808e1e04..9128b4271c 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 @@ -196,7 +196,7 @@ public class ProducerFlowControlTest extends ActiveMQTestBase { final boolean anon, final int minLargeMessageSize, final boolean realFiles) throws Exception { - final SimpleString address = new SimpleString("testaddress"); + final SimpleString address = SimpleString.of("testaddress"); server = createServer(realFiles, isNetty()); @@ -222,7 +222,7 @@ public class ProducerFlowControlTest extends ActiveMQTestBase { final String queueName = "testqueue"; for (int i = 0; i < numConsumers; i++) { - session.createQueue(new QueueConfiguration(new SimpleString(queueName + i)).setAddress(address).setDurable(false)); + session.createQueue(new QueueConfiguration(SimpleString.of(queueName + i)).setAddress(address).setDurable(false)); } final byte[] bytes = RandomUtil.randomBytes(messageSize); @@ -269,7 +269,7 @@ public class ProducerFlowControlTest extends ActiveMQTestBase { for (int i = 0; i < numConsumers; i++) { handlers[i] = new MyHandler(); - ClientConsumer consumer = session.createConsumer(new SimpleString(queueName + i)); + ClientConsumer consumer = session.createConsumer(SimpleString.of(queueName + i)); consumer.setMessageHandler(handlers[i]); } @@ -316,7 +316,7 @@ public class ProducerFlowControlTest extends ActiveMQTestBase { @Test public void testClosingSessionUnblocksBlockedProducer() throws Exception { - final SimpleString address = new SimpleString("testaddress"); + final SimpleString address = SimpleString.of("testaddress"); server = createServer(false, isNetty()); @@ -333,7 +333,7 @@ public class ProducerFlowControlTest extends ActiveMQTestBase { sf = createSessionFactory(locator); session = sf.createSession(false, true, true, true); - final SimpleString queueName = new SimpleString("testqueue"); + final SimpleString queueName = SimpleString.of("testqueue"); session.createQueue(new QueueConfiguration(queueName).setAddress(address).setDurable(false)); @@ -378,7 +378,7 @@ public class ProducerFlowControlTest extends ActiveMQTestBase { @Test public void testFlowControlMessageNotRouted() throws Exception { - final SimpleString address = new SimpleString("testaddress"); + final SimpleString address = SimpleString.of("testaddress"); server = createServer(false, isNetty()); 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 25ddb92709..4e33bde836 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 @@ -51,7 +51,7 @@ public class ProducerTest extends ActiveMQTestBase { private ActiveMQServer server; - private final SimpleString QUEUE = new SimpleString("ConsumerTestQueue"); + private final SimpleString QUEUE = SimpleString.of("ConsumerTestQueue"); @Override @BeforeEach 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 87a7d331f9..30f210c118 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 @@ -36,7 +36,7 @@ public class QueueBrowserTest extends ActiveMQTestBase { private ActiveMQServer server; - private final SimpleString QUEUE = new SimpleString("ConsumerTestQueue"); + private final SimpleString QUEUE = SimpleString.of("ConsumerTestQueue"); private ServerLocator locator; @@ -111,11 +111,11 @@ public class QueueBrowserTest extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = createTextMessage(session, "m" + i); - message.putIntProperty(new SimpleString("x"), i); + message.putIntProperty(SimpleString.of("x"), i); producer.send(message); } - ClientConsumer consumer = session.createConsumer(QUEUE, new SimpleString("x >= 50"), true); + ClientConsumer consumer = session.createConsumer(QUEUE, SimpleString.of("x >= 50"), true); for (int i = 50; i < numMessages; i++) { ClientMessage message2 = consumer.receive(1000); @@ -154,12 +154,12 @@ public class QueueBrowserTest extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = createTextMessage(session, "m" + i); if (i % 2 == 0) { - message.putStringProperty(new SimpleString("color"), new SimpleString("RED")); + message.putStringProperty(SimpleString.of("color"), SimpleString.of("RED")); } producer.send(message); } - ClientConsumer consumer = session.createConsumer(QUEUE, new SimpleString("color = 'RED'"), true); + ClientConsumer consumer = session.createConsumer(QUEUE, SimpleString.of("color = 'RED'"), true); for (int i = 0; i < numMessages; i += 2) { ClientMessage message2 = consumer.receive(1000); @@ -221,12 +221,12 @@ public class QueueBrowserTest extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = createTextMessage(session, "m" + i); - message.putIntProperty(new SimpleString("x"), i); + message.putIntProperty(SimpleString.of("x"), i); producer.send(message); } - ClientConsumer consumer = session.createConsumer(QUEUE, new SimpleString("x < 50"), true); - ClientConsumer consumer2 = session.createConsumer(QUEUE, new SimpleString("x >= 50"), true); + ClientConsumer consumer = session.createConsumer(QUEUE, SimpleString.of("x < 50"), true); + ClientConsumer consumer2 = session.createConsumer(QUEUE, SimpleString.of("x >= 50"), true); ClientConsumer consumer3 = session.createConsumer(QUEUE, null, true); for (int i = 0; i < 50; i++) { 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 8d08546bd0..be1078e8c9 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 @@ -44,9 +44,9 @@ public class ReceiveImmediateTest extends ActiveMQTestBase { private ActiveMQServer server; - private final SimpleString QUEUE = new SimpleString("ReceiveImmediateTest.queue"); + private final SimpleString QUEUE = SimpleString.of("ReceiveImmediateTest.queue"); - private final SimpleString ADDRESS = new SimpleString("ReceiveImmediateTest.address"); + private final SimpleString ADDRESS = SimpleString.of("ReceiveImmediateTest.address"); private ServerLocator locator; 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 4eecc5a926..df2edfea36 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 @@ -54,7 +54,7 @@ public class RedeliveryConsumerTest extends ActiveMQTestBase { ActiveMQServer server; - final SimpleString ADDRESS = new SimpleString("address"); + final SimpleString ADDRESS = SimpleString.of("address"); ClientSessionFactory factory; 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 72cd05ec5e..1e0575dbdd 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 @@ -51,7 +51,7 @@ public class RequestorTest extends ActiveMQTestBase { public void testRequest() throws Exception { final SimpleString key = RandomUtil.randomSimpleString(); long value = RandomUtil.randomLong(); - SimpleString requestAddress = new SimpleString("AdTest"); + SimpleString requestAddress = SimpleString.of("AdTest"); SimpleString requestQueue = RandomUtil.randomSimpleString(); final ClientSession session = sf.createSession(false, true, true); @@ -83,9 +83,9 @@ public class RequestorTest extends ActiveMQTestBase { AddressSettings settings = new AddressSettings().setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK).setMaxSizeBytes(1024); server.getAddressSettingsRepository().addMatch("#", settings); - SimpleString requestAddress = new SimpleString("RequestAddress"); + SimpleString requestAddress = SimpleString.of("RequestAddress"); - SimpleString requestQueue = new SimpleString("RequestAddress Queue"); + SimpleString requestQueue = SimpleString.of("RequestAddress Queue"); final ClientSession sessionRequest = sf.createSession(false, true, true); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/RescheduleJDBCDeliveryTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/RescheduleJDBCDeliveryTest.java index c216e0c681..8b665b495b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/RescheduleJDBCDeliveryTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/RescheduleJDBCDeliveryTest.java @@ -91,7 +91,7 @@ public class RescheduleJDBCDeliveryTest extends ActiveMQTestBase { String testQueue = getName(); Configuration configuration = createDefaultJDBCConfig(true); configuration.setMaxRedeliveryRecords(maxRecords); - configuration.addAddressSetting("#", new AddressSettings().setRedeliveryDelay(1).setMaxDeliveryAttempts(-1).setDeadLetterAddress(SimpleString.toSimpleString("DLQ"))); + configuration.addAddressSetting("#", new AddressSettings().setRedeliveryDelay(1).setMaxDeliveryAttempts(-1).setDeadLetterAddress(SimpleString.of("DLQ"))); configuration.addAddressConfiguration(new CoreAddressConfiguration().setName("DLQ").addRoutingType(RoutingType.ANYCAST)); configuration.addQueueConfiguration(new QueueConfiguration("DLQ").setAddress("DLQ").setRoutingType(RoutingType.ANYCAST)); configuration.addAddressConfiguration(new CoreAddressConfiguration().setName(testQueue).addRoutingType(RoutingType.ANYCAST)); 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 9395d631d4..00cc972289 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 @@ -39,12 +39,12 @@ import org.junit.jupiter.api.Test; public class RoutingTest extends ActiveMQTestBase { - public final SimpleString addressA = new SimpleString("addressA"); - public final SimpleString addressB = new SimpleString("addressB"); - public final SimpleString queueA = new SimpleString("queueA"); - public final SimpleString queueB = new SimpleString("queueB"); - public final SimpleString queueC = new SimpleString("queueC"); - public final SimpleString queueD = new SimpleString("queueD"); + public final SimpleString addressA = SimpleString.of("addressA"); + public final SimpleString addressB = SimpleString.of("addressB"); + public final SimpleString queueA = SimpleString.of("queueA"); + public final SimpleString queueB = SimpleString.of("queueB"); + public final SimpleString queueC = SimpleString.of("queueC"); + public final SimpleString queueD = SimpleString.of("queueD"); private ServerLocator locator; private ActiveMQServer server; @@ -142,12 +142,12 @@ public class RoutingTest extends ActiveMQTestBase { @Test public void testRouteToSingleQueueWithFilter() throws Exception { ClientSession sendSession = cf.createSession(false, true, true); - sendSession.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setFilterString(new SimpleString("foo = 'bar'")).setDurable(false)); + sendSession.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setFilterString(SimpleString.of("foo = 'bar'")).setDurable(false)); int numMessages = 300; ClientProducer p = sendSession.createProducer(addressA); for (int i = 0; i < numMessages; i++) { ClientMessage clientMessage = sendSession.createMessage(false); - clientMessage.putStringProperty(new SimpleString("foo"), new SimpleString("bar")); + clientMessage.putStringProperty(SimpleString.of("foo"), SimpleString.of("bar")); p.send(clientMessage); } ClientSession session = cf.createSession(false, true, true); @@ -166,19 +166,19 @@ public class RoutingTest extends ActiveMQTestBase { @Test public void testRouteToMultipleQueueWithFilters() throws Exception { ClientSession sendSession = cf.createSession(false, true, true); - 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)); + sendSession.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setFilterString(SimpleString.of("foo = 'bar'")).setDurable(false)); + sendSession.createQueue(new QueueConfiguration(queueB).setAddress(addressA).setFilterString(SimpleString.of("x = 1")).setDurable(false)); + sendSession.createQueue(new QueueConfiguration(queueC).setAddress(addressA).setFilterString(SimpleString.of("b = false")).setDurable(false)); int numMessages = 300; ClientProducer p = sendSession.createProducer(addressA); for (int i = 0; i < numMessages; i++) { ClientMessage clientMessage = sendSession.createMessage(false); if (i % 3 == 0) { - clientMessage.putStringProperty(new SimpleString("foo"), new SimpleString("bar")); + clientMessage.putStringProperty(SimpleString.of("foo"), SimpleString.of("bar")); } else if (i % 3 == 1) { - clientMessage.putIntProperty(new SimpleString("x"), 1); + clientMessage.putIntProperty(SimpleString.of("x"), 1); } else { - clientMessage.putBooleanProperty(new SimpleString("b"), false); + clientMessage.putBooleanProperty(SimpleString.of("b"), false); } p.send(clientMessage); } 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 64fdb4914f..af91a6aec2 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 @@ -36,7 +36,7 @@ public class SelfExpandingBufferTest extends ActiveMQTestBase { ActiveMQServer service; - SimpleString ADDRESS = new SimpleString("Address"); + SimpleString ADDRESS = SimpleString.of("Address"); @Test public void testSelfExpandingBufferNettyPersistent() throws Exception { 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 d76f6a9ebc..f9b959676e 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 @@ -152,7 +152,7 @@ public class SendAckFailTest extends SpawnedTestBase { ClientSessionFactory sf = locator.createSessionFactory(); ClientSession session = sf.createSession(); - session.createAddress(SimpleString.toSimpleString("T1"), RoutingType.ANYCAST, true); + session.createAddress(SimpleString.of("T1"), RoutingType.ANYCAST, 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/SessionCreateAndDeleteQueueTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionCreateAndDeleteQueueTest.java index 1357ded444..ee17bed070 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 @@ -42,9 +42,9 @@ public class SessionCreateAndDeleteQueueTest extends ActiveMQTestBase { private ActiveMQServer server; - private final SimpleString address = new SimpleString("address"); + private final SimpleString address = SimpleString.of("address"); - private final SimpleString queueName = new SimpleString("queue"); + private final SimpleString queueName = SimpleString.of("queue"); private ServerLocator locator; @@ -95,7 +95,7 @@ public class SessionCreateAndDeleteQueueTest extends ActiveMQTestBase { @Test public void testcreateWithFilter() throws Exception { ClientSession session = createSessionFactory(locator).createSession(false, true, true); - SimpleString filterString = new SimpleString("x=y"); + SimpleString filterString = SimpleString.of("x=y"); session.createQueue(new QueueConfiguration(queueName).setAddress(address).setFilterString(filterString).setDurable(false)); Binding binding = server.getPostOffice().getBinding(queueName); Queue q = (Queue) binding.getBindable(); @@ -108,7 +108,7 @@ public class SessionCreateAndDeleteQueueTest extends ActiveMQTestBase { public void testAddressSettingUSed() throws Exception { server.getAddressSettingsRepository().addMatch(address.toString(), new AddressSettings().setDefaultLastValueQueue(true)); ClientSession session = createSessionFactory(locator).createSession(false, true, true); - SimpleString filterString = new SimpleString("x=y"); + SimpleString filterString = SimpleString.of("x=y"); session.createQueue(new QueueConfiguration(queueName).setAddress(address).setFilterString(filterString).setDurable(false)); Binding binding = server.getPostOffice().getBinding(queueName); assertTrue(binding.getBindable() instanceof LastValueQueue); 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 6eeb06e6e8..f20c2aa0ea 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 @@ -41,9 +41,9 @@ public class SessionSendAcknowledgementHandlerTest extends ActiveMQTestBase { private ActiveMQServer server; - private final SimpleString address = new SimpleString("address"); + private final SimpleString address = SimpleString.of("address"); - private final SimpleString queueName = new SimpleString("queue"); + private final SimpleString queueName = SimpleString.of("queue"); @Override @BeforeEach 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 f44cf625e9..7f1fe7de3b 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 @@ -47,7 +47,7 @@ public class SessionStopStartTest extends ActiveMQTestBase { private ActiveMQServer server; - private final SimpleString QUEUE = new SimpleString("ConsumerTestQueue"); + private final SimpleString QUEUE = SimpleString.of("ConsumerTestQueue"); private ServerLocator locator; @@ -75,7 +75,7 @@ public class SessionStopStartTest extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = createTextMessage(session, "m" + i); - message.putIntProperty(new SimpleString("i"), i); + message.putIntProperty(SimpleString.of("i"), i); producer.send(message); } @@ -116,7 +116,7 @@ public class SessionStopStartTest extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = createTextMessage(session, "m" + i); - message.putIntProperty(new SimpleString("i"), i); + message.putIntProperty(SimpleString.of("i"), i); producer.send(message); } @@ -160,7 +160,7 @@ public class SessionStopStartTest extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = createTextMessage(session, "m" + i); - message.putIntProperty(new SimpleString("i"), i); + message.putIntProperty(SimpleString.of("i"), i); producer.send(message); } @@ -239,7 +239,7 @@ public class SessionStopStartTest extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = createTextMessage(session, "m" + i); - message.putIntProperty(new SimpleString("i"), i); + message.putIntProperty(SimpleString.of("i"), i); producer.send(message); } @@ -323,7 +323,7 @@ public class SessionStopStartTest extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = createTextMessage(session, "m" + i); - message.putIntProperty(new SimpleString("i"), i); + message.putIntProperty(SimpleString.of("i"), i); producer.send(message); } @@ -417,7 +417,7 @@ public class SessionStopStartTest extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = createTextMessage(session, "m" + i); - message.putIntProperty(new SimpleString("i"), i); + message.putIntProperty(SimpleString.of("i"), i); producer.send(message); } @@ -525,7 +525,7 @@ public class SessionStopStartTest extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = createTextMessage(session, "m" + i); - message.putIntProperty(new SimpleString("i"), i); + message.putIntProperty(SimpleString.of("i"), i); producer.send(message); } @@ -577,7 +577,7 @@ public class SessionStopStartTest extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = createTextMessage(session, "m" + i); - message.putIntProperty(new SimpleString("i"), i); + message.putIntProperty(SimpleString.of("i"), i); producer.send(message); } @@ -615,7 +615,7 @@ public class SessionStopStartTest extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = createTextMessage(session, "m" + i); - message.putIntProperty(new SimpleString("i"), i); + message.putIntProperty(SimpleString.of("i"), i); producer.send(message); } 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 a7d23b4378..2206036352 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 @@ -205,20 +205,20 @@ public class SessionTest extends ActiveMQTestBase { 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")); + ClientSession.AddressQuery resp = clientSession.addressQuery(SimpleString.of("a")); List queues = resp.getQueueNames(); assertTrue(queues.isEmpty()); - resp = clientSession.addressQuery(new SimpleString("a1")); + resp = clientSession.addressQuery(SimpleString.of("a1")); queues = resp.getQueueNames(); assertEquals(queues.size(), 2); - assertTrue(queues.contains(new SimpleString("q1"))); - assertTrue(queues.contains(new SimpleString("q2"))); - resp = clientSession.addressQuery(new SimpleString("a2")); + assertTrue(queues.contains(SimpleString.of("q1"))); + assertTrue(queues.contains(SimpleString.of("q2"))); + resp = clientSession.addressQuery(SimpleString.of("a2")); queues = resp.getQueueNames(); assertEquals(queues.size(), 3); - assertTrue(queues.contains(new SimpleString("q3"))); - assertTrue(queues.contains(new SimpleString("q4"))); - assertTrue(queues.contains(new SimpleString("q5"))); + assertTrue(queues.contains(SimpleString.of("q3"))); + assertTrue(queues.contains(SimpleString.of("q4"))); + assertTrue(queues.contains(SimpleString.of("q5"))); clientSession.close(); } @@ -242,8 +242,8 @@ public class SessionTest extends ActiveMQTestBase { Wait.assertEquals(2, queue::getMessageCount); Wait.assertEquals(2, queue::getConsumerCount); - QueueQuery resp = clientSession.queueQuery(new SimpleString(queueName)); - assertEquals(new SimpleString("a1"), resp.getAddress()); + QueueQuery resp = clientSession.queueQuery(SimpleString.of(queueName)); + assertEquals(SimpleString.of("a1"), resp.getAddress()); assertEquals(2, resp.getConsumerCount()); assertEquals(2, resp.getMessageCount()); assertNull(resp.getFilterString()); @@ -253,7 +253,7 @@ public class SessionTest extends ActiveMQTestBase { } private Queue flushQueue() throws Exception { - Queue queue = server.locateQueue(SimpleString.toSimpleString(queueName)); + Queue queue = server.locateQueue(SimpleString.of(queueName)); assertNotNull(queue); queue.flushExecutor(); return queue; @@ -271,11 +271,11 @@ public class SessionTest extends ActiveMQTestBase { clientSession.createConsumer(queueName); clientSession.createConsumer(queueName); - QueueQuery resp = clientSession.queueQuery(new SimpleString(queueName)); - assertEquals(new SimpleString("a1"), resp.getAddress()); + QueueQuery resp = clientSession.queueQuery(SimpleString.of(queueName)); + assertEquals(SimpleString.of("a1"), resp.getAddress()); assertEquals(2, resp.getConsumerCount()); assertEquals(0, resp.getMessageCount()); - assertEquals(new SimpleString("foo=bar"), resp.getFilterString()); + assertEquals(SimpleString.of("foo=bar"), resp.getFilterString()); clientSession.close(); } @@ -284,7 +284,7 @@ public class SessionTest extends ActiveMQTestBase { server.getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateQueues(false)); cf = createSessionFactory(locator); ClientSession clientSession = cf.createSession(false, true, true); - QueueQuery resp = clientSession.queueQuery(new SimpleString(queueName)); + QueueQuery resp = clientSession.queueQuery(SimpleString.of(queueName)); assertFalse(resp.isExists()); assertFalse(resp.isAutoCreateQueues()); assertEquals(queueName, resp.getAddress().toString()); @@ -399,7 +399,7 @@ public class SessionTest extends ActiveMQTestBase { for (int i = 0; i < 10; i++) { cp.send(clientSession.createMessage(false)); } - Queue q = (Queue) server.getPostOffice().getBinding(new SimpleString(queueName)).getBindable(); + Queue q = (Queue) server.getPostOffice().getBinding(SimpleString.of(queueName)).getBindable(); Wait.assertEquals(0, () -> getMessageCount(q)); clientSession.commit(); assertTrue(Wait.waitFor(() -> getMessageCount(q) == 10, 2000, 100)); @@ -419,7 +419,7 @@ public class SessionTest extends ActiveMQTestBase { for (int i = 0; i < 10; i++) { cp.send(clientSession.createMessage(false)); } - Queue q = (Queue) server.getPostOffice().getBinding(new SimpleString(queueName)).getBindable(); + Queue q = (Queue) server.getPostOffice().getBinding(SimpleString.of(queueName)).getBindable(); Wait.assertEquals(0, () -> getMessageCount(q)); clientSession.rollback(); cp.send(clientSession.createMessage(false)); @@ -444,7 +444,7 @@ public class SessionTest extends ActiveMQTestBase { for (int i = 0; i < 10; i++) { cp.send(clientSession.createMessage(false)); } - Queue q = (Queue) server.getPostOffice().getBinding(new SimpleString(queueName)).getBindable(); + Queue q = (Queue) server.getPostOffice().getBinding(SimpleString.of(queueName)).getBindable(); Wait.assertEquals(10, () -> getMessageCount(q)); ClientConsumer cc = clientSession.createConsumer(queueName); clientSession.start(); @@ -476,7 +476,7 @@ public class SessionTest extends ActiveMQTestBase { for (int i = 0; i < 10; i++) { cp.send(clientSession.createMessage(false)); } - Queue q = (Queue) server.getPostOffice().getBinding(new SimpleString(queueName)).getBindable(); + Queue q = (Queue) server.getPostOffice().getBinding(SimpleString.of(queueName)).getBindable(); Wait.assertEquals(10, () -> getMessageCount(q)); ClientConsumer cc = clientSession.createConsumer(queueName); clientSession.start(); @@ -502,8 +502,8 @@ public class SessionTest extends ActiveMQTestBase { public void testCreateQueue() throws Exception { cf = createSessionFactory(locator); ClientSession clientSession = addClientSession(cf.createSession(false, true, true)); - SimpleString queueName = SimpleString.toSimpleString(UUID.randomUUID().toString()); - SimpleString addressName = SimpleString.toSimpleString(UUID.randomUUID().toString()); + SimpleString queueName = SimpleString.of(UUID.randomUUID().toString()); + SimpleString addressName = SimpleString.of(UUID.randomUUID().toString()); { if (legacyCreateQueue) { clientSession.createQueue(addressName, RoutingType.ANYCAST, queueName); @@ -556,7 +556,7 @@ public class SessionTest extends ActiveMQTestBase { } { if (legacyCreateQueue) { - clientSession.createQueue(addressName, RoutingType.ANYCAST, queueName, SimpleString.toSimpleString("filter"), true); + clientSession.createQueue(addressName, RoutingType.ANYCAST, queueName, SimpleString.of("filter"), true); } else { clientSession.createQueue(new QueueConfiguration(queueName).setAddress(addressName).setRoutingType(RoutingType.ANYCAST).setFilterString("filter")); } @@ -584,7 +584,7 @@ public class SessionTest extends ActiveMQTestBase { } { if (legacyCreateQueue) { - clientSession.createQueue(addressName, RoutingType.ANYCAST, queueName, SimpleString.toSimpleString("filter"), true, true); + clientSession.createQueue(addressName, RoutingType.ANYCAST, queueName, SimpleString.of("filter"), true, true); } else { clientSession.createQueue(new QueueConfiguration(queueName).setAddress(addressName).setRoutingType(RoutingType.ANYCAST).setFilterString("filter").setAutoCreated(true)); } @@ -614,7 +614,7 @@ public class SessionTest extends ActiveMQTestBase { } { if (legacyCreateQueue) { - clientSession.createQueue(addressName, RoutingType.ANYCAST, queueName, SimpleString.toSimpleString("filter"), true, true, 0, true); + clientSession.createQueue(addressName, RoutingType.ANYCAST, queueName, SimpleString.of("filter"), true, true, 0, true); } else { clientSession.createQueue(new QueueConfiguration(queueName).setAddress(addressName).setRoutingType(RoutingType.ANYCAST).setFilterString("filter").setAutoCreated(true).setMaxConsumers(0).setPurgeOnNoConsumers(true)); } @@ -648,7 +648,7 @@ public class SessionTest extends ActiveMQTestBase { } { if (legacyCreateQueue) { - clientSession.createQueue(addressName, RoutingType.ANYCAST, queueName, SimpleString.toSimpleString("filter"), true, true, 0, true, true, true); + clientSession.createQueue(addressName, RoutingType.ANYCAST, queueName, SimpleString.of("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)); } 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 c7240816bd..fc055fa390 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 @@ -72,7 +72,7 @@ public class SlowConsumerTest extends ActiveMQTestBase { private ActiveMQServer server; - private final SimpleString QUEUE = new SimpleString("ConsumerTestQueue"); + private final SimpleString QUEUE = SimpleString.of("ConsumerTestQueue"); private ServerLocator locator; @@ -267,7 +267,7 @@ public class SlowConsumerTest extends ActiveMQTestBase { if (isNetty) { assertTrue(message.getSimpleStringProperty(ManagementHelper.HDR_REMOTE_ADDRESS).toString().startsWith("/127.0.0.1")); } else { - assertEquals(SimpleString.toSimpleString("invm:0"), message.getSimpleStringProperty(ManagementHelper.HDR_REMOTE_ADDRESS)); + assertEquals(SimpleString.of("invm:0"), message.getSimpleStringProperty(ManagementHelper.HDR_REMOTE_ADDRESS)); } assertNotNull(message.getSimpleStringProperty(ManagementHelper.HDR_CONNECTION_NAME)); assertNotNull(message.getSimpleStringProperty(ManagementHelper.HDR_CONSUMER_NAME)); @@ -380,12 +380,12 @@ public class SlowConsumerTest extends ActiveMQTestBase { @Test public void testSlowWildcardConsumer() throws Exception { - SimpleString addressAB = new SimpleString("a.b"); - SimpleString addressAC = new SimpleString("a.c"); - SimpleString address = new SimpleString("a.*"); - SimpleString queueName1 = new SimpleString("Q1"); - SimpleString queueName2 = new SimpleString("Q2"); - SimpleString queueName = new SimpleString("Q"); + SimpleString addressAB = SimpleString.of("a.b"); + SimpleString addressAC = SimpleString.of("a.c"); + SimpleString address = SimpleString.of("a.*"); + SimpleString queueName1 = SimpleString.of("Q1"); + SimpleString queueName2 = SimpleString.of("Q2"); + SimpleString queueName = SimpleString.of("Q"); AddressSettings addressSettings = new AddressSettings(); addressSettings.setSlowConsumerCheckPeriod(2); 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 f19b466574..025d50f978 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 @@ -50,11 +50,11 @@ public class TransactionDurabilityTest extends ActiveMQTestBase { */ @Test public void testRolledBackAcknowledgeWithSameMessageAckedByOtherSession() throws Exception { - final SimpleString testAddress = new SimpleString("testAddress"); + final SimpleString testAddress = SimpleString.of("testAddress"); - final SimpleString queue1 = new SimpleString("queue1"); + final SimpleString queue1 = SimpleString.of("queue1"); - final SimpleString queue2 = new SimpleString("queue2"); + final SimpleString queue2 = SimpleString.of("queue2"); ActiveMQServer server = createServer(true, createDefaultInVMConfig()); 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 43444a99b4..31d7b80a88 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 @@ -33,13 +33,13 @@ import org.junit.jupiter.api.Test; public class TransactionalSendTest extends ActiveMQTestBase { - public final SimpleString addressA = new SimpleString("addressA"); + public final SimpleString addressA = SimpleString.of("addressA"); - public final SimpleString queueA = new SimpleString("queueA"); + public final SimpleString queueA = SimpleString.of("queueA"); - public final SimpleString queueB = new SimpleString("queueB"); + public final SimpleString queueB = SimpleString.of("queueB"); - public final SimpleString queueC = new SimpleString("queueC"); + public final SimpleString queueC = SimpleString.of("queueC"); private ServerLocator locator; 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 695622b850..b175ed165c 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 @@ -68,8 +68,8 @@ public class TransientQueueTest extends SingleServerTestBase { @Test public void testMultipleConsumers() throws Exception { - SimpleString queue = SimpleString.toSimpleString("queue"); - SimpleString address = SimpleString.toSimpleString("address"); + SimpleString queue = SimpleString.of("queue"); + SimpleString address = SimpleString.of("address"); session.createSharedQueue(new QueueConfiguration(queue).setAddress(address).setDurable(false)); assertEquals(1, server.getConnectionCount()); @@ -179,7 +179,7 @@ public class TransientQueueTest extends SingleServerTestBase { try { // There's already a queue with that name, we are supposed to throw an exception - session2.createSharedQueue(new QueueConfiguration(queue).setAddress(address).setFilterString(SimpleString.toSimpleString("a=1")).setDurable(false)); + session2.createSharedQueue(new QueueConfiguration(queue).setAddress(address).setFilterString(SimpleString.of("a=1")).setDurable(false)); } catch (ActiveMQInvalidTransientQueueUseException e) { exHappened = true; } @@ -192,13 +192,13 @@ public class TransientQueueTest extends SingleServerTestBase { Wait.assertTrue(() -> server.locateQueue(queue) == null, 2000, 100); Wait.assertTrue(() -> server.getAddressInfo(queue) == null, 2000, 100); - session.createSharedQueue(new QueueConfiguration(queue).setAddress(address).setFilterString(SimpleString.toSimpleString("q=1")).setDurable(false)); + session.createSharedQueue(new QueueConfiguration(queue).setAddress(address).setFilterString(SimpleString.of("q=1")).setDurable(false)); exHappened = false; try { // There's already a queue with that name, we are supposed to throw an exception - session2.createSharedQueue(new QueueConfiguration(queue).setAddress(address).setFilterString(SimpleString.toSimpleString("q=2")).setDurable(false)); + session2.createSharedQueue(new QueueConfiguration(queue).setAddress(address).setFilterString(SimpleString.of("q=2")).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 a93d512c39..faabd9ab55 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 @@ -52,9 +52,9 @@ public class UpdateQueueTest extends ActiveMQTestBase { server.start(); - SimpleString ADDRESS = SimpleString.toSimpleString("queue.0"); + SimpleString ADDRESS = SimpleString.of("queue.0"); - final SimpleString user = new SimpleString("newUser"); + final SimpleString user = SimpleString.of("newUser"); Queue queue = server.createQueue(new QueueConfiguration(ADDRESS).setRoutingType(RoutingType.ANYCAST).setUser(user)); @@ -122,7 +122,7 @@ public class UpdateQueueTest extends ActiveMQTestBase { server.start(); - SimpleString ADDRESS = SimpleString.toSimpleString("queue.0"); + SimpleString ADDRESS = SimpleString.of("queue.0"); Queue queue = server.createQueue(new QueueConfiguration(ADDRESS).setRoutingType(RoutingType.ANYCAST)); @@ -217,7 +217,7 @@ public class UpdateQueueTest extends ActiveMQTestBase { server.start(); - SimpleString ADDRESS = SimpleString.toSimpleString("queue.0"); + SimpleString ADDRESS = SimpleString.of("queue.0"); AddressInfo infoAdded = new AddressInfo(ADDRESS, RoutingType.ANYCAST); 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 cf19161161..59a437c9a4 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 @@ -44,12 +44,12 @@ public class WildCardRoutingTest extends ActiveMQTestBase { @Test public void testBasicWildcardRouting() throws Exception { - SimpleString addressAB = new SimpleString("a.b"); - SimpleString addressAC = new SimpleString("a.c"); - SimpleString address = new SimpleString("a.*"); - SimpleString queueName1 = new SimpleString("Q1"); - SimpleString queueName2 = new SimpleString("Q2"); - SimpleString queueName = new SimpleString("Q"); + SimpleString addressAB = SimpleString.of("a.b"); + SimpleString addressAC = SimpleString.of("a.c"); + SimpleString address = SimpleString.of("a.*"); + SimpleString queueName1 = SimpleString.of("Q1"); + SimpleString queueName2 = SimpleString.of("Q2"); + SimpleString queueName = SimpleString.of("Q"); 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)); @@ -73,10 +73,10 @@ public class WildCardRoutingTest extends ActiveMQTestBase { @Test public void testBasicWildcardRoutingQueuesDontExist() throws Exception { - SimpleString addressAB = new SimpleString("a.b"); - SimpleString addressAC = new SimpleString("a.c"); - SimpleString address = new SimpleString("a.*"); - SimpleString queueName = new SimpleString("Q"); + SimpleString addressAB = SimpleString.of("a.b"); + SimpleString addressAC = SimpleString.of("a.c"); + SimpleString address = SimpleString.of("a.*"); + SimpleString queueName = SimpleString.of("Q"); clientSession.createQueue(new QueueConfiguration(queueName).setAddress(address).setDurable(false)); ClientProducer producer = clientSession.createProducer(addressAB); ClientProducer producer2 = clientSession.createProducer(addressAC); @@ -104,11 +104,11 @@ public class WildCardRoutingTest extends ActiveMQTestBase { @Test public void testBasicWildcardRoutingQueuesDontExist2() throws Exception { - SimpleString addressAB = new SimpleString("a.b"); - SimpleString addressAC = new SimpleString("a.c"); - SimpleString address = new SimpleString("a.*"); - SimpleString queueName = new SimpleString("Q"); - SimpleString queueName2 = new SimpleString("Q2"); + SimpleString addressAB = SimpleString.of("a.b"); + SimpleString addressAC = SimpleString.of("a.c"); + SimpleString address = SimpleString.of("a.*"); + SimpleString queueName = SimpleString.of("Q"); + SimpleString queueName2 = SimpleString.of("Q2"); clientSession.createQueue(new QueueConfiguration(queueName).setAddress(address).setDurable(false)); clientSession.createQueue(new QueueConfiguration(queueName2).setAddress(address).setDurable(false)); ClientProducer producer = clientSession.createProducer(addressAB); @@ -143,12 +143,12 @@ public class WildCardRoutingTest extends ActiveMQTestBase { @Test public void testBasicWildcardRoutingWithHash() throws Exception { - SimpleString addressAB = new SimpleString("a.b"); - SimpleString addressAC = new SimpleString("a.c"); - SimpleString address = new SimpleString("a.#"); - SimpleString queueName1 = new SimpleString("Q1"); - SimpleString queueName2 = new SimpleString("Q2"); - SimpleString queueName = new SimpleString("Q"); + SimpleString addressAB = SimpleString.of("a.b"); + SimpleString addressAC = SimpleString.of("a.c"); + SimpleString address = SimpleString.of("a.#"); + SimpleString queueName1 = SimpleString.of("Q1"); + SimpleString queueName2 = SimpleString.of("Q2"); + SimpleString queueName = SimpleString.of("Q"); 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)); @@ -172,12 +172,12 @@ public class WildCardRoutingTest extends ActiveMQTestBase { @Test public void testWildcardRoutingQueuesAddedAfter() throws Exception { - SimpleString addressAB = new SimpleString("a.b"); - SimpleString addressAC = new SimpleString("a.c"); - SimpleString address = new SimpleString("a.*"); - SimpleString queueName1 = new SimpleString("Q1"); - SimpleString queueName2 = new SimpleString("Q2"); - SimpleString queueName = new SimpleString("Q"); + SimpleString addressAB = SimpleString.of("a.b"); + SimpleString addressAC = SimpleString.of("a.c"); + SimpleString address = SimpleString.of("a.*"); + SimpleString queueName1 = SimpleString.of("Q1"); + SimpleString queueName2 = SimpleString.of("Q2"); + SimpleString queueName = SimpleString.of("Q"); clientSession.createQueue(new QueueConfiguration(queueName).setAddress(address).setDurable(false)); ClientProducer producer = clientSession.createProducer(addressAB); ClientProducer producer2 = clientSession.createProducer(addressAC); @@ -201,12 +201,12 @@ public class WildCardRoutingTest extends ActiveMQTestBase { @Test public void testWildcardRoutingQueuesAddedThenDeleted() throws Exception { - SimpleString addressAB = new SimpleString("a.b"); - SimpleString addressAC = new SimpleString("a.c"); - SimpleString address = new SimpleString("a.*"); - SimpleString queueName1 = new SimpleString("Q1"); - SimpleString queueName2 = new SimpleString("Q2"); - SimpleString queueName = new SimpleString("Q"); + SimpleString addressAB = SimpleString.of("a.b"); + SimpleString addressAC = SimpleString.of("a.c"); + SimpleString address = SimpleString.of("a.*"); + SimpleString queueName1 = SimpleString.of("Q1"); + SimpleString queueName2 = SimpleString.of("Q2"); + SimpleString queueName = SimpleString.of("Q"); 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)); @@ -234,26 +234,26 @@ public class WildCardRoutingTest extends ActiveMQTestBase { @Test public void testWildcardRoutingLotsOfQueuesAddedThenDeleted() throws Exception { - SimpleString addressAB = new SimpleString("a.b"); - SimpleString addressAC = new SimpleString("a.c"); - SimpleString addressAD = new SimpleString("a.d"); - SimpleString addressAE = new SimpleString("a.e"); - SimpleString addressAF = new SimpleString("a.f"); - SimpleString addressAG = new SimpleString("a.g"); - SimpleString addressAH = new SimpleString("a.h"); - SimpleString addressAJ = new SimpleString("a.j"); - SimpleString addressAK = new SimpleString("a.k"); - SimpleString address = new SimpleString("a.*"); - SimpleString queueName1 = new SimpleString("Q1"); - SimpleString queueName2 = new SimpleString("Q2"); - SimpleString queueName3 = new SimpleString("Q3"); - SimpleString queueName4 = new SimpleString("Q4"); - SimpleString queueName5 = new SimpleString("Q5"); - SimpleString queueName6 = new SimpleString("Q6"); - SimpleString queueName7 = new SimpleString("Q7"); - SimpleString queueName8 = new SimpleString("Q8"); - SimpleString queueName9 = new SimpleString("Q9"); - SimpleString queueName = new SimpleString("Q"); + SimpleString addressAB = SimpleString.of("a.b"); + SimpleString addressAC = SimpleString.of("a.c"); + SimpleString addressAD = SimpleString.of("a.d"); + SimpleString addressAE = SimpleString.of("a.e"); + SimpleString addressAF = SimpleString.of("a.f"); + SimpleString addressAG = SimpleString.of("a.g"); + SimpleString addressAH = SimpleString.of("a.h"); + SimpleString addressAJ = SimpleString.of("a.j"); + SimpleString addressAK = SimpleString.of("a.k"); + SimpleString address = SimpleString.of("a.*"); + SimpleString queueName1 = SimpleString.of("Q1"); + SimpleString queueName2 = SimpleString.of("Q2"); + SimpleString queueName3 = SimpleString.of("Q3"); + SimpleString queueName4 = SimpleString.of("Q4"); + SimpleString queueName5 = SimpleString.of("Q5"); + SimpleString queueName6 = SimpleString.of("Q6"); + SimpleString queueName7 = SimpleString.of("Q7"); + SimpleString queueName8 = SimpleString.of("Q8"); + SimpleString queueName9 = SimpleString.of("Q9"); + SimpleString queueName = SimpleString.of("Q"); 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)); @@ -331,26 +331,26 @@ public class WildCardRoutingTest extends ActiveMQTestBase { @Test public void testWildcardRoutingLotsOfQueuesAddedThenDeletedHash() throws Exception { - SimpleString addressAB = new SimpleString("a.b"); - SimpleString addressAC = new SimpleString("a.c"); - SimpleString addressAD = new SimpleString("a.d"); - SimpleString addressAE = new SimpleString("a.e"); - SimpleString addressAF = new SimpleString("a.f"); - SimpleString addressAG = new SimpleString("a.g"); - SimpleString addressAH = new SimpleString("a.h"); - SimpleString addressAJ = new SimpleString("a.j"); - SimpleString addressAK = new SimpleString("a.k"); - SimpleString address = new SimpleString("#"); - SimpleString queueName1 = new SimpleString("Q1"); - SimpleString queueName2 = new SimpleString("Q2"); - SimpleString queueName3 = new SimpleString("Q3"); - SimpleString queueName4 = new SimpleString("Q4"); - SimpleString queueName5 = new SimpleString("Q5"); - SimpleString queueName6 = new SimpleString("Q6"); - SimpleString queueName7 = new SimpleString("Q7"); - SimpleString queueName8 = new SimpleString("Q8"); - SimpleString queueName9 = new SimpleString("Q9"); - SimpleString queueName = new SimpleString("Q"); + SimpleString addressAB = SimpleString.of("a.b"); + SimpleString addressAC = SimpleString.of("a.c"); + SimpleString addressAD = SimpleString.of("a.d"); + SimpleString addressAE = SimpleString.of("a.e"); + SimpleString addressAF = SimpleString.of("a.f"); + SimpleString addressAG = SimpleString.of("a.g"); + SimpleString addressAH = SimpleString.of("a.h"); + SimpleString addressAJ = SimpleString.of("a.j"); + SimpleString addressAK = SimpleString.of("a.k"); + SimpleString address = SimpleString.of("#"); + SimpleString queueName1 = SimpleString.of("Q1"); + SimpleString queueName2 = SimpleString.of("Q2"); + SimpleString queueName3 = SimpleString.of("Q3"); + SimpleString queueName4 = SimpleString.of("Q4"); + SimpleString queueName5 = SimpleString.of("Q5"); + SimpleString queueName6 = SimpleString.of("Q6"); + SimpleString queueName7 = SimpleString.of("Q7"); + SimpleString queueName8 = SimpleString.of("Q8"); + SimpleString queueName9 = SimpleString.of("Q9"); + SimpleString queueName = SimpleString.of("Q"); 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)); @@ -428,12 +428,12 @@ public class WildCardRoutingTest extends ActiveMQTestBase { @Test public void testWildcardRoutingWithSingleHash() throws Exception { - SimpleString addressAB = new SimpleString("a.b"); - SimpleString addressAC = new SimpleString("a.c"); - SimpleString address = new SimpleString("#"); - SimpleString queueName1 = new SimpleString("Q1"); - SimpleString queueName2 = new SimpleString("Q2"); - SimpleString queueName = new SimpleString("Q"); + SimpleString addressAB = SimpleString.of("a.b"); + SimpleString addressAC = SimpleString.of("a.c"); + SimpleString address = SimpleString.of("#"); + SimpleString queueName1 = SimpleString.of("Q1"); + SimpleString queueName2 = SimpleString.of("Q2"); + SimpleString queueName = SimpleString.of("Q"); 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)); @@ -457,12 +457,12 @@ public class WildCardRoutingTest extends ActiveMQTestBase { @Test public void testWildcardRoutingWithHash() throws Exception { - SimpleString addressAB = new SimpleString("a.b.f"); - SimpleString addressAC = new SimpleString("a.c.f"); - SimpleString address = new SimpleString("a.#.f"); - SimpleString queueName1 = new SimpleString("Q1"); - SimpleString queueName2 = new SimpleString("Q2"); - SimpleString queueName = new SimpleString("Q"); + SimpleString addressAB = SimpleString.of("a.b.f"); + SimpleString addressAC = SimpleString.of("a.c.f"); + SimpleString address = SimpleString.of("a.#.f"); + SimpleString queueName1 = SimpleString.of("Q1"); + SimpleString queueName2 = SimpleString.of("Q2"); + SimpleString queueName = SimpleString.of("Q"); 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)); @@ -486,12 +486,12 @@ public class WildCardRoutingTest extends ActiveMQTestBase { @Test public void testWildcardRoutingWithHashMultiLengthAddresses() throws Exception { - SimpleString addressAB = new SimpleString("a.b.c.f"); - SimpleString addressAC = new SimpleString("a.c.f"); - SimpleString address = new SimpleString("a.#.f"); - SimpleString queueName1 = new SimpleString("Q1"); - SimpleString queueName2 = new SimpleString("Q2"); - SimpleString queueName = new SimpleString("Q"); + SimpleString addressAB = SimpleString.of("a.b.c.f"); + SimpleString addressAC = SimpleString.of("a.c.f"); + SimpleString address = SimpleString.of("a.#.f"); + SimpleString queueName1 = SimpleString.of("Q1"); + SimpleString queueName2 = SimpleString.of("Q2"); + SimpleString queueName = SimpleString.of("Q"); 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)); @@ -515,12 +515,12 @@ public class WildCardRoutingTest extends ActiveMQTestBase { @Test public void testWildcardRoutingWithDoubleStar() throws Exception { - SimpleString addressAB = new SimpleString("a.b"); - SimpleString addressAC = new SimpleString("a.c"); - SimpleString address = new SimpleString("*.*"); - SimpleString queueName1 = new SimpleString("Q1"); - SimpleString queueName2 = new SimpleString("Q2"); - SimpleString queueName = new SimpleString("Q"); + SimpleString addressAB = SimpleString.of("a.b"); + SimpleString addressAC = SimpleString.of("a.c"); + SimpleString address = SimpleString.of("*.*"); + SimpleString queueName1 = SimpleString.of("Q1"); + SimpleString queueName2 = SimpleString.of("Q2"); + SimpleString queueName = SimpleString.of("Q"); 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)); @@ -544,12 +544,12 @@ public class WildCardRoutingTest extends ActiveMQTestBase { @Test public void testWildcardRoutingPartialMatchStar() throws Exception { - SimpleString addressAB = new SimpleString("a.b"); - SimpleString addressAC = new SimpleString("a.c"); - SimpleString address = new SimpleString("*.b"); - SimpleString queueName1 = new SimpleString("Q1"); - SimpleString queueName2 = new SimpleString("Q2"); - SimpleString queueName = new SimpleString("Q"); + SimpleString addressAB = SimpleString.of("a.b"); + SimpleString addressAC = SimpleString.of("a.c"); + SimpleString address = SimpleString.of("*.b"); + SimpleString queueName1 = SimpleString.of("Q1"); + SimpleString queueName2 = SimpleString.of("Q2"); + SimpleString queueName = SimpleString.of("Q"); 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)); @@ -569,12 +569,12 @@ public class WildCardRoutingTest extends ActiveMQTestBase { @Test public void testWildcardRoutingVariableLengths() throws Exception { - SimpleString addressAB = new SimpleString("a.b.c"); - SimpleString addressAC = new SimpleString("a.c"); - SimpleString address = new SimpleString("a.#"); - SimpleString queueName1 = new SimpleString("Q1"); - SimpleString queueName2 = new SimpleString("Q2"); - SimpleString queueName = new SimpleString("Q"); + SimpleString addressAB = SimpleString.of("a.b.c"); + SimpleString addressAC = SimpleString.of("a.c"); + SimpleString address = SimpleString.of("a.#"); + SimpleString queueName1 = SimpleString.of("Q1"); + SimpleString queueName2 = SimpleString.of("Q2"); + SimpleString queueName = SimpleString.of("Q"); 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)); @@ -596,12 +596,12 @@ public class WildCardRoutingTest extends ActiveMQTestBase { @Test public void testWildcardRoutingVariableLengthsStar() throws Exception { - SimpleString addressAB = new SimpleString("a.b.c"); - SimpleString addressAC = new SimpleString("a.c"); - SimpleString address = new SimpleString("a.*"); - SimpleString queueName1 = new SimpleString("Q1"); - SimpleString queueName2 = new SimpleString("Q2"); - SimpleString queueName = new SimpleString("Q"); + SimpleString addressAB = SimpleString.of("a.b.c"); + SimpleString addressAC = SimpleString.of("a.c"); + SimpleString address = SimpleString.of("a.*"); + SimpleString queueName1 = SimpleString.of("Q1"); + SimpleString queueName2 = SimpleString.of("Q2"); + SimpleString queueName = SimpleString.of("Q"); 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)); @@ -621,12 +621,12 @@ public class WildCardRoutingTest extends ActiveMQTestBase { @Test public void testWildcardRoutingMultipleStars() throws Exception { - SimpleString addressAB = new SimpleString("a.b.c"); - SimpleString addressAC = new SimpleString("a.c"); - SimpleString address = new SimpleString("*.*"); - SimpleString queueName1 = new SimpleString("Q1"); - SimpleString queueName2 = new SimpleString("Q2"); - SimpleString queueName = new SimpleString("Q"); + SimpleString addressAB = SimpleString.of("a.b.c"); + SimpleString addressAC = SimpleString.of("a.c"); + SimpleString address = SimpleString.of("*.*"); + SimpleString queueName1 = SimpleString.of("Q1"); + SimpleString queueName2 = SimpleString.of("Q2"); + SimpleString queueName = SimpleString.of("Q"); 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)); @@ -646,12 +646,12 @@ public class WildCardRoutingTest extends ActiveMQTestBase { @Test public void testWildcardRoutingStarInMiddle() throws Exception { - SimpleString addressAB = new SimpleString("a.b.c"); - SimpleString addressAC = new SimpleString("a.c"); - SimpleString address = new SimpleString("*.b.*"); - SimpleString queueName1 = new SimpleString("Q1"); - SimpleString queueName2 = new SimpleString("Q2"); - SimpleString queueName = new SimpleString("Q"); + SimpleString addressAB = SimpleString.of("a.b.c"); + SimpleString addressAC = SimpleString.of("a.c"); + SimpleString address = SimpleString.of("*.b.*"); + SimpleString queueName1 = SimpleString.of("Q1"); + SimpleString queueName2 = SimpleString.of("Q2"); + SimpleString queueName = SimpleString.of("Q"); 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)); @@ -671,12 +671,12 @@ public class WildCardRoutingTest extends ActiveMQTestBase { @Test public void testWildcardRoutingStarAndHash() throws Exception { - SimpleString addressAB = new SimpleString("a.b.c.d"); - SimpleString addressAC = new SimpleString("a.c"); - SimpleString address = new SimpleString("*.b.#"); - SimpleString queueName1 = new SimpleString("Q1"); - SimpleString queueName2 = new SimpleString("Q2"); - SimpleString queueName = new SimpleString("Q"); + SimpleString addressAB = SimpleString.of("a.b.c.d"); + SimpleString addressAC = SimpleString.of("a.c"); + SimpleString address = SimpleString.of("*.b.#"); + SimpleString queueName1 = SimpleString.of("Q1"); + SimpleString queueName2 = SimpleString.of("Q2"); + SimpleString queueName = SimpleString.of("Q"); 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)); @@ -696,12 +696,12 @@ public class WildCardRoutingTest extends ActiveMQTestBase { @Test public void testWildcardRoutingHashAndStar() throws Exception { - SimpleString addressAB = new SimpleString("a.b.c"); - SimpleString addressAC = new SimpleString("a.c"); - SimpleString address = new SimpleString("#.b.*"); - SimpleString queueName1 = new SimpleString("Q1"); - SimpleString queueName2 = new SimpleString("Q2"); - SimpleString queueName = new SimpleString("Q"); + SimpleString addressAB = SimpleString.of("a.b.c"); + SimpleString addressAC = SimpleString.of("a.c"); + SimpleString address = SimpleString.of("#.b.*"); + SimpleString queueName1 = SimpleString.of("Q1"); + SimpleString queueName2 = SimpleString.of("Q2"); + SimpleString queueName = SimpleString.of("Q"); 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)); @@ -721,12 +721,12 @@ public class WildCardRoutingTest extends ActiveMQTestBase { @Test public void testLargeWildcardRouting() throws Exception { - SimpleString addressAB = new SimpleString("a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z"); - SimpleString addressAC = new SimpleString("a.c"); - SimpleString address = new SimpleString("a.#"); - SimpleString queueName1 = new SimpleString("Q1"); - SimpleString queueName2 = new SimpleString("Q2"); - SimpleString queueName = new SimpleString("Q"); + SimpleString addressAB = SimpleString.of("a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z"); + SimpleString addressAC = SimpleString.of("a.c"); + SimpleString address = SimpleString.of("a.#"); + SimpleString queueName1 = SimpleString.of("Q1"); + SimpleString queueName2 = SimpleString.of("Q2"); + SimpleString queueName = SimpleString.of("Q"); 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)); 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 23f480de39..5a29098400 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 @@ -60,12 +60,12 @@ public class WildcardConfigurationTest extends ActiveMQTestBase { @Test public void testBasicWildcardRouting() throws Exception { - SimpleString addressAB = new SimpleString("a/b"); - SimpleString addressAC = new SimpleString("a/c"); - SimpleString address = new SimpleString("a/*"); - SimpleString queueName1 = new SimpleString("Q1"); - SimpleString queueName2 = new SimpleString("Q2"); - SimpleString queueName = new SimpleString("Q"); + SimpleString addressAB = SimpleString.of("a/b"); + SimpleString addressAC = SimpleString.of("a/c"); + SimpleString address = SimpleString.of("a/*"); + SimpleString queueName1 = SimpleString.of("Q1"); + SimpleString queueName2 = SimpleString.of("Q2"); + SimpleString queueName = SimpleString.of("Q"); 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)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/XAJMSOrderTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/XAJMSOrderTest.java index 2187391f21..a0c7ae28b6 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/XAJMSOrderTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/XAJMSOrderTest.java @@ -86,7 +86,7 @@ public class XAJMSOrderTest extends JMSTestBase { @Override protected void extraServerConfig(ActiveMQServer server) { if (exclusive) { - server.getConfiguration().getAddressSettings().put("#", new AddressSettings().setAutoCreateQueues(true).setAutoCreateAddresses(true).setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ")).setDefaultExclusiveQueue(true)); + server.getConfiguration().getAddressSettings().put("#", new AddressSettings().setAutoCreateQueues(true).setAutoCreateAddresses(true).setDeadLetterAddress(SimpleString.of("ActiveMQ.DLQ")).setDefaultExclusiveQueue(true)); } } 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 b4529ed1e5..934f9d173e 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 @@ -61,8 +61,8 @@ public class ClientCrashTest extends ClientTestBase { static final int CONNECTION_TTL = 1000; - public static final SimpleString QUEUE = new SimpleString("ClientCrashTestQueue"); - public static final SimpleString QUEUE2 = new SimpleString("ClientCrashTestQueue2"); + public static final SimpleString QUEUE = SimpleString.of("ClientCrashTestQueue"); + public static final SimpleString QUEUE2 = SimpleString.of("ClientCrashTestQueue2"); public static final String MESSAGE_TEXT_FROM_SERVER = "ClientCrashTest from server"; 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 0a6ce3963e..631a6b84f3 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 @@ -47,7 +47,7 @@ public class ClientExitTest extends ClientTestBase { private static final String MESSAGE_TEXT = RandomUtil.randomString(); - private static final SimpleString QUEUE = new SimpleString("ClientExitTestQueue"); + private static final SimpleString QUEUE = SimpleString.of("ClientExitTestQueue"); private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/clientcrash/DummyInterceptor.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/clientcrash/DummyInterceptor.java index 9538c8dcc5..76dad2efb9 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/clientcrash/DummyInterceptor.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/clientcrash/DummyInterceptor.java @@ -58,7 +58,7 @@ public class DummyInterceptor implements Interceptor { if (packet instanceof SessionReceiveMessage) { SessionReceiveMessage deliver = (SessionReceiveMessage) packet; logger.debug("msg = {}", deliver.getMessage().getClass().getName()); - deliver.getMessage().putStringProperty(new SimpleString("DummyInterceptor"), new SimpleString("was here")); + deliver.getMessage().putStringProperty(SimpleString.of("DummyInterceptor"), SimpleString.of("was here")); } } return true; 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 9346da0b83..09bf41ad00 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 @@ -45,7 +45,7 @@ public class PendingDeliveriesTest extends ClientTestBase { @BeforeEach public void createQueue() throws Exception { - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("queue1"), RoutingType.ANYCAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("queue1"), RoutingType.ANYCAST)); server.createQueue(new QueueConfiguration("queue1").setRoutingType(RoutingType.ANYCAST)); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/ClusterControllerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/ClusterControllerTest.java index b91c7d2424..79065acea4 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/ClusterControllerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/ClusterControllerTest.java @@ -95,7 +95,7 @@ public class ClusterControllerTest extends ClusterTestBase { ActiveMQServer serverNode = getServer(node); ClusterManager clusterManager = serverNode.getClusterManager(); ClusterController clusterController = clusterManager.getClusterController(); - ServerLocator serverNodeLocator = clusterController.getServerLocator(new SimpleString(clusterConnectionConfigurationBeforeStart.getName())); + ServerLocator serverNodeLocator = clusterController.getServerLocator(SimpleString.of(clusterConnectionConfigurationBeforeStart.getName())); List serverNodeClusterConnectionConfigurations = serverNodeConfiguration.getClusterConfigurations(); do { 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 6d04fd18a8..8b837f74cd 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 @@ -269,7 +269,7 @@ public class BridgeReconnectTest extends BridgeTestBase { final int numMessages = NUM_MESSAGES; - SimpleString propKey = new SimpleString("propkey"); + SimpleString propKey = SimpleString.of("propkey"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session0.createMessage(true); @@ -343,7 +343,7 @@ public class BridgeReconnectTest extends BridgeTestBase { final int numMessages = NUM_MESSAGES; - SimpleString propKey = new SimpleString("propkey"); + SimpleString propKey = SimpleString.of("propkey"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session0.createMessage(false); @@ -420,7 +420,7 @@ public class BridgeReconnectTest extends BridgeTestBase { final int numMessages = NUM_MESSAGES; - SimpleString propKey = new SimpleString("propkey"); + SimpleString propKey = SimpleString.of("propkey"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session0.createMessage(false); @@ -487,7 +487,7 @@ public class BridgeReconnectTest extends BridgeTestBase { final int numMessages = NUM_MESSAGES; - SimpleString propKey = new SimpleString("propkey"); + SimpleString propKey = SimpleString.of("propkey"); CyclicBarrier routingBarrier = new CyclicBarrier(2); CountDownLatch deliveryBeforeFailureLatch = new CountDownLatch(numMessages); @@ -638,7 +638,7 @@ public class BridgeReconnectTest extends BridgeTestBase { final int numMessages = NUM_MESSAGES; - SimpleString propKey = new SimpleString("propkey"); + SimpleString propKey = SimpleString.of("propkey"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session0.createMessage(false); @@ -735,7 +735,7 @@ public class BridgeReconnectTest extends BridgeTestBase { final int numMessages = NUM_MESSAGES; - SimpleString propKey = new SimpleString("propkey"); + SimpleString propKey = SimpleString.of("propkey"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session0.createMessage(false); @@ -835,9 +835,9 @@ public class BridgeReconnectTest extends BridgeTestBase { final int numMessages = NUM_MESSAGES; - SimpleString propKey = new SimpleString("propkey"); + SimpleString propKey = SimpleString.of("propkey"); - final Queue queue = (Queue) server0.getPostOffice().getBinding(new SimpleString(queueName)).getBindable(); + final Queue queue = (Queue) server0.getPostOffice().getBinding(SimpleString.of(queueName)).getBindable(); for (int i = 0; i < numMessages; i++) { ClientMessage message = session0.createMessage(false); 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 9be2a66b27..bffd3513bf 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 @@ -134,7 +134,7 @@ public class BridgeStartTest extends ActiveMQTestBase { ClientSession session1 = sf1.createSession(false, true, true); - ClientProducer producer0 = session0.createProducer(new SimpleString(testAddress)); + ClientProducer producer0 = session0.createProducer(SimpleString.of(testAddress)); ClientConsumer consumer1 = session1.createConsumer(queueName1); @@ -142,7 +142,7 @@ public class BridgeStartTest extends ActiveMQTestBase { final int numMessages = 10; - final SimpleString propKey = new SimpleString("testkey"); + final SimpleString propKey = SimpleString.of("testkey"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session0.createMessage(false); @@ -274,11 +274,11 @@ public class BridgeStartTest extends ActiveMQTestBase { ClientSession session0 = sf0.createSession(false, true, true); - ClientProducer producer0 = session0.createProducer(new SimpleString(testAddress)); + ClientProducer producer0 = session0.createProducer(SimpleString.of(testAddress)); final int numMessages = 10; - final SimpleString propKey = new SimpleString("testkey"); + final SimpleString propKey = SimpleString.of("testkey"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session0.createMessage(false); @@ -448,11 +448,11 @@ public class BridgeStartTest extends ActiveMQTestBase { ClientSession session0 = sf0.createSession(false, true, true); - ClientProducer producer0 = session0.createProducer(new SimpleString(testAddress)); + ClientProducer producer0 = session0.createProducer(SimpleString.of(testAddress)); final int numMessages = 10; - final SimpleString propKey = new SimpleString("testkey"); + final SimpleString propKey = SimpleString.of("testkey"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session0.createMessage(false); @@ -579,11 +579,11 @@ public class BridgeStartTest extends ActiveMQTestBase { ClientSession session0 = sf0.createSession(false, true, true); - ClientProducer producer0 = session0.createProducer(new SimpleString(testAddress)); + ClientProducer producer0 = session0.createProducer(SimpleString.of(testAddress)); final int numMessages = 10; - final SimpleString propKey = new SimpleString("testkey"); + final SimpleString propKey = SimpleString.of("testkey"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session0.createMessage(false); 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 7da524038a..79fed1b5c2 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 @@ -214,7 +214,7 @@ public class BridgeTest extends ActiveMQTestBase { ClientSession session1 = sf1.createSession(false, true, true); - ClientProducer producer0 = session0.createProducer(new SimpleString(testAddress)); + ClientProducer producer0 = session0.createProducer(SimpleString.of(testAddress)); ClientConsumer consumer1 = session1.createConsumer(queueName1); @@ -222,7 +222,7 @@ public class BridgeTest extends ActiveMQTestBase { final byte[] bytes = new byte[messageSize]; - final SimpleString propKey = new SimpleString("testkey"); + final SimpleString propKey = SimpleString.of("testkey"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session0.createMessage(true); @@ -321,7 +321,7 @@ public class BridgeTest extends ActiveMQTestBase { ClientSessionFactory sf1 = addSessionFactory(locator.createSessionFactory(server1tc)); ClientSession session0 = sf0.createSession(false, true, 0); - ClientProducer producer0 = session0.createProducer(new SimpleString(testAddress)); + ClientProducer producer0 = session0.createProducer(SimpleString.of(testAddress)); ClientSession session1 = sf1.createSession(true, true, 0); ClientConsumer consumer1 = session1.createConsumer(queueName1); @@ -330,7 +330,7 @@ public class BridgeTest extends ActiveMQTestBase { final byte[] bytes = new byte[messageSize]; - final SimpleString propKey = new SimpleString("testkey"); + final SimpleString propKey = SimpleString.of("testkey"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session0.createMessage(true); @@ -386,7 +386,7 @@ public class BridgeTest extends ActiveMQTestBase { message.acknowledge(); } - Wait.assertEquals(0, server0.locateQueue(SimpleString.toSimpleString("queue0"))::getMessageCount); + Wait.assertEquals(0, server0.locateQueue(SimpleString.of("queue0"))::getMessageCount); assertNull(consumer1.receiveImmediate()); @@ -460,7 +460,7 @@ public class BridgeTest extends ActiveMQTestBase { ClientSession session1 = sf1.createSession(false, true, true); - ClientProducer producer0 = session0.createProducer(new SimpleString(testAddress)); + ClientProducer producer0 = session0.createProducer(SimpleString.of(testAddress)); ClientConsumer consumer1 = session1.createConsumer(queueName1); @@ -468,7 +468,7 @@ public class BridgeTest extends ActiveMQTestBase { final byte[] bytes = new byte[messageSize]; - final SimpleString propKey = new SimpleString("testkey"); + final SimpleString propKey = SimpleString.of("testkey"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session0.createMessage(true); @@ -616,22 +616,22 @@ public class BridgeTest extends ActiveMQTestBase { ClientSession session1 = sf1.createSession(false, true, true); - ClientProducer producer0 = session0.createProducer(new SimpleString(testAddress)); + ClientProducer producer0 = session0.createProducer(SimpleString.of(testAddress)); ClientConsumer consumer1 = session1.createConsumer(queueName1); session1.start(); - final SimpleString propKey = new SimpleString("testkey"); + final SimpleString propKey = SimpleString.of("testkey"); - final SimpleString selectorKey = new SimpleString("animal"); + final SimpleString selectorKey = SimpleString.of("animal"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session0.createMessage(true); message.putIntProperty(propKey, i); - message.putStringProperty(selectorKey, new SimpleString("monkey")); + message.putStringProperty(selectorKey, SimpleString.of("monkey")); if (largeMessage) { message.setBodyInputStream(ActiveMQTestBase.createFakeLargeStream(10 * 1024)); @@ -647,7 +647,7 @@ public class BridgeTest extends ActiveMQTestBase { message.putIntProperty(propKey, i); - message.putStringProperty(selectorKey, new SimpleString("goat")); + message.putStringProperty(selectorKey, SimpleString.of("goat")); if (largeMessage) { message.setBodyInputStream(ActiveMQTestBase.createFakeLargeStream(10 * 1024)); @@ -740,13 +740,13 @@ public class BridgeTest extends ActiveMQTestBase { ClientSession session0 = sf0.createSession(false, true, true); - ClientProducer producer0 = session0.createProducer(new SimpleString(testAddress)); + ClientProducer producer0 = session0.createProducer(SimpleString.of(testAddress)); final int numMessages = 100; - final SimpleString propKey = new SimpleString("testkey"); + final SimpleString propKey = SimpleString.of("testkey"); - final SimpleString selectorKey = new SimpleString("animal"); + final SimpleString selectorKey = SimpleString.of("animal"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session0.createMessage(true); @@ -755,7 +755,7 @@ public class BridgeTest extends ActiveMQTestBase { message.putIntProperty(propKey, i); - message.putStringProperty(selectorKey, new SimpleString("monkey" + i)); + message.putStringProperty(selectorKey, SimpleString.of("monkey" + i)); producer0.send(message); } @@ -851,13 +851,13 @@ public class BridgeTest extends ActiveMQTestBase { ClientSession session0 = sf0.createSession(false, true, true); - ClientProducer producer0 = session0.createProducer(new SimpleString(testAddress)); + ClientProducer producer0 = session0.createProducer(SimpleString.of(testAddress)); final int numMessages = 1000; - final SimpleString propKey = new SimpleString("testkey"); + final SimpleString propKey = SimpleString.of("testkey"); - final SimpleString selectorKey = new SimpleString("animal"); + final SimpleString selectorKey = SimpleString.of("animal"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session0.createMessage(true); @@ -866,7 +866,7 @@ public class BridgeTest extends ActiveMQTestBase { message.putIntProperty(propKey, i); - message.putStringProperty(selectorKey, new SimpleString("monkey" + i)); + message.putStringProperty(selectorKey, SimpleString.of("monkey" + i)); producer0.send(message); } @@ -877,7 +877,7 @@ public class BridgeTest extends ActiveMQTestBase { { long[] ids = new long[100]; - Queue queue = server0.locateQueue(new SimpleString(queueName0)); + Queue queue = server0.locateQueue(SimpleString.of(queueName0)); LinkedListIterator iterator = queue.iterator(); for (int i = 0; i < 100; i++) { @@ -932,7 +932,7 @@ public class BridgeTest extends ActiveMQTestBase { // and should make a copy of the message before sending it assertEquals(2, message.getPropertyNames().size()); assertEquals(i, message.getIntProperty(propKey).intValue()); - assertEquals(new SimpleString("monkey" + i), message.getSimpleStringProperty(selectorKey)); + assertEquals(SimpleString.of("monkey" + i), message.getSimpleStringProperty(selectorKey)); message.acknowledge(); } @@ -945,7 +945,7 @@ public class BridgeTest extends ActiveMQTestBase { sf1.close(); - SimpleString queueName1Str = new SimpleString(queueName1); + SimpleString queueName1Str = SimpleString.of(queueName1); Wait.assertTrue(() -> server1.locateQueue(queueName1Str) == null); server1.stop(); @@ -1027,7 +1027,7 @@ public class BridgeTest extends ActiveMQTestBase { ClientSession session1 = sf1.createSession(false, true, true); - ClientProducer producer0 = session0.createProducer(new SimpleString(testAddress)); + ClientProducer producer0 = session0.createProducer(SimpleString.of(testAddress)); ClientConsumer consumer1 = session1.createConsumer(queueName1); @@ -1035,12 +1035,12 @@ public class BridgeTest extends ActiveMQTestBase { final int numMessages = 10; - final SimpleString propKey = new SimpleString("wibble"); + final SimpleString propKey = SimpleString.of("wibble"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session0.createMessage(true); - message.putStringProperty(propKey, new SimpleString("bing")); + message.putStringProperty(propKey, SimpleString.of("bing")); message.getBodyBuffer().writeString("doo be doo be doo be doo"); @@ -1054,7 +1054,7 @@ public class BridgeTest extends ActiveMQTestBase { SimpleString val = (SimpleString) message.getObjectProperty(propKey); - assertEquals(new SimpleString("bong"), val); + assertEquals(SimpleString.of("bong"), val); String sval = message.getBodyBuffer().readString(); @@ -1137,7 +1137,7 @@ public class BridgeTest extends ActiveMQTestBase { ClientSession session1 = sf1.createSession(false, true, true); - ClientProducer producer0 = session0.createProducer(new SimpleString(testAddress)); + ClientProducer producer0 = session0.createProducer(SimpleString.of(testAddress)); ClientConsumer consumer1 = session1.createConsumer(queueName1); @@ -1305,7 +1305,7 @@ public class BridgeTest extends ActiveMQTestBase { session = sf.createSession(false, true, true); - producer = session.createProducer(new SimpleString(testAddress)); + producer = session.createProducer(SimpleString.of(testAddress)); for (int i = 0; i < nmsg; i++) { assertEquals(0, errors.get()); @@ -1446,7 +1446,7 @@ public class BridgeTest extends ActiveMQTestBase { ClientSession session1 = sf1.createSession(false, true, true); - ClientProducer producer0 = session0.createProducer(new SimpleString(testAddress)); + ClientProducer producer0 = session0.createProducer(SimpleString.of(testAddress)); ClientConsumer consumer1 = session1.createConsumer(queueName1); @@ -1454,7 +1454,7 @@ public class BridgeTest extends ActiveMQTestBase { final int numMessages = 200; - final SimpleString propKey = new SimpleString("testkey"); + final SimpleString propKey = SimpleString.of("testkey"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session0.createMessage(true); @@ -1665,7 +1665,7 @@ public class BridgeTest extends ActiveMQTestBase { ClientSession session1 = sf1.createSession(false, true, true); - ClientProducer producer0 = session0.createProducer(new SimpleString(testAddress)); + ClientProducer producer0 = session0.createProducer(SimpleString.of(testAddress)); ClientConsumer consumer1 = session1.createConsumer(queueName1); @@ -1673,7 +1673,7 @@ public class BridgeTest extends ActiveMQTestBase { final int numMessages = 50; - final SimpleString propKey = new SimpleString("testkey"); + final SimpleString propKey = SimpleString.of("testkey"); final int LARGE_MESSAGE_SIZE = 1024; for (int i = 0; i < numMessages; i++) { @@ -1798,7 +1798,7 @@ public class BridgeTest extends ActiveMQTestBase { ClientSession session1 = sf1.createSession(false, true, true); - ClientProducer producer0 = session0.createProducer(new SimpleString(testAddress)); + ClientProducer producer0 = session0.createProducer(SimpleString.of(testAddress)); ClientConsumer consumer1 = session1.createConsumer(queueName1); @@ -1814,7 +1814,7 @@ public class BridgeTest extends ActiveMQTestBase { session0.commit(); //check target queue for large message arriving - Wait.waitFor(() -> session1.queueQuery(SimpleString.toSimpleString(queueName1)).getMessageCount() > 0); + Wait.waitFor(() -> session1.queueQuery(SimpleString.of(queueName1)).getMessageCount() > 0); //receive the message ClientMessage message = consumer1.receive(5000); @@ -1951,7 +1951,7 @@ public class BridgeTest extends ActiveMQTestBase { ClientSession session1 = sf1.createSession(false, true, true); - ClientProducer producer0 = session0.createProducer(new SimpleString(testAddress)); + ClientProducer producer0 = session0.createProducer(SimpleString.of(testAddress)); ClientConsumer consumer1 = session1.createConsumer(queueName1); @@ -1959,7 +1959,7 @@ public class BridgeTest extends ActiveMQTestBase { final byte[] bytes = new byte[messageSize]; - final SimpleString propKey = new SimpleString("testkey"); + final SimpleString propKey = SimpleString.of("testkey"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session0.createMessage(true); @@ -1995,8 +1995,8 @@ public class BridgeTest extends ActiveMQTestBase { @TestTemplate public void testInjectedTransformer() throws Exception { - final SimpleString ADDRESS = new SimpleString("myAddress"); - final SimpleString QUEUE = new SimpleString("myQueue"); + final SimpleString ADDRESS = SimpleString.of("myAddress"); + final SimpleString QUEUE = SimpleString.of("myQueue"); final String BRIDGE = "myBridge"; ServiceRegistryImpl serviceRegistry = new ServiceRegistryImpl(); @@ -2023,10 +2023,10 @@ public class BridgeTest extends ActiveMQTestBase { @TestTemplate public void testDefaultConfirmationWindowSize() throws Exception { - final SimpleString ADDRESS = new SimpleString("myAddress"); - final SimpleString QUEUE = new SimpleString("myQueue"); - final SimpleString FORWARDING_ADDRESS = new SimpleString("myForwardingAddress"); - final SimpleString FORWARDING_QUEUE = new SimpleString("myForwardingQueue"); + final SimpleString ADDRESS = SimpleString.of("myAddress"); + final SimpleString QUEUE = SimpleString.of("myQueue"); + final SimpleString FORWARDING_ADDRESS = SimpleString.of("myForwardingAddress"); + final SimpleString FORWARDING_QUEUE = SimpleString.of("myForwardingQueue"); final String BRIDGE = "myBridge"; Configuration config = createDefaultConfig(0, isNetty()).addConnectorConfiguration("myConnector", new TransportConfiguration(getConnector())); @@ -2056,10 +2056,10 @@ public class BridgeTest extends ActiveMQTestBase { @TestTemplate public void testManagementLeak() throws Exception { - final SimpleString ADDRESS = new SimpleString("myAddress"); - final SimpleString QUEUE = new SimpleString("myQueue"); - final SimpleString FORWARDING_ADDRESS = new SimpleString("myForwardingAddress"); - final SimpleString FORWARDING_QUEUE = new SimpleString("myForwardingQueue"); + final SimpleString ADDRESS = SimpleString.of("myAddress"); + final SimpleString QUEUE = SimpleString.of("myQueue"); + final SimpleString FORWARDING_ADDRESS = SimpleString.of("myForwardingAddress"); + final SimpleString FORWARDING_QUEUE = SimpleString.of("myForwardingQueue"); final String BRIDGE = "myBridge"; ActiveMQServer server = addServer(new ActiveMQServerImpl(createDefaultConfig(0, isNetty()).addConnectorConfiguration("myConnector", new TransportConfiguration(getConnector())))); 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 ee0aa09a33..2650875287 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 @@ -146,7 +146,7 @@ public class BridgeWithDiscoveryGroupStartTest extends ActiveMQTestBase { ClientSession session1 = sf1.createSession(false, true, true); - ClientProducer producer0 = session0.createProducer(new SimpleString(testAddress)); + ClientProducer producer0 = session0.createProducer(SimpleString.of(testAddress)); ClientConsumer consumer1 = session1.createConsumer(queueName1); @@ -154,7 +154,7 @@ public class BridgeWithDiscoveryGroupStartTest extends ActiveMQTestBase { final int numMessages = 10; - final SimpleString propKey = new SimpleString("testkey"); + final SimpleString propKey = SimpleString.of("testkey"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session0.createMessage(false); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/ClusteredBridgeReconnectTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/ClusteredBridgeReconnectTest.java index 14cbf84707..e2ac8e8aa9 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/ClusteredBridgeReconnectTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/ClusteredBridgeReconnectTest.java @@ -270,7 +270,7 @@ public class ClusteredBridgeReconnectTest extends ClusterTestBase { //is created on the other node. removeConsumer(0); servers[0].getManagementService().enableNotifications(false); - servers[0].destroyQueue(new SimpleString(QUEUE)); + servers[0].destroyQueue(SimpleString.of(QUEUE)); servers[0].getManagementService().enableNotifications(true); createQueue(0, ADDRESS, QUEUE, null, false); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/SimpleTransformer.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/SimpleTransformer.java index e46224092c..a755a9ea90 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/SimpleTransformer.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/SimpleTransformer.java @@ -27,14 +27,14 @@ public class SimpleTransformer implements Transformer { @Override public Message transform(final Message messageParameter) { ICoreMessage message = messageParameter.toCore(); - SimpleString oldProp = (SimpleString) message.getObjectProperty(new SimpleString("wibble")); + SimpleString oldProp = (SimpleString) message.getObjectProperty(SimpleString.of("wibble")); - if (!oldProp.equals(new SimpleString("bing"))) { + if (!oldProp.equals(SimpleString.of("bing"))) { throw new IllegalStateException("Wrong property value!!"); } // Change a property - message.putStringProperty(new SimpleString("wibble"), new SimpleString("bong")); + message.putStringProperty(SimpleString.of("wibble"), SimpleString.of("bong")); // Change the body ActiveMQBuffer buffer = message.getBodyBuffer(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/crossprotocol/LargeHeadersClusterTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/crossprotocol/LargeHeadersClusterTest.java index 96483c0554..544f79f663 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/crossprotocol/LargeHeadersClusterTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/crossprotocol/LargeHeadersClusterTest.java @@ -60,7 +60,7 @@ public class LargeHeadersClusterTest extends ClusterTestBase { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - private static final SimpleString queueName = SimpleString.toSimpleString("queues.0"); + private static final SimpleString queueName = SimpleString.of("queues.0"); // I'm taking any number that /2 = Odd // to avoid perfect roundings and making sure messages are evenly distributed @@ -87,7 +87,7 @@ public class LargeHeadersClusterTest extends ClusterTestBase { setupCluster(loadBalancingType); - AddressSettings as = new AddressSettings().setRedistributionDelay(0).setExpiryAddress(SimpleString.toSimpleString("queues.expiry")); + AddressSettings as = new AddressSettings().setRedistributionDelay(0).setExpiryAddress(SimpleString.of("queues.expiry")); getServer(0).getAddressSettingsRepository().addMatch("queues.*", as); getServer(1).getAddressSettingsRepository().addMatch("queues.*", as); @@ -95,7 +95,7 @@ public class LargeHeadersClusterTest extends ClusterTestBase { startServers(0); startServers(1); - createQueue(SimpleString.toSimpleString("queues.expiry")); + createQueue(SimpleString.of("queues.expiry")); createQueue(queueName); } 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 95a0319afd..51d964d8b0 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 @@ -71,7 +71,7 @@ public class ProtocolsMessageLoadBalancingTest extends ClusterTestBase { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); private static final int NUMBER_OF_SERVERS = 2; - private static final SimpleString queueName = SimpleString.toSimpleString("queues.0"); + private static final SimpleString queueName = SimpleString.of("queues.0"); // I'm taking any number that /2 = Odd // to avoid perfect roundings and making sure messages are evenly distributed @@ -99,7 +99,7 @@ public class ProtocolsMessageLoadBalancingTest extends ClusterTestBase { setupCluster(loadBalancingType); - AddressSettings as = new AddressSettings().setRedistributionDelay(0).setExpiryAddress(SimpleString.toSimpleString("queues.expiry")); + AddressSettings as = new AddressSettings().setRedistributionDelay(0).setExpiryAddress(SimpleString.of("queues.expiry")); getServer(0).getAddressSettingsRepository().addMatch("queues.*", as); getServer(1).getAddressSettingsRepository().addMatch("queues.*", as); @@ -107,7 +107,7 @@ public class ProtocolsMessageLoadBalancingTest extends ClusterTestBase { startServers(0); startServers(1); - createQueue(SimpleString.toSimpleString("queues.expiry")); + createQueue(SimpleString.of("queues.expiry")); createQueue(queueName); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/AnycastRoutingWithClusterTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/AnycastRoutingWithClusterTest.java index 6fab147ffb..d54fbb58d4 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/AnycastRoutingWithClusterTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/AnycastRoutingWithClusterTest.java @@ -73,7 +73,7 @@ public class AnycastRoutingWithClusterTest extends ClusterTestBase { send(0, address, noMessages, true, null, null); for (int s = 0; s < 3; s++) { - final Queue queue = servers[s].locateQueue(new SimpleString(queueName)); + final Queue queue = servers[s].locateQueue(SimpleString.of(queueName)); Wait.waitFor(new Wait.Condition() { @Override public boolean isSatisfied() throws Exception { @@ -134,7 +134,7 @@ public class AnycastRoutingWithClusterTest extends ClusterTestBase { send(0, address, noMessages, true, null, null); for (int s = 0; s < 3; s++) { - final Queue queue = servers[s].locateQueue(new SimpleString(queueNamePrefix + s)); + final Queue queue = servers[s].locateQueue(SimpleString.of(queueNamePrefix + s)); Wait.waitFor(new Wait.Condition() { @Override public boolean isSatisfied() throws Exception { @@ -256,7 +256,7 @@ public class AnycastRoutingWithClusterTest extends ClusterTestBase { send(0, address, noMessages, true, null, null); for (int s = 0; s < 3; s++) { - final Queue queue = servers[s].locateQueue(new SimpleString(queueNamePrefix + s)); + final Queue queue = servers[s].locateQueue(SimpleString.of(queueNamePrefix + s)); Wait.waitFor(new Wait.Condition() { @Override public boolean isSatisfied() throws Exception { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/AutoDeleteClusteredDestinationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/AutoDeleteClusteredDestinationTest.java index 05445b3d49..d951234580 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/AutoDeleteClusteredDestinationTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/AutoDeleteClusteredDestinationTest.java @@ -70,7 +70,7 @@ public class AutoDeleteClusteredDestinationTest extends ClusterTestBase { final String queueName = "queue"; final String url0 = "tcp://localhost:61616?useTopologyForLoadBalancing=false"; final String url1 = "tcp://localhost:61617?useTopologyForLoadBalancing=false"; - final SimpleString simpleName = SimpleString.toSimpleString(queueName); + final SimpleString simpleName = SimpleString.of(queueName); final int messageCount = 10; final int TIMEOUT = 5000; 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 fbf1f68f66..30a4ff86c8 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 @@ -125,9 +125,9 @@ public abstract class ClusterTestBase extends ActiveMQTestBase { private static final long TIMEOUT_START_SERVER = 10; - private static final SimpleString COUNT_PROP = new SimpleString("count_prop"); + private static final SimpleString COUNT_PROP = SimpleString.of("count_prop"); - protected static final SimpleString FILTER_PROP = new SimpleString("animal"); + protected static final SimpleString FILTER_PROP = SimpleString.of("animal"); private static final int MAX_SERVERS = 10; @@ -469,7 +469,7 @@ public abstract class ClusterTestBase extends ActiveMQTestBase { } PostOffice po = server.getPostOffice(); - Bindings bindings = po.getBindingsForAddress(new SimpleString(address)); + Bindings bindings = po.getBindingsForAddress(SimpleString.of(address)); logger.debug("======================================================================="); logger.debug("Binding information for address = {} on node {}", address, node); @@ -520,7 +520,7 @@ public abstract class ClusterTestBase extends ActiveMQTestBase { if (po == null) { return "server is shutdown"; } - Bindings bindings = po.getBindingsForAddress(new SimpleString(address)); + Bindings bindings = po.getBindingsForAddress(SimpleString.of(address)); out.println("======================================================================="); out.println("Binding information for address = " + address + " on " + server); @@ -597,7 +597,7 @@ public abstract class ClusterTestBase extends ActiveMQTestBase { final RoutingType routingType, final int defaulMaxConsumers, boolean defaultPurgeOnNoConsumers) throws Exception { - AddressInfo addressInfo = new AddressInfo(new SimpleString(address)); + AddressInfo addressInfo = new AddressInfo(SimpleString.of(address)); addressInfo.addRoutingType(routingType); servers[node].addOrUpdateAddressInfo(addressInfo); } @@ -771,12 +771,12 @@ public abstract class ClusterTestBase extends ActiveMQTestBase { ClientMessage message = session.createMessage(durable); if (filterVal != null) { - message.putStringProperty(ClusterTestBase.FILTER_PROP, new SimpleString(filterVal)); + message.putStringProperty(ClusterTestBase.FILTER_PROP, SimpleString.of(filterVal)); } if (duplicateDetectionSeq != null) { String str = Integer.toString(duplicateDetectionSeq.incrementAndGet()); - message.putStringProperty(Message.HDR_DUPLICATE_DETECTION_ID, new SimpleString(str)); + message.putStringProperty(Message.HDR_DUPLICATE_DETECTION_ID, SimpleString.of(str)); } if (routingType != null) { @@ -859,7 +859,7 @@ public abstract class ClusterTestBase extends ActiveMQTestBase { final int timeout, final long groupTimeout, final long reaperPeriod) { - servers[node].getConfiguration().setGroupingHandlerConfiguration(new GroupingHandlerConfiguration().setName(new SimpleString("grouparbitrator")).setType(type).setAddress(new SimpleString("queues")).setTimeout(timeout).setGroupTimeout(groupTimeout).setReaperPeriod(reaperPeriod)); + servers[node].getConfiguration().setGroupingHandlerConfiguration(new GroupingHandlerConfiguration().setName(SimpleString.of("grouparbitrator")).setType(type).setAddress(SimpleString.of("queues")).setTimeout(timeout).setGroupTimeout(groupTimeout).setReaperPeriod(reaperPeriod)); } protected void setUpGroupHandler(final GroupingHandler groupingHandler, final int node) { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusteredGroupingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusteredGroupingTest.java index 0826843f22..d904423d21 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusteredGroupingTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusteredGroupingTest.java @@ -123,15 +123,15 @@ public class ClusteredGroupingTest extends ClusterTestBase { } } }); - sendWithProperty(0, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, new SimpleString("id1")); + sendWithProperty(0, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); verifyReceiveAll(10, 0); - sendWithProperty(0, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, new SimpleString("id2")); + sendWithProperty(0, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, SimpleString.of("id2")); verifyReceiveAll(10, 0); - QueueImpl queue0Server2 = (QueueImpl) servers[2].locateQueue(SimpleString.toSimpleString("queue0")); + QueueImpl queue0Server2 = (QueueImpl) servers[2].locateQueue(SimpleString.of("queue0")); assertEquals(2, queue0Server2.getGroupCount()); @@ -157,11 +157,11 @@ public class ClusteredGroupingTest extends ClusterTestBase { waitForBindings(0, "queues.testaddress", 2, 0, false); waitForBindings(1, "queues.testaddress", 2, 1, false); waitForBindings(2, "queues.testaddress", 2, 1, false); - sendWithProperty(0, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, new SimpleString("id1")); + sendWithProperty(0, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); verifyReceiveAll(10, 0); - sendWithProperty(0, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, new SimpleString("id2")); + sendWithProperty(0, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, SimpleString.of("id2")); verifyReceiveAll(10, 0); } @@ -224,11 +224,11 @@ public class ClusteredGroupingTest extends ClusterTestBase { } } }); - sendWithProperty(2, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, new SimpleString("id1")); + sendWithProperty(2, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); verifyReceiveAll(10, 0); - sendWithProperty(1, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, new SimpleString("id2")); + sendWithProperty(1, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, SimpleString.of("id2")); verifyReceiveAll(10, 0); @@ -245,11 +245,11 @@ public class ClusteredGroupingTest extends ClusterTestBase { waitForBindings(0, "queues.testaddress", 2, 1, false); waitForBindings(1, "queues.testaddress", 2, 0, false); waitForBindings(2, "queues.testaddress", 2, 1, false); - sendWithProperty(2, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, new SimpleString("id1")); + sendWithProperty(2, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); verifyReceiveAll(10, 0); - sendWithProperty(1, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, new SimpleString("id2")); + sendWithProperty(1, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, SimpleString.of("id2")); verifyReceiveAll(10, 0); } @@ -292,7 +292,7 @@ public class ClusteredGroupingTest extends ClusterTestBase { waitForBindings(1, "queues.testaddress", 2, 2, false); waitForBindings(2, "queues.testaddress", 2, 2, false); - sendWithProperty(0, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, new SimpleString("id1")); + sendWithProperty(0, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); verifyReceiveAll(10, 0); @@ -313,9 +313,9 @@ public class ClusteredGroupingTest extends ClusterTestBase { setupClusterConnection("cluster2", "", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 2, 0, 1); - servers[0].getConfiguration().setGroupingHandlerConfiguration(new GroupingHandlerConfiguration().setName(new SimpleString("grouparbitrator")).setType(GroupingHandlerConfiguration.TYPE.LOCAL).setTimeout(5000).setGroupTimeout(-1).setReaperPeriod(ActiveMQDefaultConfiguration.getDefaultGroupingHandlerReaperPeriod())); - servers[1].getConfiguration().setGroupingHandlerConfiguration(new GroupingHandlerConfiguration().setName(new SimpleString("grouparbitrator")).setType(GroupingHandlerConfiguration.TYPE.REMOTE).setTimeout(5000).setGroupTimeout(-1).setReaperPeriod(ActiveMQDefaultConfiguration.getDefaultGroupingHandlerReaperPeriod())); - servers[2].getConfiguration().setGroupingHandlerConfiguration(new GroupingHandlerConfiguration().setName(new SimpleString("grouparbitrator")).setType(GroupingHandlerConfiguration.TYPE.REMOTE).setTimeout(5000).setGroupTimeout(-1).setReaperPeriod(ActiveMQDefaultConfiguration.getDefaultGroupingHandlerReaperPeriod())); + servers[0].getConfiguration().setGroupingHandlerConfiguration(new GroupingHandlerConfiguration().setName(SimpleString.of("grouparbitrator")).setType(GroupingHandlerConfiguration.TYPE.LOCAL).setTimeout(5000).setGroupTimeout(-1).setReaperPeriod(ActiveMQDefaultConfiguration.getDefaultGroupingHandlerReaperPeriod())); + servers[1].getConfiguration().setGroupingHandlerConfiguration(new GroupingHandlerConfiguration().setName(SimpleString.of("grouparbitrator")).setType(GroupingHandlerConfiguration.TYPE.REMOTE).setTimeout(5000).setGroupTimeout(-1).setReaperPeriod(ActiveMQDefaultConfiguration.getDefaultGroupingHandlerReaperPeriod())); + servers[2].getConfiguration().setGroupingHandlerConfiguration(new GroupingHandlerConfiguration().setName(SimpleString.of("grouparbitrator")).setType(GroupingHandlerConfiguration.TYPE.REMOTE).setTimeout(5000).setGroupTimeout(-1).setReaperPeriod(ActiveMQDefaultConfiguration.getDefaultGroupingHandlerReaperPeriod())); startServers(0, 1, 2); @@ -339,7 +339,7 @@ public class ClusteredGroupingTest extends ClusterTestBase { waitForBindings(1, "queues.testaddress", 2, 2, false); waitForBindings(2, "queues.testaddress", 2, 2, false); - sendWithProperty(0, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, new SimpleString("id1")); + sendWithProperty(0, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); verifyReceiveAll(10, 0); @@ -385,9 +385,9 @@ public class ClusteredGroupingTest extends ClusterTestBase { waitForBindings(1, "queues.testaddress", 2, 2, false); waitForBindings(2, "queues.testaddress", 2, 2, false); - sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, new SimpleString("id1")); - sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, new SimpleString("id2")); - sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, new SimpleString("id3")); + sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); + sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, SimpleString.of("id2")); + sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, SimpleString.of("id3")); // It should receive one message on each server ClientMessage msg = consumers[0].getConsumer().receive(1000); @@ -493,35 +493,35 @@ public class ClusteredGroupingTest extends ClusterTestBase { waitForBindings(1, "queues.testaddress", 2, 2, false); waitForBindings(2, "queues.testaddress", 2, 2, false); - sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, new SimpleString("id1")); - sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, new SimpleString("id2")); - sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, new SimpleString("id3")); + sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); + sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, SimpleString.of("id2")); + sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, SimpleString.of("id3")); - assertNotNull(servers[0].getGroupingHandler().getProposal(SimpleString.toSimpleString("id1.queue0"), false)); + assertNotNull(servers[0].getGroupingHandler().getProposal(SimpleString.of("id1.queue0"), false)); // Group timeout Thread.sleep(1000); long timeLimit = System.currentTimeMillis() + 5000; - while (timeLimit > System.currentTimeMillis() && servers[0].getGroupingHandler().getProposal(SimpleString.toSimpleString("id1.queue0"), false) != null) { + while (timeLimit > System.currentTimeMillis() && servers[0].getGroupingHandler().getProposal(SimpleString.of("id1.queue0"), false) != null) { Thread.sleep(10); } Thread.sleep(1000); - assertNull(servers[0].getGroupingHandler().getProposal(SimpleString.toSimpleString("id1.queue0"), false), "Group should have timed out"); + assertNull(servers[0].getGroupingHandler().getProposal(SimpleString.of("id1.queue0"), false), "Group should have timed out"); - sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, new SimpleString("id1")); - sendWithProperty(1, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, new SimpleString("id1")); + sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); + sendWithProperty(1, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); // Verify why this is failing... whyt it's creating a new one here???? - assertNotNull(servers[0].getGroupingHandler().getProposal(SimpleString.toSimpleString("id1.queue0"), false)); - assertNotNull(servers[1].getGroupingHandler().getProposal(SimpleString.toSimpleString("id1.queue0"), false)); + assertNotNull(servers[0].getGroupingHandler().getProposal(SimpleString.of("id1.queue0"), false)); + assertNotNull(servers[1].getGroupingHandler().getProposal(SimpleString.of("id1.queue0"), false)); timeLimit = System.currentTimeMillis() + 1500; // We will keep bothering server1 as it will ping server0 eventually - while (timeLimit > System.currentTimeMillis() && servers[1].getGroupingHandler().getProposal(SimpleString.toSimpleString("id1.queue0"), true) != null) { - assertNotNull(servers[0].getGroupingHandler().getProposal(SimpleString.toSimpleString("id1.queue0"), false)); + while (timeLimit > System.currentTimeMillis() && servers[1].getGroupingHandler().getProposal(SimpleString.of("id1.queue0"), true) != null) { + assertNotNull(servers[0].getGroupingHandler().getProposal(SimpleString.of("id1.queue0"), false)); Thread.sleep(10); } @@ -529,11 +529,11 @@ public class ClusteredGroupingTest extends ClusterTestBase { Thread.sleep(1000); timeLimit = System.currentTimeMillis() + 5000; - while (timeLimit > System.currentTimeMillis() && servers[0].getGroupingHandler().getProposal(SimpleString.toSimpleString("id1.queue0"), false) != null) { + while (timeLimit > System.currentTimeMillis() && servers[0].getGroupingHandler().getProposal(SimpleString.of("id1.queue0"), false) != null) { Thread.sleep(10); } - assertNull(servers[0].getGroupingHandler().getProposal(SimpleString.toSimpleString("id1.queue0"), false), "Group should have timed out"); + assertNull(servers[0].getGroupingHandler().getProposal(SimpleString.of("id1.queue0"), false), "Group should have timed out"); } @Test @@ -594,8 +594,8 @@ public class ClusteredGroupingTest extends ClusterTestBase { for (int i = 0; i < 500; i++) { ClientMessage message = session.createMessage(true); String group = UUID.randomUUID().toString(); - message.putStringProperty(Message.HDR_GROUP_ID, new SimpleString(group)); - SimpleString dupID = new SimpleString(UUID.randomUUID().toString()); + message.putStringProperty(Message.HDR_GROUP_ID, SimpleString.of(group)); + SimpleString dupID = SimpleString.of(UUID.randomUUID().toString()); message.putStringProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID); if (i % 100 == 0) { groups.add(group); @@ -659,8 +659,8 @@ public class ClusteredGroupingTest extends ClusterTestBase { while (timeToRun > System.currentTimeMillis()) { ClientMessage message = session.createMessage(true); - message.putStringProperty(Message.HDR_GROUP_ID, new SimpleString(group)); - SimpleString dupID = new SimpleString(basicID + ":" + messageCount); + message.putStringProperty(Message.HDR_GROUP_ID, SimpleString.of(group)); + SimpleString dupID = SimpleString.of(basicID + ":" + messageCount); message.putStringProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID); try { producer.send(message); @@ -830,9 +830,9 @@ public class ClusteredGroupingTest extends ClusterTestBase { waitForBindings(1, "queues.testaddress", 2, 2, false); waitForBindings(2, "queues.testaddress", 2, 2, false); - sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, new SimpleString("id1")); - sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, new SimpleString("id2")); - sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, new SimpleString("id3")); + sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); + sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, SimpleString.of("id2")); + sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, SimpleString.of("id3")); verifyReceiveAll(1, 0, 1, 2); @@ -863,9 +863,9 @@ public class ClusteredGroupingTest extends ClusterTestBase { waitForBindings(1, "queues.testaddress", 2, 2, false); waitForBindings(2, "queues.testaddress", 2, 2, false); - sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, new SimpleString("id1")); - sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, new SimpleString("id2")); - sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, new SimpleString("id3")); + sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); + sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, SimpleString.of("id2")); + sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, SimpleString.of("id3")); verifyReceiveAll(1, 0, 1, 2); } @@ -908,9 +908,9 @@ public class ClusteredGroupingTest extends ClusterTestBase { waitForBindings(1, "queues.testaddress", 2, 2, false); waitForBindings(2, "queues.testaddress", 2, 2, false); - sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, new SimpleString("id1")); - sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, new SimpleString("id2")); - sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, new SimpleString("id3")); + sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); + sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, SimpleString.of("id2")); + sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, SimpleString.of("id3")); closeAllConsumers(); closeSessionFactory(0); @@ -934,9 +934,9 @@ public class ClusteredGroupingTest extends ClusterTestBase { waitForBindings(0, "queues.testaddress", 1, 0, false); waitForBindings(2, "queues.testaddress", 1, 1, false); - sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, new SimpleString("id1")); - sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, new SimpleString("id2")); - sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, new SimpleString("id3")); + sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); + sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, SimpleString.of("id2")); + sendWithProperty(0, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, SimpleString.of("id3")); //check for 2 messages on 0 verifyReceiveAll(1, 0); @@ -1075,7 +1075,7 @@ public class ClusteredGroupingTest extends ClusterTestBase { waitForBindings(2, "queues.testaddress", 2, 2, false); try { - sendWithProperty(1, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, new SimpleString("id1")); + sendWithProperty(1, "queues.testaddress", 1, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); // it should get the Retries on the latch assertTrue(latch.await(10, TimeUnit.SECONDS)); @@ -1122,10 +1122,10 @@ public class ClusteredGroupingTest extends ClusterTestBase { waitForBindings(1, "queues.testaddress", 2, 2, false); waitForBindings(2, "queues.testaddress", 2, 2, false); - sendInRange(0, "queues.testaddress", 0, 10, false, Message.HDR_GROUP_ID, new SimpleString("id1")); + sendInRange(0, "queues.testaddress", 0, 10, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); verifyReceiveAllInRange(0, 10, 0); - sendInRange(1, "queues.testaddress", 10, 20, false, Message.HDR_GROUP_ID, new SimpleString("id1")); + sendInRange(1, "queues.testaddress", 10, 20, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); verifyReceiveAllInRange(10, 20, 0); @@ -1169,13 +1169,13 @@ public class ClusteredGroupingTest extends ClusterTestBase { waitForBindings(1, "queues.testaddress", 2, 2, false); waitForBindings(2, "queues.testaddress", 2, 2, false); - sendInRange(0, "queues.testaddress", 0, 10, false, Message.HDR_GROUP_ID, new SimpleString("id1")); + sendInRange(0, "queues.testaddress", 0, 10, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); verifyReceiveAllInRange(0, 10, 0); - sendInRange(1, "queues.testaddress", 10, 20, false, Message.HDR_GROUP_ID, new SimpleString("id1")); + sendInRange(1, "queues.testaddress", 10, 20, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); verifyReceiveAllInRange(10, 20, 0); - sendInRange(2, "queues.testaddress", 10, 20, false, Message.HDR_GROUP_ID, new SimpleString("id1")); + sendInRange(2, "queues.testaddress", 10, 20, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); verifyReceiveAllInRange(10, 20, 0); @@ -1216,13 +1216,13 @@ public class ClusteredGroupingTest extends ClusterTestBase { waitForBindings(1, "queues.testaddress", 2, 0, false); waitForBindings(2, "queues.testaddress", 2, 1, false); - sendInRange(1, "queues.testaddress", 0, 10, false, Message.HDR_GROUP_ID, new SimpleString("id1")); + sendInRange(1, "queues.testaddress", 0, 10, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); verifyReceiveAllInRange(0, 10, 1); - sendInRange(2, "queues.testaddress", 10, 20, false, Message.HDR_GROUP_ID, new SimpleString("id1")); + sendInRange(2, "queues.testaddress", 10, 20, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); verifyReceiveAllInRange(10, 20, 1); - sendInRange(0, "queues.testaddress", 20, 30, false, Message.HDR_GROUP_ID, new SimpleString("id1")); + sendInRange(0, "queues.testaddress", 20, 30, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); verifyReceiveAllInRange(20, 30, 1); } @@ -1264,7 +1264,7 @@ public class ClusteredGroupingTest extends ClusterTestBase { waitForBindings(1, "queues.testaddress", 2, 2, false); waitForBindings(2, "queues.testaddress", 2, 1, false); - sendInRange(1, "queues.testaddress", 0, 1, false, Message.HDR_GROUP_ID, new SimpleString("id1")); + sendInRange(1, "queues.testaddress", 0, 1, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); int consumer = 0; if (consumers[0].consumer.receive(5000) != null) { @@ -1275,13 +1275,13 @@ public class ClusteredGroupingTest extends ClusterTestBase { fail("Message was not received."); } - sendInRange(1, "queues.testaddress", 0, 10, false, Message.HDR_GROUP_ID, new SimpleString("id1")); + sendInRange(1, "queues.testaddress", 0, 10, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); verifyReceiveAllInRange(0, 10, consumer); - sendInRange(2, "queues.testaddress", 10, 20, false, Message.HDR_GROUP_ID, new SimpleString("id1")); + sendInRange(2, "queues.testaddress", 10, 20, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); verifyReceiveAllInRange(10, 20, consumer); - sendInRange(0, "queues.testaddress", 20, 30, false, Message.HDR_GROUP_ID, new SimpleString("id1")); + sendInRange(0, "queues.testaddress", 20, 30, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); verifyReceiveAllInRange(20, 30, consumer); @@ -1325,9 +1325,9 @@ public class ClusteredGroupingTest extends ClusterTestBase { waitForBindings(1, "queues.testaddress", 2, 2, false); waitForBindings(2, "queues.testaddress", 2, 2, false); - sendInRange(0, "queues.testaddress", 0, 10, false, Message.HDR_GROUP_ID, new SimpleString("id1")); - sendInRange(0, "queues.testaddress", 10, 20, false, Message.HDR_GROUP_ID, new SimpleString("id2")); - sendInRange(0, "queues.testaddress", 20, 30, false, Message.HDR_GROUP_ID, new SimpleString("id3")); + sendInRange(0, "queues.testaddress", 0, 10, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); + sendInRange(0, "queues.testaddress", 10, 20, false, Message.HDR_GROUP_ID, SimpleString.of("id2")); + sendInRange(0, "queues.testaddress", 20, 30, false, Message.HDR_GROUP_ID, SimpleString.of("id3")); verifyReceiveAllWithGroupIDRoundRobin(0, 10, 0, 1, 2); } @@ -1370,13 +1370,13 @@ public class ClusteredGroupingTest extends ClusterTestBase { waitForBindings(1, "queues.testaddress", 2, 2, false); waitForBindings(2, "queues.testaddress", 2, 2, false); - sendInRange(0, "queues.testaddress", 0, 10, false, Message.HDR_GROUP_ID, new SimpleString("id1")); + sendInRange(0, "queues.testaddress", 0, 10, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); verifyReceiveAllInRange(0, 10, 0); - sendInRange(1, "queues.testaddress", 10, 20, false, Message.HDR_GROUP_ID, new SimpleString("id1")); + sendInRange(1, "queues.testaddress", 10, 20, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); verifyReceiveAllInRange(10, 20, 0); - sendInRange(2, "queues.testaddress", 20, 30, false, Message.HDR_GROUP_ID, new SimpleString("id1")); + sendInRange(2, "queues.testaddress", 20, 30, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); verifyReceiveAllInRange(20, 30, 0); removeConsumer(0); @@ -1392,11 +1392,11 @@ public class ClusteredGroupingTest extends ClusterTestBase { waitForBindings(1, "queues.testaddress", 1, 1, false); waitForBindings(2, "queues.testaddress", 1, 1, false); - sendInRange(0, "queues.testaddress", 30, 40, false, Message.HDR_GROUP_ID, new SimpleString("id1")); + sendInRange(0, "queues.testaddress", 30, 40, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); verifyReceiveAllInRange(30, 40, 3); - sendInRange(1, "queues.testaddress", 40, 50, false, Message.HDR_GROUP_ID, new SimpleString("id1")); + sendInRange(1, "queues.testaddress", 40, 50, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); verifyReceiveAllInRange(40, 50, 3); - sendInRange(2, "queues.testaddress", 50, 60, false, Message.HDR_GROUP_ID, new SimpleString("id1")); + sendInRange(2, "queues.testaddress", 50, 60, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); verifyReceiveAllInRange(50, 60, 3); } @@ -1436,7 +1436,7 @@ public class ClusteredGroupingTest extends ClusterTestBase { waitForBindings(1, "queues.testaddress", 2, 0, false); waitForBindings(2, "queues.testaddress", 2, 1, false); - sendInRange(1, "queues.testaddress", 0, 10, true, Message.HDR_GROUP_ID, new SimpleString("id1")); + sendInRange(1, "queues.testaddress", 0, 10, true, Message.HDR_GROUP_ID, SimpleString.of("id1")); verifyReceiveAllInRange(true, 0, 10, 0); @@ -1455,7 +1455,7 @@ public class ClusteredGroupingTest extends ClusterTestBase { waitForBindings(2, "queues.testaddress", 2, 1, false); waitForBindings(1, "queues.testaddress", 1, 1, true); waitForBindings(0, "queues.testaddress", 2, 1, false); - sendInRange(2, "queues.testaddress", 10, 20, true, Message.HDR_GROUP_ID, new SimpleString("id1")); + sendInRange(2, "queues.testaddress", 10, 20, true, Message.HDR_GROUP_ID, SimpleString.of("id1")); verifyReceiveAllInRange(10, 20, 0); } @@ -1495,13 +1495,13 @@ public class ClusteredGroupingTest extends ClusterTestBase { waitForBindings(1, "queues.testaddress", 2, 0, false); waitForBindings(2, "queues.testaddress", 2, 1, false); - sendInRange(1, "queues.testaddress", 0, 10, true, Message.HDR_GROUP_ID, new SimpleString("id1")); + sendInRange(1, "queues.testaddress", 0, 10, true, Message.HDR_GROUP_ID, SimpleString.of("id1")); verifyReceiveAllInRange(true, 0, 10, 0); closeAllConsumers(); - sendInRange(2, "queues.testaddress", 10, 20, true, Message.HDR_GROUP_ID, new SimpleString("id1")); + sendInRange(2, "queues.testaddress", 10, 20, true, Message.HDR_GROUP_ID, SimpleString.of("id1")); stopServers(1); @@ -1557,7 +1557,7 @@ public class ClusteredGroupingTest extends ClusterTestBase { waitForBindings(1, "queues.testaddress", 2, 0, false); waitForBindings(2, "queues.testaddress", 2, 1, false); - sendInRange(1, "queues.testaddress", 0, 10, false, Message.HDR_GROUP_ID, new SimpleString("id1")); + sendInRange(1, "queues.testaddress", 0, 10, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); verifyReceiveAllInRange(0, 10, 0); stopServers(1); @@ -1569,11 +1569,11 @@ public class ClusteredGroupingTest extends ClusterTestBase { waitForBindings(1, "queues.testaddress", 1, 1, true); waitForBindings(0, "queues.testaddress", 2, 1, false); waitForBindings(2, "queues.testaddress", 2, 1, false); - sendInRange(2, "queues.testaddress", 10, 20, false, Message.HDR_GROUP_ID, new SimpleString("id1")); + sendInRange(2, "queues.testaddress", 10, 20, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); verifyReceiveAllInRange(10, 20, 1); - sendInRange(0, "queues.testaddress", 20, 30, false, Message.HDR_GROUP_ID, new SimpleString("id1")); + sendInRange(0, "queues.testaddress", 20, 30, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); verifyReceiveAllInRange(20, 30, 1); } @@ -1623,7 +1623,7 @@ public class ClusteredGroupingTest extends ClusterTestBase { waitForBindings(1, "queues.testaddress", 4, 4, false); waitForBindings(2, "queues.testaddress", 4, 4, false); - sendWithProperty(0, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, new SimpleString("id1")); + sendWithProperty(0, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); verifyReceiveAll(10, 0); @@ -1670,7 +1670,7 @@ public class ClusteredGroupingTest extends ClusterTestBase { Thread[] threads = new Thread[9]; int range = 0; for (int i = 0; i < 9; i++, range += 10) { - threads[i] = new Thread(new ThreadSender(range, range + 10, 1, new SimpleString("id" + i), latch, i < 8)); + threads[i] = new Thread(new ThreadSender(range, range + 10, 1, SimpleString.of("id" + i), latch, i < 8)); } for (Thread thread : threads) { thread.start(); 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 457914096b..b6acf067aa 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 @@ -68,7 +68,7 @@ public class ExpireWhileLoadBalanceTest extends ClusterTestBase { waitForTopology(getServer(1), 3); waitForTopology(getServer(2), 3); - SimpleString expiryQueue = SimpleString.toSimpleString("expiryQueue"); + SimpleString expiryQueue = SimpleString.of("expiryQueue"); AddressSettings as = new AddressSettings(); as.setDeadLetterAddress(expiryQueue); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/MessageLoadBalancingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/MessageLoadBalancingTest.java index e74af6b985..99eac00ed6 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/MessageLoadBalancingTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/MessageLoadBalancingTest.java @@ -117,7 +117,7 @@ public class MessageLoadBalancingTest extends ClusterTestBase { PostOffice[] po = new PostOffice[2]; for (int i = 0; i < 2; i++) { po[i] = servers[i].getPostOffice(); - bindings[i] = po[i].getBinding(new SimpleString("queue0")); + bindings[i] = po[i].getBinding(SimpleString.of("queue0")); assertNotNull(bindings[i]); Queue queue0 = (Queue)bindings[i].getBindable(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/MessageRedistributionTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/MessageRedistributionTest.java index 0a0f4cebb3..ccb238d29d 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/MessageRedistributionTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/MessageRedistributionTest.java @@ -97,8 +97,8 @@ public class MessageRedistributionTest extends ClusterTestBase { logger.debug("Doing test"); - getServer(0).getConfiguration().setGroupingHandlerConfiguration(new GroupingHandlerConfiguration().setName(new SimpleString("handler")).setType(GroupingHandlerConfiguration.TYPE.LOCAL).setAddress(new SimpleString("queues"))); - getServer(1).getConfiguration().setGroupingHandlerConfiguration(new GroupingHandlerConfiguration().setName(new SimpleString("handler")).setType(GroupingHandlerConfiguration.TYPE.REMOTE).setAddress(new SimpleString("queues"))); + getServer(0).getConfiguration().setGroupingHandlerConfiguration(new GroupingHandlerConfiguration().setName(SimpleString.of("handler")).setType(GroupingHandlerConfiguration.TYPE.LOCAL).setAddress(SimpleString.of("queues"))); + getServer(1).getConfiguration().setGroupingHandlerConfiguration(new GroupingHandlerConfiguration().setName(SimpleString.of("handler")).setType(GroupingHandlerConfiguration.TYPE.REMOTE).setAddress(SimpleString.of("queues"))); startServers(0, 1); @@ -116,7 +116,7 @@ public class MessageRedistributionTest extends ClusterTestBase { waitForBindings(1, "queues.testaddress", 1, 0, false); //send some grouped messages before we add the consumer to node 0 so we guarantee its pinned to node 1 - sendWithProperty(0, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, new SimpleString("grp1")); + sendWithProperty(0, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, SimpleString.of("grp1")); addConsumer(0, 0, "queue0", null); waitForBindings(0, "queues.testaddress", 1, 1, true); @@ -288,7 +288,7 @@ public class MessageRedistributionTest extends ClusterTestBase { removeConsumer(0); addConsumer(0, 0, "queue0", null); - Bindable bindable = servers[0].getPostOffice().getBinding(new SimpleString("queue0")).getBindable(); + Bindable bindable = servers[0].getPostOffice().getBinding(SimpleString.of("queue0")).getBindable(); String debug = ((QueueImpl) bindable).debug(); assertFalse(debug.contains(Redistributor.class.getName())); logger.debug("Test done"); @@ -1366,7 +1366,7 @@ public class MessageRedistributionTest extends ClusterTestBase { removeConsumer(0); addConsumer(1, 1, "queue0", null); - Queue queue = servers[1].locateQueue(SimpleString.toSimpleString("queue0")); + Queue queue = servers[1].locateQueue(SimpleString.of("queue0")); assertNotNull(queue); Wait.waitFor(() -> queue.getMessageCount() == 200); @@ -1444,7 +1444,7 @@ public class MessageRedistributionTest extends ClusterTestBase { waitForBindings(0, "queues.testaddress", 1, 0, false); - getServer(0).getPagingManager().getPageStore(new SimpleString("queues.testaddress")).startPaging(); + getServer(0).getPagingManager().getPageStore(SimpleString.of("queues.testaddress")).startPaging(); ClientSession session0 = sfs[0].createSession(true, true, 0); ClientProducer producer0 = session0.createProducer("queues.testaddress"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/RemoteBindingWithoutLoadBalancingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/RemoteBindingWithoutLoadBalancingTest.java index 3402a96bdb..63686d4809 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/RemoteBindingWithoutLoadBalancingTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/RemoteBindingWithoutLoadBalancingTest.java @@ -114,7 +114,7 @@ public class RemoteBindingWithoutLoadBalancingTest extends ClusterTestBase { waitForBindings(1, QUEUE_NAME, 1, 0, true); - assertTrue(Wait.waitFor(() -> servers[1].locateQueue(SimpleString.toSimpleString(QUEUE_NAME)).getMessageCount() == 1, 2000, 100)); + assertTrue(Wait.waitFor(() -> servers[1].locateQueue(SimpleString.of(QUEUE_NAME)).getMessageCount() == 1, 2000, 100)); c1.close(); c2.close(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/SimpleSymmetricClusterTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/SimpleSymmetricClusterTest.java index 1ad1ddb59c..0349683755 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/SimpleSymmetricClusterTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/SimpleSymmetricClusterTest.java @@ -320,7 +320,7 @@ public class SimpleSymmetricClusterTest extends ClusterTestBase { waitForBindings(1, ADDRESS, 1, 1, false); // there should be both a local and a remote binding - Collection bindings = servers[0].getPostOffice().getDirectBindings(SimpleString.toSimpleString(ADDRESS)); + Collection bindings = servers[0].getPostOffice().getDirectBindings(SimpleString.of(ADDRESS)); assertEquals(2, bindings.size()); // the remote binding should point to the SnF queue @@ -336,7 +336,7 @@ public class SimpleSymmetricClusterTest extends ClusterTestBase { servers[0].getActiveMQServerControl().deleteAddress(ADDRESS, true); // no bindings should remain but the SnF queue should still be there - bindings = servers[0].getPostOffice().getDirectBindings(SimpleString.toSimpleString(ADDRESS)); + bindings = servers[0].getPostOffice().getDirectBindings(SimpleString.of(ADDRESS)); assertEquals(0, bindings.size()); assertNotNull(servers[0].locateQueue(snf)); } @@ -398,7 +398,7 @@ public class SimpleSymmetricClusterTest extends ClusterTestBase { waitForBindings(0, address, 1, 1, false); waitForBindings(1, address, 1, 1, false); - SimpleString SnFQueueName = SimpleString.toSimpleString( + SimpleString SnFQueueName = SimpleString.of( Arrays.stream(servers[0].getActiveMQServerControl().getQueueNames()).filter( queueName -> queueName.contains(servers[0].getInternalNamingPrefix())) .findFirst() diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/SymmetricClusterTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/SymmetricClusterTest.java index f14885668f..a5f3b33c91 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/SymmetricClusterTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/SymmetricClusterTest.java @@ -251,7 +251,7 @@ public class SymmetricClusterTest extends ClusterTestBase { } for (int i = 0; i < 5; i++) { - servers[i].addAddressInfo(new AddressInfo(SimpleString.toSimpleString("queues.testaddress"), RoutingType.MULTICAST)); + servers[i].addAddressInfo(new AddressInfo(SimpleString.of("queues.testaddress"), RoutingType.MULTICAST)); createQueue(i, "queues.testaddress", "queue0", null, false); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/TwoWayTwoNodeClusterTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/TwoWayTwoNodeClusterTest.java index eadd5acd6e..59e91c834f 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/TwoWayTwoNodeClusterTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/TwoWayTwoNodeClusterTest.java @@ -118,7 +118,7 @@ public class TwoWayTwoNodeClusterTest extends ClusterTestBase { Thread.sleep(100); } - Queue queue0 = servers[0].locateQueue(new SimpleString("queue0")); + Queue queue0 = servers[0].locateQueue(SimpleString.of("queue0")); assertTrue(queue0.getPageSubscription().isPaging()); closeAllSessionFactories(); @@ -163,8 +163,8 @@ public class TwoWayTwoNodeClusterTest extends ClusterTestBase { addrSettings = new AddressSettings(); addressSettingsMap0.put("#", addrSettings); } - addrSettings.setDeadLetterAddress(new SimpleString("jms.queue.DLQ")); - addrSettings.setExpiryAddress(new SimpleString("jms.queue.ExpiryQueue")); + addrSettings.setDeadLetterAddress(SimpleString.of("jms.queue.DLQ")); + addrSettings.setExpiryAddress(SimpleString.of("jms.queue.ExpiryQueue")); addrSettings.setRedeliveryDelay(30); addrSettings.setMaxDeliveryAttempts(5); addrSettings.setMaxSizeBytes(1048576); 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 2eaafff960..5f6cd287df 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 @@ -373,7 +373,7 @@ public class AsynchronousFailoverTest extends FailoverTestBase { message.putIntProperty("counter", i); - message.putStringProperty(Message.HDR_DUPLICATE_DETECTION_ID, new SimpleString("id:" + i + + message.putStringProperty(Message.HDR_DUPLICATE_DETECTION_ID, SimpleString.of("id:" + i + ",exec:" + executionId)); 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 cb9936d530..01d82ce028 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 @@ -259,7 +259,7 @@ public class BackupSyncJournalTest extends FailoverTestBase { id.position(0); id.get(bytes); UUID uuid = new UUID(UUID.TYPE_TIME_BASED, bytes); - SimpleString storedNodeId = new SimpleString(uuid.toString()); + SimpleString storedNodeId = SimpleString.of(uuid.toString()); assertEquals(backupServer.getServer().getNodeID(), storedNodeId, "nodeId must match"); } finally { raFile.close(); 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 cee2dd0671..870c00c542 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 @@ -291,7 +291,7 @@ public class FailBackAutoTest extends FailoverTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = session.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); - message.putIntProperty(new SimpleString("count"), i); + message.putIntProperty(SimpleString.of("count"), i); message.getBodyBuffer().writeString("aardvarks"); producer.send(message); } @@ -305,7 +305,7 @@ public class FailBackAutoTest extends FailoverTestBase { assertEquals("aardvarks", message2.getBodyBuffer().readString()); - assertEquals(i, message2.getObjectProperty(new SimpleString("count"))); + assertEquals(i, message2.getObjectProperty(SimpleString.of("count"))); message2.acknowledge(); } 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 281e86166d..2e166784c3 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 @@ -142,7 +142,7 @@ public class FailBackManualTest extends FailoverTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = session.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); - message.putIntProperty(new SimpleString("count"), i); + message.putIntProperty(SimpleString.of("count"), i); message.getBodyBuffer().writeString("aardvarks"); producer.send(message); } @@ -156,7 +156,7 @@ public class FailBackManualTest extends FailoverTestBase { assertEquals("aardvarks", message2.getBodyBuffer().readString()); - assertEquals(i, message2.getObjectProperty(new SimpleString("count"))); + assertEquals(i, message2.getObjectProperty(SimpleString.of("count"))); message2.acknowledge(); } 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 4c3506280b..dec856098a 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 @@ -228,7 +228,7 @@ public class FailoverListenerTest extends FailoverTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = session.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); - message.putIntProperty(new SimpleString("count"), i); + message.putIntProperty(SimpleString.of("count"), i); message.getBodyBuffer().writeString("aardvarks"); producer.send(message); } @@ -242,7 +242,7 @@ public class FailoverListenerTest extends FailoverTestBase { assertEquals("aardvarks", message2.getBodyBuffer().readString()); - assertEquals(i, message2.getObjectProperty(new SimpleString("count"))); + assertEquals(i, message2.getObjectProperty(SimpleString.of("count"))); message2.acknowledge(); } 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 cc4bc02bb0..8a98f295c0 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 @@ -1760,7 +1760,7 @@ public class FailoverTest extends FailoverTestBase { List consumers = new ArrayList<>(); for (int j = 0; j < numConsumersPerSession; j++) { - SimpleString queueName = new SimpleString("queue" + i + "-" + j); + SimpleString queueName = SimpleString.of("queue" + i + "-" + j); session.createQueue(new QueueConfiguration(queueName).setAddress(FailoverTestBase.ADDRESS)); @@ -2143,7 +2143,7 @@ public class FailoverTest extends FailoverTestBase { if (i == 0) { // Only need to add it on one message per tx - message.putStringProperty(Message.HDR_DUPLICATE_DETECTION_ID, new SimpleString(txID)); + message.putStringProperty(Message.HDR_DUPLICATE_DETECTION_ID, SimpleString.of(txID)); } setBody(i, message); @@ -2225,7 +2225,7 @@ public class FailoverTest extends FailoverTestBase { if (i == 0) { // Only need to add it on one message per tx - message.putStringProperty(Message.HDR_DUPLICATE_DETECTION_ID, new SimpleString(txID)); + message.putStringProperty(Message.HDR_DUPLICATE_DETECTION_ID, SimpleString.of(txID)); } setBody(i, message); @@ -2595,7 +2595,7 @@ public class FailoverTest extends FailoverTestBase { for (int i = 0; i < NUM_MESSAGES; i++) { ClientMessage message = session.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); - message.putIntProperty(new SimpleString("count"), i); + message.putIntProperty(SimpleString.of("count"), i); message.getBodyBuffer().writeString("aardvarks"); producer.send(message); } @@ -2609,7 +2609,7 @@ public class FailoverTest extends FailoverTestBase { assertEquals("aardvarks", message2.getBodyBuffer().readString()); - assertEquals(i, message2.getObjectProperty(new SimpleString("count"))); + assertEquals(i, message2.getObjectProperty(SimpleString.of("count"))); message2.acknowledge(); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTestBase.java index ff6f98e213..27960fb085 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTestBase.java @@ -63,7 +63,7 @@ import org.junit.jupiter.api.BeforeEach; public abstract class FailoverTestBase extends ActiveMQTestBase { - protected static final SimpleString ADDRESS = new SimpleString("FailoverTestAddress"); + protected static final SimpleString ADDRESS = SimpleString.of("FailoverTestAddress"); /* * Used only by tests of large messages. diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/GroupingFailoverTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/GroupingFailoverTestBase.java index bea075b3f7..1dfd425f45 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/GroupingFailoverTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/GroupingFailoverTestBase.java @@ -95,7 +95,7 @@ public abstract class GroupingFailoverTestBase extends ClusterTestBase { waitForTopology(servers[1], 2, 1); - sendWithProperty(0, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, new SimpleString("id1")); + sendWithProperty(0, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); verifyReceiveAll(10, 0); @@ -117,7 +117,7 @@ public abstract class GroupingFailoverTestBase extends ClusterTestBase { waitForBindings(2, "queues.testaddress", 1, 1, true); - sendWithProperty(2, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, new SimpleString("id1")); + sendWithProperty(2, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); verifyReceiveAll(10, 2); } @@ -200,12 +200,12 @@ public abstract class GroupingFailoverTestBase extends ClusterTestBase { waitForTopology(servers[1], 2); - sendWithProperty(0, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, new SimpleString("id1")); - sendWithProperty(0, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, new SimpleString("id2")); - sendWithProperty(0, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, new SimpleString("id3")); - sendWithProperty(0, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, new SimpleString("id4")); - sendWithProperty(0, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, new SimpleString("id5")); - sendWithProperty(0, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, new SimpleString("id6")); + sendWithProperty(0, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); + sendWithProperty(0, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, SimpleString.of("id2")); + sendWithProperty(0, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, SimpleString.of("id3")); + sendWithProperty(0, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, SimpleString.of("id4")); + sendWithProperty(0, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, SimpleString.of("id5")); + sendWithProperty(0, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, SimpleString.of("id6")); verifyReceiveAllWithGroupIDRoundRobin(0, 30, 0, 1); @@ -240,12 +240,12 @@ public abstract class GroupingFailoverTestBase extends ClusterTestBase { waitForBindings(1, "queues.testaddress", 1, 1, false); - sendWithProperty(2, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, new SimpleString("id1")); - sendWithProperty(2, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, new SimpleString("id2")); - sendWithProperty(2, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, new SimpleString("id3")); - sendWithProperty(2, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, new SimpleString("id4")); - sendWithProperty(2, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, new SimpleString("id5")); - sendWithProperty(2, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, new SimpleString("id6")); + sendWithProperty(2, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, SimpleString.of("id1")); + sendWithProperty(2, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, SimpleString.of("id2")); + sendWithProperty(2, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, SimpleString.of("id3")); + sendWithProperty(2, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, SimpleString.of("id4")); + sendWithProperty(2, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, SimpleString.of("id5")); + sendWithProperty(2, "queues.testaddress", 10, false, Message.HDR_GROUP_ID, SimpleString.of("id6")); verifyReceiveAllWithGroupIDRoundRobin(2, 30, 1, 2); } 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 d81036585a..90ec4d1b2d 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 @@ -98,7 +98,7 @@ public abstract class MultipleBackupsFailoverTestBase extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = session.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); - message.putIntProperty(new SimpleString("count"), i); + message.putIntProperty(SimpleString.of("count"), i); message.getBodyBuffer().writeString("aardvarks"); producer.send(message); } @@ -114,7 +114,7 @@ public abstract class MultipleBackupsFailoverTestBase extends ActiveMQTestBase { assertEquals("aardvarks", message2.getBodyBuffer().readString()); - assertEquals(i, message2.getObjectProperty(new SimpleString("count"))); + assertEquals(i, message2.getObjectProperty(SimpleString.of("count"))); message2.acknowledge(); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/MultipleServerFailoverTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/MultipleServerFailoverTestBase.java index 01b037ad2e..56452e9ff1 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/MultipleServerFailoverTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/MultipleServerFailoverTestBase.java @@ -73,7 +73,7 @@ public abstract class MultipleServerFailoverTestBase extends ActiveMQTestBase { // TODO: find a better solution for this // this is necessary because the cluster connection is using "jms" as its match; see org.apache.activemq.artemis.tests.util.ActiveMQTestBase.basicClusterConnectionConfig() - protected static final SimpleString ADDRESS = new SimpleString("jms.FailoverTestAddress"); + protected static final SimpleString ADDRESS = SimpleString.of("jms.FailoverTestAddress"); protected List primaryServers = new ArrayList<>(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NettyReplicatedFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NettyReplicatedFailoverTest.java index 6f17219689..389d29c36c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NettyReplicatedFailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NettyReplicatedFailoverTest.java @@ -99,7 +99,7 @@ public class NettyReplicatedFailoverTest extends NettyFailoverInVMTest { Wait.assertTrue(backupServer.getServer()::isReplicaSync); SharedNothingBackupActivation activation = (SharedNothingBackupActivation) backupServer.getServer().getActivation(); - Map currentPages = activation.getReplicationEndpoint().getPageIndex().get(SimpleString.toSimpleString(queueName)); + Map currentPages = activation.getReplicationEndpoint().getPageIndex().get(SimpleString.of(queueName)); logger.info("There are {} page files open", currentPages.size()); Wait.assertTrue(() -> currentPages.size() <= 1, 10_000); @@ -107,7 +107,7 @@ public class NettyReplicatedFailoverTest extends NettyFailoverInVMTest { producer.send(session.createTextMessage("on currentPage")); session.commit(); - PagingStore store = primaryServer.getServer().getPagingManager().getPageStore(SimpleString.toSimpleString(queueName)); + PagingStore store = primaryServer.getServer().getPagingManager().getPageStore(SimpleString.of(queueName)); Page currentPage = store.getCurrentPage(); logger.info("Page {}", currentPage.getPageId()); 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 39f7a556f7..bc97ac1566 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 @@ -47,7 +47,7 @@ import org.junit.jupiter.api.Test; */ public class PagingFailoverTest extends FailoverTestBase { - private static final SimpleString ADDRESS = new SimpleString("SimpleAddress"); + private static final SimpleString ADDRESS = SimpleString.of("SimpleAddress"); private ServerLocator locator; @@ -100,7 +100,7 @@ public class PagingFailoverTest extends FailoverTestBase { session.commit(); } ClientMessage msg = session.createMessage(true); - msg.putIntProperty(new SimpleString("key"), i); + msg.putIntProperty(SimpleString.of("key"), i); prod.send(msg); } @@ -128,7 +128,7 @@ public class PagingFailoverTest extends FailoverTestBase { if (transacted && i % 10 == 0) { session.commit(); } - assertEquals(i, msg.getObjectProperty(new SimpleString("key"))); + assertEquals(i, msg.getObjectProperty(SimpleString.of("key"))); } session.commit(); @@ -153,7 +153,7 @@ public class PagingFailoverTest extends FailoverTestBase { assertNotNull(msg); msg.acknowledge(); - int result = (Integer) msg.getObjectProperty(new SimpleString("key")); + int result = (Integer) msg.getObjectProperty(SimpleString.of("key")); assertEquals(i, result); } } @@ -173,7 +173,7 @@ public class PagingFailoverTest extends FailoverTestBase { for (int i = 0; i < TOTAL_MESSAGES; i++) { ClientMessage msg = session.createMessage(true); - msg.putIntProperty(new SimpleString("key"), i); + msg.putIntProperty(SimpleString.of("key"), i); msg.setExpiration(System.currentTimeMillis() + 100); prod.send(msg); } 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 6dd176a0aa..47b6bd052e 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 @@ -58,7 +58,7 @@ public class ReplicaTimeoutTest extends ActiveMQTestBase { protected ServerLocator locator; - protected static final SimpleString ADDRESS = new SimpleString("FailoverTestAddress"); + protected static final SimpleString ADDRESS = SimpleString.of("FailoverTestAddress"); @BeforeEach public void setup() { 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 750440001a..e9a0719356 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 @@ -47,7 +47,7 @@ public class ReplicatedDistributionTest extends ClusterTestBase { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - private static final SimpleString ADDRESS = new SimpleString("test.SomeAddress"); + private static final SimpleString ADDRESS = SimpleString.of("test.SomeAddress"); private ClientSession sessionOne; private ClientSession sessionThree; private ClientConsumer consThree; @@ -98,7 +98,7 @@ public class ReplicatedDistributionTest extends ClusterTestBase { // System.out.println(i + " msg = " + msg); - int received = (Integer) msg.getObjectProperty(new SimpleString("key")); + int received = (Integer) msg.getObjectProperty(SimpleString.of("key")); assertEquals(i, received); @@ -153,7 +153,7 @@ public class ReplicatedDistributionTest extends ClusterTestBase { for (int i = 0; i < 100; i++) { ClientMessage msg = sessionOne.createMessage(true); - msg.putIntProperty(new SimpleString("key"), i); + msg.putIntProperty(SimpleString.of("key"), i); producer.send(msg); } sessionOne.commit(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/SharedStoreScaleDownBackupTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/SharedStoreScaleDownBackupTest.java index 4447cf4490..228cfabd98 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/SharedStoreScaleDownBackupTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/SharedStoreScaleDownBackupTest.java @@ -94,8 +94,8 @@ public class SharedStoreScaleDownBackupTest extends ClusterTestBase { // removeConsumer(1); // at this point on node 0 there should be 2 messages in testQueue1 and 1 message in testQueue2 - assertEquals(TEST_SIZE, getMessageCount(((LocalQueueBinding) servers[0].getPostOffice().getBinding(new SimpleString(queueName1))).getQueue())); - assertEquals(TEST_SIZE - 1, getMessageCount(((LocalQueueBinding) servers[0].getPostOffice().getBinding(new SimpleString(queueName2))).getQueue())); + assertEquals(TEST_SIZE, getMessageCount(((LocalQueueBinding) servers[0].getPostOffice().getBinding(SimpleString.of(queueName1))).getQueue())); + assertEquals(TEST_SIZE - 1, getMessageCount(((LocalQueueBinding) servers[0].getPostOffice().getBinding(SimpleString.of(queueName2))).getQueue())); // trigger scaleDown from node 0 to node 1 servers[0].stop(); 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 adc4c013ed..fb63962a27 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 @@ -48,7 +48,7 @@ public class OrderReattachTest extends ActiveMQTestBase { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - final SimpleString ADDRESS = new SimpleString("address"); + final SimpleString ADDRESS = SimpleString.of("address"); private ActiveMQServer server; @@ -151,7 +151,7 @@ public class OrderReattachTest extends ActiveMQTestBase { Set sessions = new HashSet<>(); for (int i = 0; i < numSessions; i++) { - SimpleString subName = new SimpleString("sub" + i); + SimpleString subName = SimpleString.of("sub" + i); // failureQueue.push(true); @@ -176,7 +176,7 @@ public class OrderReattachTest extends ActiveMQTestBase { if (i % 10 == 0) { // failureQueue.push(true); } - message.putIntProperty(new SimpleString("count"), i); + message.putIntProperty(SimpleString.of("count"), i); producer.send(message); } @@ -251,7 +251,7 @@ public class OrderReattachTest extends ActiveMQTestBase { failureQueue.push(true); - SimpleString subName = new SimpleString("sub" + i); + SimpleString subName = SimpleString.of("sub" + i); s.deleteQueue(subName); } 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 9529c98c1a..5982a7416e 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 @@ -65,7 +65,7 @@ public class ReattachTest extends ActiveMQTestBase { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - private static final SimpleString ADDRESS = new SimpleString("FailoverTestAddress"); + private static final SimpleString ADDRESS = SimpleString.of("FailoverTestAddress"); private ActiveMQServer server; private ServerLocator locator; @@ -97,7 +97,7 @@ public class ReattachTest extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = session.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); - message.putIntProperty(new SimpleString("count"), i); + message.putIntProperty(SimpleString.of("count"), i); message.getBodyBuffer().writeString("aardvarks"); producer.send(message); } @@ -117,7 +117,7 @@ public class ReattachTest extends ActiveMQTestBase { assertEquals("aardvarks", message.getBodyBuffer().readString()); - assertEquals(i, message.getObjectProperty(new SimpleString("count"))); + assertEquals(i, message.getObjectProperty(SimpleString.of("count"))); message.acknowledge(); } @@ -242,7 +242,7 @@ public class ReattachTest extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = session.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); - message.putIntProperty(new SimpleString("count"), i); + message.putIntProperty(SimpleString.of("count"), i); message.getBodyBuffer().writeBytes(new byte[5000]); producer.send(message); } @@ -278,7 +278,7 @@ public class ReattachTest extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = session.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); - message.putIntProperty(new SimpleString("count"), i); + message.putIntProperty(SimpleString.of("count"), i); message.getBodyBuffer().writeString("aardvarks"); producer.send(message); } @@ -380,7 +380,7 @@ public class ReattachTest extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = session.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); - message.putIntProperty(new SimpleString("count"), i); + message.putIntProperty(SimpleString.of("count"), i); message.getBodyBuffer().writeString("aardvarks"); producer.send(message); } @@ -461,7 +461,7 @@ public class ReattachTest extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = session.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); - message.putIntProperty(new SimpleString("count"), i); + message.putIntProperty(SimpleString.of("count"), i); message.getBodyBuffer().writeString("aardvarks"); producer.send(message); } @@ -775,7 +775,7 @@ public class ReattachTest extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = session.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); - message.putIntProperty(new SimpleString("count"), i); + message.putIntProperty(SimpleString.of("count"), i); message.getBodyBuffer().writeString("aardvarks"); producer.send(message); } @@ -834,7 +834,7 @@ public class ReattachTest extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = session.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); - message.putIntProperty(new SimpleString("count"), i); + message.putIntProperty(SimpleString.of("count"), i); message.getBodyBuffer().writeString("aardvarks"); producer.send(message); } @@ -913,7 +913,7 @@ public class ReattachTest extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = session.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); - message.putIntProperty(new SimpleString("count"), i); + message.putIntProperty(SimpleString.of("count"), i); message.getBodyBuffer().writeString("aardvarks"); producer.send(message); } @@ -938,7 +938,7 @@ public class ReattachTest extends ActiveMQTestBase { assertEquals("aardvarks", message.getBodyBuffer().readString()); - assertEquals(i, message.getObjectProperty(new SimpleString("count"))); + assertEquals(i, message.getObjectProperty(SimpleString.of("count"))); message.acknowledge(); } @@ -982,7 +982,7 @@ public class ReattachTest extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = session.createMessage(ActiveMQTextMessage.TYPE, false, 0, System.currentTimeMillis(), (byte) 1); - message.putIntProperty(new SimpleString("count"), i); + message.putIntProperty(SimpleString.of("count"), i); message.getBodyBuffer().writeString("aardvarks"); producer.send(message); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/restart/ClusterRestartTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/restart/ClusterRestartTest.java index 3df03144dc..5f4837f988 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/restart/ClusterRestartTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/restart/ClusterRestartTest.java @@ -156,7 +156,7 @@ public class ClusterRestartTest extends ClusterTestBase { private void printBindings(final int num) throws Exception { for (int i = 0; i < num; i++) { - Collection bindings0 = getServer(i).getPostOffice().getBindingsForAddress(new SimpleString("queues.testaddress")).getBindings(); + Collection bindings0 = getServer(i).getPostOffice().getBindingsForAddress(SimpleString.of("queues.testaddress")).getBindings(); for (Binding binding : bindings0) { logger.debug("{} on node {} at {}", binding, i, binding.getID()); } 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 c8e5f8a937..7585ddc083 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 @@ -64,9 +64,9 @@ public class AMQPToJMSCoreTest extends ActiveMQTestBase { Configuration serverConfig = server.getConfiguration(); serverConfig.getAddressSettings().put("#", new AddressSettings().setAutoCreateQueues(false) .setAutoCreateAddresses(false) - .setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ"))); + .setDeadLetterAddress(SimpleString.of("ActiveMQ.DLQ"))); serverConfig.setSecurityEnabled(false); - coreQueue = new SimpleString(queueName); + coreQueue = SimpleString.of(queueName); server.createQueue(new QueueConfiguration(coreQueue).setRoutingType(RoutingType.ANYCAST).setDurable(false)); } 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 d8ecc1da0f..228c90bded 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 @@ -77,9 +77,9 @@ public class AMQPToOpenwireTest extends ActiveMQTestBase { server.waitForActivation(10, TimeUnit.SECONDS); Configuration serverConfig = server.getConfiguration(); - serverConfig.getAddressSettings().put("#", new AddressSettings().setAutoCreateQueues(false).setAutoCreateAddresses(false).setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ"))); + serverConfig.getAddressSettings().put("#", new AddressSettings().setAutoCreateQueues(false).setAutoCreateAddresses(false).setDeadLetterAddress(SimpleString.of("ActiveMQ.DLQ"))); serverConfig.setSecurityEnabled(false); - coreQueue = new SimpleString(queueName); + coreQueue = SimpleString.of(queueName); 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 84aae70904..e9b6b54b61 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 @@ -59,9 +59,9 @@ public class AMQPToStompTest extends ActiveMQTestBase { Configuration serverConfig = server.getConfiguration(); serverConfig.getAddressSettings().put("#", new AddressSettings().setAutoCreateQueues(false) .setAutoCreateAddresses(false) - .setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ"))); + .setDeadLetterAddress(SimpleString.of("ActiveMQ.DLQ"))); serverConfig.setSecurityEnabled(false); - coreQueue = new SimpleString(queueName); + coreQueue = SimpleString.of(queueName); server.createQueue(new QueueConfiguration(coreQueue).setRoutingType(RoutingType.ANYCAST).setDurable(false)); } 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 5e25a63b53..3fc1486c63 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 @@ -55,7 +55,7 @@ public class MessageIDMultiProtocolTest extends OpenWireTestBase { String protocolConsumer; ConnectionFactory senderCF; ConnectionFactory consumerCF; - private static final SimpleString queueName = SimpleString.toSimpleString("MessageIDueueTest"); + private static final SimpleString queueName = SimpleString.of("MessageIDueueTest"); public MessageIDMultiProtocolTest(String protocolSender, String protocolConsumer) { this.protocolSender = protocolSender; 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 7260d2ad32..a0e4183da2 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 @@ -65,10 +65,10 @@ public class OpenWireToAMQPTest extends ActiveMQTestBase { super.setUp(); server = createServer(true, true); Configuration serverConfig = server.getConfiguration(); - serverConfig.getAddressSettings().put("#", new AddressSettings().setAutoCreateQueues(true).setAutoCreateAddresses(true).setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ"))); + serverConfig.getAddressSettings().put("#", new AddressSettings().setAutoCreateQueues(true).setAutoCreateAddresses(true).setDeadLetterAddress(SimpleString.of("ActiveMQ.DLQ"))); serverConfig.setSecurityEnabled(false); server.start(); - coreQueue = new SimpleString(queueName); + coreQueue = SimpleString.of(queueName); 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 d9ffa7ef41..6de961127b 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 @@ -62,7 +62,7 @@ public class OpenwireAmqpResenderTest extends ActiveMQTestBase { Configuration serverConfig = server.getConfiguration(); serverConfig.getAddressSettings().put("#", new AddressSettings().setAutoCreateQueues(true) - .setAutoCreateAddresses(true).setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ"))); + .setAutoCreateAddresses(true).setDeadLetterAddress(SimpleString.of("ActiveMQ.DLQ"))); serverConfig.setSecurityEnabled(false); server.start(); 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 34e10af4f0..d2147a0e86 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 @@ -61,9 +61,9 @@ public class RequestReplyMultiProtocolTest extends OpenWireTestBase { String protocolConsumer; ConnectionFactory senderCF; ConnectionFactory consumerCF; - private static final SimpleString queueName = SimpleString.toSimpleString("RequestReplyQueueTest"); - private static final SimpleString topicName = SimpleString.toSimpleString("RequestReplyTopicTest"); - private static final SimpleString replyQueue = SimpleString.toSimpleString("ReplyOnRequestReplyQueueTest"); + private static final SimpleString queueName = SimpleString.of("RequestReplyQueueTest"); + private static final SimpleString topicName = SimpleString.of("RequestReplyTopicTest"); + private static final SimpleString replyQueue = SimpleString.of("ReplyOnRequestReplyQueueTest"); public RequestReplyMultiProtocolTest(String protocolSender, String protocolConsumer) { this.protocolSender = protocolSender; 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 e5859c0d03..030f03c86a 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 @@ -54,9 +54,9 @@ import org.junit.jupiter.api.extension.ExtendWith; @ExtendWith(ParameterizedTestExtension.class) public class RequestReplyNonJMSTest extends OpenWireTestBase { - private static final SimpleString queueName = SimpleString.toSimpleString("RequestReplyQueueTest"); - private static final SimpleString topicName = SimpleString.toSimpleString("RequestReplyTopicTest"); - private static final SimpleString replyQueue = SimpleString.toSimpleString("ReplyOnRequestReplyQueueTest"); + private static final SimpleString queueName = SimpleString.of("RequestReplyQueueTest"); + private static final SimpleString topicName = SimpleString.of("RequestReplyTopicTest"); + private static final SimpleString replyQueue = SimpleString.of("ReplyOnRequestReplyQueueTest"); private final String protocolConsumer; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/discovery/DiscoveryTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/discovery/DiscoveryTest.java index 80cb35bd3a..6879c03dce 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/discovery/DiscoveryTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/discovery/DiscoveryTest.java @@ -924,14 +924,14 @@ public class DiscoveryTest extends DiscoveryBaseTest { assertEquals(1, notifListener.getNotifications().size()); Notification notif = notifListener.getNotifications().get(0); assertEquals(CoreNotificationType.DISCOVERY_GROUP_STARTED, notif.getType()); - assertEquals(dg.getName(), notif.getProperties().getSimpleStringProperty(new SimpleString("name")).toString()); + assertEquals(dg.getName(), notif.getProperties().getSimpleStringProperty(SimpleString.of("name")).toString()); dg.stop(); assertEquals(2, notifListener.getNotifications().size()); notif = notifListener.getNotifications().get(1); assertEquals(CoreNotificationType.DISCOVERY_GROUP_STOPPED, notif.getType()); - assertEquals(dg.getName(), notif.getProperties().getSimpleStringProperty(new SimpleString("name")).toString()); + assertEquals(dg.getName(), notif.getProperties().getSimpleStringProperty(SimpleString.of("name")).toString()); } @Test @@ -954,13 +954,13 @@ public class DiscoveryTest extends DiscoveryBaseTest { assertEquals(1, notifListener.getNotifications().size()); Notification notif = notifListener.getNotifications().get(0); assertEquals(CoreNotificationType.BROADCAST_GROUP_STARTED, notif.getType()); - assertEquals(bg.getName(), notif.getProperties().getSimpleStringProperty(new SimpleString("name")).toString()); + assertEquals(bg.getName(), notif.getProperties().getSimpleStringProperty(SimpleString.of("name")).toString()); bg.stop(); assertEquals(2, notifListener.getNotifications().size()); notif = notifListener.getNotifications().get(1); assertEquals(CoreNotificationType.BROADCAST_GROUP_STOPPED, notif.getType()); - assertEquals(bg.getName(), notif.getProperties().getSimpleStringProperty(new SimpleString("name")).toString()); + assertEquals(bg.getName(), notif.getProperties().getSimpleStringProperty(SimpleString.of("name")).toString()); } } 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 331292b196..35c2e7140a 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 @@ -133,9 +133,9 @@ public class DivertTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - final SimpleString queueName1 = new SimpleString("queue1"); + final SimpleString queueName1 = SimpleString.of("queue1"); - final SimpleString queueName2 = new SimpleString("queue2"); + final SimpleString queueName2 = SimpleString.of("queue2"); session.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress).setDurable(false)); @@ -143,7 +143,7 @@ public class DivertTest extends ActiveMQTestBase { session.start(); - ClientProducer producer = session.createProducer(new SimpleString(testAddress)); + ClientProducer producer = session.createProducer(SimpleString.of(testAddress)); ClientConsumer consumer1 = session.createConsumer(queueName1); @@ -151,7 +151,7 @@ public class DivertTest extends ActiveMQTestBase { final int numMessages = 1; - final SimpleString propKey = new SimpleString("testkey"); + final SimpleString propKey = SimpleString.of("testkey"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session.createMessage(false); @@ -230,9 +230,9 @@ public class DivertTest extends ActiveMQTestBase { server.start(); - final SimpleString queueName1 = SimpleString.toSimpleString(testAddress); + final SimpleString queueName1 = SimpleString.of(testAddress); - final SimpleString queueName2 = SimpleString.toSimpleString(forwardAddress); + final SimpleString queueName2 = SimpleString.of(forwardAddress); { // this is setting up the queues ServerLocator locator = createInVMNonHALocator(); @@ -243,7 +243,7 @@ public class DivertTest extends ActiveMQTestBase { session.createQueue(new QueueConfiguration(queueName1).setAddress(testAddress).setRoutingType(RoutingType.ANYCAST)); - session.createQueue(new QueueConfiguration(SimpleString.toSimpleString(testForConvert)).setAddress(testForConvert).setRoutingType(RoutingType.ANYCAST)); + session.createQueue(new QueueConfiguration(SimpleString.of(testForConvert)).setAddress(testForConvert).setRoutingType(RoutingType.ANYCAST)); session.createQueue(new QueueConfiguration(queueName2).setAddress(forwardAddress).setRoutingType(RoutingType.ANYCAST)); } @@ -312,9 +312,9 @@ public class DivertTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - final SimpleString queueName1 = new SimpleString("queue1"); + final SimpleString queueName1 = SimpleString.of("queue1"); - final SimpleString queueName2 = new SimpleString("queue2"); + final SimpleString queueName2 = SimpleString.of("queue2"); session.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress).setRoutingType(RoutingType.ANYCAST).setDurable(false)); @@ -322,7 +322,7 @@ public class DivertTest extends ActiveMQTestBase { session.start(); - ClientProducer producer = session.createProducer(new SimpleString(testAddress)); + ClientProducer producer = session.createProducer(SimpleString.of(testAddress)); ClientConsumer consumer1 = session.createConsumer(queueName1); @@ -330,7 +330,7 @@ public class DivertTest extends ActiveMQTestBase { final int numMessages = 1; - final SimpleString propKey = new SimpleString("testkey"); + final SimpleString propKey = SimpleString.of("testkey"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session.createMessage(false); @@ -387,9 +387,9 @@ public class DivertTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - final SimpleString queueName1 = new SimpleString("queue1"); + final SimpleString queueName1 = SimpleString.of("queue1"); - final SimpleString queueName2 = new SimpleString("queue2"); + final SimpleString queueName2 = SimpleString.of("queue2"); session.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress).setRoutingType(RoutingType.ANYCAST).setDurable(false)); @@ -397,13 +397,13 @@ public class DivertTest extends ActiveMQTestBase { session.start(); - ClientProducer producer = session.createProducer(new SimpleString(testAddress)); + ClientProducer producer = session.createProducer(SimpleString.of(testAddress)); ClientConsumer consumer1 = session.createConsumer(queueName1); final int numMessages = 1; - final SimpleString propKey = new SimpleString("testkey"); + final SimpleString propKey = SimpleString.of("testkey"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session.createMessage(false); @@ -436,7 +436,7 @@ public class DivertTest extends ActiveMQTestBase { final String expiryAddress = "expiryAddress"; - AddressSettings expirySettings = new AddressSettings().setExpiryAddress(new SimpleString(expiryAddress)); + AddressSettings expirySettings = new AddressSettings().setExpiryAddress(SimpleString.of(expiryAddress)); DivertConfiguration divertConf = new DivertConfiguration().setName("divert1").setRoutingName("divert1").setAddress(testAddress).setForwardingAddress(forwardAddress); @@ -452,9 +452,9 @@ public class DivertTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, false, false); - final SimpleString queueName1 = new SimpleString("queue1"); + final SimpleString queueName1 = SimpleString.of("queue1"); - final SimpleString queueName2 = new SimpleString("queue2"); + final SimpleString queueName2 = SimpleString.of("queue2"); session.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress)); @@ -464,7 +464,7 @@ public class DivertTest extends ActiveMQTestBase { session.start(); - ClientProducer producer = session.createProducer(new SimpleString(testAddress)); + ClientProducer producer = session.createProducer(SimpleString.of(testAddress)); ClientConsumer consumer1 = session.createConsumer(queueName1); @@ -472,7 +472,7 @@ public class DivertTest extends ActiveMQTestBase { final int numMessages = 1; - final SimpleString propKey = new SimpleString("testkey"); + final SimpleString propKey = SimpleString.of("testkey"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session.createMessage(true); @@ -553,13 +553,13 @@ public class DivertTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - final SimpleString queueName1 = new SimpleString("queue1"); + final SimpleString queueName1 = SimpleString.of("queue1"); - final SimpleString queueName2 = new SimpleString("queue2"); + final SimpleString queueName2 = SimpleString.of("queue2"); - final SimpleString queueName3 = new SimpleString("queue3"); + final SimpleString queueName3 = SimpleString.of("queue3"); - final SimpleString queueName4 = new SimpleString("queue4"); + final SimpleString queueName4 = SimpleString.of("queue4"); session.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress).setDurable(false)); @@ -571,7 +571,7 @@ public class DivertTest extends ActiveMQTestBase { session.start(); - ClientProducer producer = session.createProducer(new SimpleString(testAddress)); + ClientProducer producer = session.createProducer(SimpleString.of(testAddress)); ClientConsumer consumer1 = session.createConsumer(queueName1); @@ -583,7 +583,7 @@ public class DivertTest extends ActiveMQTestBase { final int numMessages = 10; - final SimpleString propKey = new SimpleString("testkey"); + final SimpleString propKey = SimpleString.of("testkey"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session.createMessage(false); @@ -661,19 +661,19 @@ public class DivertTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - final SimpleString queueName1 = new SimpleString("queue1"); + final SimpleString queueName1 = SimpleString.of("queue1"); session.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress).setDurable(false)); session.start(); - ClientProducer producer = session.createProducer(new SimpleString(testAddress)); + ClientProducer producer = session.createProducer(SimpleString.of(testAddress)); ClientConsumer consumer1 = session.createConsumer(queueName1); final int numMessages = 10; - final SimpleString propKey = new SimpleString("testkey"); + final SimpleString propKey = SimpleString.of("testkey"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session.createMessage(false); @@ -715,13 +715,13 @@ public class DivertTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - final SimpleString queueName1 = new SimpleString("queue1"); + final SimpleString queueName1 = SimpleString.of("queue1"); - final SimpleString queueName2 = new SimpleString("queue2"); + final SimpleString queueName2 = SimpleString.of("queue2"); - final SimpleString queueName3 = new SimpleString("queue3"); + final SimpleString queueName3 = SimpleString.of("queue3"); - final SimpleString queueName4 = new SimpleString("queue4"); + final SimpleString queueName4 = SimpleString.of("queue4"); session.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress).setDurable(false)); @@ -731,7 +731,7 @@ public class DivertTest extends ActiveMQTestBase { session.start(); - ClientProducer producer = session.createProducer(new SimpleString(testAddress)); + ClientProducer producer = session.createProducer(SimpleString.of(testAddress)); ClientConsumer consumer1 = session.createConsumer(queueName1); @@ -743,7 +743,7 @@ public class DivertTest extends ActiveMQTestBase { final int numMessages = 10; - final SimpleString propKey = new SimpleString("testkey"); + final SimpleString propKey = SimpleString.of("testkey"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session.createMessage(false); @@ -800,9 +800,9 @@ public class DivertTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - final SimpleString queueName1 = new SimpleString("queue1"); - final SimpleString queueName2 = new SimpleString("queue2"); - final SimpleString queueName3 = new SimpleString("queue3"); + final SimpleString queueName1 = SimpleString.of("queue1"); + final SimpleString queueName2 = SimpleString.of("queue2"); + final SimpleString queueName3 = SimpleString.of("queue3"); session.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress1).setDurable(false)); session.createQueue(new QueueConfiguration(queueName2).setAddress(forwardAddress2).setDurable(false)); @@ -810,11 +810,11 @@ public class DivertTest extends ActiveMQTestBase { session.start(); - ClientProducer producer = session.createProducer(new SimpleString(testAddress)); + ClientProducer producer = session.createProducer(SimpleString.of(testAddress)); final int numMessages = 10; - final SimpleString propKey = new SimpleString("testkey"); + final SimpleString propKey = SimpleString.of("testkey"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session.createMessage(false); @@ -867,11 +867,11 @@ public class DivertTest extends ActiveMQTestBase { server.start(); - Binding divert1 = server.getPostOffice().getBinding(new SimpleString("divert1")); + Binding divert1 = server.getPostOffice().getBinding(SimpleString.of("divert1")); assertNotNull(divert1); - assertEquals(divert1.getRoutingName(), new SimpleString("divert2")); + assertEquals(divert1.getRoutingName(), SimpleString.of("divert2")); } @Test @@ -901,11 +901,11 @@ public class DivertTest extends ActiveMQTestBase { server.start(); - Binding divert1 = server.getPostOffice().getBinding(new SimpleString("divert1")); + Binding divert1 = server.getPostOffice().getBinding(SimpleString.of("divert1")); assertNotNull(divert1); - assertEquals(divert1.getRoutingName(), new SimpleString("divert2")); + assertEquals(divert1.getRoutingName(), SimpleString.of("divert2")); } @Test @@ -931,11 +931,11 @@ public class DivertTest extends ActiveMQTestBase { server.start(); - Binding divert1 = server.getPostOffice().getBinding(new SimpleString("divert1")); + Binding divert1 = server.getPostOffice().getBinding(SimpleString.of("divert1")); assertNotNull(divert1); - assertEquals(divert1.getRoutingName(), new SimpleString("divert1")); + assertEquals(divert1.getRoutingName(), SimpleString.of("divert1")); } @Test @@ -969,7 +969,7 @@ public class DivertTest extends ActiveMQTestBase { server.start(); - Binding divert1 = server.getPostOffice().getBinding(new SimpleString("divert1")); + Binding divert1 = server.getPostOffice().getBinding(SimpleString.of("divert1")); assertNull(divert1); } @@ -1015,11 +1015,11 @@ public class DivertTest extends ActiveMQTestBase { server.start(); - Binding divert1 = server.getPostOffice().getBinding(new SimpleString("divert1")); + Binding divert1 = server.getPostOffice().getBinding(SimpleString.of("divert1")); assertNull(divert1); - Binding divert2 = server.getPostOffice().getBinding(new SimpleString("divert2")); + Binding divert2 = server.getPostOffice().getBinding(SimpleString.of("divert2")); assertNotNull(divert2); } @@ -1050,13 +1050,13 @@ public class DivertTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - final SimpleString queueName1 = new SimpleString("queue1"); + final SimpleString queueName1 = SimpleString.of("queue1"); - final SimpleString queueName2 = new SimpleString("queue2"); + final SimpleString queueName2 = SimpleString.of("queue2"); - final SimpleString queueName3 = new SimpleString("queue3"); + final SimpleString queueName3 = SimpleString.of("queue3"); - final SimpleString queueName4 = new SimpleString("queue4"); + final SimpleString queueName4 = SimpleString.of("queue4"); session.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress1).setDurable(false)); @@ -1068,7 +1068,7 @@ public class DivertTest extends ActiveMQTestBase { session.start(); - ClientProducer producer = session.createProducer(new SimpleString(testAddress)); + ClientProducer producer = session.createProducer(SimpleString.of(testAddress)); ClientConsumer consumer1 = session.createConsumer(queueName1); @@ -1080,7 +1080,7 @@ public class DivertTest extends ActiveMQTestBase { final int numMessages = 10; - final SimpleString propKey = new SimpleString("testkey"); + final SimpleString propKey = SimpleString.of("testkey"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session.createMessage(false); @@ -1165,13 +1165,13 @@ public class DivertTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - final SimpleString queueName1 = new SimpleString("queue1"); + final SimpleString queueName1 = SimpleString.of("queue1"); - final SimpleString queueName2 = new SimpleString("queue2"); + final SimpleString queueName2 = SimpleString.of("queue2"); - final SimpleString queueName3 = new SimpleString("queue3"); + final SimpleString queueName3 = SimpleString.of("queue3"); - final SimpleString queueName4 = new SimpleString("queue4"); + final SimpleString queueName4 = SimpleString.of("queue4"); session.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress1).setDurable(false)); @@ -1183,7 +1183,7 @@ public class DivertTest extends ActiveMQTestBase { session.start(); - ClientProducer producer = session.createProducer(new SimpleString(testAddress)); + ClientProducer producer = session.createProducer(SimpleString.of(testAddress)); ClientConsumer consumer1 = session.createConsumer(queueName1); @@ -1195,7 +1195,7 @@ public class DivertTest extends ActiveMQTestBase { final int numMessages = 10; - final SimpleString propKey = new SimpleString("testkey"); + final SimpleString propKey = SimpleString.of("testkey"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session.createMessage(false); @@ -1269,13 +1269,13 @@ public class DivertTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - final SimpleString queueName1 = new SimpleString("queue1"); + final SimpleString queueName1 = SimpleString.of("queue1"); - final SimpleString queueName2 = new SimpleString("queue2"); + final SimpleString queueName2 = SimpleString.of("queue2"); - final SimpleString queueName3 = new SimpleString("queue3"); + final SimpleString queueName3 = SimpleString.of("queue3"); - final SimpleString queueName4 = new SimpleString("queue4"); + final SimpleString queueName4 = SimpleString.of("queue4"); session.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress1).setDurable(false)); @@ -1287,7 +1287,7 @@ public class DivertTest extends ActiveMQTestBase { session.start(); - ClientProducer producer = session.createProducer(new SimpleString(testAddress)); + ClientProducer producer = session.createProducer(SimpleString.of(testAddress)); ClientConsumer consumer1 = session.createConsumer(queueName1); @@ -1299,7 +1299,7 @@ public class DivertTest extends ActiveMQTestBase { final int numMessages = 10; - final SimpleString propKey = new SimpleString("testkey"); + final SimpleString propKey = SimpleString.of("testkey"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session.createMessage(false); @@ -1367,13 +1367,13 @@ public class DivertTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - final SimpleString queueName1 = new SimpleString("queue1"); + final SimpleString queueName1 = SimpleString.of("queue1"); - final SimpleString queueName2 = new SimpleString("queue2"); + final SimpleString queueName2 = SimpleString.of("queue2"); - final SimpleString queueName3 = new SimpleString("queue3"); + final SimpleString queueName3 = SimpleString.of("queue3"); - final SimpleString queueName4 = new SimpleString("queue4"); + final SimpleString queueName4 = SimpleString.of("queue4"); session.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress1).setDurable(false)); @@ -1385,7 +1385,7 @@ public class DivertTest extends ActiveMQTestBase { session.start(); - ClientProducer producer = session.createProducer(new SimpleString(testAddress)); + ClientProducer producer = session.createProducer(SimpleString.of(testAddress)); ClientConsumer consumer1 = session.createConsumer(queueName1); @@ -1397,12 +1397,12 @@ public class DivertTest extends ActiveMQTestBase { final int numMessages = 10; - final SimpleString propKey = new SimpleString("testkey"); + final SimpleString propKey = SimpleString.of("testkey"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session.createMessage(false); - message.putStringProperty(new SimpleString("animal"), new SimpleString("giraffe")); + message.putStringProperty(SimpleString.of("animal"), SimpleString.of("giraffe")); message.putIntProperty(propKey, i); @@ -1461,7 +1461,7 @@ public class DivertTest extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = session.createMessage(false); - message.putStringProperty(new SimpleString("animal"), new SimpleString("antelope")); + message.putStringProperty(SimpleString.of("animal"), SimpleString.of("antelope")); message.putIntProperty(propKey, i); @@ -1513,13 +1513,13 @@ public class DivertTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - final SimpleString queueName1 = new SimpleString("queue1"); + final SimpleString queueName1 = SimpleString.of("queue1"); - final SimpleString queueName2 = new SimpleString("queue2"); + final SimpleString queueName2 = SimpleString.of("queue2"); - final SimpleString queueName3 = new SimpleString("queue3"); + final SimpleString queueName3 = SimpleString.of("queue3"); - final SimpleString queueName4 = new SimpleString("queue4"); + final SimpleString queueName4 = SimpleString.of("queue4"); session.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress1).setDurable(false)); @@ -1531,7 +1531,7 @@ public class DivertTest extends ActiveMQTestBase { session.start(); - ClientProducer producer = session.createProducer(new SimpleString(testAddress)); + ClientProducer producer = session.createProducer(SimpleString.of(testAddress)); ClientConsumer consumer1 = session.createConsumer(queueName1); @@ -1543,7 +1543,7 @@ public class DivertTest extends ActiveMQTestBase { final int numMessages = 10; - final SimpleString propKey = new SimpleString("testkey"); + final SimpleString propKey = SimpleString.of("testkey"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session.createMessage(false); @@ -1638,13 +1638,13 @@ public class DivertTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); - final SimpleString queueName1 = new SimpleString("queue1"); + final SimpleString queueName1 = SimpleString.of("queue1"); - final SimpleString queueName2 = new SimpleString("queue2"); + final SimpleString queueName2 = SimpleString.of("queue2"); - final SimpleString queueName3 = new SimpleString("queue3"); + final SimpleString queueName3 = SimpleString.of("queue3"); - final SimpleString queueName4 = new SimpleString("queue4"); + final SimpleString queueName4 = SimpleString.of("queue4"); session.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress1).setDurable(false)); @@ -1656,7 +1656,7 @@ public class DivertTest extends ActiveMQTestBase { session.start(); - ClientProducer producer = session.createProducer(new SimpleString(testAddress)); + ClientProducer producer = session.createProducer(SimpleString.of(testAddress)); ClientConsumer consumer1 = session.createConsumer(queueName1); @@ -1668,7 +1668,7 @@ public class DivertTest extends ActiveMQTestBase { final int numMessages = 10; - final SimpleString propKey = new SimpleString("testkey"); + final SimpleString propKey = SimpleString.of("testkey"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session.createMessage(false); @@ -1719,7 +1719,7 @@ public class DivertTest extends ActiveMQTestBase { @Test public void testInjectedTransformer() throws Exception { - final SimpleString ADDRESS = new SimpleString("myAddress"); + final SimpleString ADDRESS = SimpleString.of("myAddress"); final String DIVERT = "myDivert"; ServiceRegistryImpl serviceRegistry = new ServiceRegistryImpl(); @@ -1746,14 +1746,14 @@ public class DivertTest extends ActiveMQTestBase { assertNotNull(divert); assertEquals(transformer, divert.getTransformer()); - server.destroyDivert(SimpleString.toSimpleString(DIVERT)); + server.destroyDivert(SimpleString.of(DIVERT)); assertNull(serviceRegistry.getDivertTransformer(DIVERT, null)); } @Test public void testProperties() throws Exception { final String testAddress = "testAddress"; - final SimpleString queue = SimpleString.toSimpleString("queue"); + final SimpleString queue = SimpleString.of("queue"); final int COUNT = 25; ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig(), false)); @@ -1772,7 +1772,7 @@ public class DivertTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, true, true); session.start(); - ClientProducer producer = session.createProducer(new SimpleString(testAddress + "0")); + ClientProducer producer = session.createProducer(SimpleString.of(testAddress + "0")); ClientConsumer consumer1 = session.createConsumer(queue); ClientMessage message = session.createMessage(false); producer.send(message); @@ -1904,7 +1904,7 @@ public class DivertTest extends ActiveMQTestBase { //Trigger autoDelete instead of waiting QueueManagerImpl.performAutoDeleteQueue(server, server.locateQueue(forwardAddress)); - Wait.assertTrue(() -> server.getPostOffice().getAddressInfo(SimpleString.toSimpleString(forwardAddress)) + Wait.assertTrue(() -> server.getPostOffice().getAddressInfo(SimpleString.of(forwardAddress)) .getBindingRemovedTimestamp() != -1, DivertTest.TIMEOUT, 100); for (int i = 0; i < numMessages; i++) { 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 165d7492e4..b1a19b22f6 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 @@ -77,13 +77,13 @@ public class PersistentDivertTest extends ActiveMQTestBase { ClientSession session = sf.createSession(true, true, 0); - final SimpleString queueName1 = new SimpleString("queue1"); + final SimpleString queueName1 = SimpleString.of("queue1"); - final SimpleString queueName2 = new SimpleString("queue2"); + final SimpleString queueName2 = SimpleString.of("queue2"); - final SimpleString queueName3 = new SimpleString("queue3"); + final SimpleString queueName3 = SimpleString.of("queue3"); - final SimpleString queueName4 = new SimpleString("queue4"); + final SimpleString queueName4 = SimpleString.of("queue4"); session.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress1)); @@ -95,7 +95,7 @@ public class PersistentDivertTest extends ActiveMQTestBase { session.start(); - ClientProducer producer = session.createProducer(new SimpleString(testAddress)); + ClientProducer producer = session.createProducer(SimpleString.of(testAddress)); ClientConsumer consumer1 = session.createConsumer(queueName1); @@ -107,7 +107,7 @@ public class PersistentDivertTest extends ActiveMQTestBase { final int numMessages = 10; - final SimpleString propKey = new SimpleString("testkey"); + final SimpleString propKey = SimpleString.of("testkey"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session.createMessage(true); @@ -232,13 +232,13 @@ public class PersistentDivertTest extends ActiveMQTestBase { ClientSession session = sf.createSession(true, true, 0); - final SimpleString queueName1 = new SimpleString("queue1"); + final SimpleString queueName1 = SimpleString.of("queue1"); - final SimpleString queueName2 = new SimpleString("queue2"); + final SimpleString queueName2 = SimpleString.of("queue2"); - final SimpleString queueName3 = new SimpleString("queue3"); + final SimpleString queueName3 = SimpleString.of("queue3"); - final SimpleString queueName4 = new SimpleString("queue4"); + final SimpleString queueName4 = SimpleString.of("queue4"); session.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress1)); @@ -248,11 +248,11 @@ public class PersistentDivertTest extends ActiveMQTestBase { session.createQueue(new QueueConfiguration(queueName4).setAddress(testAddress)); - ClientProducer producer = session.createProducer(new SimpleString(testAddress)); + ClientProducer producer = session.createProducer(SimpleString.of(testAddress)); final int numMessages = 10; - final SimpleString propKey = new SimpleString("testkey"); + final SimpleString propKey = SimpleString.of("testkey"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session.createMessage(true); 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 3d4c7482d4..832f91166f 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 @@ -150,7 +150,7 @@ public class FederatedAddressTest extends FederatedTestBase { MessageConsumer consumer0 = session0.createConsumer(topic0); assertTrue(Wait.waitFor(() -> getServer(1).getPostOffice().getBindingsForAddress( - SimpleString.toSimpleString(address)).getBindings().size() == 1)); + SimpleString.of(address)).getBindings().size() == 1)); producer1.send(session1.createTextMessage("hello")); Message message = consumer0.receive(1000); @@ -322,7 +322,7 @@ public class FederatedAddressTest extends FederatedTestBase { String address2 = "fedOneWayDivertTest"; if (addressFirst) { - getServer(0).addAddressInfo(new AddressInfo(SimpleString.toSimpleString(address), RoutingType.MULTICAST)); + getServer(0).addAddressInfo(new AddressInfo(SimpleString.of(address), RoutingType.MULTICAST)); } final FederationConfiguration federationConfiguration; @@ -364,7 +364,7 @@ public class FederatedAddressTest extends FederatedTestBase { MessageConsumer consumer0 = session0.createConsumer(queue0); if (!addressFirst) { - getServer(0).addAddressInfo(new AddressInfo(SimpleString.toSimpleString(address), RoutingType.MULTICAST)); + getServer(0).addAddressInfo(new AddressInfo(SimpleString.of(address), RoutingType.MULTICAST)); } if (!divertBeforeConsumer) { @@ -373,9 +373,9 @@ public class FederatedAddressTest extends FederatedTestBase { .setRoutingType(ComponentConfigurationRoutingType.ANYCAST)); } - assertTrue(Wait.waitFor(() -> getServer(1).getPostOffice().getBindingsForAddress(SimpleString.toSimpleString(address)).getBindings().size() == 1, + assertTrue(Wait.waitFor(() -> getServer(1).getPostOffice().getBindingsForAddress(SimpleString.of(address)).getBindings().size() == 1, 1000, 100)); - final QueueBinding remoteQueueBinding = (QueueBinding) getServer(1).getPostOffice().getBindingsForAddress(SimpleString.toSimpleString(address)) + final QueueBinding remoteQueueBinding = (QueueBinding) getServer(1).getPostOffice().getBindingsForAddress(SimpleString.of(address)) .getBindings().iterator().next(); Wait.assertEquals(1, () -> remoteQueueBinding.getQueue().getConsumerCount()); @@ -384,10 +384,10 @@ public class FederatedAddressTest extends FederatedTestBase { //Test consumer is cleaned up after divert destroyed if (destroyDivert) { - getServer(0).destroyDivert(SimpleString.toSimpleString(address + ":" + address2)); + getServer(0).destroyDivert(SimpleString.of(address + ":" + address2)); //Test consumer is cleaned up after queue destroyed } else { - getServer(0).destroyQueue(SimpleString.toSimpleString(address2), null, false); + getServer(0).destroyQueue(SimpleString.of(address2), null, false); } assertTrue(Wait.waitFor(() -> remoteQueueBinding.getQueue().getConsumerCount() == 0, 2000, 100)); } @@ -413,7 +413,7 @@ public class FederatedAddressTest extends FederatedTestBase { MessageConsumer consumer0 = session0.createConsumer(topic0); assertTrue(Wait.waitFor(() -> getServer(1).getPostOffice().getBindingsForAddress( - SimpleString.toSimpleString(address)).getBindings().size() == 1, 2000, 100)); + SimpleString.of(address)).getBindings().size() == 1, 2000, 100)); producer.send(session1.createTextMessage("hello")); @@ -479,7 +479,7 @@ public class FederatedAddressTest extends FederatedTestBase { getServer(0).getFederationManager().deploy(); Wait.waitFor(() -> getServer(1).getPostOffice().getBindingsForAddress( - SimpleString.toSimpleString(address)).getBindings().size() == 1, 2000, 100); + SimpleString.of(address)).getBindings().size() == 1, 2000, 100); producer.send(session1.createTextMessage("hello")); assertNotNull(consumer0.receive(1000)); @@ -511,7 +511,7 @@ public class FederatedAddressTest extends FederatedTestBase { Topic topic0 = session0.createTopic(address); MessageConsumer consumer0 = session0.createConsumer(topic0); - Wait.waitFor(() -> getServer(1).getPostOffice().getBindingsForAddress(SimpleString.toSimpleString(address)).getBindings().size() == 1); + Wait.waitFor(() -> getServer(1).getPostOffice().getBindingsForAddress(SimpleString.of(address)).getBindings().size() == 1); producer.send(session1.createTextMessage("hello")); @@ -538,7 +538,7 @@ public class FederatedAddressTest extends FederatedTestBase { topic1 = session1.createTopic(address); producer = session1.createProducer(topic1); - Wait.waitFor(() -> getServer(1).getPostOffice().getBindingsForAddress(SimpleString.toSimpleString(address)).getBindings().size() == 1); + Wait.waitFor(() -> getServer(1).getPostOffice().getBindingsForAddress(SimpleString.of(address)).getBindings().size() == 1); producer.send(session1.createTextMessage("hello")); assertNotNull(consumer0.receive(1000)); @@ -570,7 +570,7 @@ public class FederatedAddressTest extends FederatedTestBase { Topic topic0 = session0.createTopic(address); MessageConsumer consumer0 = session0.createConsumer(topic0); - Wait.waitFor(() -> getServer(1).getPostOffice().getBindingsForAddress(SimpleString.toSimpleString(address)).getBindings().size() == 1); + Wait.waitFor(() -> getServer(1).getPostOffice().getBindingsForAddress(SimpleString.of(address)).getBindings().size() == 1); producer.send(session1.createTextMessage("hello")); @@ -596,7 +596,7 @@ public class FederatedAddressTest extends FederatedTestBase { topic0 = session0.createTopic(address); consumer0 = session0.createConsumer(topic0); - Wait.waitFor(() -> getServer(1).getPostOffice().getBindingsForAddress(SimpleString.toSimpleString(address)).getBindings().size() == 1); + Wait.waitFor(() -> getServer(1).getPostOffice().getBindingsForAddress(SimpleString.of(address)).getBindings().size() == 1); producer.send(session1.createTextMessage("hello")); assertNotNull(consumer0.receive(1000)); @@ -643,8 +643,8 @@ public class FederatedAddressTest extends FederatedTestBase { MessageProducer producer2 = session2.createProducer(topic2); MessageConsumer consumer0 = session0.createConsumer(topic0); - assertTrue(Wait.waitFor(() -> getServer(1).getPostOffice().getBindingsForAddress(SimpleString.toSimpleString(address)).getBindings().size() == 1)); - assertTrue(Wait.waitFor(() -> getServer(2).getPostOffice().getBindingsForAddress(SimpleString.toSimpleString(address)).getBindings().size() == 1)); + assertTrue(Wait.waitFor(() -> getServer(1).getPostOffice().getBindingsForAddress(SimpleString.of(address)).getBindings().size() == 1)); + assertTrue(Wait.waitFor(() -> getServer(2).getPostOffice().getBindingsForAddress(SimpleString.of(address)).getBindings().size() == 1)); //Test producers being on broker 2 and consumer on broker 0, with broker 2 being in the middle of the chain. producer2.send(session2.createTextMessage("hello")); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/federation/FederatedQueuePullConsumerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/federation/FederatedQueuePullConsumerTest.java index e721673f4c..009dc0af8a 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/federation/FederatedQueuePullConsumerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/federation/FederatedQueuePullConsumerTest.java @@ -81,8 +81,8 @@ public class FederatedQueuePullConsumerTest extends FederatedTestBase { getServer(0).getAddressSettingsRepository().getMatch("#").setAutoCreateAddresses(true).setAutoCreateQueues(true); getServer(1).getAddressSettingsRepository().getMatch("#").setAutoCreateAddresses(true).setAutoCreateQueues(true); - getServer(0).addAddressInfo(new AddressInfo(SimpleString.toSimpleString("source"), RoutingType.MULTICAST)); - getServer(1).addAddressInfo(new AddressInfo(SimpleString.toSimpleString("source"), RoutingType.MULTICAST)); + getServer(0).addAddressInfo(new AddressInfo(SimpleString.of("source"), RoutingType.MULTICAST)); + getServer(1).addAddressInfo(new AddressInfo(SimpleString.of("source"), RoutingType.MULTICAST)); getServer(0).getConfiguration().getFederationConfigurations().add(new FederationConfiguration().setName("default").addFederationPolicy(new FederationAddressPolicyConfiguration().setName("myAddressPolicy").addInclude(new FederationAddressPolicyConfiguration.Matcher().setAddressMatch("#"))).addUpstreamConfiguration(new FederationUpstreamConfiguration().setName("server1-upstream").addPolicyRef("myAddressPolicy").setStaticConnectors(Collections.singletonList(connector)))); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/federation/FederatedQueueTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/federation/FederatedQueueTest.java index 803f893516..80ec8fc1c6 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/federation/FederatedQueueTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/federation/FederatedQueueTest.java @@ -501,17 +501,17 @@ public class FederatedQueueTest extends FederatedTestBase { producer1.send(session1.createTextMessage("hello")); assertNotNull(consumer0.receive(1000)); - Wait.assertTrue(() -> getServer(0).getPostOffice().getBinding(SimpleString.toSimpleString(queueName)) != null); - Wait.assertTrue(() -> getServer(1).getPostOffice().getBinding(SimpleString.toSimpleString(queueName)) != null); + Wait.assertTrue(() -> getServer(0).getPostOffice().getBinding(SimpleString.of(queueName)) != null); + Wait.assertTrue(() -> getServer(1).getPostOffice().getBinding(SimpleString.of(queueName)) != null); //Wait to see if extra consumers are created - this tests to make sure there is no loop and tests the FederatedQueue metaDataFilterString //is working properly - should only be 1 consumer on each (1 for the local consumer on broker0 and 1 for the federated consumer on broker1) - assertFalse(Wait.waitFor(() -> getServer(0).locateQueue(SimpleString.toSimpleString(queueName)).getConsumerCount() > 1, 500, 100)); - assertFalse(Wait.waitFor(() -> getServer(1).locateQueue(SimpleString.toSimpleString(queueName)).getConsumerCount() > 1, 500, 100)); + assertFalse(Wait.waitFor(() -> getServer(0).locateQueue(SimpleString.of(queueName)).getConsumerCount() > 1, 500, 100)); + assertFalse(Wait.waitFor(() -> getServer(1).locateQueue(SimpleString.of(queueName)).getConsumerCount() > 1, 500, 100)); //Test consumer move from broker 0, to broker 1 final int server1ConsumerCount = getServer(1).getConnectionCount(); consumer0.close(); - Wait.waitFor(() -> ((QueueBinding) getServer(0).getPostOffice().getBinding(SimpleString.toSimpleString(queueName))).consumerCount() == 0, 1000); + Wait.waitFor(() -> ((QueueBinding) getServer(0).getPostOffice().getBinding(SimpleString.of(queueName))).consumerCount() == 0, 1000); //Make sure we don't drop connection if shared if (shared) { @@ -634,7 +634,7 @@ public class FederatedQueueTest extends FederatedTestBase { } private boolean getConsumerCount(ActiveMQServer server, String queueName, int count) { - QueueBinding binding = (QueueBinding)server.getPostOffice().getBinding(SimpleString.toSimpleString(queueName)); + QueueBinding binding = (QueueBinding)server.getPostOffice().getBinding(SimpleString.of(queueName)); if (binding == null) { return false; } @@ -690,10 +690,10 @@ public class FederatedQueueTest extends FederatedTestBase { consumer0 = session0.createConsumer(queue0); producer.send(session1.createTextMessage("hello")); - Wait.assertTrue(() -> getServer(1).getPostOffice().getBinding(SimpleString.toSimpleString(queueName)) != null); + Wait.assertTrue(() -> getServer(1).getPostOffice().getBinding(SimpleString.of(queueName)) != null); Wait.waitFor(() -> ((QueueBinding) getServer(1) .getPostOffice() - .getBinding(SimpleString.toSimpleString(queueName))) + .getBinding(SimpleString.of(queueName))) .consumerCount() == 1); assertNotNull(consumer0.receive(5000)); 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 be85e6868f..0155e94ba0 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 @@ -81,7 +81,7 @@ public class FederatedTestBase extends ActiveMQTestBase { } protected void createSimpleQueue(ActiveMQServer server, String queueName) throws Exception { - SimpleString simpleStringQueueName = SimpleString.toSimpleString(queueName); + SimpleString simpleStringQueueName = SimpleString.of(queueName); try { 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 d68bc8590c..40da3d8af4 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 @@ -42,7 +42,7 @@ import org.junit.jupiter.api.Test; public class CoreClientOverHttpTest extends ActiveMQTestBase { - private static final SimpleString QUEUE = new SimpleString("CoreClientOverHttpTestQueue"); + private static final SimpleString QUEUE = SimpleString.of("CoreClientOverHttpTestQueue"); private Configuration conf; private ActiveMQServer server; private ServerLocator locator; 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 168fa31017..c79366cf83 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 @@ -75,7 +75,7 @@ public class InterceptorTest extends ActiveMQTestBase { private ActiveMQServer server; - private final SimpleString QUEUE = new SimpleString("InterceptorTestQueue"); + private final SimpleString QUEUE = SimpleString.of("InterceptorTestQueue"); private ServerLocator locator; @@ -117,7 +117,7 @@ public class InterceptorTest extends ActiveMQTestBase { if (packet.getType() == PacketImpl.CREATE_QUEUE || packet.getType() == PacketImpl.CREATE_QUEUE_V2) { String userName = getUsername(packet, connection); CreateQueueMessage createQueue = (CreateQueueMessage) packet; - createQueue.setFilterString(new SimpleString("userName='" + userName + "'")); + createQueue.setFilterString(SimpleString.of("userName='" + userName + "'")); logger.debug("userName on createQueue = {}", userName); } else if (packet.getType() == PacketImpl.SESS_SEND) { @@ -147,7 +147,7 @@ public class InterceptorTest extends ActiveMQTestBase { if (packet.getType() == PacketImpl.SESS_CREATECONSUMER) { String userName = getUsername(packet, connection); SessionCreateConsumerMessage createQueue = (SessionCreateConsumerMessage) packet; - createQueue.setFilterString(new SimpleString("userName='" + userName + "'")); + createQueue.setFilterString(SimpleString.of("userName='" + userName + "'")); logger.debug("userName = {}", userName); } else if (packet.getType() == PacketImpl.SESS_SEND) { 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 363840c8b7..def8df0cf2 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 @@ -41,7 +41,7 @@ public class ShutdownServerTest extends ActiveMQTestBase { private ActiveMQServer server; - private final SimpleString QUEUE = new SimpleString("ConsumerTestQueue"); + private final SimpleString QUEUE = SimpleString.of("ConsumerTestQueue"); private ServerLocator locator; 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 c5190e7f91..7c031884bc 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 @@ -244,7 +244,7 @@ public class ActiveMQConnectionFactoryTest extends ActiveMQTestBase { private void testDeserializationOptions(boolean useJndi, boolean useBrowser) throws Exception { String qname = "SerialTestQueue"; - SimpleString qaddr = new SimpleString(qname); + SimpleString qaddr = SimpleString.of(qname); liveService.createQueue(new QueueConfiguration(qaddr) .setRoutingType(RoutingType.ANYCAST)); @@ -318,7 +318,7 @@ public class ActiveMQConnectionFactoryTest extends ActiveMQTestBase { System.setProperty(ObjectInputStreamWithClassLoader.WHITELIST_PROPERTY, "some.other.package"); String qname = "SerialTestQueue"; - SimpleString qaddr = new SimpleString(qname); + SimpleString qaddr = SimpleString.of(qname); liveService.createQueue(new QueueConfiguration(qaddr).setRoutingType(RoutingType.ANYCAST)); try { @@ -350,7 +350,7 @@ public class ActiveMQConnectionFactoryTest extends ActiveMQTestBase { System.setProperty(ObjectInputStreamWithClassLoader.ALLOWLIST_PROPERTY, "some.other.package"); String qname = "SerialTestQueue"; - SimpleString qaddr = new SimpleString(qname); + SimpleString qaddr = SimpleString.of(qname); liveService.createQueue(new QueueConfiguration(qaddr).setRoutingType(RoutingType.ANYCAST)); try { 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 08509f9942..f402f897ed 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 @@ -154,7 +154,7 @@ public class JmsProducerTest extends JMSTestBase { context.createProducer().setProperty("prop1", 1).setProperty("prop2", 2).send(q1, "Text1"); - org.apache.activemq.artemis.core.server.Queue queue = server.locateQueue(SimpleString.toSimpleString(queueName)); + org.apache.activemq.artemis.core.server.Queue queue = server.locateQueue(SimpleString.of(queueName)); assertEquals(5, queue.getMaxConsumers()); assertTrue(queue.isPurgeOnNoConsumers()); @@ -172,7 +172,7 @@ public class JmsProducerTest extends JMSTestBase { session.createProducer(session.createQueue(queueName)); - org.apache.activemq.artemis.core.server.Queue queue = server.locateQueue(SimpleString.toSimpleString(queueName)); + org.apache.activemq.artemis.core.server.Queue queue = server.locateQueue(SimpleString.of(queueName)); assertEquals(5, queue.getMaxConsumers()); assertTrue(queue.isPurgeOnNoConsumers()); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/ProgrammaticRedeployTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/ProgrammaticRedeployTest.java index a097ba4065..9f73eb6241 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/ProgrammaticRedeployTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/ProgrammaticRedeployTest.java @@ -112,16 +112,16 @@ public class ProgrammaticRedeployTest extends ActiveMQTestBase { } private AddressInfo getAddressInfo(EmbeddedActiveMQ embeddedActiveMQ, String address) { - return embeddedActiveMQ.getActiveMQServer().getPostOffice().getAddressInfo(SimpleString.toSimpleString(address)); + return embeddedActiveMQ.getActiveMQServer().getPostOffice().getAddressInfo(SimpleString.of(address)); } private org.apache.activemq.artemis.core.server.Queue getQueue(EmbeddedActiveMQ embeddedActiveMQ, String queueName) throws Exception { - QueueBinding queueBinding = (QueueBinding) embeddedActiveMQ.getActiveMQServer().getPostOffice().getBinding(SimpleString.toSimpleString(queueName)); + QueueBinding queueBinding = (QueueBinding) embeddedActiveMQ.getActiveMQServer().getPostOffice().getBinding(SimpleString.of(queueName)); return queueBinding == null ? null : queueBinding.getQueue(); } private List listQueuesNamesForAddress(EmbeddedActiveMQ embeddedActiveMQ, String address) throws Exception { - return embeddedActiveMQ.getActiveMQServer().getPostOffice().listQueuesForAddress(SimpleString.toSimpleString(address)).stream().map( + return embeddedActiveMQ.getActiveMQServer().getPostOffice().listQueuesForAddress(SimpleString.of(address)).stream().map( org.apache.activemq.artemis.core.server.Queue::getName).map(SimpleString::toString).collect(Collectors.toList()); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/RedeployTempTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/RedeployTempTest.java index b90accf559..12e4973179 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/RedeployTempTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/RedeployTempTest.java @@ -122,17 +122,17 @@ public class RedeployTempTest extends ActiveMQTestBase { } private AddressInfo getAddressInfo(EmbeddedActiveMQ embeddedActiveMQ, String address) { - return embeddedActiveMQ.getActiveMQServer().getPostOffice().getAddressInfo(SimpleString.toSimpleString(address)); + return embeddedActiveMQ.getActiveMQServer().getPostOffice().getAddressInfo(SimpleString.of(address)); } private org.apache.activemq.artemis.core.server.Queue getQueue(EmbeddedActiveMQ embeddedActiveMQ, String queueName) throws Exception { - QueueBinding queueBinding = (QueueBinding) embeddedActiveMQ.getActiveMQServer().getPostOffice().getBinding(SimpleString.toSimpleString(queueName)); + QueueBinding queueBinding = (QueueBinding) embeddedActiveMQ.getActiveMQServer().getPostOffice().getBinding(SimpleString.of(queueName)); return queueBinding == null ? null : queueBinding.getQueue(); } private List listQueuesNamesForAddress(EmbeddedActiveMQ embeddedActiveMQ, String address) throws Exception { - return embeddedActiveMQ.getActiveMQServer().getPostOffice().listQueuesForAddress(SimpleString.toSimpleString(address)).stream().map(org.apache.activemq.artemis.core.server.Queue::getName).map(SimpleString::toString).collect(Collectors.toList()); + return embeddedActiveMQ.getActiveMQServer().getPostOffice().listQueuesForAddress(SimpleString.of(address)).stream().map(org.apache.activemq.artemis.core.server.Queue::getName).map(SimpleString::toString).collect(Collectors.toList()); } } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/RedeployTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/RedeployTest.java index 40fb80ba51..b3ab9dc4d3 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/RedeployTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/RedeployTest.java @@ -104,13 +104,13 @@ public class RedeployTest extends ActiveMQTestBase { // this simulates a remote queue or other type being added that wouldnt get deleted, its not valid to have this happen but it can happen when addresses and queues are auto created in a clustered env embeddedActiveMQ.getActiveMQServer().getPostOffice().addBinding(new RemoteQueueBindingImpl(5L, - new SimpleString("autoQueue"), - new SimpleString("uniqueName"), - new SimpleString("routingName"), + SimpleString.of("autoQueue"), + SimpleString.of("uniqueName"), + SimpleString.of("routingName"), 6L, null, - new FakeQueue(new SimpleString("foo"), 6L), - new SimpleString("bridge"), + new FakeQueue(SimpleString.of("foo"), 6L), + SimpleString.of("bridge"), 1, MessageLoadBalancingType.OFF)); @@ -379,7 +379,7 @@ public class RedeployTest extends ActiveMQTestBase { assertEquals("a", addressSettings.getDeadLetterAddress().toString()); AddressSettings settings = new AddressSettings(); - settings.setDeadLetterAddress(SimpleString.toSimpleString("c")).setExpiryDelay(0L); + settings.setDeadLetterAddress(SimpleString.of("c")).setExpiryDelay(0L); embeddedActiveMQ.getActiveMQServer().getActiveMQServerControl().addAddressSettings("bar", settings.toJSON()); addressSettings = embeddedActiveMQ.getActiveMQServer().getAddressSettingsRepository().getMatch("bar"); @@ -422,7 +422,7 @@ public class RedeployTest extends ActiveMQTestBase { try { latch.await(10, TimeUnit.SECONDS); - DivertBinding divertBinding = (DivertBinding) embeddedActiveMQ.getActiveMQServer().getPostOffice().getBinding(new SimpleString("a")); + DivertBinding divertBinding = (DivertBinding) embeddedActiveMQ.getActiveMQServer().getPostOffice().getBinding(SimpleString.of("a")); assertNotNull(divertBinding); assertEquals("a", divertBinding.getDivert().getAddress().toString()); @@ -434,11 +434,11 @@ public class RedeployTest extends ActiveMQTestBase { embeddedActiveMQ.getActiveMQServer().getReloadManager().setTick(tick); latch.await(10, TimeUnit.SECONDS); - divertBinding = (DivertBinding) embeddedActiveMQ.getActiveMQServer().getPostOffice().getBinding(new SimpleString("b")); + divertBinding = (DivertBinding) embeddedActiveMQ.getActiveMQServer().getPostOffice().getBinding(SimpleString.of("b")); assertNotNull(divertBinding); assertEquals("b", divertBinding.getDivert().getAddress().toString()); - divertBinding = (DivertBinding) embeddedActiveMQ.getActiveMQServer().getPostOffice().getBinding(new SimpleString("c")); + divertBinding = (DivertBinding) embeddedActiveMQ.getActiveMQServer().getPostOffice().getBinding(SimpleString.of("c")); assertNotNull(divertBinding); assertEquals("c", divertBinding.getDivert().getAddress().toString()); @@ -493,7 +493,7 @@ public class RedeployTest extends ActiveMQTestBase { producer.send(message); } - Binding binding = embeddedActiveMQ.getActiveMQServer().getPostOffice().getBinding(SimpleString.toSimpleString("myFilterQueue")); + Binding binding = embeddedActiveMQ.getActiveMQServer().getPostOffice().getBinding(SimpleString.of("myFilterQueue")); Files.copy(url2.openStream(), brokerXML, StandardCopyOption.REPLACE_EXISTING); brokerXML.toFile().setLastModified(System.currentTimeMillis() + 1000); @@ -501,7 +501,7 @@ public class RedeployTest extends ActiveMQTestBase { embeddedActiveMQ.getActiveMQServer().getReloadManager().setTick(tick); latch.await(10, TimeUnit.SECONDS); - Binding bindingAfterChange = embeddedActiveMQ.getActiveMQServer().getPostOffice().getBinding(SimpleString.toSimpleString("myFilterQueue")); + Binding bindingAfterChange = embeddedActiveMQ.getActiveMQServer().getPostOffice().getBinding(SimpleString.of("myFilterQueue")); assertTrue(binding == bindingAfterChange, "Instance should be the same (as should be non destructive)"); assertEquals(binding.getID(), bindingAfterChange.getID()); @@ -651,7 +651,7 @@ public class RedeployTest extends ActiveMQTestBase { // Test that the original filter has been set up LocalQueueBinding queueBinding = (LocalQueueBinding) embeddedActiveMQ.getActiveMQServer().getPostOffice() - .getBinding(new SimpleString("myFilterQueue")); + .getBinding(SimpleString.of("myFilterQueue")); // The "x = 'x'" value is found in "reload-queue-filter.xml" assertEquals("x = 'x'", queueBinding.getFilter().getFilterString().toString()); @@ -687,7 +687,7 @@ public class RedeployTest extends ActiveMQTestBase { // Test that the filter has been removed LocalQueueBinding queueBinding = (LocalQueueBinding) embeddedActiveMQ.getActiveMQServer().getPostOffice() - .getBinding(new SimpleString("myFilterQueue")); + .getBinding(SimpleString.of("myFilterQueue")); assertNull(queueBinding.getFilter()); MessageProducer producer = session.createProducer(queue); @@ -735,11 +735,11 @@ public class RedeployTest extends ActiveMQTestBase { embeddedActiveMQ.getActiveMQServer().updateQueue(new QueueConfiguration("virtualQueue").setFilterString("foo")); LocalQueueBinding queueBinding = (LocalQueueBinding) embeddedActiveMQ.getActiveMQServer().getPostOffice() - .getBinding(new SimpleString("virtualQueue")); + .getBinding(SimpleString.of("virtualQueue")); org.apache.activemq.artemis.core.server.Queue queue = queueBinding.getQueue(); - assertEquals(new SimpleString("bob"), queue.getUser()); - assertEquals(new SimpleString("foo"), queue.getFilter().getFilterString()); + assertEquals(SimpleString.of("bob"), queue.getUser()); + assertEquals(SimpleString.of("foo"), queue.getFilter().getFilterString()); } finally { embeddedActiveMQ.stop(); @@ -754,7 +754,7 @@ public class RedeployTest extends ActiveMQTestBase { try { LocalQueueBinding queueBinding = (LocalQueueBinding) embeddedActiveMQ.getActiveMQServer().getPostOffice() - .getBinding(new SimpleString("myQueue")); + .getBinding(SimpleString.of("myQueue")); org.apache.activemq.artemis.core.server.Queue queue = queueBinding.getQueue(); assertNotEquals(ActiveMQDefaultConfiguration.getDefaultMaxQueueConsumers(), queue.getMaxConsumers()); @@ -769,7 +769,7 @@ public class RedeployTest extends ActiveMQTestBase { assertNotEquals(ActiveMQDefaultConfiguration.getDefaultConsumersBeforeDispatch(), queue.getConsumersBeforeDispatch()); assertNotEquals(ActiveMQDefaultConfiguration.getDefaultDelayBeforeDispatch(), queue.getDelayBeforeDispatch()); assertNotNull(queue.getFilter()); - assertEquals(new SimpleString("jdoe"), queue.getUser()); + assertEquals(SimpleString.of("jdoe"), queue.getUser()); assertNotEquals(ActiveMQDefaultConfiguration.getDefaultRingSize(), queue.getRingSize()); deployBrokerConfig(embeddedActiveMQ, "reload-queue-defaults-after.xml"); @@ -801,7 +801,7 @@ public class RedeployTest extends ActiveMQTestBase { try { DivertBinding divertBinding = (DivertBinding) embeddedActiveMQ.getActiveMQServer().getPostOffice() - .getBinding(new SimpleString("divert")); + .getBinding(SimpleString.of("divert")); assertNotNull(divertBinding); final Queue sourceQueue = (Queue) ActiveMQDestination.createDestination("queue://source", ActiveMQDestination.TYPE.QUEUE); @@ -824,9 +824,9 @@ public class RedeployTest extends ActiveMQTestBase { deployBrokerConfig(embeddedActiveMQ, "reload-divert-undeploy-after.xml"); Wait.waitFor(() -> embeddedActiveMQ.getActiveMQServer().getPostOffice() - .getBinding(new SimpleString("divert")) == null); + .getBinding(SimpleString.of("divert")) == null); divertBinding = (DivertBinding) embeddedActiveMQ.getActiveMQServer().getPostOffice() - .getBinding(new SimpleString("divert")); + .getBinding(SimpleString.of("divert")); assertNull(divertBinding); try (ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(); @@ -896,7 +896,7 @@ public class RedeployTest extends ActiveMQTestBase { final EmbeddedActiveMQ embeddedActiveMQ = createEmbeddedActiveMQServer("reload-divert-filter-none.xml"); - final SimpleString divertName = new SimpleString("source-to-target"); + final SimpleString divertName = SimpleString.of("source-to-target"); final Queue sourceQueue = (Queue) ActiveMQDestination.createDestination("queue://source", ActiveMQDestination.TYPE.QUEUE); final Queue targetQueue = (Queue) ActiveMQDestination.createDestination("queue://target", ActiveMQDestination.TYPE.QUEUE); final Map emptyTestMessageProperties = Map.of(); @@ -907,7 +907,7 @@ public class RedeployTest extends ActiveMQTestBase { assertNotNull(divertBinding, "Divert '" + divertName + "' binding should exist."); assertNull(divertBinding.getFilter(), "The divert '" + divertName + "' should have no filter applied at first."); - assertNull(embeddedActiveMQ.getActiveMQServer().getPostOffice().getBinding(new SimpleString("foo"))); + assertNull(embeddedActiveMQ.getActiveMQServer().getPostOffice().getBinding(SimpleString.of("foo"))); // Message with no properties should be diverted. sendDivertedTestMessage(sourceQueue, targetQueue, false, true, emptyTestMessageProperties); @@ -934,7 +934,7 @@ public class RedeployTest extends ActiveMQTestBase { public void testRemoveDivertFilter() throws Exception { final EmbeddedActiveMQ embeddedActiveMQ = createEmbeddedActiveMQServer("reload-divert-filter-x-eq-x.xml"); - final SimpleString divertName = new SimpleString("source-to-target"); + final SimpleString divertName = SimpleString.of("source-to-target"); final Queue sourceQueue = (Queue) ActiveMQDestination.createDestination("queue://source", ActiveMQDestination.TYPE.QUEUE); final Queue targetQueue = (Queue) ActiveMQDestination.createDestination("queue://target", ActiveMQDestination.TYPE.QUEUE); final Map emptyTestMessageProperties = Map.of(); @@ -970,7 +970,7 @@ public class RedeployTest extends ActiveMQTestBase { public void testChangeDivertFilter() throws Exception { final EmbeddedActiveMQ embeddedActiveMQ = createEmbeddedActiveMQServer("reload-divert-filter-x-eq-x.xml"); - final SimpleString divertName = new SimpleString("source-to-target"); + final SimpleString divertName = SimpleString.of("source-to-target"); final Queue sourceQueue = (Queue) ActiveMQDestination.createDestination("queue://source", ActiveMQDestination.TYPE.QUEUE); final Queue targetQueue = (Queue) ActiveMQDestination.createDestination("queue://target", ActiveMQDestination.TYPE.QUEUE); final Map testMessagePropertiesXX = Map.of("x", "x"); @@ -1006,7 +1006,7 @@ public class RedeployTest extends ActiveMQTestBase { public void testChangeDivertExclusivity() throws Exception { final EmbeddedActiveMQ embeddedActiveMQ = createEmbeddedActiveMQServer("reload-divert-exclusive.xml"); - final SimpleString divertName = new SimpleString("source-to-target"); + final SimpleString divertName = SimpleString.of("source-to-target"); final Queue sourceQueue = (Queue) ActiveMQDestination.createDestination("queue://source", ActiveMQDestination.TYPE.QUEUE); final Queue targetQueue = (Queue) ActiveMQDestination.createDestination("queue://target", ActiveMQDestination.TYPE.QUEUE); @@ -1033,7 +1033,7 @@ public class RedeployTest extends ActiveMQTestBase { public void testChangeDivertAddress() throws Exception { final EmbeddedActiveMQ embeddedActiveMQ = createEmbeddedActiveMQServer("reload-divert-address-source1.xml"); - final SimpleString divertName = new SimpleString("source-to-target"); + final SimpleString divertName = SimpleString.of("source-to-target"); final Queue sourceQueue1 = (Queue) ActiveMQDestination.createDestination("queue://source1", ActiveMQDestination.TYPE.QUEUE); final Queue sourceQueue2 = (Queue) ActiveMQDestination.createDestination("queue://source2", ActiveMQDestination.TYPE.QUEUE); final Queue targetQueue = (Queue) ActiveMQDestination.createDestination("queue://target", ActiveMQDestination.TYPE.QUEUE); @@ -1368,8 +1368,8 @@ public class RedeployTest extends ActiveMQTestBase { assertEquals(getSecurityRoles(embeddedActiveMQ, "security_address").size(), 1); assertEquals(getSecurityRoles(embeddedActiveMQ, "security_address").iterator().next().getName(), "b"); - assertEquals(getAddressSettings(embeddedActiveMQ, "address_settings_address").getDeadLetterAddress(), SimpleString.toSimpleString("OriginalDLQ")); - assertEquals(getAddressSettings(embeddedActiveMQ, "address_settings_address").getExpiryAddress(), SimpleString.toSimpleString("OriginalExpiryQueue")); + assertEquals(getAddressSettings(embeddedActiveMQ, "address_settings_address").getDeadLetterAddress(), SimpleString.of("OriginalDLQ")); + assertEquals(getAddressSettings(embeddedActiveMQ, "address_settings_address").getExpiryAddress(), SimpleString.of("OriginalExpiryQueue")); assertNotNull(getAddressInfo(embeddedActiveMQ, "config_test_address_removal_no_queue")); assertNotNull(getAddressInfo(embeddedActiveMQ, "config_test_address_removal")); @@ -1397,8 +1397,8 @@ public class RedeployTest extends ActiveMQTestBase { assertEquals(getSecurityRoles(embeddedActiveMQ, "security_address").iterator().next().getName(), "c"); //Assert that the address settings change applied - assertEquals(getAddressSettings(embeddedActiveMQ, "address_settings_address").getDeadLetterAddress(), SimpleString.toSimpleString("NewDLQ")); - assertEquals(getAddressSettings(embeddedActiveMQ, "address_settings_address").getExpiryAddress(), SimpleString.toSimpleString("NewExpiryQueue")); + assertEquals(getAddressSettings(embeddedActiveMQ, "address_settings_address").getDeadLetterAddress(), SimpleString.of("NewDLQ")); + assertEquals(getAddressSettings(embeddedActiveMQ, "address_settings_address").getExpiryAddress(), SimpleString.of("NewExpiryQueue")); //Assert the address and queue changes applied assertNull(getAddressInfo(embeddedActiveMQ, "config_test_address_removal_no_queue")); @@ -1429,8 +1429,8 @@ public class RedeployTest extends ActiveMQTestBase { assertEquals(getSecurityRoles(embeddedActiveMQ, "security_address").iterator().next().getName(), "c"); //Assert that the address settings changes persist a stop and start server (e.g. like what occurs if network health check stops the node), but JVM remains up. - assertEquals(getAddressSettings(embeddedActiveMQ, "address_settings_address").getDeadLetterAddress(), SimpleString.toSimpleString("NewDLQ")); - assertEquals(getAddressSettings(embeddedActiveMQ, "address_settings_address").getExpiryAddress(), SimpleString.toSimpleString("NewExpiryQueue")); + assertEquals(getAddressSettings(embeddedActiveMQ, "address_settings_address").getDeadLetterAddress(), SimpleString.of("NewDLQ")); + assertEquals(getAddressSettings(embeddedActiveMQ, "address_settings_address").getExpiryAddress(), SimpleString.of("NewExpiryQueue")); //Assert that the address and queue changes persist a stop and start server (e.g. like what occurs if network health check stops the node), but JVM remains up. assertNull(getAddressInfo(embeddedActiveMQ, "config_test_address_removal_no_queue")); @@ -1461,16 +1461,16 @@ public class RedeployTest extends ActiveMQTestBase { } private AddressInfo getAddressInfo(EmbeddedActiveMQ embeddedActiveMQ, String address) { - return embeddedActiveMQ.getActiveMQServer().getPostOffice().getAddressInfo(SimpleString.toSimpleString(address)); + return embeddedActiveMQ.getActiveMQServer().getPostOffice().getAddressInfo(SimpleString.of(address)); } private org.apache.activemq.artemis.core.server.Queue getQueue(EmbeddedActiveMQ embeddedActiveMQ, String queueName) throws Exception { - QueueBinding queueBinding = (QueueBinding) embeddedActiveMQ.getActiveMQServer().getPostOffice().getBinding(SimpleString.toSimpleString(queueName)); + QueueBinding queueBinding = (QueueBinding) embeddedActiveMQ.getActiveMQServer().getPostOffice().getBinding(SimpleString.of(queueName)); return queueBinding == null ? null : queueBinding.getQueue(); } private List listQueuesNamesForAddress(EmbeddedActiveMQ embeddedActiveMQ, String address) throws Exception { - return embeddedActiveMQ.getActiveMQServer().getPostOffice().listQueuesForAddress(SimpleString.toSimpleString(address)).stream().map( + return embeddedActiveMQ.getActiveMQServer().getPostOffice().listQueuesForAddress(SimpleString.of(address)).stream().map( org.apache.activemq.artemis.core.server.Queue::getName).map(SimpleString::toString).collect(Collectors.toList()); } 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 27e7fc55f0..17475e4070 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 @@ -47,7 +47,7 @@ import org.junit.jupiter.api.Test; */ public class ExclusiveTest extends JMSTestBase { - private SimpleString queueName = SimpleString.toSimpleString("jms.exclusive.queue"); + private SimpleString queueName = SimpleString.of("jms.exclusive.queue"); @Override @BeforeEach diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/ExpiryMessageTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/ExpiryMessageTest.java index bd646976b6..e05e189897 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/ExpiryMessageTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/ExpiryMessageTest.java @@ -42,7 +42,7 @@ public class ExpiryMessageTest extends JMSTestBase { @Test public void testSendTopicNoSubscription() throws Exception { Topic topic = createTopic("test-topic"); - AddressControl control = ManagementControlHelper.createAddressControl(new SimpleString(topic.getTopicName()), mbeanServer); + AddressControl control = ManagementControlHelper.createAddressControl(SimpleString.of(topic.getTopicName()), mbeanServer); Connection conn2 = cf.createConnection(); 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 a722c5290b..02c3fad031 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 @@ -69,7 +69,7 @@ public class GroupingTest extends JMSTestBase { } protected void setProperty(Message message) { - ((ActiveMQMessage) message).getCoreMessage().putStringProperty(org.apache.activemq.artemis.api.core.Message.HDR_GROUP_ID, new SimpleString("foo")); + ((ActiveMQMessage) message).getCoreMessage().putStringProperty(org.apache.activemq.artemis.api.core.Message.HDR_GROUP_ID, SimpleString.of("foo")); } protected ConnectionFactory getCF() throws Exception { @@ -875,7 +875,7 @@ public class GroupingTest extends JMSTestBase { MessageProducer producer = session.createProducer(queue); - QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.toSimpleString(testQueueName)); + QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.of(testQueueName)); assertEquals(4, queueBinding.getQueue().getGroupBuckets()); } finally { connection.close(); @@ -904,7 +904,7 @@ public class GroupingTest extends JMSTestBase { MessageProducer producer = session.createProducer(queue); - QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.toSimpleString(testQueueName)); + QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.of(testQueueName)); assertTrue(queueBinding.getQueue().isGroupRebalance()); } finally { connection.close(); @@ -933,7 +933,7 @@ public class GroupingTest extends JMSTestBase { MessageProducer producer = session.createProducer(queue); - QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.toSimpleString(testQueueName)); + QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.of(testQueueName)); assertEquals("my-custom-key", queueBinding.getQueue().getGroupFirstKey().toString()); } finally { connection.close(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/MoveMessageDuplicateIDTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/MoveMessageDuplicateIDTest.java index 774f002d07..f488d77bc6 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/MoveMessageDuplicateIDTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/MoveMessageDuplicateIDTest.java @@ -62,7 +62,7 @@ public class MoveMessageDuplicateIDTest extends JMSTestBase { @TestTemplate public void testTwoQueuesSingleDLQ() throws Exception { server.getAddressSettingsRepository().clear(); - server.getAddressSettingsRepository().addMatch("#", new AddressSettings().setDeadLetterAddress(SimpleString.toSimpleString("JUNKYARD")).setExpiryAddress(SimpleString.toSimpleString("JUNKYARD")).setMaxDeliveryAttempts(1)); + server.getAddressSettingsRepository().addMatch("#", new AddressSettings().setDeadLetterAddress(SimpleString.of("JUNKYARD")).setExpiryAddress(SimpleString.of("JUNKYARD")).setMaxDeliveryAttempts(1)); createQueue("JUNKYARD"); Queue junkQueue = server.locateQueue("JUNKYARD"); @@ -116,13 +116,13 @@ public class MoveMessageDuplicateIDTest extends JMSTestBase { @TestTemplate public void testMultiplSubscriptionSingleExpire() throws Exception { server.getAddressSettingsRepository().clear(); - server.getAddressSettingsRepository().addMatch("#", new AddressSettings().setDeadLetterAddress(SimpleString.toSimpleString("DLQ")).setExpiryAddress(SimpleString.toSimpleString("DLQ"))); + server.getAddressSettingsRepository().addMatch("#", new AddressSettings().setDeadLetterAddress(SimpleString.of("DLQ")).setExpiryAddress(SimpleString.of("DLQ"))); createQueue("DLQ"); Queue dlqServerQueue = server.locateQueue("DLQ"); assertNotNull(dlqServerQueue); Topic topic = createTopic("test-topic"); - AddressControl control = ManagementControlHelper.createAddressControl(new SimpleString(topic.getTopicName()), mbeanServer); + AddressControl control = ManagementControlHelper.createAddressControl(SimpleString.of(topic.getTopicName()), mbeanServer); ConnectionFactory cf = CFUtil.createConnectionFactory(protocol, "tcp://localhost:61616"); @@ -160,7 +160,7 @@ public class MoveMessageDuplicateIDTest extends JMSTestBase { @TestTemplate public void testTwoQueuesSingleExpire() throws Exception { server.getAddressSettingsRepository().clear(); - server.getAddressSettingsRepository().addMatch("#", new AddressSettings().setDeadLetterAddress(SimpleString.toSimpleString("JUNKYARD")).setExpiryAddress(SimpleString.toSimpleString("JUNKYARD"))); + server.getAddressSettingsRepository().addMatch("#", new AddressSettings().setDeadLetterAddress(SimpleString.of("JUNKYARD")).setExpiryAddress(SimpleString.of("JUNKYARD"))); createQueue("JUNKYARD"); Queue junkQueue = server.locateQueue("JUNKYARD"); 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 405cfbf4d9..1ae15f4fc8 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 @@ -89,7 +89,7 @@ public class QueueAutoDeleteTest extends JMSTestBase { producer.send(session.createTextMessage("hello1")); producer.send(session.createTextMessage("hello2")); - QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.toSimpleString(testQueueName)); + QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.of(testQueueName)); assertTrue(queueBinding.getQueue().isAutoDelete()); Wait.assertEquals(2, queueBinding.getQueue()::getMessageCount); @@ -98,7 +98,7 @@ public class QueueAutoDeleteTest extends JMSTestBase { message.acknowledge(); - queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.toSimpleString(testQueueName)); + queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.of(testQueueName)); Wait.assertEquals(1, queueBinding.getQueue()::getMessageCount); final MessageConsumer consumer2 = session.createConsumer(queue); @@ -110,7 +110,7 @@ public class QueueAutoDeleteTest extends JMSTestBase { consumer2.close(); - Wait.assertTrue(() -> server.getPostOffice().getBinding(SimpleString.toSimpleString(testQueueName)) == null, 5000, 10); + Wait.assertTrue(() -> server.getPostOffice().getBinding(SimpleString.of(testQueueName)) == null, 5000, 10); } finally { connection.close(); @@ -144,7 +144,7 @@ public class QueueAutoDeleteTest extends JMSTestBase { // this will hold a consumer just to avoid the queue from being auto-deleted MessageConsumer consumerHolder = session.createSharedDurableConsumer(topic, sub); - QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.toSimpleString(sub)); + QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.of(sub)); assertTrue(queueBinding.getQueue().isAutoDelete()); assertEquals(0, queueBinding.getQueue().getMessageCount()); @@ -159,7 +159,7 @@ public class QueueAutoDeleteTest extends JMSTestBase { consumer.close(); - queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.toSimpleString(sub)); + queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.of(sub)); assertNotNull(queueBinding); consumer = session.createSharedDurableConsumer(topic, sub); @@ -171,7 +171,7 @@ public class QueueAutoDeleteTest extends JMSTestBase { consumer.close(); - Wait.assertTrue(() -> server.getPostOffice().getBinding(SimpleString.toSimpleString(sub)) == null, 5000, 10); + Wait.assertTrue(() -> server.getPostOffice().getBinding(SimpleString.of(sub)) == null, 5000, 10); } finally { connection.close(); @@ -198,7 +198,7 @@ public class QueueAutoDeleteTest extends JMSTestBase { MessageConsumer consumer = session.createSharedDurableConsumer(topic, sub); - QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.toSimpleString(sub)); + QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.of(sub)); assertFalse(queueBinding.getQueue().isAutoDelete()); Wait.assertEquals(0, queueBinding.getQueue()::getMessageCount); @@ -213,7 +213,7 @@ public class QueueAutoDeleteTest extends JMSTestBase { consumer.close(); - queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.toSimpleString(sub)); + queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.of(sub)); assertNotNull(queueBinding); consumer = session.createSharedDurableConsumer(topic, sub); @@ -227,7 +227,7 @@ public class QueueAutoDeleteTest extends JMSTestBase { //Wait longer than scan period. Thread.sleep(20); - queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.toSimpleString(sub)); + queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.of(sub)); assertNotNull(queueBinding); @@ -262,7 +262,7 @@ public class QueueAutoDeleteTest extends JMSTestBase { producer.send(session.createTextMessage("hello1")); producer.send(session.createTextMessage("hello2")); - QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.toSimpleString(testQueueName)); + QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.of(testQueueName)); assertFalse(queueBinding.getQueue().isAutoDelete()); Wait.assertEquals(2, queueBinding.getQueue()::getMessageCount); @@ -273,7 +273,7 @@ public class QueueAutoDeleteTest extends JMSTestBase { consumer.close(); - queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.toSimpleString(testQueueName)); + queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.of(testQueueName)); Wait.assertEquals(1, queueBinding.getQueue()::getMessageCount); consumer = session.createConsumer(queue); @@ -286,7 +286,7 @@ public class QueueAutoDeleteTest extends JMSTestBase { //Wait longer than scan period. Thread.sleep(20); - queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.toSimpleString(testQueueName)); + queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.of(testQueueName)); assertNotNull(queueBinding); Wait.assertEquals(0, queueBinding.getQueue()::getMessageCount); @@ -318,7 +318,7 @@ public class QueueAutoDeleteTest extends JMSTestBase { producer.send(session.createTextMessage("hello1")); producer.send(session.createTextMessage("hello2")); - QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.toSimpleString(testQueueName)); + QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.of(testQueueName)); assertTrue(queueBinding.getQueue().isAutoDelete()); assertEquals(100, queueBinding.getQueue().getAutoDeleteDelay()); Wait.assertEquals(2, queueBinding.getQueue()::getMessageCount); @@ -330,7 +330,7 @@ public class QueueAutoDeleteTest extends JMSTestBase { consumer.close(); - queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.toSimpleString(testQueueName)); + queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.of(testQueueName)); Wait.assertEquals(1, queueBinding.getQueue()::getMessageCount); consumer = session.createConsumer(queue); @@ -344,10 +344,10 @@ public class QueueAutoDeleteTest extends JMSTestBase { Thread.sleep(50); //Check the queue has not been removed. - queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.toSimpleString(testQueueName)); + queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.of(testQueueName)); assertNotNull(queueBinding); - Wait.assertTrue(() -> server.getPostOffice().getBinding(SimpleString.toSimpleString(testQueueName)) == null, 5000, 10); + Wait.assertTrue(() -> server.getPostOffice().getBinding(SimpleString.of(testQueueName)) == null, 5000, 10); } finally { @@ -378,7 +378,7 @@ public class QueueAutoDeleteTest extends JMSTestBase { producer.send(session.createTextMessage("hello1")); producer.send(session.createTextMessage("hello2")); - QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.toSimpleString(testQueueName)); + QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.of(testQueueName)); assertTrue(queueBinding.getQueue().isAutoDelete()); Wait.assertEquals(1, queueBinding.getQueue()::getAutoDeleteMessageCount); Wait.assertEquals(2, queueBinding.getQueue()::getMessageCount); @@ -393,7 +393,7 @@ public class QueueAutoDeleteTest extends JMSTestBase { //Wait longer than scan period Thread.sleep(20); - Wait.assertTrue(() -> server.getPostOffice().getBinding(SimpleString.toSimpleString(testQueueName)) == null, 5000, 10); + Wait.assertTrue(() -> server.getPostOffice().getBinding(SimpleString.of(testQueueName)) == null, 5000, 10); } finally { connection.close(); @@ -424,7 +424,7 @@ public class QueueAutoDeleteTest extends JMSTestBase { producer.send(session.createTextMessage("hello" + i)); } - QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.toSimpleString(testQueueName)); + QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.of(testQueueName)); Wait.assertEquals(100, queueBinding.getQueue()::getMessageCount); assertTrue(queueBinding.getQueue().isAutoDelete()); assertEquals(-1, queueBinding.getQueue().getAutoDeleteMessageCount()); @@ -439,7 +439,7 @@ public class QueueAutoDeleteTest extends JMSTestBase { //Wait longer than scan period Thread.sleep(20); - Wait.assertTrue(() -> server.getPostOffice().getBinding(SimpleString.toSimpleString(testQueueName)) == null, 5000, 10); + Wait.assertTrue(() -> server.getPostOffice().getBinding(SimpleString.of(testQueueName)) == null, 5000, 10); } finally { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/TemporaryDestinationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/TemporaryDestinationTest.java index 9292f09a9e..d3760099d1 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/TemporaryDestinationTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/TemporaryDestinationTest.java @@ -101,7 +101,7 @@ public class TemporaryDestinationTest extends JMSTestBase { assertFalse(((ActiveMQDestination) tempQueue).isCreated()); - assertFalse(conn.containsTemporaryQueue(SimpleString.toSimpleString(tempQueue.getQueueName()))); + assertFalse(conn.containsTemporaryQueue(SimpleString.of(tempQueue.getQueueName()))); } finally { if (conn != null) { conn.close(); @@ -241,7 +241,7 @@ public class TemporaryDestinationTest extends JMSTestBase { TemporaryQueue tempQueue = producerSession.createTemporaryQueue(); - assertNotNull(server.getAddressInfo(SimpleString.toSimpleString(tempQueue.getQueueName()))); + assertNotNull(server.getAddressInfo(SimpleString.of(tempQueue.getQueueName()))); server.stop(); @@ -251,7 +251,7 @@ public class TemporaryDestinationTest extends JMSTestBase { waitForServerToStart(server); - assertNull(server.getAddressInfo(SimpleString.toSimpleString(tempQueue.getQueueName()))); + assertNull(server.getAddressInfo(SimpleString.of(tempQueue.getQueueName()))); } finally { if (conn != null) { conn.close(); @@ -289,7 +289,7 @@ public class TemporaryDestinationTest extends JMSTestBase { assertFalse(((ServerSessionImpl)serverSession).cloneProducers().containsKey(temporaryQueue.getQueueName())); } Wait.assertTrue(() -> server.locateQueue(temporaryQueue.getQueueName()) == null, 1000, 100); - Wait.assertTrue(() -> server.getAddressInfo(SimpleString.toSimpleString(temporaryQueue.getQueueName())) == null, 1000, 100); + Wait.assertTrue(() -> server.getAddressInfo(SimpleString.of(temporaryQueue.getQueueName())) == null, 1000, 100); } finally { if (conn != null) { conn.close(); @@ -323,11 +323,11 @@ public class TemporaryDestinationTest extends JMSTestBase { // These next two assertions are here to validate the test itself // The queue and address should be found on the server while they still exist on the connection Wait.assertFalse(() -> server.locateQueue(temporaryQueue.getQueueName()) == null, 1000, 100); - Wait.assertFalse(() -> server.getAddressInfo(SimpleString.toSimpleString(temporaryQueue.getQueueName())) == null, 1000, 100); + Wait.assertFalse(() -> server.getAddressInfo(SimpleString.of(temporaryQueue.getQueueName())) == null, 1000, 100); } Wait.assertTrue(() -> server.locateQueue(temporaryQueue.getQueueName()) == null, 1000, 100); - Wait.assertTrue(() -> server.getAddressInfo(SimpleString.toSimpleString(temporaryQueue.getQueueName())) == null, 1000, 100); + Wait.assertTrue(() -> server.getAddressInfo(SimpleString.of(temporaryQueue.getQueueName())) == null, 1000, 100); } @Test diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/TopicCleanupTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/TopicCleanupTest.java index b7d1387e9c..8cb0dc6f62 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/TopicCleanupTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/TopicCleanupTest.java @@ -86,8 +86,8 @@ public class TopicCleanupTest extends JMSTestBase { for (int i = 0; i < 100; i++) { long txid = storage.generateID(); - final Queue queue = new QueueImpl(storage.generateID(), SimpleString.toSimpleString("topic"), - SimpleString.toSimpleString("topic"), + final Queue queue = new QueueImpl(storage.generateID(), SimpleString.of("topic"), + SimpleString.of("topic"), FilterImpl.createFilter(Filter.GENERIC_IGNORED_FILTER), null, true, false, false, server.getScheduledPool(), server.getPostOffice(), storage, server.getAddressSettingsRepository(), @@ -139,7 +139,7 @@ public class TopicCleanupTest extends JMSTestBase { conn.close(); boolean foundStrayRoutingBinding = false; - Bindings bindings = server.getPostOffice().getBindingsForAddress(new SimpleString(topic.getAddress())); + Bindings bindings = server.getPostOffice().getBindingsForAddress(SimpleString.of(topic.getAddress())); Map> routingNames = ((BindingsImpl) bindings).getRoutingNameBindingMap(); for (SimpleString key : routingNames.keySet()) { if (!key.toString().equals(topic.getAddress())) { 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 7d60c450c8..766a7c7919 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 @@ -125,7 +125,7 @@ public class JMSFailoverListenerTest extends ActiveMQTestBase { ClientSession coreSession = ((ActiveMQSession) sess).getCoreSession(); - SimpleString jmsQueueName = new SimpleString("myqueue"); + SimpleString jmsQueueName = SimpleString.of("myqueue"); coreSession.createQueue(new QueueConfiguration(jmsQueueName).setRoutingType(RoutingType.ANYCAST)); @@ -200,7 +200,7 @@ public class JMSFailoverListenerTest extends ActiveMQTestBase { ClientSession coreSessionPrimary = ((ActiveMQSession) sessPrimary).getCoreSession(); - SimpleString jmsQueueName = new SimpleString("myqueue"); + SimpleString jmsQueueName = SimpleString.of("myqueue"); coreSessionPrimary.createQueue(new QueueConfiguration(jmsQueueName).setRoutingType(RoutingType.ANYCAST)); 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 7e8b09d56e..1a66adedbc 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 @@ -204,7 +204,7 @@ public class JMSFailoverTest extends ActiveMQTestBase { ClientSession coreSession = ((ActiveMQSession) sess).getCoreSession(); - SimpleString jmsQueueName = new SimpleString("myqueue"); + SimpleString jmsQueueName = SimpleString.of("myqueue"); coreSession.createQueue(new QueueConfiguration(jmsQueueName).setRoutingType(RoutingType.ANYCAST)); @@ -278,7 +278,7 @@ public class JMSFailoverTest extends ActiveMQTestBase { RemotingConnection coreConnPrimary = ((ClientSessionInternal) coreSessionPrimary).getConnection(); - SimpleString jmsQueueName = new SimpleString("myqueue"); + SimpleString jmsQueueName = SimpleString.of("myqueue"); coreSessionPrimary.createQueue(new QueueConfiguration(jmsQueueName).setRoutingType(RoutingType.ANYCAST)); @@ -327,7 +327,7 @@ public class JMSFailoverTest extends ActiveMQTestBase { @Test public void testSendReceiveLargeMessages() throws Exception { - SimpleString QUEUE = new SimpleString("somequeue"); + SimpleString QUEUE = SimpleString.of("somequeue"); ActiveMQConnectionFactory jbcf = ActiveMQJMSClient.createConnectionFactoryWithHA(JMSFactoryType.CF, primarytc, backuptc); jbcf.setReconnectAttempts(-1); 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 a8a68f2ec7..6653e87abc 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 @@ -104,7 +104,7 @@ public class JMSReconnectTest extends ActiveMQTestBase { RemotingConnection coreConn = ((ClientSessionInternal) coreSession).getConnection(); - SimpleString jmsQueueName = new SimpleString("myqueue"); + SimpleString jmsQueueName = SimpleString.of("myqueue"); coreSession.createQueue(new QueueConfiguration(jmsQueueName).setRoutingType(RoutingType.ANYCAST)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/TopicClusterPageStoreSizeTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/TopicClusterPageStoreSizeTest.java index 09d21698af..c0d019c94f 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/TopicClusterPageStoreSizeTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/TopicClusterPageStoreSizeTest.java @@ -119,9 +119,9 @@ public class TopicClusterPageStoreSizeTest extends JMSClusteredTestBase { if (forcePaging) { // message in the store, should have getPagedSize or is there some such thing? - assertTrue(server2.getPagingManager().getPageStore(SimpleString.toSimpleString(TOPIC)).getNumberOfPages() > 0, "size on 2"); + assertTrue(server2.getPagingManager().getPageStore(SimpleString.of(TOPIC)).getNumberOfPages() > 0, "size on 2"); } else { - assertTrue(server2.getPagingManager().getPageStore(SimpleString.toSimpleString(TOPIC)).getAddressSize() > 0, "size on 2"); + assertTrue(server2.getPagingManager().getPageStore(SimpleString.of(TOPIC)).getAddressSize() > 0, "size on 2"); } // reconnect @@ -150,8 +150,8 @@ public class TopicClusterPageStoreSizeTest extends JMSClusteredTestBase { prod1.send(topic1, session1.createTextMessage("someOtherMessage")); // stays on server 1 - assertTrue(server1.getPagingManager().getPageStore(SimpleString.toSimpleString(TOPIC)).getAddressSize() > 0, "some size on 1"); - assertTrue(server2.getPagingManager().getPageStore(SimpleString.toSimpleString(TOPIC)).getAddressSize() == 0, "no size on 2"); + assertTrue(server1.getPagingManager().getPageStore(SimpleString.of(TOPIC)).getAddressSize() > 0, "some size on 1"); + assertTrue(server2.getPagingManager().getPageStore(SimpleString.of(TOPIC)).getAddressSize() == 0, "no size on 2"); // duplicate this sub on 2 conn2 = cf2.createConnection(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/consumer/CreateSubscriptionTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/consumer/CreateSubscriptionTest.java index 4356e65f52..21422cf006 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/consumer/CreateSubscriptionTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/consumer/CreateSubscriptionTest.java @@ -60,7 +60,7 @@ public class CreateSubscriptionTest extends JMSTestBase { @TestTemplate public void testSharedConsumer() throws Exception { - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("myTopic")).addRoutingType(RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("myTopic")).addRoutingType(RoutingType.MULTICAST)); ConnectionFactory cf = CFUtil.createConnectionFactory(protocol, "tcp://localhost:61616"); Connection connection = cf.createConnection(); Session session = connection.createSession(); @@ -86,7 +86,7 @@ public class CreateSubscriptionTest extends JMSTestBase { @TestTemplate public void testSharedDurableConsumer() throws Exception { - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("myTopic")).addRoutingType(RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("myTopic")).addRoutingType(RoutingType.MULTICAST)); ConnectionFactory cf = CFUtil.createConnectionFactory(protocol, "tcp://localhost:61616"); Connection connection = cf.createConnection(); Session session = connection.createSession(); @@ -134,7 +134,7 @@ public class CreateSubscriptionTest extends JMSTestBase { try (AssertionLoggerHandler loggerHandler = new AssertionLoggerHandler()) { - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("myTopic")).addRoutingType(RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("myTopic")).addRoutingType(RoutingType.MULTICAST)); ConnectionFactory cf = CFUtil.createConnectionFactory(protocol, "tcp://localhost:61616"); AtomicInteger errors = new AtomicInteger(0); 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 14f0506862..4afb74aacf 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 @@ -145,7 +145,7 @@ public class JmsConsumerTest extends JMSTestBase { assertNotNull(m); } - SimpleString queueName = new SimpleString(JmsConsumerTest.Q_NAME); + SimpleString queueName = SimpleString.of(JmsConsumerTest.Q_NAME); assertEquals(0, getMessageCount((Queue) server.getPostOffice().getBinding(queueName).getBindable())); assertEquals(0, getMessageCount((Queue) server.getPostOffice().getBinding(queueName).getBindable())); } @@ -191,7 +191,7 @@ public class JmsConsumerTest extends JMSTestBase { assertEquals("m" + i, m.getText()); } - SimpleString queueName = new SimpleString(JmsConsumerTest.Q_NAME); + SimpleString queueName = SimpleString.of(JmsConsumerTest.Q_NAME); conn.close(); assertEquals(0, ((Queue) server.getPostOffice().getBinding(queueName).getBindable()).getDeliveringCount()); @@ -238,7 +238,7 @@ public class JmsConsumerTest extends JMSTestBase { assertEquals("m" + i, m.getText()); } - SimpleString queueName = new SimpleString(JmsConsumerTest.Q_NAME); + SimpleString queueName = SimpleString.of(JmsConsumerTest.Q_NAME); context.close(); assertEquals(0, ((Queue) server.getPostOffice().getBinding(queueName).getBindable()).getDeliveringCount()); @@ -313,7 +313,7 @@ public class JmsConsumerTest extends JMSTestBase { assertEquals("m" + i, m.getText()); } - SimpleString queueName = new SimpleString(JmsConsumerTest.Q_NAME); + SimpleString queueName = SimpleString.of(JmsConsumerTest.Q_NAME); conn.close(); Queue queue = server.locateQueue(queueName); @@ -342,7 +342,7 @@ public class JmsConsumerTest extends JMSTestBase { } // Messages should all have been acked since we set pre ack on the cf - SimpleString queueName = new SimpleString(JmsConsumerTest.Q_NAME); + SimpleString queueName = SimpleString.of(JmsConsumerTest.Q_NAME); Queue queue = server.locateQueue(queueName); Wait.assertEquals(0, queue::getDeliveringCount); Wait.assertEquals(0, queue::getMessageCount); @@ -816,7 +816,7 @@ public class JmsConsumerTest extends JMSTestBase { session.createConsumer(session.createQueue(queueName)); - org.apache.activemq.artemis.core.server.Queue queue = server.locateQueue(SimpleString.toSimpleString(queueName)); + org.apache.activemq.artemis.core.server.Queue queue = server.locateQueue(SimpleString.of(queueName)); assertEquals(5, queue.getMaxConsumers()); assertTrue(queue.isPurgeOnNoConsumers()); @@ -836,15 +836,15 @@ 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.addAddressInfo(new AddressInfo(SimpleString.of(queue1), RoutingType.ANYCAST)); server.createQueue(new QueueConfiguration(queue1).setRoutingType(RoutingType.ANYCAST).setDurable(false)); //create addresses for both topics - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(topic1), RoutingType.MULTICAST)); - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(topic2), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of(topic1), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of(topic2), RoutingType.MULTICAST)); //Remove the wildcard address associated with topic2 - server.removeAddressInfo(SimpleString.toSimpleString(topic1), null); + server.removeAddressInfo(SimpleString.of(topic1), null); conn = cf.createConnection(); conn.setClientID("clientId"); @@ -869,12 +869,12 @@ 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.addAddressInfo(new AddressInfo(SimpleString.of(queue1), RoutingType.ANYCAST)); server.createQueue(new QueueConfiguration(queue1).setRoutingType(RoutingType.ANYCAST).setDurable(false)); //create addresses for both topics - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(topic1), RoutingType.MULTICAST)); - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(topic2), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of(topic1), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of(topic2), RoutingType.MULTICAST)); conn = cf.createConnection(); conn.setClientID("clientId"); @@ -910,8 +910,8 @@ public class JmsConsumerTest extends JMSTestBase { } private void testAddressRemovalWithWithConsumers(String topic1, String topic2) throws Exception { - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(topic1), RoutingType.MULTICAST)); - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(topic2), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of(topic1), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of(topic2), RoutingType.MULTICAST)); conn = cf.createConnection(); conn.setClientID("clientId"); @@ -922,8 +922,8 @@ public class JmsConsumerTest extends JMSTestBase { c1.close(); // Make sure topic2 address can be removed and the bindings still exist for topic1 - server.removeAddressInfo(SimpleString.toSimpleString(topic2), null); - assertEquals(1, server.getPostOffice().getBindingsForAddress(SimpleString.toSimpleString(topic1)) + server.removeAddressInfo(SimpleString.of(topic2), null); + assertEquals(1, server.getPostOffice().getBindingsForAddress(SimpleString.of(topic1)) .getBindings().size()); // Re-create address by creating a consumer on the topic and make sure the diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/jms2client/SharedConsumerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/jms2client/SharedConsumerTest.java index d08aebe5a7..ceac2ed581 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/jms2client/SharedConsumerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/jms2client/SharedConsumerTest.java @@ -80,7 +80,7 @@ public class SharedConsumerTest extends JMSTestBase { try (JMSContext context = cf.createContext("foo", "bar")) { context.createSharedDurableConsumer(topic1, "mySharedCon"); boolean found = false; - for (Binding binding : server.getPostOffice().getBindingsForAddress(SimpleString.toSimpleString(topic1.getTopicName())).getBindings()) { + for (Binding binding : server.getPostOffice().getBindingsForAddress(SimpleString.of(topic1.getTopicName())).getBindings()) { found = true; assertTrue(binding instanceof LocalQueueBinding); assertEquals("mySharedCon", ((LocalQueueBinding)binding).getQueue().getName().toString()); @@ -114,10 +114,10 @@ public class SharedConsumerTest extends JMSTestBase { JMSConsumer con1 = context.createSharedConsumer(topic1, "mySharedCon"); JMSConsumer con2 = context.createSharedConsumer(topic1, "mySharedCon"); con1.close(); - Binding binding = server.getPostOffice().getBinding(new SimpleString("nonDurable.mySharedCon")); + Binding binding = server.getPostOffice().getBinding(SimpleString.of("nonDurable.mySharedCon")); assertNotNull(binding); con2.close(); - Wait.assertTrue(() -> server.getPostOffice().getBinding(new SimpleString("nonDurable.mySharedCon")) == null, 2000, 100); + Wait.assertTrue(() -> server.getPostOffice().getBinding(SimpleString.of("nonDurable.mySharedCon")) == null, 2000, 100); con1 = context.createSharedConsumer(topic2, "mySharedCon"); } finally { context.close(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSConsumerDelayDispatchTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSConsumerDelayDispatchTest.java index 2b8e768301..df1ab8896e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSConsumerDelayDispatchTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSConsumerDelayDispatchTest.java @@ -35,8 +35,8 @@ import org.junit.jupiter.api.Test; public class JMSConsumerDelayDispatchTest extends MultiprotocolJMSClientTestSupport { - private SimpleString queueName = SimpleString.toSimpleString("jms.consumer.delay.queue"); - private SimpleString normalQueueName = SimpleString.toSimpleString("jms.normal.queue"); + private SimpleString queueName = SimpleString.of("jms.consumer.delay.queue"); + private SimpleString normalQueueName = SimpleString.of("jms.normal.queue"); private static final long DELAY_BEFORE_DISPATCH = 2000L; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSFQQNConsumerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSFQQNConsumerTest.java index ff128046ba..59f60fea0d 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSFQQNConsumerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSFQQNConsumerTest.java @@ -83,7 +83,7 @@ public class JMSFQQNConsumerTest extends MultiprotocolJMSClientTestSupport { MessageConsumer mc = s.createConsumer(t, filter); Wait.assertTrue(() -> server.locateQueue(queue) != null, 2000, 100); - org.apache.activemq.artemis.core.server.Queue serverQueue = server.locateQueue(SimpleString.toSimpleString(queue)); + org.apache.activemq.artemis.core.server.Queue serverQueue = server.locateQueue(SimpleString.of(queue)); assertEquals(RoutingType.MULTICAST, serverQueue.getRoutingType()); assertNotNull(serverQueue.getFilter()); @@ -130,7 +130,7 @@ public class JMSFQQNConsumerTest extends MultiprotocolJMSClientTestSupport { MessageConsumer mc = s.createConsumer(t); Wait.assertTrue(() -> server.locateQueue(queue) != null, 2000, 100); - org.apache.activemq.artemis.core.server.Queue serverQueue = server.locateQueue(SimpleString.toSimpleString(queue)); + org.apache.activemq.artemis.core.server.Queue serverQueue = server.locateQueue(SimpleString.of(queue)); Wait.assertEquals(1, () -> serverQueue.getConsumers().size()); serverQueue.getConsumers().forEach(serverConsumer -> { @@ -197,7 +197,7 @@ public class JMSFQQNConsumerTest extends MultiprotocolJMSClientTestSupport { MessageConsumer mc = s.createConsumer(t, filter); Wait.assertTrue(() -> server.locateQueue(queue) != null, 2000, 100); - org.apache.activemq.artemis.core.server.Queue serverQueue = server.locateQueue(SimpleString.toSimpleString(queue)); + org.apache.activemq.artemis.core.server.Queue serverQueue = server.locateQueue(SimpleString.of(queue)); assertEquals(RoutingType.MULTICAST, serverQueue.getRoutingType()); assertNull(serverQueue.getFilter()); // it was pre-created without a filter, so we will just filter on the consumer @@ -305,7 +305,7 @@ public class JMSFQQNConsumerTest extends MultiprotocolJMSClientTestSupport { MessageConsumer mc = s.createConsumer(q, filter); Wait.assertTrue(() -> server.locateQueue(queue) != null, 2000, 100); - org.apache.activemq.artemis.core.server.Queue serverQueue = server.locateQueue(SimpleString.toSimpleString(queue)); + org.apache.activemq.artemis.core.server.Queue serverQueue = server.locateQueue(SimpleString.of(queue)); assertEquals(RoutingType.ANYCAST, serverQueue.getRoutingType()); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSLVQTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSLVQTest.java index f23288cdc6..f99c66d68e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSLVQTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSLVQTest.java @@ -49,7 +49,7 @@ public class JMSLVQTest extends MultiprotocolJMSClientTestSupport { server.getConfiguration().setMessageExpiryScanPeriod(1000); 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))); + server.getAddressSettingsRepository().addMatch(LVQ_CUSTOM_KEY_QUEUE_NAME, new AddressSettings().setDefaultLastValueQueue(true).setDefaultLastValueKey(SimpleString.of(CUSTOM_KEY))); } @Override @@ -57,16 +57,16 @@ public class JMSLVQTest extends MultiprotocolJMSClientTestSupport { super.createAddressAndQueues(server); //Add Standard Queue - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(NORMAL_QUEUE_NAME), RoutingType.ANYCAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of(NORMAL_QUEUE_NAME), RoutingType.ANYCAST)); 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.addAddressInfo(new AddressInfo(SimpleString.of(LVQ_QUEUE_NAME), RoutingType.ANYCAST)); 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.addAddressInfo(new AddressInfo(SimpleString.of(LVQ_CUSTOM_KEY_QUEUE_NAME), RoutingType.ANYCAST)); 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/jms/multiprotocol/JMSMessageGroupsTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSMessageGroupsTest.java index 94512879c7..5bc45fad4c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSMessageGroupsTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSMessageGroupsTest.java @@ -67,9 +67,9 @@ public class JMSMessageGroupsTest extends MultiprotocolJMSClientTestSupport { addressSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE); addressSettings.setAutoCreateQueues(isAutoCreateQueues()); addressSettings.setAutoCreateAddresses(isAutoCreateAddresses()); - addressSettings.setDeadLetterAddress(SimpleString.toSimpleString(getDeadLetterAddress())); - addressSettings.setExpiryAddress(SimpleString.toSimpleString(getDeadLetterAddress())); - addressSettings.setDefaultGroupFirstKey(SimpleString.toSimpleString("JMSXFirstInGroupID")); + addressSettings.setDeadLetterAddress(SimpleString.of(getDeadLetterAddress())); + addressSettings.setExpiryAddress(SimpleString.of(getDeadLetterAddress())); + addressSettings.setDefaultGroupFirstKey(SimpleString.of("JMSXFirstInGroupID")); server.getConfiguration().getAddressSettings().put("GroupFirst.#", addressSettings); @@ -139,7 +139,7 @@ public class JMSMessageGroupsTest extends MultiprotocolJMSClientTestSupport { public void testGroupSeqCloseGroup(ConnectionSupplier producerConnectionSupplier, ConnectionSupplier consumerConnectionSupplier) throws Exception { - final QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.toSimpleString(getQueueName())); + final QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.of(getQueueName())); try (Connection producerConnection = producerConnectionSupplier.createConnection(); Session producerSession = producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSMismatchedRoutingTypeTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSMismatchedRoutingTypeTest.java index bb11a2c29b..639f56bfed 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSMismatchedRoutingTypeTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSMismatchedRoutingTypeTest.java @@ -56,10 +56,10 @@ public class JMSMismatchedRoutingTypeTest extends MultiprotocolJMSClientTestSupp @Override protected void createAddressAndQueues(ActiveMQServer server) throws Exception { - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(ANYCAST_ADDRESS), RoutingType.ANYCAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of(ANYCAST_ADDRESS), RoutingType.ANYCAST)); server.createQueue(new QueueConfiguration(RandomUtil.randomString()).setAddress(ANYCAST_ADDRESS).setRoutingType(RoutingType.ANYCAST)); - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(MULTICAST_ADDRESS), RoutingType.MULTICAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of(MULTICAST_ADDRESS), RoutingType.MULTICAST)); server.createQueue(new QueueConfiguration(RandomUtil.randomString()).setAddress(MULTICAST_ADDRESS).setRoutingType(RoutingType.MULTICAST)); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSNonDestructiveTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSNonDestructiveTest.java index a1205ee2bc..667909bb93 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSNonDestructiveTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSNonDestructiveTest.java @@ -101,19 +101,19 @@ public class JMSNonDestructiveTest extends MultiprotocolJMSClientTestSupport { super.createAddressAndQueues(server); //Add Non Destructive Queue - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(NON_DESTRUCTIVE_QUEUE_NAME), RoutingType.ANYCAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of(NON_DESTRUCTIVE_QUEUE_NAME), RoutingType.ANYCAST)); 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.addAddressInfo(new AddressInfo(SimpleString.of(NON_DESTRUCTIVE_EXPIRY_QUEUE_NAME), RoutingType.ANYCAST)); 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.addAddressInfo(new AddressInfo(SimpleString.of(NON_DESTRUCTIVE_LVQ_QUEUE_NAME), RoutingType.ANYCAST)); 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.addAddressInfo(new AddressInfo(SimpleString.of(NON_DESTRUCTIVE_TOMBSTONE_LVQ_QUEUE_NAME), RoutingType.ANYCAST)); server.createQueue(new QueueConfiguration(NON_DESTRUCTIVE_TOMBSTONE_LVQ_QUEUE_NAME).setRoutingType(RoutingType.ANYCAST)); } @@ -164,7 +164,7 @@ public class JMSNonDestructiveTest extends MultiprotocolJMSClientTestSupport { public void testNonDestructiveSingle(ConnectionSupplier producerConnectionSupplier, ConnectionSupplier consumerConnectionSupplier) throws Exception { sendMessage(producerConnectionSupplier, NON_DESTRUCTIVE_QUEUE_NAME); - QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.toSimpleString(NON_DESTRUCTIVE_QUEUE_NAME)); + QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.of(NON_DESTRUCTIVE_QUEUE_NAME)); assertEquals(1, queueBinding.getQueue().getMessageCount(), "Ensure Message count"); @@ -185,7 +185,7 @@ public class JMSNonDestructiveTest extends MultiprotocolJMSClientTestSupport { public void testNonDestructiveDualConsumer(ConnectionSupplier producerConnectionSupplier, ConnectionSupplier consumerConnectionSupplier) throws Exception { sendMessage(producerConnectionSupplier, NON_DESTRUCTIVE_QUEUE_NAME); - QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.toSimpleString(NON_DESTRUCTIVE_QUEUE_NAME)); + QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.of(NON_DESTRUCTIVE_QUEUE_NAME)); assertEquals(1, queueBinding.getQueue().getMessageCount(), "Ensure Message count"); @@ -206,7 +206,7 @@ public class JMSNonDestructiveTest extends MultiprotocolJMSClientTestSupport { public void testNonDestructiveExpiry(ConnectionSupplier producerConnectionSupplier, ConnectionSupplier consumerConnectionSupplier) throws Exception { sendMessage(producerConnectionSupplier, NON_DESTRUCTIVE_EXPIRY_QUEUE_NAME); - QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.toSimpleString(NON_DESTRUCTIVE_EXPIRY_QUEUE_NAME)); + QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.of(NON_DESTRUCTIVE_EXPIRY_QUEUE_NAME)); assertEquals(1, queueBinding.getQueue().getMessageCount(), "Ensure Message count"); @@ -233,7 +233,7 @@ public class JMSNonDestructiveTest extends MultiprotocolJMSClientTestSupport { sendMessage(producerConnectionSupplier, NON_DESTRUCTIVE_QUEUE_NAME, 1); sendMessage(producerConnectionSupplier, NON_DESTRUCTIVE_QUEUE_NAME, 2); - QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.toSimpleString(NON_DESTRUCTIVE_QUEUE_NAME)); + QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.of(NON_DESTRUCTIVE_QUEUE_NAME)); assertEquals(3, queueBinding.getQueue().getMessageCount(), "Ensure Message count"); @@ -254,7 +254,7 @@ public class JMSNonDestructiveTest extends MultiprotocolJMSClientTestSupport { sendMessage(producerConnectionSupplier, NON_DESTRUCTIVE_QUEUE_NAME, 1); sendMessage(producerConnectionSupplier, NON_DESTRUCTIVE_QUEUE_NAME, 2); - QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.toSimpleString(NON_DESTRUCTIVE_QUEUE_NAME)); + QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.of(NON_DESTRUCTIVE_QUEUE_NAME)); assertEquals(3, queueBinding.getQueue().getMessageCount(), "Ensure Message count"); @@ -273,7 +273,7 @@ public class JMSNonDestructiveTest extends MultiprotocolJMSClientTestSupport { public void testNonDestructiveLVQ(ConnectionSupplier producerConnectionSupplier, ConnectionSupplier consumerConnectionSupplier) throws Exception { sendLVQ(producerConnectionSupplier, NON_DESTRUCTIVE_LVQ_QUEUE_NAME, Message.HDR_LAST_VALUE_NAME.toString()); - QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.toSimpleString(NON_DESTRUCTIVE_LVQ_QUEUE_NAME)); + QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.of(NON_DESTRUCTIVE_LVQ_QUEUE_NAME)); assertEquals(1, queueBinding.getQueue().getMessageCount(), "Ensure Message count"); //Simulate a small pause, else both messages could be consumed if consumer is fast enough @@ -366,7 +366,7 @@ public class JMSNonDestructiveTest extends MultiprotocolJMSClientTestSupport { public void testNonDestructiveLVQTombstone(ConnectionSupplier producerConnectionSupplier, ConnectionSupplier consumerConnectionSupplier) throws Exception { int tombstoneTimeToLive = 500; - QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.toSimpleString(NON_DESTRUCTIVE_TOMBSTONE_LVQ_QUEUE_NAME)); + QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.of(NON_DESTRUCTIVE_TOMBSTONE_LVQ_QUEUE_NAME)); LastValueQueue lastValueQueue = (LastValueQueue)queueBinding.getQueue(); //Send again sendLVQ(producerConnectionSupplier, NON_DESTRUCTIVE_TOMBSTONE_LVQ_QUEUE_NAME, Message.HDR_LAST_VALUE_NAME.toString()); @@ -409,7 +409,7 @@ public class JMSNonDestructiveTest extends MultiprotocolJMSClientTestSupport { public void testMessageCount() throws Exception { sendMessage(CoreConnection, NON_DESTRUCTIVE_QUEUE_NAME); - QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.toSimpleString(NON_DESTRUCTIVE_QUEUE_NAME)); + QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.of(NON_DESTRUCTIVE_QUEUE_NAME)); assertEquals(1, queueBinding.getQueue().getMessageCount(), "Ensure Message count"); //Consume Once diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSSelectorTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSSelectorTest.java index be7f7ca35b..3751a9bf6b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSSelectorTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSSelectorTest.java @@ -52,7 +52,7 @@ public class JMSSelectorTest extends MultiprotocolJMSClientTestSupport { super.createAddressAndQueues(server); //Add Standard Queue - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(NORMAL_QUEUE_NAME), RoutingType.ANYCAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of(NORMAL_QUEUE_NAME), RoutingType.ANYCAST)); server.createQueue(new QueueConfiguration(NORMAL_QUEUE_NAME).setRoutingType(RoutingType.ANYCAST)); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSSharedConsumerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSSharedConsumerTest.java index 5a8035609e..4faa1a1e29 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSSharedConsumerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSSharedConsumerTest.java @@ -101,7 +101,7 @@ public class JMSSharedConsumerTest extends MultiprotocolJMSClientTestSupport { if (amqpQueueName) { consumerQueueName = "SharedConsumer:shared-volatile:global"; } - QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.toSimpleString(consumerQueueName)); + QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.of(consumerQueueName)); assertTrue(queueBinding.getQueue().isTemporary()); } finally { connection1.close(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSSharedDurableConsumerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSSharedDurableConsumerTest.java index b9648bb4b2..347270716d 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSSharedDurableConsumerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSSharedDurableConsumerTest.java @@ -152,7 +152,7 @@ public class JMSSharedDurableConsumerTest extends MultiprotocolJMSClientTestSupp @TestTemplate @Timeout(30) public void testSharedDurableConsumerWithSelectorChange() throws Exception { - SimpleString qName = amqpUseCoreSubscriptionNaming ? new SimpleString("SharedConsumer") : new SimpleString("SharedConsumer:global"); + SimpleString qName = amqpUseCoreSubscriptionNaming ? SimpleString.of("SharedConsumer") : SimpleString.of("SharedConsumer:global"); Connection connection = createConnection(true); try { Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSTopicSubscriberTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSTopicSubscriberTest.java index 2f087b5087..fdbe7ad3b5 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSTopicSubscriberTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSTopicSubscriberTest.java @@ -64,9 +64,9 @@ public class JMSTopicSubscriberTest extends MultiprotocolJMSClientTestSupport { try { Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); javax.jms.Topic topic = session.createTopic(getTopicName()); - assertEquals(0, server.getPostOffice().getBindingsForAddress(SimpleString.toSimpleString(getTopicName())).size()); + assertEquals(0, server.getPostOffice().getBindingsForAddress(SimpleString.of(getTopicName())).size()); session.createConsumer(topic); - Wait.assertEquals(1, () -> server.getPostOffice().getBindingsForAddress(SimpleString.toSimpleString(getTopicName())).size(), 2000, 100); + Wait.assertEquals(1, () -> server.getPostOffice().getBindingsForAddress(SimpleString.of(getTopicName())).size(), 2000, 100); } finally { connection.close(); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSXPathSelectorTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSXPathSelectorTest.java index ed546c5019..3b41ed2baa 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSXPathSelectorTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/JMSXPathSelectorTest.java @@ -62,7 +62,7 @@ public class JMSXPathSelectorTest extends MultiprotocolJMSClientTestSupport { super.createAddressAndQueues(server); //Add Standard Queue - server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString(NORMAL_QUEUE_NAME), RoutingType.ANYCAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of(NORMAL_QUEUE_NAME), RoutingType.ANYCAST)); server.createQueue(new QueueConfiguration(NORMAL_QUEUE_NAME).setRoutingType(RoutingType.ANYCAST)); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/MultiprotocolJMSClientTestSupport.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/MultiprotocolJMSClientTestSupport.java index e4668dcf6b..24e75f99a5 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/MultiprotocolJMSClientTestSupport.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/multiprotocol/MultiprotocolJMSClientTestSupport.java @@ -193,8 +193,8 @@ public abstract class MultiprotocolJMSClientTestSupport extends ActiveMQTestBase addressSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE); addressSettings.setAutoCreateQueues(isAutoCreateQueues()); addressSettings.setAutoCreateAddresses(isAutoCreateAddresses()); - addressSettings.setDeadLetterAddress(SimpleString.toSimpleString(getDeadLetterAddress())); - addressSettings.setExpiryAddress(SimpleString.toSimpleString(getDeadLetterAddress())); + addressSettings.setDeadLetterAddress(SimpleString.of(getDeadLetterAddress())); + addressSettings.setExpiryAddress(SimpleString.of(getDeadLetterAddress())); server.getConfiguration().getAddressSettings().put("#", addressSettings); Set acceptors = server.getConfiguration().getAcceptorConfigurations(); @@ -260,7 +260,7 @@ public abstract class MultiprotocolJMSClientTestSupport extends ActiveMQTestBase } public Queue getProxyToQueue(String queueName) { - return server.locateQueue(SimpleString.toSimpleString(queueName)); + return server.locateQueue(SimpleString.of(queueName)); } private Connection trackJMSConnection(Connection connection) { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/TopicControlClusterTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/TopicControlClusterTest.java index 0dca7d1c5a..6b728c273b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/TopicControlClusterTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/TopicControlClusterTest.java @@ -34,7 +34,7 @@ public class TopicControlClusterTest extends JMSClusteredTestBase { @Test public void testClusteredSubscriptionCount() throws Exception { final String topicName = "t1"; - final SimpleString simpleTopicName = SimpleString.toSimpleString(topicName); + final SimpleString simpleTopicName = SimpleString.of(topicName); try (Connection conn1 = cf1.createConnection(); Connection conn2 = cf2.createConnection()) { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/journal/DuplicateRecordIdTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/journal/DuplicateRecordIdTest.java index 6ecdfd999b..bc7cf9b124 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/journal/DuplicateRecordIdTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/journal/DuplicateRecordIdTest.java @@ -37,7 +37,7 @@ public class DuplicateRecordIdTest extends ActiveMQTestBase { @BeforeEach public void setUp() throws Exception { super.setUp(); - server = createServer(false, createDefaultInVMConfig().addAddressSetting("#", new AddressSettings().setDeadLetterAddress(new SimpleString("dlq")).setExpiryAddress(new SimpleString("dlq")).setSlowConsumerPolicy(SlowConsumerPolicy.NOTIFY).setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK))); + server = createServer(false, createDefaultInVMConfig().addAddressSetting("#", new AddressSettings().setDeadLetterAddress(SimpleString.of("dlq")).setExpiryAddress(SimpleString.of("dlq")).setSlowConsumerPolicy(SlowConsumerPolicy.NOTIFY).setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK))); server.getConfiguration().setPersistenceEnabled(true); } @@ -49,7 +49,7 @@ public class DuplicateRecordIdTest extends ActiveMQTestBase { serverControl.removeAddressSettings("q"); AddressSettingsInfo defaultSettings = AddressSettingsInfo.fromJSON(serverControl.getAddressSettingsAsJSON("#")); AddressSettings settings = new AddressSettings(); - settings.setExpiryAddress(SimpleString.toSimpleString(defaultSettings.getExpiryAddress())).setExpiryDelay(defaultSettings.getExpiryDelay()).setMaxDeliveryAttempts(1) + settings.setExpiryAddress(SimpleString.of(defaultSettings.getExpiryAddress())).setExpiryDelay(defaultSettings.getExpiryDelay()).setMaxDeliveryAttempts(1) .setMaxSizeBytes(defaultSettings.getMaxSizeBytes()).setPageSizeBytes(defaultSettings.getPageSizeBytes()) .setPageCacheMaxSize(defaultSettings.getPageCacheMaxSize()).setRedeliveryDelay(defaultSettings.getRedeliveryDelay()) .setMaxExpiryDelay(defaultSettings.getMaxRedeliveryDelay()).setRedistributionDelay(defaultSettings.getRedistributionDelay()) diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AcceptorControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AcceptorControlTest.java index 5b84500e3f..4ca5f8f28b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AcceptorControlTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AcceptorControlTest.java @@ -144,14 +144,14 @@ public class AcceptorControlTest extends ManagementTestBase { Notification notif = notifListener.getNotifications().get(i); assertEquals(CoreNotificationType.ACCEPTOR_STOPPED, notif.getType()); - assertEquals(NettyAcceptorFactory.class.getName(), notif.getProperties().getSimpleStringProperty(new SimpleString("factory")).toString()); + assertEquals(NettyAcceptorFactory.class.getName(), notif.getProperties().getSimpleStringProperty(SimpleString.of("factory")).toString()); acceptorControl.start(); i = findNotification(notifListener, CoreNotificationType.ACCEPTOR_STARTED); notif = notifListener.getNotifications().get(i); assertEquals(CoreNotificationType.ACCEPTOR_STARTED, notif.getType()); - assertEquals(NettyAcceptorFactory.class.getName(), notif.getProperties().getSimpleStringProperty(new SimpleString("factory")).toString()); + assertEquals(NettyAcceptorFactory.class.getName(), notif.getProperties().getSimpleStringProperty(SimpleString.of("factory")).toString()); } private int findNotification(SimpleNotificationService.Listener notifListener, CoreNotificationType type) { 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 cf7d94fd9d..feaaa85db0 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 @@ -1231,7 +1231,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase { public void mergeAddressSettings() throws Exception { ActiveMQServerControl serverControl = createManagementControl(); AddressSettings addressSettings = new AddressSettings(); - addressSettings.setDeadLetterAddress(new SimpleString("DLA")); + addressSettings.setDeadLetterAddress(SimpleString.of("DLA")); String returnedSettings = serverControl.addAddressSettings("foo", addressSettings.toJSON()); AddressSettings info = AddressSettings.fromJSON(returnedSettings); assertEquals(addressSettings.getDeadLetterAddress(), info.getDeadLetterAddress()); @@ -1239,7 +1239,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase { assertEquals(addressSettings.getRedeliveryDelay(), 0); - addressSettings.setExpiryAddress(SimpleString.toSimpleString("EA")); + addressSettings.setExpiryAddress(SimpleString.of("EA")); returnedSettings = serverControl.addAddressSettings("foo", addressSettings.toJSON()); info = AddressSettings.fromJSON(returnedSettings); assertEquals(addressSettings.getDeadLetterAddress(), info.getDeadLetterAddress()); @@ -1374,8 +1374,8 @@ public class ActiveMQServerControlTest extends ManagementTestBase { boolean enableMetrics = RandomUtil.randomBoolean(); AddressSettings addressSettings = new AddressSettings(); - addressSettings.setDeadLetterAddress(new SimpleString(DLA)) - .setExpiryAddress(new SimpleString(expiryAddress)) + addressSettings.setDeadLetterAddress(SimpleString.of(DLA)) + .setExpiryAddress(SimpleString.of(expiryAddress)) .setExpiryDelay(expiryDelay) .setDefaultLastValueQueue(lastValueQueue) .setMaxDeliveryAttempts(deliveryAttempts) @@ -1398,12 +1398,12 @@ public class ActiveMQServerControlTest extends ManagementTestBase { .setConfigDeleteQueues(DeletionPolicy.valueOf(configDeleteQueues)) .setConfigDeleteAddresses(DeletionPolicy.valueOf(configDeleteAddresses)) .setMaxSizeBytesRejectThreshold(maxSizeBytesRejectThreshold) - .setDefaultLastValueKey(SimpleString.toSimpleString(defaultLastValueKey)) + .setDefaultLastValueKey(SimpleString.of(defaultLastValueKey)) .setDefaultNonDestructive(defaultNonDestructive) .setDefaultExclusiveQueue(defaultExclusiveQueue) .setDefaultGroupRebalance(defaultGroupRebalance) .setDefaultGroupBuckets(defaultGroupBuckets) - .setDefaultGroupFirstKey(SimpleString.toSimpleString(defaultGroupFirstKey)) + .setDefaultGroupFirstKey(SimpleString.of(defaultGroupFirstKey)) .setDefaultMaxConsumers(defaultMaxConsumers) .setDefaultPurgeOnNoConsumers(defaultPurgeOnNoConsumers) .setDefaultConsumersBeforeDispatch(defaultConsumersBeforeDispatch) @@ -1419,11 +1419,11 @@ public class ActiveMQServerControlTest extends ManagementTestBase { .setRedeliveryCollisionAvoidanceFactor(redeliveryCollisionAvoidanceFactor) .setRetroactiveMessageCount(retroactiveMessageCount) .setAutoCreateDeadLetterResources(autoCreateDeadLetterResources) - .setDeadLetterQueuePrefix(SimpleString.toSimpleString(deadLetterQueuePrefix)) - .setDeadLetterQueueSuffix(SimpleString.toSimpleString(deadLetterQueueSuffix)) + .setDeadLetterQueuePrefix(SimpleString.of(deadLetterQueuePrefix)) + .setDeadLetterQueueSuffix(SimpleString.of(deadLetterQueueSuffix)) .setAutoCreateExpiryResources(autoCreateExpiryResources) - .setExpiryQueuePrefix(SimpleString.toSimpleString(expiryQueuePrefix)) - .setExpiryQueueSuffix(SimpleString.toSimpleString(expiryQueueSuffix)) + .setExpiryQueuePrefix(SimpleString.of(expiryQueuePrefix)) + .setExpiryQueueSuffix(SimpleString.of(expiryQueueSuffix)) .setMinExpiryDelay(minExpiryDelay) .setMaxExpiryDelay(maxExpiryDelay) .setEnableMetrics(enableMetrics); @@ -1640,8 +1640,8 @@ public class ActiveMQServerControlTest extends ManagementTestBase { boolean enableMetrics = RandomUtil.randomBoolean(); AddressSettings addressSettings = new AddressSettings(); - addressSettings.setDeadLetterAddress(new SimpleString(DLA)) - .setExpiryAddress(new SimpleString(expiryAddress)) + addressSettings.setDeadLetterAddress(SimpleString.of(DLA)) + .setExpiryAddress(SimpleString.of(expiryAddress)) .setExpiryDelay(expiryDelay) .setDefaultLastValueQueue(lastValueQueue) .setMaxDeliveryAttempts(deliveryAttempts) @@ -1664,12 +1664,12 @@ public class ActiveMQServerControlTest extends ManagementTestBase { .setConfigDeleteQueues(DeletionPolicy.valueOf(configDeleteQueues)) .setConfigDeleteAddresses(DeletionPolicy.valueOf(configDeleteAddresses)) .setMaxSizeBytesRejectThreshold(maxSizeBytesRejectThreshold) - .setDefaultLastValueKey(SimpleString.toSimpleString(defaultLastValueKey)) + .setDefaultLastValueKey(SimpleString.of(defaultLastValueKey)) .setDefaultNonDestructive(defaultNonDestructive) .setDefaultExclusiveQueue(defaultExclusiveQueue) .setDefaultGroupRebalance(defaultGroupRebalance) .setDefaultGroupBuckets(defaultGroupBuckets) - .setDefaultGroupFirstKey(SimpleString.toSimpleString(defaultGroupFirstKey)) + .setDefaultGroupFirstKey(SimpleString.of(defaultGroupFirstKey)) .setDefaultMaxConsumers(defaultMaxConsumers) .setDefaultPurgeOnNoConsumers(defaultPurgeOnNoConsumers) .setDefaultConsumersBeforeDispatch(defaultConsumersBeforeDispatch) @@ -1685,11 +1685,11 @@ public class ActiveMQServerControlTest extends ManagementTestBase { .setRedeliveryCollisionAvoidanceFactor(redeliveryCollisionAvoidanceFactor) .setRetroactiveMessageCount(retroactiveMessageCount) .setAutoCreateDeadLetterResources(autoCreateDeadLetterResources) - .setDeadLetterQueuePrefix(SimpleString.toSimpleString(deadLetterQueuePrefix)) - .setDeadLetterQueueSuffix(SimpleString.toSimpleString(deadLetterQueueSuffix)) + .setDeadLetterQueuePrefix(SimpleString.of(deadLetterQueuePrefix)) + .setDeadLetterQueueSuffix(SimpleString.of(deadLetterQueueSuffix)) .setAutoCreateExpiryResources(autoCreateExpiryResources) - .setExpiryQueuePrefix(SimpleString.toSimpleString(expiryQueuePrefix)) - .setExpiryQueueSuffix(SimpleString.toSimpleString(expiryQueueSuffix)) + .setExpiryQueuePrefix(SimpleString.of(expiryQueuePrefix)) + .setExpiryQueueSuffix(SimpleString.of(expiryQueueSuffix)) .setMinExpiryDelay(minExpiryDelay) .setMaxExpiryDelay(maxExpiryDelay) .setEnableMetrics(enableMetrics); @@ -2156,7 +2156,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase { @TestTemplate public void testListPreparedTransactionDetails() throws Exception { - SimpleString atestq = new SimpleString("BasicXaTestq"); + SimpleString atestq = SimpleString.of("BasicXaTestq"); Xid xid = newXID(); ServerLocator locator = createInVMNonHALocator(); @@ -2231,7 +2231,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase { @TestTemplate public void testListPreparedTransactionDetailsOnConsumer() throws Exception { - SimpleString atestq = new SimpleString("BasicXaTestq"); + SimpleString atestq = SimpleString.of("BasicXaTestq"); Xid xid = newXID(); ServerLocator locator = createInVMNonHALocator(); @@ -2284,7 +2284,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase { @TestTemplate public void testListPreparedTransactionDetailsAsHTML() throws Exception { - SimpleString atestq = new SimpleString("BasicXaTestq"); + SimpleString atestq = SimpleString.of("BasicXaTestq"); Xid xid = newXID(); ServerLocator locator = createInVMNonHALocator(); @@ -2327,8 +2327,8 @@ public class ActiveMQServerControlTest extends ManagementTestBase { @TestTemplate public void testCommitPreparedTransactions() throws Exception { - SimpleString recQueue = new SimpleString("BasicXaTestqRec"); - SimpleString sendQueue = new SimpleString("BasicXaTestqSend"); + SimpleString recQueue = SimpleString.of("BasicXaTestqRec"); + SimpleString sendQueue = SimpleString.of("BasicXaTestqSend"); byte[] globalTransactionId = UUIDGenerator.getInstance().generateStringUUID().getBytes(); Xid xid = new XidImpl("xa1".getBytes(), 1, globalTransactionId); @@ -2446,9 +2446,9 @@ public class ActiveMQServerControlTest extends ManagementTestBase { session.commit(); // flush executors on queues so we can get precise number of messages - Queue queue1 = server.locateQueue(SimpleString.toSimpleString(random1)); + Queue queue1 = server.locateQueue(SimpleString.of(random1)); queue1.flushExecutor(); - Queue queue2 = server.locateQueue(SimpleString.toSimpleString(random1)); + Queue queue2 = server.locateQueue(SimpleString.of(random1)); queue2.flushExecutor(); assertEquals(2, serverControl.getTotalMessageCount()); @@ -2587,8 +2587,8 @@ public class ActiveMQServerControlTest extends ManagementTestBase { String random2 = RandomUtil.randomString(); ActiveMQServerControl serverControl = createManagementControl(); - QueueControl queueControl1 = ManagementControlHelper.createQueueControl(SimpleString.toSimpleString(random1), SimpleString.toSimpleString(random1), RoutingType.ANYCAST, mbeanServer); - QueueControl queueControl2 = ManagementControlHelper.createQueueControl(SimpleString.toSimpleString(random2), SimpleString.toSimpleString(random2), RoutingType.ANYCAST, mbeanServer); + QueueControl queueControl1 = ManagementControlHelper.createQueueControl(SimpleString.of(random1), SimpleString.of(random1), RoutingType.ANYCAST, mbeanServer); + QueueControl queueControl2 = ManagementControlHelper.createQueueControl(SimpleString.of(random2), SimpleString.of(random2), RoutingType.ANYCAST, mbeanServer); ServerLocator locator = createInVMNonHALocator(); ClientSessionFactory csf = createSessionFactory(locator); @@ -2670,7 +2670,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase { @TestTemplate public void testListConsumersAsJSON() throws Exception { - SimpleString queueName = new SimpleString(UUID.randomUUID().toString()); + SimpleString queueName = SimpleString.of(UUID.randomUUID().toString()); final String filter = "x = 1"; ActiveMQServerControl serverControl = createManagementControl(); @@ -2685,7 +2685,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase { } 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)); + addClientConsumer(session.createConsumer(queueName, SimpleString.of(filter), true)); String jsonString = serverControl.listConsumersAsJSON(factory.getConnection().getID().toString()); logger.debug(jsonString); @@ -2731,7 +2731,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase { @TestTemplate public void testListAllConsumersAsJSON() throws Exception { - SimpleString queueName = new SimpleString(UUID.randomUUID().toString()); + SimpleString queueName = SimpleString.of(UUID.randomUUID().toString()); ActiveMQServerControl serverControl = createManagementControl(); ServerLocator locator = createInVMNonHALocator(); @@ -2819,7 +2819,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase { @TestTemplate public void testListAllConsumersAsJSONTXCommit() throws Exception { - SimpleString queueName = new SimpleString(UUID.randomUUID().toString()); + SimpleString queueName = SimpleString.of(UUID.randomUUID().toString()); ActiveMQServerControl serverControl = createManagementControl(); ServerLocator locator = createInVMNonHALocator(); @@ -2908,7 +2908,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase { @TestTemplate public void testListAllConsumersAsJSONTXCommitAck() throws Exception { - SimpleString queueName = new SimpleString(UUID.randomUUID().toString()); + SimpleString queueName = SimpleString.of(UUID.randomUUID().toString()); ActiveMQServerControl serverControl = createManagementControl(); ServerLocator locator = createInVMNonHALocator(); @@ -2977,7 +2977,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase { @TestTemplate public void testListAllConsumersAsJSONTXRollback() throws Exception { - SimpleString queueName = new SimpleString(UUID.randomUUID().toString()); + SimpleString queueName = SimpleString.of(UUID.randomUUID().toString()); ActiveMQServerControl serverControl = createManagementControl(); ServerLocator locator = createInVMNonHALocator(); @@ -3097,7 +3097,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase { @TestTemplate public void testListAllConsumersAsJSONCancel() throws Exception { - SimpleString queueName = new SimpleString(UUID.randomUUID().toString()); + SimpleString queueName = SimpleString.of(UUID.randomUUID().toString()); ActiveMQServerControl serverControl = createManagementControl(); ServerLocator locator = createInVMNonHALocator(); @@ -3168,7 +3168,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase { @TestTemplate public void testListAllConsumersAsJSONNoTX() throws Exception { - SimpleString queueName = new SimpleString(UUID.randomUUID().toString()); + SimpleString queueName = SimpleString.of(UUID.randomUUID().toString()); ActiveMQServerControl serverControl = createManagementControl(); ServerLocator locator = createInVMNonHALocator(); @@ -3219,7 +3219,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase { @TestTemplate public void testListAllConsumersAsJSONXACommit() throws Exception { - SimpleString queueName = new SimpleString(UUID.randomUUID().toString()); + SimpleString queueName = SimpleString.of(UUID.randomUUID().toString()); ActiveMQServerControl serverControl = createManagementControl(); ServerLocator locator = createInVMNonHALocator(); @@ -3304,7 +3304,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase { @TestTemplate public void testListAllConsumersAsJSONXARollback() throws Exception { - SimpleString queueName = new SimpleString(UUID.randomUUID().toString()); + SimpleString queueName = SimpleString.of(UUID.randomUUID().toString()); ActiveMQServerControl serverControl = createManagementControl(); ServerLocator locator = createInVMNonHALocator(); @@ -3390,7 +3390,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase { @TestTemplate public void testListSessionsAsJSON() throws Exception { - SimpleString queueName = new SimpleString(UUID.randomUUID().toString()); + SimpleString queueName = SimpleString.of(UUID.randomUUID().toString()); server.addAddressInfo(new AddressInfo(queueName, RoutingType.ANYCAST)); if (legacyCreateQueue) { server.createQueue(queueName, RoutingType.ANYCAST, queueName, null, false, false); @@ -3449,7 +3449,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase { @TestTemplate public void testListAllSessionsAsJSON() throws Exception { - SimpleString queueName = new SimpleString(UUID.randomUUID().toString()); + SimpleString queueName = SimpleString.of(UUID.randomUUID().toString()); server.addAddressInfo(new AddressInfo(queueName, RoutingType.ANYCAST)); if (legacyCreateQueue) { server.createQueue(queueName, RoutingType.ANYCAST, queueName, null, false, false); @@ -3496,7 +3496,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase { @TestTemplate public void testListAllSessionsAsJSONWithJMS() throws Exception { - SimpleString queueName = new SimpleString(UUID.randomUUID().toString()); + SimpleString queueName = SimpleString.of(UUID.randomUUID().toString()); server.addAddressInfo(new AddressInfo(queueName, RoutingType.ANYCAST)); if (legacyCreateQueue) { server.createQueue(queueName, RoutingType.ANYCAST, queueName, null, false, false); @@ -3522,9 +3522,9 @@ public class ActiveMQServerControlTest extends ManagementTestBase { @TestTemplate public void testListQueues() throws Exception { - SimpleString queueName1 = new SimpleString("my_queue_one"); - SimpleString queueName2 = new SimpleString("my_queue_two"); - SimpleString queueName3 = new SimpleString("other_queue_three"); + SimpleString queueName1 = SimpleString.of("my_queue_one"); + SimpleString queueName2 = SimpleString.of("my_queue_two"); + SimpleString queueName3 = SimpleString.of("other_queue_three"); ActiveMQServerControl serverControl = createManagementControl(); @@ -3609,15 +3609,15 @@ public class ActiveMQServerControlTest extends ManagementTestBase { @TestTemplate public void testListQueuesOrder() throws Exception { - SimpleString queueName1 = new SimpleString("my_queue_1"); - SimpleString queueName2 = new SimpleString("my_queue_2"); - SimpleString queueName3 = new SimpleString("my_queue_3"); + SimpleString queueName1 = SimpleString.of("my_queue_1"); + SimpleString queueName2 = SimpleString.of("my_queue_2"); + SimpleString queueName3 = SimpleString.of("my_queue_3"); ActiveMQServerControl serverControl = createManagementControl(); server.addAddressInfo(new AddressInfo(queueName1, RoutingType.ANYCAST)); if (legacyCreateQueue) { - server.createQueue(queueName1, RoutingType.ANYCAST, queueName1, new SimpleString("filter1"),null,true, + server.createQueue(queueName1, RoutingType.ANYCAST, queueName1, SimpleString.of("filter1"),null,true, false, false,20,false,false); } else { server.createQueue(new QueueConfiguration(queueName1).setRoutingType(RoutingType.ANYCAST).setFilterString("filter1").setMaxConsumers(20).setAutoCreateAddress(false)); @@ -3625,7 +3625,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase { Thread.sleep(500); server.addAddressInfo(new AddressInfo(queueName2, RoutingType.ANYCAST)); if (legacyCreateQueue) { - server.createQueue(queueName2, RoutingType.ANYCAST, queueName2, new SimpleString("filter3"), null,true, + server.createQueue(queueName2, RoutingType.ANYCAST, queueName2, SimpleString.of("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)); @@ -3633,7 +3633,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase { Thread.sleep(500); server.addAddressInfo(new AddressInfo(queueName3, RoutingType.ANYCAST)); if (legacyCreateQueue) { - server.createQueue(queueName3, RoutingType.ANYCAST, queueName3, new SimpleString("filter0"),null,true, + server.createQueue(queueName3, RoutingType.ANYCAST, queueName3, SimpleString.of("filter0"),null,true, false, false,10,false,false); } else { server.createQueue(new QueueConfiguration(queueName3).setRoutingType(RoutingType.ANYCAST).setFilterString("filter0").setMaxConsumers(10).setAutoCreateAddress(false)); @@ -3734,10 +3734,10 @@ public class ActiveMQServerControlTest extends ManagementTestBase { @TestTemplate public void testListQueuesNumericFilter() throws Exception { - SimpleString queueName1 = new SimpleString("my_queue_one"); - SimpleString queueName2 = new SimpleString("my_queue_two"); - SimpleString queueName3 = new SimpleString("one_consumer_queue_three"); - SimpleString queueName4 = new SimpleString("my_queue_four"); + SimpleString queueName1 = SimpleString.of("my_queue_one"); + SimpleString queueName2 = SimpleString.of("my_queue_two"); + SimpleString queueName3 = SimpleString.of("one_consumer_queue_three"); + SimpleString queueName4 = SimpleString.of("my_queue_four"); ActiveMQServerControl serverControl = createManagementControl(); @@ -3890,10 +3890,10 @@ public class ActiveMQServerControlTest extends ManagementTestBase { @TestTemplate public void testListQueuesNumericFilterInvalid() throws Exception { - SimpleString queueName1 = new SimpleString("my_queue_one"); - SimpleString queueName2 = new SimpleString("one_consumer_queue_two"); - SimpleString queueName3 = new SimpleString("one_consumer_queue_three"); - SimpleString queueName4 = new SimpleString("my_queue_four"); + SimpleString queueName1 = SimpleString.of("my_queue_one"); + SimpleString queueName2 = SimpleString.of("one_consumer_queue_two"); + SimpleString queueName3 = SimpleString.of("one_consumer_queue_three"); + SimpleString queueName4 = SimpleString.of("my_queue_four"); ActiveMQServerControl serverControl = createManagementControl(); @@ -4004,14 +4004,14 @@ public class ActiveMQServerControlTest extends ManagementTestBase { @TestTemplate public void testListAddresses() throws Exception { - SimpleString queueName1 = new SimpleString("my_queue_one"); - SimpleString queueName2 = new SimpleString("my_queue_two"); - SimpleString queueName3 = new SimpleString("other_queue_three"); - SimpleString queueName4 = new SimpleString("other_queue_four"); + SimpleString queueName1 = SimpleString.of("my_queue_one"); + SimpleString queueName2 = SimpleString.of("my_queue_two"); + SimpleString queueName3 = SimpleString.of("other_queue_three"); + SimpleString queueName4 = SimpleString.of("other_queue_four"); - SimpleString addressName1 = new SimpleString("my_address_one"); - SimpleString addressName2 = new SimpleString("my_address_two"); - SimpleString addressName3 = new SimpleString("other_address_three"); + SimpleString addressName1 = SimpleString.of("my_address_one"); + SimpleString addressName2 = SimpleString.of("my_address_two"); + SimpleString addressName3 = SimpleString.of("other_address_three"); ActiveMQServerControl serverControl = createManagementControl(); @@ -4096,14 +4096,14 @@ public class ActiveMQServerControlTest extends ManagementTestBase { @TestTemplate public void testListAddressOrder() throws Exception { - SimpleString queueName1 = new SimpleString("my_queue_one"); - SimpleString queueName2 = new SimpleString("my_queue_two"); - SimpleString queueName3 = new SimpleString("other_queue_three"); - SimpleString queueName4 = new SimpleString("other_queue_four"); + SimpleString queueName1 = SimpleString.of("my_queue_one"); + SimpleString queueName2 = SimpleString.of("my_queue_two"); + SimpleString queueName3 = SimpleString.of("other_queue_three"); + SimpleString queueName4 = SimpleString.of("other_queue_four"); - SimpleString addressName1 = new SimpleString("my_address_1"); - SimpleString addressName2 = new SimpleString("my_address_2"); - SimpleString addressName3 = new SimpleString("my_address_3"); + SimpleString addressName1 = SimpleString.of("my_address_1"); + SimpleString addressName2 = SimpleString.of("my_address_2"); + SimpleString addressName3 = SimpleString.of("my_address_3"); ActiveMQServerControl serverControl = createManagementControl(); @@ -4159,11 +4159,11 @@ public class ActiveMQServerControlTest extends ManagementTestBase { @TestTemplate public void testListConsumers() throws Exception { - SimpleString queueName1 = new SimpleString("my_queue_one"); - SimpleString queueName2 = new SimpleString("my_queue_two"); - SimpleString queueName3 = new SimpleString("other_queue_three"); - SimpleString addressName1 = new SimpleString("my_address_one"); - SimpleString addressName2 = new SimpleString("my_address_two"); + SimpleString queueName1 = SimpleString.of("my_queue_one"); + SimpleString queueName2 = SimpleString.of("my_queue_two"); + SimpleString queueName3 = SimpleString.of("other_queue_three"); + SimpleString addressName1 = SimpleString.of("my_address_one"); + SimpleString addressName2 = SimpleString.of("my_address_two"); ActiveMQServerControl serverControl = createManagementControl(); @@ -4268,8 +4268,8 @@ public class ActiveMQServerControlTest extends ManagementTestBase { @TestTemplate public void testListConsumersOrder() throws Exception { - SimpleString queueName1 = new SimpleString("my_queue_one"); - SimpleString addressName1 = new SimpleString("my_address_one"); + SimpleString queueName1 = SimpleString.of("my_queue_one"); + SimpleString addressName1 = SimpleString.of("my_address_one"); ActiveMQServerControl serverControl = createManagementControl(); @@ -4321,8 +4321,8 @@ public class ActiveMQServerControlTest extends ManagementTestBase { @TestTemplate public void testListSessions() throws Exception { - SimpleString queueName1 = new SimpleString("my_queue_one"); - SimpleString addressName1 = new SimpleString("my_address_one"); + SimpleString queueName1 = SimpleString.of("my_queue_one"); + SimpleString addressName1 = SimpleString.of("my_address_one"); ActiveMQServerControl serverControl = createManagementControl(); @@ -4437,8 +4437,8 @@ public class ActiveMQServerControlTest extends ManagementTestBase { @TestTemplate public void testListConnections() throws Exception { - SimpleString queueName1 = new SimpleString("my_queue_one"); - SimpleString addressName1 = new SimpleString("my_address_one"); + SimpleString queueName1 = SimpleString.of("my_queue_one"); + SimpleString addressName1 = SimpleString.of("my_address_one"); ActiveMQServerControl serverControl = createManagementControl(); @@ -4580,8 +4580,8 @@ public class ActiveMQServerControlTest extends ManagementTestBase { @TestTemplate public void testListProducers() throws Exception { - SimpleString queueName1 = new SimpleString("my_queue_one"); - SimpleString addressName1 = new SimpleString("my_address_one"); + SimpleString queueName1 = SimpleString.of("my_queue_one"); + SimpleString addressName1 = SimpleString.of("my_address_one"); ActiveMQServerControl serverControl = createManagementControl(); @@ -4641,8 +4641,8 @@ public class ActiveMQServerControlTest extends ManagementTestBase { @TestTemplate public void testListProducersLargeMessages() throws Exception { - SimpleString queueName1 = new SimpleString("my_queue_one"); - SimpleString addressName1 = new SimpleString("my_address_one"); + SimpleString queueName1 = SimpleString.of("my_queue_one"); + SimpleString addressName1 = SimpleString.of("my_address_one"); ActiveMQServerControl serverControl = createManagementControl(); @@ -4702,8 +4702,8 @@ public class ActiveMQServerControlTest extends ManagementTestBase { @TestTemplate public void testListProducersAsJSONAgainstServer() throws Exception { - SimpleString queueName1 = new SimpleString("my_queue_one"); - SimpleString addressName1 = new SimpleString("my_address_one"); + SimpleString queueName1 = SimpleString.of("my_queue_one"); + SimpleString addressName1 = SimpleString.of("my_address_one"); ActiveMQServerControl serverControl = createManagementControl(); @@ -4757,8 +4757,8 @@ public class ActiveMQServerControlTest extends ManagementTestBase { @TestTemplate public void testListProducersAgainstServer() throws Exception { - SimpleString queueName1 = new SimpleString("my_queue_one"); - SimpleString addressName1 = new SimpleString("my_address_one"); + SimpleString queueName1 = SimpleString.of("my_queue_one"); + SimpleString addressName1 = SimpleString.of("my_address_one"); ActiveMQServerControl serverControl = createManagementControl(); @@ -4820,7 +4820,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase { public void testListProducersJMS(ConnectionFactory connectionFactory, String protocol) throws Exception { String queueName = "my_queue_one"; - SimpleString ssQueueName = SimpleString.toSimpleString(queueName); + SimpleString ssQueueName = SimpleString.of(queueName); ActiveMQServerControl serverControl = createManagementControl(); server.addAddressInfo(new AddressInfo(ssQueueName, RoutingType.ANYCAST)); @@ -4876,7 +4876,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase { @TestTemplate public void testListProducersJMSLegacy() throws Exception { String queueName = "my_queue_one"; - SimpleString ssQueueName = SimpleString.toSimpleString(queueName); + SimpleString ssQueueName = SimpleString.of(queueName); ActiveMQServerControl serverControl = createManagementControl(); server.addAddressInfo(new AddressInfo(ssQueueName, RoutingType.ANYCAST)); @@ -4972,9 +4972,9 @@ public class ActiveMQServerControlTest extends ManagementTestBase { @TestTemplate public void testListFqqnProducersJMSLegacy() throws Exception { - SimpleString queueName1 = new SimpleString("my_queue_one"); - SimpleString addressName1 = new SimpleString("my_address_one"); - SimpleString FQQNName = new SimpleString(addressName1 + "::" + queueName1); + SimpleString queueName1 = SimpleString.of("my_queue_one"); + SimpleString addressName1 = SimpleString.of("my_address_one"); + SimpleString FQQNName = SimpleString.of(addressName1 + "::" + queueName1); ActiveMQServerControl serverControl = createManagementControl(); server.addAddressInfo(new AddressInfo(FQQNName, RoutingType.ANYCAST)); @@ -5050,7 +5050,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase { @TestTemplate public void testListAnonProducersJMSLegacy() throws Exception { String queueName = "my_queue_one"; - SimpleString ssQueueName = SimpleString.toSimpleString(queueName); + SimpleString ssQueueName = SimpleString.of(queueName); ActiveMQServerControl serverControl = createManagementControl(); server.addAddressInfo(new AddressInfo(ssQueueName, RoutingType.ANYCAST)); @@ -5151,7 +5151,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase { } public void testListProducersJMSMultipleProducers(ConnectionFactory connectionFactory, String protocol) throws Exception { String queueName = "my_queue_one"; - SimpleString ssQueueName = SimpleString.toSimpleString(queueName); + SimpleString ssQueueName = SimpleString.of(queueName); ActiveMQServerControl serverControl = createManagementControl(); server.addAddressInfo(new AddressInfo(ssQueueName, RoutingType.ANYCAST)); @@ -5239,9 +5239,9 @@ public class ActiveMQServerControlTest extends ManagementTestBase { String queueName1 = "my_queue_one"; String queueName2 = "my_queue_two"; String queueName3 = "my_queue_three"; - SimpleString ssQueueName1 = SimpleString.toSimpleString(queueName1); - SimpleString ssQueueName2 = SimpleString.toSimpleString(queueName2); - SimpleString ssQueueName3 = SimpleString.toSimpleString(queueName3); + SimpleString ssQueueName1 = SimpleString.of(queueName1); + SimpleString ssQueueName2 = SimpleString.of(queueName2); + SimpleString ssQueueName3 = SimpleString.of(queueName3); ActiveMQServerControl serverControl = createManagementControl(); server.addAddressInfo(new AddressInfo(ssQueueName1, RoutingType.ANYCAST)); @@ -5320,7 +5320,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase { testListProducersJMSTopic(new org.apache.activemq.ActiveMQConnectionFactory("tcp://localhost:61616"), "OPENWIRE"); } public void testListProducersJMSTopic(ConnectionFactory connectionFactory, String protocol) throws Exception { - SimpleString topicName = SimpleString.toSimpleString("my-topic"); + SimpleString topicName = SimpleString.of("my-topic"); ActiveMQServerControl serverControl = createManagementControl(); server.addAddressInfo(new AddressInfo(topicName, RoutingType.MULTICAST)); @@ -5387,9 +5387,9 @@ public class ActiveMQServerControlTest extends ManagementTestBase { @TestTemplate public void testListProducersFQQN() throws Exception { - SimpleString queueName1 = new SimpleString("my_queue_one"); - SimpleString addressName1 = new SimpleString("my_address_one"); - SimpleString FQQNName = new SimpleString(addressName1 + "::" + queueName1); + SimpleString queueName1 = SimpleString.of("my_queue_one"); + SimpleString addressName1 = SimpleString.of("my_address_one"); + SimpleString FQQNName = SimpleString.of(addressName1 + "::" + queueName1); ActiveMQServerControl serverControl = createManagementControl(); server.addAddressInfo(new AddressInfo(addressName1, RoutingType.ANYCAST)); @@ -5470,8 +5470,8 @@ public class ActiveMQServerControlTest extends ManagementTestBase { public void testListProducersMessageCountsJMS(ConnectionFactory connectionFactory, String protocol) throws Exception { String myQueue = "my_queue"; - SimpleString queueName1 = new SimpleString(myQueue); - SimpleString addressName1 = new SimpleString(myQueue); + SimpleString queueName1 = SimpleString.of(myQueue); + SimpleString addressName1 = SimpleString.of(myQueue); ActiveMQServerControl serverControl = createManagementControl(); @@ -5519,8 +5519,8 @@ public class ActiveMQServerControlTest extends ManagementTestBase { @TestTemplate public void testListProducersMessageCounts() throws Exception { - SimpleString queueName1 = new SimpleString("my_queue_one"); - SimpleString addressName1 = new SimpleString("my_address_one"); + SimpleString queueName1 = SimpleString.of("my_queue_one"); + SimpleString addressName1 = SimpleString.of("my_address_one"); ActiveMQServerControl serverControl = createManagementControl(); @@ -5575,8 +5575,8 @@ public class ActiveMQServerControlTest extends ManagementTestBase { @TestTemplate public void testListProducersMessageCounts2() throws Exception { - SimpleString queueName1 = new SimpleString("my_queue_one"); - SimpleString addressName1 = new SimpleString("my_address_one"); + SimpleString queueName1 = SimpleString.of("my_queue_one"); + SimpleString addressName1 = SimpleString.of("my_address_one"); ActiveMQServerControl serverControl = createManagementControl(); @@ -5648,7 +5648,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase { session.createQueue(new QueueConfiguration(name1).setRoutingType(RoutingType.ANYCAST).setDurable(false)); } - Queue serverQueue = server.locateQueue(SimpleString.toSimpleString(name1)); + Queue serverQueue = server.locateQueue(SimpleString.of(name1)); assertFalse(serverQueue.isDurable()); ClientProducer producer1 = session.createProducer(name1); sendMessagesWithPredefinedSize(30, session, producer1, MESSAGE_SIZE); @@ -5688,7 +5688,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase { session.createQueue(new QueueConfiguration(name2).setRoutingType(RoutingType.ANYCAST).setDurable(false)); } - Queue serverQueue = server.locateQueue(SimpleString.toSimpleString(name1)); + Queue serverQueue = server.locateQueue(SimpleString.of(name1)); assertFalse(serverQueue.isDurable()); ClientProducer producer1 = session.createProducer(name1); @@ -6157,7 +6157,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase { } protected void scaleDown(ScaleDownHandler handler) throws Exception { - SimpleString address = new SimpleString("testQueue"); + SimpleString address = SimpleString.of("testQueue"); HashMap params = new HashMap<>(); params.put(TransportConstants.SERVER_ID_PROP_NAME, "2"); Configuration config = createDefaultInVMConfig(2).clearAcceptorConfigurations().addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getName(), params)).setSecurityEnabled(false); 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 c7f16cb772..647d7218f2 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 @@ -88,7 +88,7 @@ public class AddressControlTest extends ManagementTestBase { @Test public void testManagementAddressAlwaysExists() throws Exception { - ClientSession.AddressQuery query = session.addressQuery(new SimpleString("activemq.management")); + ClientSession.AddressQuery query = session.addressQuery(SimpleString.of("activemq.management")); assertTrue(query.isExists()); } @@ -675,7 +675,7 @@ public class AddressControlTest extends ManagementTestBase { String queue = "testQueue" + RandomUtil.randomString(); server.addAddressInfo(new AddressInfo(queue).addRoutingType(RoutingType.ANYCAST)); server.createQueue(new QueueConfiguration(queue).setRoutingType(RoutingType.ANYCAST).setAddress(queue)); - AddressControl addressControl = createManagementControl(SimpleString.toSimpleString(queue)); + AddressControl addressControl = createManagementControl(SimpleString.of(queue)); ConnectionFactory factory = CFUtil.createConnectionFactory("core", "tcp://localhost:61616"); try (Connection connection = factory.createConnection()) { @@ -735,7 +735,7 @@ public class AddressControlTest extends ManagementTestBase { server.addAddressInfo(new AddressInfo(queue).addRoutingType(RoutingType.ANYCAST)); server.createQueue(new QueueConfiguration(queue).setRoutingType(RoutingType.ANYCAST).setAddress(queue)); - AddressControl addressControl = createManagementControl(SimpleString.toSimpleString(queue)); + AddressControl addressControl = createManagementControl(SimpleString.of(queue)); ConnectionFactory factory = CFUtil.createConnectionFactory("core", "tcp://localhost:61616"); try (Connection connection = factory.createConnection()) { 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 4dc415e929..8264bba290 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 @@ -109,14 +109,14 @@ public class BridgeControlTest extends ManagementTestBase { assertEquals(1, notifListener.getNotifications().size()); Notification notif = notifListener.getNotifications().get(0); assertEquals(CoreNotificationType.BRIDGE_STOPPED, notif.getType()); - assertEquals(bridgeControl.getName(), notif.getProperties().getSimpleStringProperty(new SimpleString("name")).toString()); + assertEquals(bridgeControl.getName(), notif.getProperties().getSimpleStringProperty(SimpleString.of("name")).toString()); bridgeControl.start(); assertEquals(2, notifListener.getNotifications().size()); notif = notifListener.getNotifications().get(1); assertEquals(CoreNotificationType.BRIDGE_STARTED, notif.getType()); - assertEquals(bridgeControl.getName(), notif.getProperties().getSimpleStringProperty(new SimpleString("name")).toString()); + assertEquals(bridgeControl.getName(), notif.getProperties().getSimpleStringProperty(SimpleString.of("name")).toString()); } @Override 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 551b23529d..e36814f8d7 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 @@ -159,14 +159,14 @@ public class ClusterConnectionControlTest extends ManagementTestBase { assertTrue(notifListener.getNotifications().size() > 0); Notification notif = getFirstNotificationOfType(notifListener.getNotifications(), CoreNotificationType.CLUSTER_CONNECTION_STOPPED); assertNotNull(notif); - assertEquals(clusterConnectionControl.getName(), notif.getProperties().getSimpleStringProperty(new SimpleString("name")).toString()); + assertEquals(clusterConnectionControl.getName(), notif.getProperties().getSimpleStringProperty(SimpleString.of("name")).toString()); clusterConnectionControl.start(); assertTrue(notifListener.getNotifications().size() > 0); notif = getFirstNotificationOfType(notifListener.getNotifications(), CoreNotificationType.CLUSTER_CONNECTION_STARTED); assertNotNull(notif); - assertEquals(clusterConnectionControl.getName(), notif.getProperties().getSimpleStringProperty(new SimpleString("name")).toString()); + assertEquals(clusterConnectionControl.getName(), notif.getProperties().getSimpleStringProperty(SimpleString.of("name")).toString()); } private Notification getFirstNotificationOfType(List notifications, CoreNotificationType type) { 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 55a3fb13c8..5076744650 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 @@ -74,7 +74,7 @@ public class DivertControlTest extends ManagementTestBase { 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()) + .setName(ResourceNames.getRetroactiveResourceDivertName(server.getInternalNamingPrefix(), server.getConfiguration().getWildcardConfiguration().getDelimiterString(), SimpleString.of(address)).toString()) .setRoutingName(RandomUtil.randomString()).setAddress(queueConfig.getAddress().toString()) .setForwardingAddress(forwardQueueConfig.getAddress().toString()) .setExclusive(RandomUtil.randomBoolean()) diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementTestBase.java index 552fa02c35..df9654a040 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementTestBase.java @@ -90,7 +90,7 @@ public abstract class ManagementTestBase extends ActiveMQTestBase { } protected QueueControl createManagementControl(final String address, final String queue) throws Exception { - return createManagementControl(SimpleString.toSimpleString(address), SimpleString.toSimpleString(queue)); + return createManagementControl(SimpleString.of(address), SimpleString.of(queue)); } protected QueueControl createManagementControl(final SimpleString address, 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 61156098c3..e0726c48bc 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 @@ -119,7 +119,7 @@ public class ManagementWithPagingServerTest extends ManagementTestBase { int num = 1000; - SimpleString key = new SimpleString("key"); + SimpleString key = SimpleString.of("key"); long matchingValue = RandomUtil.randomLong(); long unmatchingValue = matchingValue + 1; String filter = key + " =" + matchingValue; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/MessageAuthorizationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/MessageAuthorizationTest.java index 42ac2592b0..80c8c8d2b2 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/MessageAuthorizationTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/MessageAuthorizationTest.java @@ -60,8 +60,8 @@ public class MessageAuthorizationTest extends ActiveMQTestBase { } private ActiveMQServer server; - private SimpleString QUEUE = new SimpleString("TestQueue"); - private SimpleString TOPIC = new SimpleString("TestTopic"); + private SimpleString QUEUE = SimpleString.of("TestQueue"); + private SimpleString TOPIC = SimpleString.of("TestTopic"); @Override @BeforeEach 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 f9cd0e47cf..af452fea63 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 @@ -172,18 +172,18 @@ public class NotificationTest extends ActiveMQTestBase { long start = System.currentTimeMillis(); ClientConsumer consumer = mySession.createConsumer(queue); - SimpleString consumerName = SimpleString.toSimpleString(((ClientSessionInternal) mySession).getName()); + SimpleString consumerName = SimpleString.of(((ClientSessionInternal) mySession).getName()); ClientMessage[] notifications = NotificationTest.consumeMessages(1, notifConsumer); assertEquals(CONSUMER_CREATED.toString(), notifications[0].getObjectProperty(ManagementHelper.HDR_NOTIFICATION_TYPE).toString()); assertEquals(queue.toString(), notifications[0].getObjectProperty(ManagementHelper.HDR_ROUTING_NAME).toString()); assertEquals(address.toString(), notifications[0].getObjectProperty(ManagementHelper.HDR_ADDRESS).toString()); assertEquals(1, notifications[0].getObjectProperty(ManagementHelper.HDR_CONSUMER_COUNT)); - assertEquals(SimpleString.toSimpleString("myUser"), notifications[0].getSimpleStringProperty(ManagementHelper.HDR_USER)); + assertEquals(SimpleString.of("myUser"), notifications[0].getSimpleStringProperty(ManagementHelper.HDR_USER)); assertNull(notifications[0].getSimpleStringProperty(ManagementHelper.HDR_VALIDATED_USER)); - assertEquals(SimpleString.toSimpleString("invm:0"), notifications[0].getSimpleStringProperty(ManagementHelper.HDR_REMOTE_ADDRESS)); + assertEquals(SimpleString.of("invm:0"), notifications[0].getSimpleStringProperty(ManagementHelper.HDR_REMOTE_ADDRESS)); assertEquals(consumerName, notifications[0].getSimpleStringProperty(ManagementHelper.HDR_SESSION_NAME)); - assertEquals(SimpleString.toSimpleString("unavailable"), notifications[0].getSimpleStringProperty(ManagementHelper.HDR_CERT_SUBJECT_DN)); + assertEquals(SimpleString.of("unavailable"), notifications[0].getSimpleStringProperty(ManagementHelper.HDR_CERT_SUBJECT_DN)); assertTrue(notifications[0].getTimestamp() >= start); assertTrue((long) notifications[0].getObjectProperty(ManagementHelper.HDR_NOTIFICATION_TIMESTAMP) >= start); assertEquals(notifications[0].getTimestamp(), (long) notifications[0].getObjectProperty(ManagementHelper.HDR_NOTIFICATION_TIMESTAMP)); @@ -198,7 +198,7 @@ public class NotificationTest extends ActiveMQTestBase { SimpleString queue = RandomUtil.randomSimpleString(); SimpleString address = RandomUtil.randomSimpleString(); - SimpleString filter = SimpleString.toSimpleString(""); + SimpleString filter = SimpleString.of(""); boolean durable = RandomUtil.randomBoolean(); try ( @@ -256,7 +256,7 @@ public class NotificationTest extends ActiveMQTestBase { mySession.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); ClientConsumer consumer = mySession.createConsumer(queue); - SimpleString sessionName = SimpleString.toSimpleString(((ClientSessionInternal) mySession).getName()); + SimpleString sessionName = SimpleString.of(((ClientSessionInternal) mySession).getName()); NotificationTest.flush(notifConsumer); @@ -268,8 +268,8 @@ public class NotificationTest extends ActiveMQTestBase { assertEquals(queue.toString(), notifications[0].getObjectProperty(ManagementHelper.HDR_ROUTING_NAME).toString()); assertEquals(address.toString(), notifications[0].getObjectProperty(ManagementHelper.HDR_ADDRESS).toString()); assertEquals(0, notifications[0].getObjectProperty(ManagementHelper.HDR_CONSUMER_COUNT)); - assertEquals(SimpleString.toSimpleString("myUser"), notifications[0].getSimpleStringProperty(ManagementHelper.HDR_USER)); - assertEquals(SimpleString.toSimpleString("invm:0"), notifications[0].getSimpleStringProperty(ManagementHelper.HDR_REMOTE_ADDRESS)); + assertEquals(SimpleString.of("myUser"), notifications[0].getSimpleStringProperty(ManagementHelper.HDR_USER)); + assertEquals(SimpleString.of("invm:0"), notifications[0].getSimpleStringProperty(ManagementHelper.HDR_REMOTE_ADDRESS)); assertEquals(sessionName, notifications[0].getSimpleStringProperty(ManagementHelper.HDR_SESSION_NAME)); assertTrue(notifications[0].getTimestamp() >= start); assertTrue((long) notifications[0].getObjectProperty(ManagementHelper.HDR_NOTIFICATION_TIMESTAMP) >= start); @@ -332,7 +332,7 @@ public class NotificationTest extends ActiveMQTestBase { assertEquals(SESSION_CREATED.toString(), notifications[1].getObjectProperty(ManagementHelper.HDR_NOTIFICATION_TYPE).toString()); assertNotNull(notifications[1].getObjectProperty(ManagementHelper.HDR_CONNECTION_NAME)); assertNotNull(notifications[1].getObjectProperty(ManagementHelper.HDR_SESSION_NAME)); - assertEquals(SimpleString.toSimpleString("myUser"), notifications[1].getObjectProperty(ManagementHelper.HDR_USER)); + assertEquals(SimpleString.of("myUser"), notifications[1].getObjectProperty(ManagementHelper.HDR_USER)); assertTrue(notifications[1].getTimestamp() >= start); assertTrue((long) notifications[1].getObjectProperty(ManagementHelper.HDR_NOTIFICATION_TIMESTAMP) >= start); assertEquals(notifications[1].getTimestamp(), (long) notifications[1].getObjectProperty(ManagementHelper.HDR_NOTIFICATION_TIMESTAMP)); @@ -348,7 +348,7 @@ public class NotificationTest extends ActiveMQTestBase { assertEquals(SESSION_CLOSED.toString(), notifications[0].getObjectProperty(ManagementHelper.HDR_NOTIFICATION_TYPE).toString()); assertNotNull(notifications[0].getObjectProperty(ManagementHelper.HDR_CONNECTION_NAME)); assertNotNull(notifications[0].getObjectProperty(ManagementHelper.HDR_SESSION_NAME)); - assertEquals(SimpleString.toSimpleString("myUser"), notifications[0].getObjectProperty(ManagementHelper.HDR_USER)); + assertEquals(SimpleString.of("myUser"), notifications[0].getObjectProperty(ManagementHelper.HDR_USER)); assertTrue(notifications[0].getTimestamp() >= start); assertTrue((Long) notifications[0].getObjectProperty(ManagementHelper.HDR_NOTIFICATION_TIMESTAMP) >= start); 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 65f934f8df..da4460d92f 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 @@ -265,7 +265,7 @@ public class QueueControlTest extends ManagementTestBase { public void testAttributes() throws Exception { SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); - SimpleString filter = new SimpleString("color = 'blue'"); + SimpleString filter = SimpleString.of("color = 'blue'"); session.createQueue(new QueueConfiguration(queue).setAddress(address).setFilterString(filter).setDurable(durable)); @@ -405,7 +405,7 @@ public class QueueControlTest extends ManagementTestBase { QueueControl queueControl = createManagementControl(address, queue); - AddressSettings addressSettings = new AddressSettings().setDeadLetterAddress(new SimpleString(deadLetterAddress)); + AddressSettings addressSettings = new AddressSettings().setDeadLetterAddress(SimpleString.of(deadLetterAddress)); server.getAddressSettingsRepository().addMatch(address.toString(), addressSettings); assertEquals(deadLetterAddress, queueControl.getDeadLetterAddress()); @@ -441,7 +441,7 @@ public class QueueControlTest extends ManagementTestBase { QueueControl queueControl = createManagementControl(address, queue); - AddressSettings addressSettings = new AddressSettings().setExpiryAddress(new SimpleString(expiryAddress)); + AddressSettings addressSettings = new AddressSettings().setExpiryAddress(SimpleString.of(expiryAddress)); server.getAddressSettingsRepository().addMatch(address.toString(), addressSettings); assertEquals(expiryAddress, queueControl.getExpiryAddress()); @@ -1194,7 +1194,7 @@ public class QueueControlTest extends ManagementTestBase { final String twentyBytes = new String(new char[20]).replace("\0", "#"); ClientMessage clientMessage = session.createMessage(Message.TEXT_TYPE, durable); - clientMessage.getBodyBuffer().writeNullableSimpleString(SimpleString.toSimpleString(twentyBytes)); + clientMessage.getBodyBuffer().writeNullableSimpleString(SimpleString.of(twentyBytes)); clientMessage.putStringProperty("x", twentyBytes); QueueControl queueControl = createManagementControl(address, queue); @@ -1415,7 +1415,7 @@ public class QueueControlTest extends ManagementTestBase { for (int i = 0; i < numMsg; i++) { ClientMessage message = transSession.createMessage(durable); - message.putIntProperty(new SimpleString("seqno"), i); + message.putIntProperty(SimpleString.of("seqno"), i); producer.send(message); } @@ -1500,7 +1500,7 @@ public class QueueControlTest extends ManagementTestBase { ClientProducer producer = session.createProducer(address); ClientMessage message = session.createMessage(durable); - message.putIntProperty(new SimpleString("key"), intValue); + message.putIntProperty(SimpleString.of("key"), intValue); producer.send(message); producer.send(session.createMessage(durable)); @@ -1542,7 +1542,7 @@ public class QueueControlTest extends ManagementTestBase { ClientProducer producer = session.createProducer(address); ClientMessage message = session.createMessage(durable); - message.putIntProperty(new SimpleString("key"), intValue); + message.putIntProperty(SimpleString.of("key"), intValue); producer.send(message); producer.send(session.createMessage(durable)); @@ -1577,7 +1577,7 @@ public class QueueControlTest extends ManagementTestBase { ClientProducer producer = session.createProducer(address); ClientMessage message = session.createMessage(durable); message.putLongProperty(Message.HDR_SCHEDULED_DELIVERY_TIME, System.currentTimeMillis() + delay); - message.putIntProperty(new SimpleString("key"), intValue); + message.putIntProperty(SimpleString.of("key"), intValue); producer.send(message); // unscheduled message producer.send(session.createMessage(durable)); @@ -1611,7 +1611,7 @@ public class QueueControlTest extends ManagementTestBase { ClientProducer producer = session.createProducer(address); ClientMessage message = session.createMessage(false); message.putLongProperty(Message.HDR_SCHEDULED_DELIVERY_TIME, System.currentTimeMillis() + delay); - message.putIntProperty(new SimpleString("key"), intValue); + message.putIntProperty(SimpleString.of("key"), intValue); producer.send(message); // unscheduled message producer.send(session.createMessage(durable)); @@ -1752,7 +1752,7 @@ public class QueueControlTest extends ManagementTestBase { ClientProducer producer = session.createProducer(address); ClientMessage message = session.createMessage(durable); - message.putIntProperty(new SimpleString("key"), intValue); + message.putIntProperty(SimpleString.of("key"), intValue); producer.send(message); String jsonString = queueControl.listMessagesAsJSON(null); @@ -1775,7 +1775,7 @@ public class QueueControlTest extends ManagementTestBase { @TestTemplate public void testListMessagesWithFilter() throws Exception { - SimpleString key = new SimpleString("key"); + SimpleString key = SimpleString.of("key"); long matchingValue = RandomUtil.randomLong(); long unmatchingValue = matchingValue + 1; String filter = key + " =" + matchingValue; @@ -1852,7 +1852,7 @@ public class QueueControlTest extends ManagementTestBase { @TestTemplate public void testListMessagesAsJSONWithFilter() throws Exception { - SimpleString key = new SimpleString("key"); + SimpleString key = SimpleString.of("key"); long matchingValue = RandomUtil.randomLong(); long unmatchingValue = matchingValue + 1; String filter = key + " =" + matchingValue; @@ -1894,10 +1894,10 @@ public class QueueControlTest extends ManagementTestBase { */ @TestTemplate public void testRetryMessage() throws Exception { - final SimpleString dla = new SimpleString("DLA"); - final SimpleString qName = new SimpleString("q1"); - final SimpleString adName = new SimpleString("ad1"); - final SimpleString dlq = new SimpleString("DLQ1"); + final SimpleString dla = SimpleString.of("DLA"); + final SimpleString qName = SimpleString.of("q1"); + final SimpleString adName = SimpleString.of("ad1"); + final SimpleString dlq = SimpleString.of("DLQ1"); final String sampleText = "Put me on DLQ"; AddressSettings addressSettings = new AddressSettings().setMaxDeliveryAttempts(1).setDeadLetterAddress(dla); @@ -1949,9 +1949,9 @@ public class QueueControlTest extends ManagementTestBase { */ @TestTemplate public void testRetryMessageWithAutoCreatedResources() throws Exception { - final SimpleString dla = new SimpleString("DLA"); - final SimpleString qName = new SimpleString("q1"); - final SimpleString adName = new SimpleString("ad1"); + final SimpleString dla = SimpleString.of("DLA"); + final SimpleString qName = SimpleString.of("q1"); + final SimpleString adName = SimpleString.of("ad1"); final String sampleText = "Put me on DLQ"; AddressSettings addressSettings = server.getAddressSettingsRepository().getMatch(adName.toString()); @@ -2001,10 +2001,10 @@ public class QueueControlTest extends ManagementTestBase { @TestTemplate public void testRetryMessageWithoutDLQ() throws Exception { - final SimpleString qName = new SimpleString("q1"); - final SimpleString qName2 = new SimpleString("q2"); - final SimpleString adName = new SimpleString("ad1"); - final SimpleString adName2 = new SimpleString("ad2"); + final SimpleString qName = SimpleString.of("q1"); + final SimpleString qName2 = SimpleString.of("q2"); + final SimpleString adName = SimpleString.of("ad1"); + final SimpleString adName2 = SimpleString.of("ad2"); final String sampleText = "Put me on DLQ"; session.createQueue(new QueueConfiguration(qName).setAddress(adName).setDurable(durable)); @@ -2055,11 +2055,11 @@ public class QueueControlTest extends ManagementTestBase { */ @TestTemplate public void testRetryDivertedMessage() throws Exception { - final SimpleString dla = new SimpleString("DLA"); - final SimpleString dlq = new SimpleString("DLQ"); - final SimpleString forwardingQueue = new SimpleString("forwardingQueue"); - final SimpleString forwardingAddress = new SimpleString("forwardingAddress"); - final SimpleString myTopic = new SimpleString("myTopic"); + final SimpleString dla = SimpleString.of("DLA"); + final SimpleString dlq = SimpleString.of("DLQ"); + final SimpleString forwardingQueue = SimpleString.of("forwardingQueue"); + final SimpleString forwardingAddress = SimpleString.of("forwardingAddress"); + final SimpleString myTopic = SimpleString.of("myTopic"); final String sampleText = "Put me on DLQ"; AddressSettings addressSettings = new AddressSettings().setMaxDeliveryAttempts(1).setDeadLetterAddress(dla); @@ -2118,10 +2118,10 @@ public class QueueControlTest extends ManagementTestBase { */ @TestTemplate public void testRetryMultipleMessages() throws Exception { - final SimpleString dla = new SimpleString("DLA"); - final SimpleString qName = new SimpleString("q1"); - final SimpleString adName = new SimpleString("ad1"); - final SimpleString dlq = new SimpleString("DLQ1"); + final SimpleString dla = SimpleString.of("DLA"); + final SimpleString qName = SimpleString.of("q1"); + final SimpleString adName = SimpleString.of("ad1"); + final SimpleString dlq = SimpleString.of("DLQ1"); final String sampleText = "Put me on DLQ"; final int numMessagesToTest = 10; @@ -2197,10 +2197,10 @@ public class QueueControlTest extends ManagementTestBase { */ @TestTemplate public void testSendToDLAIncludesPagedMessages() throws Exception { - final SimpleString dla = new SimpleString("DLA"); - final SimpleString qName = new SimpleString("q1"); - final SimpleString adName = new SimpleString("ad1"); - final SimpleString dlq = new SimpleString("DLQ1"); + final SimpleString dla = SimpleString.of("DLA"); + final SimpleString qName = SimpleString.of("q1"); + final SimpleString adName = SimpleString.of("ad1"); + final SimpleString dlq = SimpleString.of("DLQ1"); final String sampleText = "Put me on DLQ"; final int messageCount = 10; @@ -2237,10 +2237,10 @@ public class QueueControlTest extends ManagementTestBase { */ @TestTemplate public void testSendMessageToDLAIncludesPagedMessage() throws Exception { - final SimpleString dla = new SimpleString("DLA"); - final SimpleString qName = new SimpleString("q1"); - final SimpleString adName = new SimpleString("ad1"); - final SimpleString dlq = new SimpleString("DLQ1"); + final SimpleString dla = SimpleString.of("DLA"); + final SimpleString qName = SimpleString.of("q1"); + final SimpleString adName = SimpleString.of("ad1"); + final SimpleString dlq = SimpleString.of("DLQ1"); final String sampleText = "Message Content"; final int messageCount = 10; @@ -2339,9 +2339,9 @@ public class QueueControlTest extends ManagementTestBase { @TestTemplate public void testMoveMessages2() throws Exception { SimpleString address = RandomUtil.randomSimpleString(); - SimpleString queueA = new SimpleString("A"); - SimpleString queueB = new SimpleString("B"); - SimpleString queueC = new SimpleString("C"); + SimpleString queueA = SimpleString.of("A"); + SimpleString queueB = SimpleString.of("B"); + SimpleString queueC = SimpleString.of("C"); server.createQueue(new QueueConfiguration(queueA).setAddress(address).setDurable(durable)); server.createQueue(new QueueConfiguration(queueB).setAddress(address).setDurable(durable)); @@ -2443,7 +2443,7 @@ public class QueueControlTest extends ManagementTestBase { */ @TestTemplate public void testMoveMessagesWithFilter() throws Exception { - SimpleString key = new SimpleString("key"); + SimpleString key = SimpleString.of("key"); long matchingValue = RandomUtil.randomLong(); long unmatchingValue = matchingValue + 1; @@ -2584,11 +2584,11 @@ public class QueueControlTest extends ManagementTestBase { */ @TestTemplate public void testMoveMessageToFQQN() throws Exception { - SimpleString address = new SimpleString("ErrorQueue"); - SimpleString queue = new SimpleString("ErrorQueue"); - SimpleString otherAddress = new SimpleString("parent.addr.1"); - SimpleString otherQueue1 = new SimpleString("child.queue.1"); - SimpleString otherQueue2 = new SimpleString("child.queue.2"); + SimpleString address = SimpleString.of("ErrorQueue"); + SimpleString queue = SimpleString.of("ErrorQueue"); + SimpleString otherAddress = SimpleString.of("parent.addr.1"); + SimpleString otherQueue1 = SimpleString.of("child.queue.1"); + SimpleString otherQueue2 = SimpleString.of("child.queue.2"); session.createQueue(new QueueConfiguration(queue).setAddress(address).setRoutingType(RoutingType.ANYCAST).setDurable(durable)); session.createQueue(new QueueConfiguration(otherQueue1).setAddress(otherAddress).setDurable(durable)); @@ -2660,7 +2660,7 @@ public class QueueControlTest extends ManagementTestBase { @TestTemplate public void testCopiedMessageProperties() throws Exception { final String testAddress = "testAddress"; - final SimpleString queue = SimpleString.toSimpleString("queue"); + final SimpleString queue = SimpleString.of("queue"); final int COUNT = 5; for (int i = 0; i < COUNT; i++) { @@ -2672,14 +2672,14 @@ public class QueueControlTest extends ManagementTestBase { ClientSession session = sf.createSession(false, true, true); session.start(); - ClientProducer producer = session.createProducer(new SimpleString(testAddress + "0")); + ClientProducer producer = session.createProducer(SimpleString.of(testAddress + "0")); ClientMessage message = session.createMessage(durable); producer.send(message); producer.close(); for (int i = 0; i < COUNT - 1; i++) { - QueueControl queueControl = createManagementControl(SimpleString.toSimpleString(testAddress + i), queue.concat(Integer.toString(i)), RoutingType.ANYCAST); - QueueControl otherQueueControl = createManagementControl(SimpleString.toSimpleString(testAddress + (i + 1)), queue.concat(Integer.toString(i + 1)), RoutingType.ANYCAST); + QueueControl queueControl = createManagementControl(SimpleString.of(testAddress + i), queue.concat(Integer.toString(i)), RoutingType.ANYCAST); + QueueControl otherQueueControl = createManagementControl(SimpleString.of(testAddress + (i + 1)), queue.concat(Integer.toString(i + 1)), RoutingType.ANYCAST); assertMessageMetrics(queueControl, 1, durable); assertMessageMetrics(otherQueueControl, 0, durable); @@ -2708,7 +2708,7 @@ public class QueueControlTest extends ManagementTestBase { @TestTemplate public void testRemoveMessages() throws Exception { - SimpleString key = new SimpleString("key"); + SimpleString key = SimpleString.of("key"); long matchingValue = RandomUtil.randomLong(); long unmatchingValue = matchingValue + 1; @@ -2752,7 +2752,7 @@ public class QueueControlTest extends ManagementTestBase { @TestTemplate public void testRemoveMessagesWithLimit() throws Exception { - SimpleString key = new SimpleString("key"); + SimpleString key = SimpleString.of("key"); long matchingValue = RandomUtil.randomLong(); long unmatchingValue = matchingValue + 1; @@ -3073,7 +3073,7 @@ public class QueueControlTest extends ManagementTestBase { @TestTemplate public void testCountDeliveringMessageCountWithFilter() throws Exception { - SimpleString key = new SimpleString("key"); + SimpleString key = SimpleString.of("key"); long matchingValue = RandomUtil.randomPositiveLong(); long unmatchingValue = matchingValue + 1; @@ -3109,7 +3109,7 @@ public class QueueControlTest extends ManagementTestBase { @TestTemplate public void testCountDeliveringMessageCountNoFilter() throws Exception { - SimpleString key = new SimpleString("key"); + SimpleString key = SimpleString.of("key"); long matchingValue = RandomUtil.randomLong(); long unmatchingValue = matchingValue + 1; @@ -3141,7 +3141,7 @@ public class QueueControlTest extends ManagementTestBase { @TestTemplate public void testCountDeliveringMessageCountNoGroupNoFilter() throws Exception { - SimpleString key = new SimpleString("key"); + SimpleString key = SimpleString.of("key"); long matchingValue = RandomUtil.randomLong(); long unmatchingValue = matchingValue + 1; @@ -3258,7 +3258,7 @@ public class QueueControlTest extends ManagementTestBase { @TestTemplate public void testCountMessagesWithFilter() throws Exception { - SimpleString key = new SimpleString("key"); + SimpleString key = SimpleString.of("key"); long matchingValue = RandomUtil.randomLong(); long unmatchingValue = matchingValue + 1; @@ -3289,7 +3289,7 @@ public class QueueControlTest extends ManagementTestBase { @TestTemplate public void testCountMessagesWithInvalidFilter() throws Exception { - SimpleString key = new SimpleString("key"); + SimpleString key = SimpleString.of("key"); String matchingValue = "MATCH"; String nonMatchingValue = "DIFFERENT"; @@ -3302,20 +3302,20 @@ public class QueueControlTest extends ManagementTestBase { // send on queue for (int i = 0; i < 100; i++) { ClientMessage msg = session.createMessage(durable); - msg.putStringProperty(key, SimpleString.toSimpleString(matchingValue)); + msg.putStringProperty(key, SimpleString.of(matchingValue)); producer.send(msg); } for (int i = 0; i < 10; i++) { ClientMessage msg = session.createMessage(durable); - msg.putStringProperty(key, SimpleString.toSimpleString(nonMatchingValue)); + msg.putStringProperty(key, SimpleString.of(nonMatchingValue)); producer.send(msg); } // this is just to guarantee a round trip and avoid in transit messages, so they are all accounted for session.commit(); - ClientConsumer consumer = session.createConsumer(queue, SimpleString.toSimpleString("nonExistentProperty like \'%Temp/88\'")); + ClientConsumer consumer = session.createConsumer(queue, SimpleString.of("nonExistentProperty like \'%Temp/88\'")); session.start(); @@ -3396,7 +3396,7 @@ public class QueueControlTest extends ManagementTestBase { @TestTemplate public void testExpireMessagesWithFilter() throws Exception { - SimpleString key = new SimpleString("key"); + SimpleString key = SimpleString.of("key"); long matchingValue = RandomUtil.randomLong(); long unmatchingValue = matchingValue + 1; @@ -3764,8 +3764,8 @@ public class QueueControlTest extends ManagementTestBase { @TestTemplate public void testMoveMessagesBack() throws Exception { - server.createQueue(new QueueConfiguration(new SimpleString("q1")).setRoutingType(RoutingType.MULTICAST).setDurable(durable)); - server.createQueue(new QueueConfiguration(new SimpleString("q2")).setRoutingType(RoutingType.MULTICAST).setDurable(durable)); + server.createQueue(new QueueConfiguration(SimpleString.of("q1")).setRoutingType(RoutingType.MULTICAST).setDurable(durable)); + server.createQueue(new QueueConfiguration(SimpleString.of("q2")).setRoutingType(RoutingType.MULTICAST).setDurable(durable)); ServerLocator locator = createInVMNonHALocator(); @@ -3778,7 +3778,7 @@ public class QueueControlTest extends ManagementTestBase { for (int i = 0; i < 10; i++) { ClientMessage msg = session.createMessage(durable); - msg.putStringProperty(Message.HDR_DUPLICATE_DETECTION_ID, new SimpleString("dupl-" + i)); + msg.putStringProperty(Message.HDR_DUPLICATE_DETECTION_ID, SimpleString.of("dupl-" + i)); prod1.send(msg); } @@ -3791,9 +3791,9 @@ public class QueueControlTest extends ManagementTestBase { assertNotNull(consumer.receive(5000)); consumer.close(); - QueueControl q1Control = ManagementControlHelper.createQueueControl(new SimpleString("q1"), new SimpleString("q1"), mbeanServer); + QueueControl q1Control = ManagementControlHelper.createQueueControl(SimpleString.of("q1"), SimpleString.of("q1"), mbeanServer); - QueueControl q2Control = ManagementControlHelper.createQueueControl(new SimpleString("q2"), new SimpleString("q2"), mbeanServer); + QueueControl q2Control = ManagementControlHelper.createQueueControl(SimpleString.of("q2"), SimpleString.of("q2"), mbeanServer); assertEquals(10, q1Control.moveMessages(null, "q2")); @@ -3828,8 +3828,8 @@ public class QueueControlTest extends ManagementTestBase { @TestTemplate public void testMoveMessagesBack2() throws Exception { - server.createQueue(new QueueConfiguration(new SimpleString("q1")).setRoutingType(RoutingType.MULTICAST).setDurable(durable)); - server.createQueue(new QueueConfiguration(new SimpleString("q2")).setRoutingType(RoutingType.MULTICAST).setDurable(durable)); + server.createQueue(new QueueConfiguration(SimpleString.of("q1")).setRoutingType(RoutingType.MULTICAST).setDurable(durable)); + server.createQueue(new QueueConfiguration(SimpleString.of("q2")).setRoutingType(RoutingType.MULTICAST).setDurable(durable)); ServerLocator locator = createInVMNonHALocator(); @@ -3844,7 +3844,7 @@ public class QueueControlTest extends ManagementTestBase { for (int i = 0; i < NUMBER_OF_MSGS; i++) { ClientMessage msg = session.createMessage(durable); - msg.putStringProperty(Message.HDR_DUPLICATE_DETECTION_ID, new SimpleString("dupl-" + i)); + msg.putStringProperty(Message.HDR_DUPLICATE_DETECTION_ID, SimpleString.of("dupl-" + i)); prod1.send(msg); } @@ -3857,9 +3857,9 @@ public class QueueControlTest extends ManagementTestBase { assertNotNull(consumer.receive(5000)); consumer.close(); - QueueControl q1Control = ManagementControlHelper.createQueueControl(new SimpleString("q1"), new SimpleString("q1"), mbeanServer); + QueueControl q1Control = ManagementControlHelper.createQueueControl(SimpleString.of("q1"), SimpleString.of("q1"), mbeanServer); - QueueControl q2Control = ManagementControlHelper.createQueueControl(new SimpleString("q2"), new SimpleString("q2"), mbeanServer); + QueueControl q2Control = ManagementControlHelper.createQueueControl(SimpleString.of("q2"), SimpleString.of("q2"), mbeanServer); assertEquals(NUMBER_OF_MSGS, q1Control.moveMessages(null, "q2")); @@ -4073,7 +4073,7 @@ public class QueueControlTest extends ManagementTestBase { JMSUtil.JMXListener listener = new JMSUtil.JMXListener(); this.mbeanServer.addNotificationListener(ObjectNameBuilder.DEFAULT.getActiveMQServerObjectName(), listener, null, null); - SimpleString testQueueName = new SimpleString("newQueue"); + SimpleString testQueueName = SimpleString.of("newQueue"); String testQueueName2 = "newQueue2"; this.server.createQueue(new QueueConfiguration(testQueueName).setDurable(durable)); @@ -4134,8 +4134,8 @@ public class QueueControlTest extends ManagementTestBase { @TestTemplate public void testSendMessageWithAMQP() throws Exception { - SimpleString address = new SimpleString("address_testSendMessageWithAMQP"); - SimpleString queue = new SimpleString("queue_testSendMessageWithAMQP"); + SimpleString address = SimpleString.of("address_testSendMessageWithAMQP"); + SimpleString queue = SimpleString.of("queue_testSendMessageWithAMQP"); server.addAddressInfo(new AddressInfo(address).setAutoCreated(false).addRoutingType(RoutingType.ANYCAST)); server.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable).setRoutingType(RoutingType.ANYCAST)); @@ -4204,8 +4204,8 @@ public class QueueControlTest extends ManagementTestBase { @TestTemplate public void testSendMessageWithAMQPLarge() throws Exception { - SimpleString address = new SimpleString("address_testSendMessageWithAMQP"); - SimpleString queue = new SimpleString("queue_testSendMessageWithAMQP"); + SimpleString address = SimpleString.of("address_testSendMessageWithAMQP"); + SimpleString queue = SimpleString.of("queue_testSendMessageWithAMQP"); server.addAddressInfo(new AddressInfo(address).setAutoCreated(false).addRoutingType(RoutingType.ANYCAST)); server.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable).setRoutingType(RoutingType.ANYCAST)); @@ -4495,9 +4495,9 @@ public class QueueControlTest extends ManagementTestBase { */ @TestTemplate public void testRetryMessageWithAutoCreatedResourcesAndOrigRoutingType() throws Exception { - final SimpleString dla = new SimpleString("DLA"); - final SimpleString qName = new SimpleString("q1"); - final SimpleString adName = new SimpleString("ad1"); + final SimpleString dla = SimpleString.of("DLA"); + final SimpleString qName = SimpleString.of("q1"); + final SimpleString adName = SimpleString.of("ad1"); final String sampleText = "Put me on DLQ"; AddressSettings addressSettings = server.getAddressSettingsRepository().getMatch(adName.toString()); @@ -4554,9 +4554,9 @@ public class QueueControlTest extends ManagementTestBase { */ @TestTemplate public void testRetryMessageReturnedWhenNoOrigQueue() throws Exception { - final SimpleString dla = new SimpleString("DLA"); - final SimpleString qName = new SimpleString("q1"); - final SimpleString adName = new SimpleString("ad1"); + final SimpleString dla = SimpleString.of("DLA"); + final SimpleString qName = SimpleString.of("q1"); + final SimpleString adName = SimpleString.of("ad1"); final String sampleText = "Put me on DLQ"; AddressSettings addressSettings = server.getAddressSettingsRepository().getMatch(adName.toString()); 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 b08ee5e3a2..55858a1bd7 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 @@ -211,7 +211,7 @@ public class SecurityNotificationTest extends ActiveMQTestBase { assertEquals("guest", notifications[0].getObjectProperty(ManagementHelper.HDR_USER).toString()); assertEquals("guest", notifications[0].getObjectProperty(ManagementHelper.HDR_VALIDATED_USER).toString()); assertEquals(address.toString(), notifications[0].getObjectProperty(ManagementHelper.HDR_ADDRESS).toString()); - assertEquals(SimpleString.toSimpleString("unavailable"), notifications[0].getSimpleStringProperty(ManagementHelper.HDR_CERT_SUBJECT_DN)); + assertEquals(SimpleString.of("unavailable"), notifications[0].getSimpleStringProperty(ManagementHelper.HDR_CERT_SUBJECT_DN)); assertTrue(notifications[0].getTimestamp() >= start); assertTrue((long) notifications[0].getObjectProperty(ManagementHelper.HDR_NOTIFICATION_TIMESTAMP) >= start); assertEquals(notifications[0].getTimestamp(), (long) notifications[0].getObjectProperty(ManagementHelper.HDR_NOTIFICATION_TIMESTAMP)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/MQTTFQQNTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/MQTTFQQNTest.java index 1633a5cc65..216e52d136 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/MQTTFQQNTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/MQTTFQQNTest.java @@ -42,18 +42,18 @@ public class MQTTFQQNTest extends MQTTTestSupport { try { subscriptionProvider.subscribe("foo/bah", AT_MOST_ONCE); - Bindings bindings = server.getPostOffice().getBindingsForAddress(SimpleString.toSimpleString("foo.bah")); + Bindings bindings = server.getPostOffice().getBindingsForAddress(SimpleString.of("foo.bah")); assertEquals(1, bindings.size()); Binding b = bindings.getBindings().iterator().next(); //check that query using bare queue name works as before QueueQueryResult result = server.queueQuery(b.getUniqueName()); assertTrue(result.isExists()); - assertEquals(result.getAddress(), new SimpleString("foo.bah")); + assertEquals(result.getAddress(), SimpleString.of("foo.bah")); assertEquals(b.getUniqueName(), result.getName()); //check that queue query using FQQN returns FQQN - result = server.queueQuery(new SimpleString("foo.bah::" + b.getUniqueName())); + result = server.queueQuery(SimpleString.of("foo.bah::" + b.getUniqueName())); assertTrue(result.isExists()); - assertEquals(new SimpleString("foo.bah"), result.getAddress()); + assertEquals(SimpleString.of("foo.bah"), result.getAddress()); assertEquals(b.getUniqueName(), result.getName()); } finally { subscriptionProvider.disconnect(); @@ -137,22 +137,22 @@ public class MQTTFQQNTest extends MQTTTestSupport { try { subscriptionProvider.subscribe("foo/bah", AT_MOST_ONCE); - Bindings bindings = server.getPostOffice().getBindingsForAddress(SimpleString.toSimpleString("foo.bah")); + Bindings bindings = server.getPostOffice().getBindingsForAddress(SimpleString.of("foo.bah")); assertEquals(1, bindings.size()); Binding b = bindings.getBindings().iterator().next(); //check ::queue - QueueQueryResult result = server.queueQuery(new SimpleString("::" + b.getUniqueName())); + QueueQueryResult result = server.queueQuery(SimpleString.of("::" + b.getUniqueName())); assertTrue(result.isExists()); - assertEquals(new SimpleString("foo.bah"), result.getAddress()); + assertEquals(SimpleString.of("foo.bah"), result.getAddress()); assertEquals(b.getUniqueName(), result.getName()); //check queue:: - result = server.queueQuery(new SimpleString(b.getUniqueName() + "::")); + result = server.queueQuery(SimpleString.of(b.getUniqueName() + "::")); assertFalse(result.isExists()); //check :: - result = server.queueQuery(new SimpleString("::")); + result = server.queueQuery(SimpleString.of("::")); assertFalse(result.isExists()); } finally { subscriptionProvider.disconnect(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/MQTTQueueCleanTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/MQTTQueueCleanTest.java index ab37b27292..2b8dcffbdb 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/MQTTQueueCleanTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/MQTTQueueCleanTest.java @@ -68,10 +68,10 @@ public class MQTTQueueCleanTest extends MQTTTestSupport { clientProvider.disconnect(); if (managed) { - assertTrue(Wait.waitFor(() -> server.locateQueue(SimpleString.toSimpleString(queueName)) != null && - server.locateQueue(SimpleString.toSimpleString(queueName)).getConsumerCount() == 0, 5000, 10)); + assertTrue(Wait.waitFor(() -> server.locateQueue(SimpleString.of(queueName)) != null && + server.locateQueue(SimpleString.of(queueName)).getConsumerCount() == 0, 5000, 10)); } else { - assertTrue(Wait.waitFor(() -> server.locateQueue(SimpleString.toSimpleString(queueName)) == null, 5000, 10)); + assertTrue(Wait.waitFor(() -> server.locateQueue(SimpleString.of(queueName)) == null, 5000, 10)); } } @@ -87,7 +87,7 @@ public class MQTTQueueCleanTest extends MQTTTestSupport { clientProvider.subscribe(topic, AT_LEAST_ONCE); server.stop(); server.start(); - Wait.assertTrue(() -> server.locateQueue(SimpleString.toSimpleString(queueName)) == null, 5000, 10); + Wait.assertTrue(() -> server.locateQueue(SimpleString.of(queueName)) == null, 5000, 10); } @Test @@ -120,7 +120,7 @@ public class MQTTQueueCleanTest extends MQTTTestSupport { clientProvider.disconnect(); } clientProviders.clear(); - assertTrue(Wait.waitFor(() -> server.locateQueue(SimpleString.toSimpleString(queueName)) == null, 5000, 10)); + assertTrue(Wait.waitFor(() -> server.locateQueue(SimpleString.of(queueName)) == null, 5000, 10)); } } } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/MQTTTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/MQTTTest.java index ee9d2071f9..2cb7e4327f 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/MQTTTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/MQTTTest.java @@ -342,7 +342,7 @@ public class MQTTTest extends MQTTTestSupport { assertEquals(payload, new String(message)); } - final Queue queue = server.locateQueue(new SimpleString(MQTTUtil.MANAGEMENT_QUEUE_PREFIX + clientId)); + final Queue queue = server.locateQueue(SimpleString.of(MQTTUtil.MANAGEMENT_QUEUE_PREFIX + clientId)); Wait.waitFor(() -> queue.getMessageCount() == 0, 1000, 100); @@ -2074,7 +2074,7 @@ public class MQTTTest extends MQTTTestSupport { public void testAnycastAddressWorksWithMQTT() throws Exception { String anycastAddress = "foo/bar"; - getServer().addAddressInfo(new AddressInfo(SimpleString.toSimpleString("foo.bar"), RoutingType.ANYCAST)); + getServer().addAddressInfo(new AddressInfo(SimpleString.of("foo.bar"), RoutingType.ANYCAST)); String clientId = "testMqtt"; Topic[] mqttSubscription = new Topic[]{new Topic(anycastAddress, QoS.AT_LEAST_ONCE)}; @@ -2111,7 +2111,7 @@ public class MQTTTest extends MQTTTestSupport { EnumSet routingTypeSet = EnumSet.of(RoutingType.ANYCAST, RoutingType.MULTICAST); - getServer().addAddressInfo(new AddressInfo(SimpleString.toSimpleString("foo.bar"), routingTypeSet)); + getServer().addAddressInfo(new AddressInfo(SimpleString.of("foo.bar"), routingTypeSet)); String clientId = "testMqtt"; Topic[] mqttSubscription = new Topic[]{new Topic(anycastAddress, QoS.AT_LEAST_ONCE)}; @@ -2148,7 +2148,7 @@ public class MQTTTest extends MQTTTestSupport { String payload = "This is a test message"; // Create address - getServer().addAddressInfo(new AddressInfo(SimpleString.toSimpleString(address), RoutingType.MULTICAST)); + getServer().addAddressInfo(new AddressInfo(SimpleString.of(address), RoutingType.MULTICAST)); // Send MQTT Retain Message Topic[] mqttTopic = new Topic[]{new Topic(address, QoS.AT_LEAST_ONCE)}; @@ -2259,11 +2259,11 @@ public class MQTTTest extends MQTTTestSupport { final MQTTClientProvider subscriptionProvider = getMQTTClientProvider(); initializeConnection(subscriptionProvider); subscriptionProvider.subscribe("foo/bar", AT_MOST_ONCE); - assertNotNull(server.getAddressInfo(SimpleString.toSimpleString("foo.bar"))); + assertNotNull(server.getAddressInfo(SimpleString.of("foo.bar"))); subscriptionProvider.disconnect(); - Wait.assertTrue(() -> server.getAddressInfo(SimpleString.toSimpleString("foo.bar")) == null); + Wait.assertTrue(() -> server.getAddressInfo(SimpleString.of("foo.bar")) == null); } @Test diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/MQTTTestSupport.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/MQTTTestSupport.java index e63a73c175..91129f917f 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/MQTTTestSupport.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/MQTTTestSupport.java @@ -213,8 +213,8 @@ public class MQTTTestSupport extends ActiveMQTestBase { private ActiveMQServer createServerForMQTT() throws Exception { Configuration defaultConfig = createDefaultConfig(true).setIncomingInterceptorClassNames(singletonList(MQTTIncomingInterceptor.class.getName())).setOutgoingInterceptorClassNames(singletonList(MQTTOutoingInterceptor.class.getName())); AddressSettings addressSettings = new AddressSettings(); - addressSettings.setDeadLetterAddress(SimpleString.toSimpleString("DLA")); - addressSettings.setExpiryAddress(SimpleString.toSimpleString("EXPIRY")); + addressSettings.setDeadLetterAddress(SimpleString.of("DLA")); + addressSettings.setExpiryAddress(SimpleString.of("EXPIRY")); defaultConfig.getAddressSettings().put("#", addressSettings); return createServer(true, defaultConfig); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/MqttWildCardSubAutoCreateTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/MqttWildCardSubAutoCreateTest.java index b5cdc3b9f0..2d3c13109c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/MqttWildCardSubAutoCreateTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/MqttWildCardSubAutoCreateTest.java @@ -96,7 +96,7 @@ public class MqttWildCardSubAutoCreateTest extends MQTTTestSupport { sender.publish(publishTo, UUID.randomUUID().toString().getBytes(), 2, false); sender.publish(publishTo, UUID.randomUUID().toString().getBytes(), 2, false); - assertTrue(server.getPagingManager().getPageStore(new SimpleString(MQTTUtil.getCoreAddressFromMqttTopic(subscribeTo, server.getConfiguration().getWildcardConfiguration()))).isPaging()); + assertTrue(server.getPagingManager().getPageStore(SimpleString.of(MQTTUtil.getCoreAddressFromMqttTopic(subscribeTo, server.getConfiguration().getWildcardConfiguration()))).isPaging()); subscriber = createMqttClient(subscriberId); subscriber.subscribe(subscribeTo, 2); @@ -228,7 +228,7 @@ public class MqttWildCardSubAutoCreateTest extends MQTTTestSupport { int countOfPageStores = 0; SimpleString[] storeNames = server.getPagingManager().getStoreNames(); for (int i = 0; i < storeNames.length; i++) { - if (!storeNames[i].equals(SimpleString.toSimpleString(MQTTUtil.MQTT_SESSION_STORE))) { + if (!storeNames[i].equals(SimpleString.of(MQTTUtil.MQTT_SESSION_STORE))) { countOfPageStores++; } } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/MQTT5Test.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/MQTT5Test.java index 0a4aebdb81..9b861b92d3 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/MQTT5Test.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/MQTT5Test.java @@ -216,7 +216,7 @@ public class MQTT5Test extends MQTT5TestSupport { producer.disconnect(); producer.close(); - Wait.assertTrue(() -> server.getAddressInfo(SimpleString.toSimpleString(DESTINATION)) != null, 2000, 100); + Wait.assertTrue(() -> server.getAddressInfo(SimpleString.of(DESTINATION)) != null, 2000, 100); } @Test @@ -231,7 +231,7 @@ public class MQTT5Test extends MQTT5TestSupport { producer.disconnect(); producer.close(); - assertTrue(server.getAddressInfo(SimpleString.toSimpleString(DESTINATION)) == null); + assertTrue(server.getAddressInfo(SimpleString.of(DESTINATION)) == null); } /* @@ -313,7 +313,7 @@ public class MQTT5Test extends MQTT5TestSupport { // enable send-to-dla-on-no-route so that we can detect an errant will message on disconnect server.createQueue(new QueueConfiguration("activemq.notifications")); server.createQueue(new QueueConfiguration("DLA")); - server.getAddressSettingsRepository().addMatch("#", new AddressSettings().setSendToDLAOnNoRoute(true).setDeadLetterAddress(SimpleString.toSimpleString("DLA"))); + server.getAddressSettingsRepository().addMatch("#", new AddressSettings().setSendToDLAOnNoRoute(true).setDeadLetterAddress(SimpleString.of("DLA"))); MqttClient client = createPahoClient("willGenerator"); MqttConnectionOptions options = new MqttConnectionOptionsBuilder() @@ -374,7 +374,7 @@ public class MQTT5Test extends MQTT5TestSupport { consumer1.setCallback(new LatchedMqttCallback(ackLatch1)); consumer1.subscribe(SHARED_SUB1, 1); - assertNotNull(server.getAddressInfo(SimpleString.toSimpleString(TOPIC1))); + assertNotNull(server.getAddressInfo(SimpleString.of(TOPIC1))); Queue q1 = getSharedSubscriptionQueue(SHARED_SUB1); assertNotNull(q1); assertEquals(TOPIC1, q1.getAddress().toString()); @@ -385,7 +385,7 @@ public class MQTT5Test extends MQTT5TestSupport { consumer2.setCallback(new LatchedMqttCallback(ackLatch2)); consumer2.subscribe(SHARED_SUB2, 1); - assertNotNull(server.getAddressInfo(SimpleString.toSimpleString(TOPIC2))); + assertNotNull(server.getAddressInfo(SimpleString.of(TOPIC2))); Queue q2 = getSharedSubscriptionQueue(SHARED_SUB2); assertNotNull(q2); assertEquals(TOPIC2, q2.getAddress().toString()); @@ -430,13 +430,13 @@ public class MQTT5Test extends MQTT5TestSupport { consumer.setCallback(new LatchedMqttCallback(ackLatch)); consumer.subscribe(SHARED_SUBS, new int[]{1, 1}); - assertNotNull(server.getAddressInfo(SimpleString.toSimpleString(TOPIC1))); + assertNotNull(server.getAddressInfo(SimpleString.of(TOPIC1))); Queue q1 = getSharedSubscriptionQueue(SHARED_SUBS[0]); assertNotNull(q1); assertEquals(TOPIC1, q1.getAddress().toString()); assertEquals(1, q1.getConsumerCount()); - assertNotNull(server.getAddressInfo(SimpleString.toSimpleString(TOPIC2))); + assertNotNull(server.getAddressInfo(SimpleString.of(TOPIC2))); Queue q2 = getSharedSubscriptionQueue(SHARED_SUBS[1]); assertNotNull(q2); assertEquals(TOPIC2, q2.getAddress().toString()); @@ -564,13 +564,13 @@ public class MQTT5Test extends MQTT5TestSupport { assertTrue(latch.await(2, TimeUnit.SECONDS)); for (String address : addresses) { - assertNotNull(server.getAddressInfo(SimpleString.toSimpleString(address))); + assertNotNull(server.getAddressInfo(SimpleString.of(address))); } PostOfficeTestAccessor.sweepAndReapAddresses((PostOfficeImpl) server.getPostOffice()); for (String address : addresses) { - assertNull(server.getAddressInfo(SimpleString.toSimpleString(address))); + assertNull(server.getAddressInfo(SimpleString.of(address))); } consumer.disconnect(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/MQTT5TestSupport.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/MQTT5TestSupport.java index 3e45285ba1..61ef9b673a 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/MQTT5TestSupport.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/MQTT5TestSupport.java @@ -77,8 +77,8 @@ public class MQTT5TestSupport extends ActiveMQTestBase { protected static final String WS = "ws"; protected static final String SSL = "ssl"; protected static final String WSS = "wss"; - protected static final SimpleString DEAD_LETTER_ADDRESS = new SimpleString("DLA"); - protected static final SimpleString EXPIRY_ADDRESS = new SimpleString("EXPIRY"); + protected static final SimpleString DEAD_LETTER_ADDRESS = SimpleString.of("DLA"); + protected static final SimpleString EXPIRY_ADDRESS = SimpleString.of("EXPIRY"); protected MqttClient createPahoClient(String clientId) throws MqttException { return createPahoClient(TCP, clientId); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/MQTTRetainMessageManagerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/MQTTRetainMessageManagerTest.java index 99549649b1..0ef32bdb75 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/MQTTRetainMessageManagerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/MQTTRetainMessageManagerTest.java @@ -146,7 +146,7 @@ public class MQTTRetainMessageManagerTest extends MQTT5TestSupport { mqttPublisher.publish(topic, message); lastMessagePublished.set(message); } - Wait.waitFor(() -> server.getAddressInfo(SimpleString.toSimpleString(topic)).getRoutedMessageCount() >= numberOfMessages, 5000, 100); + Wait.waitFor(() -> server.getAddressInfo(SimpleString.of(topic)).getRoutedMessageCount() >= numberOfMessages, 5000, 100); mqttConsumerAfterPublish.subscribe(topic, qos); mqttConsumerAfterPublish2.subscribe(topic, qos); Wait.waitFor(() -> lastMessageArrivedOnConsumerAfterPublish.get() != null, 5000, 100); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/spec/TopicNameAndFilterTests.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/spec/TopicNameAndFilterTests.java index 4d199bbc93..69977f3a13 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/spec/TopicNameAndFilterTests.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/spec/TopicNameAndFilterTests.java @@ -85,7 +85,7 @@ public class TopicNameAndFilterTests extends MQTT5TestSupport { }); consumer.subscribe(wildcard, 0); - final SimpleString DOLLAR_TOPIC = SimpleString.toSimpleString("$foo"); + final SimpleString DOLLAR_TOPIC = SimpleString.of("$foo"); ServerLocator locator = ActiveMQClient.createServerLocator("vm://0"); ClientSessionFactory csf = locator.createSessionFactory(); ClientSession s = csf.createSession(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/spec/controlpackets/PublishTestsWithSecurity.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/spec/controlpackets/PublishTestsWithSecurity.java index 7f940c9638..9e5f3fb63e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/spec/controlpackets/PublishTestsWithSecurity.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/spec/controlpackets/PublishTestsWithSecurity.java @@ -113,7 +113,7 @@ public class PublishTestsWithSecurity extends MQTT5TestSupport { assertFalse(client.isConnected()); - Wait.assertTrue(() -> server.getAddressInfo(SimpleString.toSimpleString(MQTTUtil.getCoreAddressFromMqttTopic(TOPIC, server.getConfiguration().getWildcardConfiguration()))) != null, 2000, 100); + Wait.assertTrue(() -> server.getAddressInfo(SimpleString.of(MQTTUtil.getCoreAddressFromMqttTopic(TOPIC, server.getConfiguration().getWildcardConfiguration()))) != null, 2000, 100); } @Test diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/spec/controlpackets/SubAckTests.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/spec/controlpackets/SubAckTests.java index e9276e20bd..f5add23a62 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/spec/controlpackets/SubAckTests.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/spec/controlpackets/SubAckTests.java @@ -52,7 +52,7 @@ public class SubAckTests extends MQTT5TestSupport { final String TOPIC = RandomUtil.randomString(); SimpleString[] topicNames = new SimpleString[SUBSCRIPTION_COUNT]; for (int i = 0; i < SUBSCRIPTION_COUNT; i++) { - topicNames[i] = new SimpleString(i + "-" + TOPIC); + topicNames[i] = SimpleString.of(i + "-" + TOPIC); } MqttAsyncClient consumer = createAsyncPahoClient("consumer"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/spec/controlpackets/SubscribeTests.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/spec/controlpackets/SubscribeTests.java index 793a02b156..f85bb53992 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/spec/controlpackets/SubscribeTests.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/spec/controlpackets/SubscribeTests.java @@ -323,7 +323,7 @@ public class SubscribeTests extends MQTT5TestSupport { final AtomicInteger subAckCount = new AtomicInteger(0); SimpleString[] topicNames = new SimpleString[SUBSCRIPTION_COUNT]; for (int i = 0; i < SUBSCRIPTION_COUNT; i++) { - topicNames[i] = new SimpleString(i + "-" + TOPIC); + topicNames[i] = SimpleString.of(i + "-" + TOPIC); } MQTTInterceptor outgoingInterceptor = (packet, connection) -> { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/spec/controlpackets/UnsubAckTests.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/spec/controlpackets/UnsubAckTests.java index b08524d7b7..9cc112081e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/spec/controlpackets/UnsubAckTests.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/spec/controlpackets/UnsubAckTests.java @@ -54,7 +54,7 @@ public class UnsubAckTests extends MQTT5TestSupport { final String TOPIC = RandomUtil.randomString(); SimpleString[] topicNames = new SimpleString[SUBSCRIPTION_COUNT]; for (int i = 0; i < SUBSCRIPTION_COUNT; i++) { - topicNames[i] = new SimpleString(i + "-" + TOPIC); + topicNames[i] = SimpleString.of(i + "-" + TOPIC); } MqttAsyncClient consumer = createAsyncPahoClient("consumer"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/spec/controlpackets/UnsubscribeTests.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/spec/controlpackets/UnsubscribeTests.java index 4f25bb97e6..9c425059b0 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/spec/controlpackets/UnsubscribeTests.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt5/spec/controlpackets/UnsubscribeTests.java @@ -70,7 +70,7 @@ public class UnsubscribeTests extends MQTT5TestSupport { final AtomicInteger unsubAckCount = new AtomicInteger(0); SimpleString[] topicNames = new SimpleString[SUBSCRIPTION_COUNT]; for (int i = 0; i < SUBSCRIPTION_COUNT; i++) { - topicNames[i] = new SimpleString(i + "-" + TOPIC); + topicNames[i] = SimpleString.of(i + "-" + TOPIC); } MQTTInterceptor outgoingInterceptor = (packet, connection) -> { 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 8358f9fee9..033b28d39f 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 @@ -66,15 +66,15 @@ public class BasicOpenWireTest extends OpenWireTestBase { super.setUp(); System.setProperty("org.apache.activemq.transport.AbstractInactivityMonitor.keepAliveTime", "5"); createFactories(); - SimpleString coreQueue = new SimpleString(queueName); + SimpleString coreQueue = SimpleString.of(queueName); this.server.createQueue(new QueueConfiguration(coreQueue).setRoutingType(RoutingType.ANYCAST)); testQueues.put(queueName, coreQueue); - SimpleString coreQueue2 = new SimpleString(queueName2); + SimpleString coreQueue2 = SimpleString.of(queueName2); this.server.createQueue(new QueueConfiguration(coreQueue2).setRoutingType(RoutingType.ANYCAST)); testQueues.put(queueName2, coreQueue2); - SimpleString durableQueue = new SimpleString(durableQueueName); + SimpleString durableQueue = SimpleString.of(durableQueueName); this.server.createQueue(new QueueConfiguration(durableQueue).setRoutingType(RoutingType.ANYCAST)); testQueues.put(durableQueueName, durableQueue); @@ -145,7 +145,7 @@ public class BasicOpenWireTest extends OpenWireTestBase { public void makeSureCoreQueueExist(String qname) throws Exception { SimpleString coreQ = testQueues.get(qname); if (coreQ == null) { - coreQ = new SimpleString(qname); + coreQ = SimpleString.of(qname); 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/CompactingOpenWireTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/CompactingOpenWireTest.java index fe83ea6956..8fc2bafe0c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/CompactingOpenWireTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/CompactingOpenWireTest.java @@ -61,7 +61,7 @@ public class CompactingOpenWireTest extends BasicOpenWireTest { createFactories(); for (int i = 0; i < 30; i++) { - SimpleString coreQueue = new SimpleString(queueName + i); + SimpleString coreQueue = SimpleString.of(queueName + i); this.server.createQueue(new QueueConfiguration(coreQueue).setRoutingType(RoutingType.ANYCAST)); testQueues.put(queueName, coreQueue); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/CompositeDestinationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/CompositeDestinationTest.java index 67fb7edb7e..766ea2ba58 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/CompositeDestinationTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/CompositeDestinationTest.java @@ -37,9 +37,9 @@ public class CompositeDestinationTest extends BasicOpenWireTest { @BeforeEach public void setUp() throws Exception { super.setUp(); - AddressInfo addressInfo = new AddressInfo(new SimpleString("p.IN"), RoutingType.MULTICAST); + AddressInfo addressInfo = new AddressInfo(SimpleString.of("p.IN"), RoutingType.MULTICAST); this.server.addAddressInfo(addressInfo); - addressInfo = new AddressInfo(new SimpleString("q.IN"), RoutingType.MULTICAST); + addressInfo = new AddressInfo(SimpleString.of("q.IN"), RoutingType.MULTICAST); this.server.addAddressInfo(addressInfo); } 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 6f3a8c3b61..601d46b815 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 @@ -70,12 +70,12 @@ public class FQQNOpenWireTest extends OpenWireTestBase { return Arrays.asList(new Object[][]{{"OpenWire"}, {"Artemis"}}); } - private SimpleString anycastAddress = new SimpleString("address.anycast"); - private SimpleString multicastAddress = new SimpleString("address.multicast"); + private SimpleString anycastAddress = SimpleString.of("address.anycast"); + private SimpleString multicastAddress = SimpleString.of("address.multicast"); - private SimpleString anycastQ1 = new SimpleString("q1"); - private SimpleString anycastQ2 = new SimpleString("q2"); - private SimpleString anycastQ3 = new SimpleString("q3"); + private SimpleString anycastQ1 = SimpleString.of("q1"); + private SimpleString anycastQ2 = SimpleString.of("q2"); + private SimpleString anycastQ3 = SimpleString.of("q3"); private ConnectionFactory factory; @@ -179,8 +179,8 @@ public class FQQNOpenWireTest extends OpenWireTestBase { @TestTemplate public void testQueueConsumerReceiveTopicUsingFQQN() throws Exception { - SimpleString queueName1 = new SimpleString("sub.queue1"); - SimpleString queueName2 = new SimpleString("sub.queue2"); + SimpleString queueName1 = SimpleString.of("sub.queue1"); + SimpleString queueName2 = SimpleString.of("sub.queue2"); server.createQueue(new QueueConfiguration(queueName1).setAddress(multicastAddress).setDurable(false)); server.createQueue(new QueueConfiguration(queueName2).setAddress(multicastAddress).setDurable(false)); Connection connection = factory.createConnection(); @@ -288,7 +288,7 @@ public class FQQNOpenWireTest extends OpenWireTestBase { public void testFQNConsumer() throws Exception { Connection exConn = null; - SimpleString durableQueue = new SimpleString("myqueue"); + SimpleString durableQueue = SimpleString.of("myqueue"); this.server.createQueue(new QueueConfiguration(durableQueue).setRoutingType(RoutingType.ANYCAST)); try { @@ -326,7 +326,7 @@ public class FQQNOpenWireTest extends OpenWireTestBase { public void testSpecialFQQNCase() throws Exception { Connection exConn = null; - SimpleString durableQueue = new SimpleString("myqueue"); + SimpleString durableQueue = SimpleString.of("myqueue"); this.server.createQueue(new QueueConfiguration(durableQueue).setRoutingType(RoutingType.ANYCAST)); try { @@ -374,8 +374,8 @@ public class FQQNOpenWireTest extends OpenWireTestBase { public void testVirtualTopicFQQN() throws Exception { Connection exConn = null; - SimpleString topic = new SimpleString("VirtualTopic.Orders"); - SimpleString subscriptionQ = new SimpleString("Consumer.A"); + SimpleString topic = SimpleString.of("VirtualTopic.Orders"); + SimpleString subscriptionQ = SimpleString.of("Consumer.A"); this.server.addAddressInfo(new AddressInfo(topic, RoutingType.MULTICAST)); this.server.createQueue(new QueueConfiguration(subscriptionQ).setAddress(topic)); @@ -419,8 +419,8 @@ public class FQQNOpenWireTest extends OpenWireTestBase { public void testVirtualTopicFQQNAutoCreateQueue() throws Exception { Connection exConn = null; - SimpleString topic = new SimpleString("VirtualTopic.Orders"); - SimpleString subscriptionQ = new SimpleString("Consumer.A"); + SimpleString topic = SimpleString.of("VirtualTopic.Orders"); + SimpleString subscriptionQ = SimpleString.of("Consumer.A"); // defaults are false via test setUp this.server.addAddressInfo(new AddressInfo(topic, RoutingType.MULTICAST)); @@ -466,8 +466,8 @@ public class FQQNOpenWireTest extends OpenWireTestBase { public void testVirtualTopicFQQNAutoCreateQAndAddress() throws Exception { Connection exConn = null; - SimpleString topic = new SimpleString("VirtualTopic.Orders"); - SimpleString subscriptionQ = new SimpleString("Consumer.A"); + SimpleString topic = SimpleString.of("VirtualTopic.Orders"); + SimpleString subscriptionQ = SimpleString.of("Consumer.A"); // defaults are false via test setUp this.server.getAddressSettingsRepository().getMatch("VirtualTopic.#").setAutoCreateQueues(true); @@ -513,8 +513,8 @@ public class FQQNOpenWireTest extends OpenWireTestBase { public void testVirtualTopicFQQNConsumerAutoCreateQAndAddress() throws Exception { Connection exConn = null; - SimpleString topic = new SimpleString("VirtualTopic.Orders"); - SimpleString subscriptionQ = new SimpleString("Consumer.A"); + SimpleString topic = SimpleString.of("VirtualTopic.Orders"); + SimpleString subscriptionQ = SimpleString.of("Consumer.A"); // defaults are false via test setUp this.server.getAddressSettingsRepository().getMatch("VirtualTopic.#").setAutoCreateQueues(true); @@ -559,8 +559,8 @@ public class FQQNOpenWireTest extends OpenWireTestBase { public void testVirtualTopicFQQNAutoCreateQWithExistingAddressWithAnyCastDefault() throws Exception { Connection exConn = null; - SimpleString topic = new SimpleString("VirtualTopic.Orders"); - SimpleString subscriptionQ = new SimpleString("Consumer.A"); + SimpleString topic = SimpleString.of("VirtualTopic.Orders"); + SimpleString subscriptionQ = SimpleString.of("Consumer.A"); // defaults are false via test setUp this.server.addAddressInfo(new AddressInfo(topic, RoutingType.MULTICAST)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/FastReconnectOpenWireTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/FastReconnectOpenWireTest.java index b162bb2684..5801009a15 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/FastReconnectOpenWireTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/FastReconnectOpenWireTest.java @@ -59,9 +59,9 @@ public class FastReconnectOpenWireTest extends OpenWireTestBase { protected void configureAddressSettings(Map addressSettingsMap) { super.configureAddressSettings(addressSettingsMap); // force send to dlq early - addressSettingsMap.put("exampleQueue", new AddressSettings().setAutoCreateQueues(false).setAutoCreateAddresses(false).setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ")).setAutoCreateAddresses(true).setMaxDeliveryAttempts(2)); + addressSettingsMap.put("exampleQueue", new AddressSettings().setAutoCreateQueues(false).setAutoCreateAddresses(false).setDeadLetterAddress(SimpleString.of("ActiveMQ.DLQ")).setAutoCreateAddresses(true).setMaxDeliveryAttempts(2)); // force send to dlq late - addressSettingsMap.put("exampleQueueTwo", new AddressSettings().setAutoCreateQueues(false).setAutoCreateAddresses(false).setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ")).setAutoCreateAddresses(true).setMaxDeliveryAttempts(-1)); + addressSettingsMap.put("exampleQueueTwo", new AddressSettings().setAutoCreateQueues(false).setAutoCreateAddresses(false).setDeadLetterAddress(SimpleString.of("ActiveMQ.DLQ")).setAutoCreateAddresses(true).setMaxDeliveryAttempts(-1)); } @@ -70,7 +70,7 @@ public class FastReconnectOpenWireTest extends OpenWireTestBase { public void testFastReconnectCreateConsumerNoErrors() throws Exception { final ArrayList errors = new ArrayList<>(); - SimpleString durableQueue = new SimpleString("exampleQueueTwo"); + SimpleString durableQueue = SimpleString.of("exampleQueueTwo"); this.server.createQueue(new QueueConfiguration(durableQueue).setRoutingType(RoutingType.ANYCAST)); Queue queue = new ActiveMQQueue(durableQueue.toString()); @@ -133,7 +133,7 @@ public class FastReconnectOpenWireTest extends OpenWireTestBase { public void testFastReconnectCreateConsumerNoErrorsNoClientId() throws Exception { final ArrayList errors = new ArrayList<>(); - SimpleString durableQueue = new SimpleString("exampleQueueTwo"); + SimpleString durableQueue = SimpleString.of("exampleQueueTwo"); this.server.createQueue(new QueueConfiguration(durableQueue).setRoutingType(RoutingType.ANYCAST)); Queue queue = new ActiveMQQueue(durableQueue.toString()); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/LargeMessageQueueAutoCreationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/LargeMessageQueueAutoCreationTest.java index a7f72a9dad..afd45d3f98 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/LargeMessageQueueAutoCreationTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/LargeMessageQueueAutoCreationTest.java @@ -97,7 +97,7 @@ public class LargeMessageQueueAutoCreationTest extends BasicOpenWireTest { protected Queue createCoreQueue(final String queueName) throws Exception { - SimpleString address = SimpleString.toSimpleString(queueName); + SimpleString address = SimpleString.of(queueName); clientSession.createAddress(address, RoutingType.ANYCAST, false); return new ActiveMQQueue(queueName); } 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 ca706cc791..16ae19ee86 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 @@ -53,24 +53,24 @@ public class OpenWireDivertExclusiveTest extends OpenWireDivertTestBase { ClientSession coreSession = sf.createSession(false, true, true); - final SimpleString queueName1 = new SimpleString("queue1"); + final SimpleString queueName1 = SimpleString.of("queue1"); - final SimpleString queueName2 = new SimpleString("queue2"); + final SimpleString queueName2 = SimpleString.of("queue2"); - final SimpleString queueName3 = new SimpleString("queue3"); + final SimpleString queueName3 = SimpleString.of("queue3"); - final SimpleString queueName4 = new SimpleString("queue4"); + final SimpleString queueName4 = SimpleString.of("queue4"); 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)); + ClientProducer producer = coreSession.createProducer(SimpleString.of(testAddress)); final int numMessages = 10; - final SimpleString propKey = new SimpleString("testkey"); + final SimpleString propKey = SimpleString.of("testkey"); for (int i = 0; i < numMessages; i++) { ClientMessage message = coreSession.createMessage(false); @@ -124,8 +124,8 @@ public class OpenWireDivertExclusiveTest extends OpenWireDivertTestBase { ClientSession coreSession = sf.createSession(false, true, true); - final SimpleString queueName1 = new SimpleString("queue1"); - final SimpleString queueName2 = new SimpleString("queue2"); + final SimpleString queueName1 = SimpleString.of("queue1"); + final SimpleString queueName2 = SimpleString.of("queue2"); coreSession.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress).setRoutingType(RoutingType.ANYCAST).setDurable(false)); coreSession.createQueue(new QueueConfiguration(queueName2).setAddress(testAddress).setRoutingType(RoutingType.ANYCAST).setDurable(false)); 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 efab674d1f..0704fd2c68 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 @@ -55,18 +55,18 @@ public class OpenWireDivertNonExclusiveTest extends OpenWireDivertTestBase { ClientSession coreSession = sf.createSession(false, true, true); - final SimpleString queueName1 = new SimpleString("queue1"); + final SimpleString queueName1 = SimpleString.of("queue1"); - final SimpleString queueName2 = new SimpleString("queue2"); + final SimpleString queueName2 = SimpleString.of("queue2"); coreSession.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress).setDurable(false)); coreSession.createQueue(new QueueConfiguration(queueName2).setAddress(testAddress).setDurable(false)); - ClientProducer producer = coreSession.createProducer(new SimpleString(testAddress)); + ClientProducer producer = coreSession.createProducer(SimpleString.of(testAddress)); final int numMessages = 1; - final SimpleString propKey = new SimpleString("testkey"); + final SimpleString propKey = SimpleString.of("testkey"); for (int i = 0; i < numMessages; i++) { ClientMessage message = coreSession.createMessage(false); @@ -130,8 +130,8 @@ public class OpenWireDivertNonExclusiveTest extends OpenWireDivertTestBase { ClientSessionFactory sf = createSessionFactory(locator); ClientSession coreSession = sf.createSession(false, true, true); - final SimpleString queueName1 = new SimpleString("queue1"); - final SimpleString queueName2 = new SimpleString("queue2"); + final SimpleString queueName1 = SimpleString.of("queue1"); + final SimpleString queueName2 = SimpleString.of("queue2"); coreSession.createQueue(new QueueConfiguration(queueName1).setAddress(forwardAddress).setRoutingType(RoutingType.ANYCAST).setDurable(false)); coreSession.createQueue(new QueueConfiguration(queueName2).setAddress(testAddress).setRoutingType(RoutingType.ANYCAST).setDurable(false)); 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 404be74f8a..a3420bf0a1 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 @@ -51,14 +51,14 @@ public class OpenWireFlowControlFailTest extends OpenWireTestBase { @Override protected void configureAddressSettings(Map addressSettingsMap) { addressSettingsMap.put("#", new AddressSettings().setAutoCreateQueues(false).setAutoCreateAddresses(false). - setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ")).setAddressFullMessagePolicy(AddressFullMessagePolicy.FAIL).setMaxSizeBytes(10000)); + setDeadLetterAddress(SimpleString.of("ActiveMQ.DLQ")).setAddressFullMessagePolicy(AddressFullMessagePolicy.FAIL).setMaxSizeBytes(10000)); } @Test @Timeout(60) public void testMessagesNotSent() throws Exception { - AddressInfo addressInfo = new AddressInfo(SimpleString.toSimpleString("Test"), RoutingType.ANYCAST); + AddressInfo addressInfo = new AddressInfo(SimpleString.of("Test"), RoutingType.ANYCAST); server.addAddressInfo(addressInfo); server.createQueue(new QueueConfiguration(addressInfo.getName()).setRoutingType(RoutingType.ANYCAST)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireGroupingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireGroupingTest.java index 84612dd9d6..9bd77b3ee2 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireGroupingTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireGroupingTest.java @@ -146,7 +146,7 @@ public class OpenWireGroupingTest extends BasicOpenWireTest { protected void setProperty(Message message) { if (coreSend) { - ((ActiveMQMessage) message).getCoreMessage().putStringProperty(org.apache.activemq.artemis.api.core.Message.HDR_GROUP_ID, new SimpleString("foo")); + ((ActiveMQMessage) message).getCoreMessage().putStringProperty(org.apache.activemq.artemis.api.core.Message.HDR_GROUP_ID, SimpleString.of("foo")); } else { org.apache.activemq.command.ActiveMQMessage m = (org.apache.activemq.command.ActiveMQMessage) message; m.setGroupID("foo"); 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 09e1d39fae..f72304f4fe 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 @@ -64,8 +64,8 @@ public class OpenWireLargeMessageTest extends BasicOpenWireTest { super(); } - public SimpleString lmAddress = new SimpleString("LargeMessageAddress"); - public SimpleString lmDropAddress = new SimpleString("LargeMessageDropAddress"); + public SimpleString lmAddress = SimpleString.of("LargeMessageAddress"); + public SimpleString lmDropAddress = SimpleString.of("LargeMessageDropAddress"); @Override @BeforeEach @@ -78,7 +78,7 @@ public class OpenWireLargeMessageTest extends BasicOpenWireTest { @Override protected void configureAddressSettings(Map addressSettingsMap) { - addressSettingsMap.put("#", new AddressSettings().setAutoCreateQueues(false).setAutoCreateAddresses(false).setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ")).setAutoCreateAddresses(true)); + addressSettingsMap.put("#", new AddressSettings().setAutoCreateQueues(false).setAutoCreateAddresses(false).setDeadLetterAddress(SimpleString.of("ActiveMQ.DLQ")).setAutoCreateAddresses(true)); addressSettingsMap.put(lmDropAddress.toString(), new AddressSettings() .setMaxSizeBytes(100 * 1024) diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireScheduledDelayTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireScheduledDelayTest.java index a8f4268a60..15704feac5 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireScheduledDelayTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireScheduledDelayTest.java @@ -40,7 +40,7 @@ public class OpenWireScheduledDelayTest extends OpenWireTestBase { @Override protected void configureAddressSettings(Map addressSettingsMap) { - addressSettingsMap.put("#", new AddressSettings().setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ"))); + addressSettingsMap.put("#", new AddressSettings().setDeadLetterAddress(SimpleString.of("ActiveMQ.DLQ"))); } @Test diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireTestBase.java index ed093a7f73..c8cefbead8 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireTestBase.java @@ -122,7 +122,7 @@ public class OpenWireTestBase extends ActiveMQTestBase { } protected void configureAddressSettings(Map addressSettingsMap) { - addressSettingsMap.put("#", new AddressSettings().setAutoCreateQueues(false).setAutoCreateAddresses(false).setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ")).setAutoCreateAddresses(true)); + addressSettingsMap.put("#", new AddressSettings().setAutoCreateQueues(false).setAutoCreateAddresses(false).setDeadLetterAddress(SimpleString.of("ActiveMQ.DLQ")).setAutoCreateAddresses(true)); } //override this to add extra server configs diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/PrefetchRedeliveryCountOpenwireTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/PrefetchRedeliveryCountOpenwireTest.java index 7c4b02ced1..c6752f274a 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/PrefetchRedeliveryCountOpenwireTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/PrefetchRedeliveryCountOpenwireTest.java @@ -83,9 +83,9 @@ public class PrefetchRedeliveryCountOpenwireTest extends OpenWireTestBase { protected void configureAddressSettings(Map addressSettingsMap) { super.configureAddressSettings(addressSettingsMap); // force send to dlq early - addressSettingsMap.put("exampleQueue", new AddressSettings().setAutoCreateQueues(false).setAutoCreateAddresses(false).setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ")).setAutoCreateAddresses(true).setMaxDeliveryAttempts(2)); + addressSettingsMap.put("exampleQueue", new AddressSettings().setAutoCreateQueues(false).setAutoCreateAddresses(false).setDeadLetterAddress(SimpleString.of("ActiveMQ.DLQ")).setAutoCreateAddresses(true).setMaxDeliveryAttempts(2)); // force send to dlq late - addressSettingsMap.put("exampleQueueTwo", new AddressSettings().setAutoCreateQueues(false).setAutoCreateAddresses(false).setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ")).setAutoCreateAddresses(true).setMaxDeliveryAttempts(-1)); + addressSettingsMap.put("exampleQueueTwo", new AddressSettings().setAutoCreateQueues(false).setAutoCreateAddresses(false).setDeadLetterAddress(SimpleString.of("ActiveMQ.DLQ")).setAutoCreateAddresses(true).setMaxDeliveryAttempts(-1)); } @Override @@ -110,7 +110,7 @@ public class PrefetchRedeliveryCountOpenwireTest extends OpenWireTestBase { public void doTestConsumerSingleMessageLoop(boolean exclusive) throws Exception { Connection exConn = null; - SimpleString durableQueue = new SimpleString("exampleQueue"); + SimpleString durableQueue = SimpleString.of("exampleQueue"); this.server.createQueue(new QueueConfiguration(durableQueue).setRoutingType(RoutingType.ANYCAST).setExclusive(exclusive)); try { @@ -156,7 +156,7 @@ public class PrefetchRedeliveryCountOpenwireTest extends OpenWireTestBase { public void testExclusiveConsumerOrderOnReconnectionLargePrefetch() throws Exception { Connection exConn = null; - SimpleString durableQueue = new SimpleString("exampleQueueTwo"); + SimpleString durableQueue = SimpleString.of("exampleQueueTwo"); this.server.createQueue(new QueueConfiguration(durableQueue).setRoutingType(RoutingType.ANYCAST).setExclusive(true)); try { @@ -226,7 +226,7 @@ public class PrefetchRedeliveryCountOpenwireTest extends OpenWireTestBase { public void testServerSideRollbackOnCloseOrder() throws Exception { final ArrayList errors = new ArrayList<>(); - SimpleString durableQueue = new SimpleString("exampleQueueTwo"); + SimpleString durableQueue = SimpleString.of("exampleQueueTwo"); this.server.createQueue(new QueueConfiguration(durableQueue).setRoutingType(RoutingType.ANYCAST).setExclusive(true)); Queue queue = new ActiveMQQueue(durableQueue.toString()); @@ -388,7 +388,7 @@ public class PrefetchRedeliveryCountOpenwireTest extends OpenWireTestBase { public void testExclusiveConsumerBatchOrderUnderLoad() throws Exception { final ArrayList errors = new ArrayList<>(); - SimpleString durableQueue = new SimpleString("exampleQueueTwo"); + SimpleString durableQueue = SimpleString.of("exampleQueueTwo"); this.server.createQueue(new QueueConfiguration(durableQueue).setRoutingType(RoutingType.ANYCAST).setExclusive(true)); Queue queue = new ActiveMQQueue(durableQueue.toString()); @@ -553,7 +553,7 @@ public class PrefetchRedeliveryCountOpenwireTest extends OpenWireTestBase { public void underLoad(final int numProducers, Runnable r) throws Exception { // produce some load with a producer(s)/consumer - SimpleString durableQueue = new SimpleString("exampleQueue"); + SimpleString durableQueue = SimpleString.of("exampleQueue"); this.server.createQueue(new QueueConfiguration(durableQueue).setRoutingType(RoutingType.ANYCAST)); ExecutorService executor = Executors.newFixedThreadPool(numProducers + 1); @@ -648,7 +648,7 @@ public class PrefetchRedeliveryCountOpenwireTest extends OpenWireTestBase { Connection exConn = null; ExecutorService executorService = Executors.newFixedThreadPool(10); - SimpleString durableQueue = new SimpleString("exampleQueueTwo"); + SimpleString durableQueue = SimpleString.of("exampleQueueTwo"); this.server.createQueue(new QueueConfiguration(durableQueue).setRoutingType(RoutingType.ANYCAST).setExclusive(true)); AtomicInteger batchConsumed = new AtomicInteger(0); 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 ab4e2309e5..d97ffed6e4 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 @@ -67,7 +67,7 @@ public class SecurityOpenWireTest extends BasicOpenWireTest { roles.add(new Role("programmers", false, false, false, false, false, false, false, false, false, false, false, false)); server.getSecurityRepository().addMatch("denyQ", roles); - SimpleString denyQ = new SimpleString("denyQ"); + SimpleString denyQ = SimpleString.of("denyQ"); server.createQueue(new QueueConfiguration(denyQ).setRoutingType(RoutingType.ANYCAST)); try (Connection connection = factory.createConnection("denyQ", "denyQ")) { Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); 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 53bf6d51cc..f9c65d9a37 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 @@ -978,8 +978,8 @@ public class SimpleOpenWireTest extends BasicOpenWireTest { MessageConsumer consumer = session.createConsumer(queue); - assertTrue(Wait.waitFor(() -> (server.locateQueue(SimpleString.toSimpleString("foo")) != null), 2000, 100)); - assertTrue(Wait.waitFor(() -> (server.getAddressInfo(SimpleString.toSimpleString("foo")) != null), 2000, 100)); + assertTrue(Wait.waitFor(() -> (server.locateQueue(SimpleString.of("foo")) != null), 2000, 100)); + assertTrue(Wait.waitFor(() -> (server.getAddressInfo(SimpleString.of("foo")) != null), 2000, 100)); MessageProducer producer = session.createProducer(null); producer.send(queue, message); @@ -987,13 +987,13 @@ public class SimpleOpenWireTest extends BasicOpenWireTest { TextMessage message1 = (TextMessage) consumer.receive(1000); assertTrue(message1.getText().equals(message.getText())); - assertNotNull(server.locateQueue(SimpleString.toSimpleString("foo"))); + assertNotNull(server.locateQueue(SimpleString.of("foo"))); consumer.close(); connection.close(); - assertTrue(Wait.waitFor(() -> (server.locateQueue(SimpleString.toSimpleString("foo")) == null), 2000, 100)); - assertTrue(Wait.waitFor(() -> (server.getAddressInfo(SimpleString.toSimpleString("foo")) == null), 2000, 100)); + assertTrue(Wait.waitFor(() -> (server.locateQueue(SimpleString.of("foo")) == null), 2000, 100)); + assertTrue(Wait.waitFor(() -> (server.getAddressInfo(SimpleString.of("foo")) == null), 2000, 100)); } @Test @@ -1062,7 +1062,7 @@ public class SimpleOpenWireTest extends BasicOpenWireTest { public void testOpenWireExample() throws Exception { Connection exConn = null; - SimpleString durableQueue = new SimpleString("exampleQueue"); + SimpleString durableQueue = SimpleString.of("exampleQueue"); this.server.createQueue(new QueueConfiguration(durableQueue).setRoutingType(RoutingType.ANYCAST)); try { @@ -1104,7 +1104,7 @@ public class SimpleOpenWireTest extends BasicOpenWireTest { public void testMultipleConsumers() throws Exception { Connection exConn = null; - SimpleString durableQueue = new SimpleString("exampleQueue"); + SimpleString durableQueue = SimpleString.of("exampleQueue"); this.server.createQueue(new QueueConfiguration(durableQueue).setRoutingType(RoutingType.ANYCAST)); try { @@ -1141,7 +1141,7 @@ public class SimpleOpenWireTest extends BasicOpenWireTest { public void testMixedOpenWireExample() throws Exception { Connection openConn = null; - SimpleString durableQueue = new SimpleString("exampleQueue"); + SimpleString durableQueue = SimpleString.of("exampleQueue"); this.server.createQueue(new QueueConfiguration(durableQueue).setRoutingType(RoutingType.ANYCAST)); ActiveMQConnectionFactory openCF = new ActiveMQConnectionFactory(); @@ -1181,7 +1181,7 @@ public class SimpleOpenWireTest extends BasicOpenWireTest { public void testMixedOpenWireExample2() throws Exception { Connection conn1 = null; - SimpleString durableQueue = new SimpleString("exampleQueue"); + SimpleString durableQueue = SimpleString.of("exampleQueue"); this.server.createQueue(new QueueConfiguration(durableQueue).setRoutingType(RoutingType.ANYCAST)); Queue queue = ActiveMQJMSClient.createQueue("exampleQueue"); @@ -1826,7 +1826,7 @@ public class SimpleOpenWireTest extends BasicOpenWireTest { private void checkQueueEmpty(String qName) { PostOffice po = server.getPostOffice(); - LocalQueueBinding binding = (LocalQueueBinding) po.getBinding(SimpleString.toSimpleString(qName)); + LocalQueueBinding binding = (LocalQueueBinding) po.getBinding(SimpleString.of(qName)); try { //waiting for last ack to finish Thread.sleep(1000); 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 c85dfc8558..a1c55aa379 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 @@ -44,7 +44,7 @@ public class VerySimpleOenwireTest extends OpenWireTestBase { public void testOpenWireExample() throws Exception { Connection exConn = null; - SimpleString durableQueue = new SimpleString("exampleQueue"); + SimpleString durableQueue = SimpleString.of("exampleQueue"); this.server.createQueue(new QueueConfiguration(durableQueue).setRoutingType(RoutingType.ANYCAST)); try { @@ -81,7 +81,7 @@ public class VerySimpleOenwireTest extends OpenWireTestBase { public void testMixedOpenWireExample() throws Exception { Connection openConn = null; - SimpleString durableQueue = new SimpleString("exampleQueue"); + SimpleString durableQueue = SimpleString.of("exampleQueue"); 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/VirtualTopicToFQQNOpenWireTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/VirtualTopicToFQQNOpenWireTest.java index 97342f231b..174dad5f7c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/VirtualTopicToFQQNOpenWireTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/VirtualTopicToFQQNOpenWireTest.java @@ -56,7 +56,7 @@ public class VirtualTopicToFQQNOpenWireTest extends OpenWireTestBase { public void testAutoVirtualTopicFQQN() throws Exception { Connection connection = null; - SimpleString topic = new SimpleString("VirtualTopic.Orders"); + SimpleString topic = SimpleString.of("VirtualTopic.Orders"); this.server.getAddressSettingsRepository().getMatch("VirtualTopic.#").setAutoCreateQueues(true); this.server.getAddressSettingsRepository().getMatch("VirtualTopic.#").setAutoCreateAddresses(true); this.server.getAddressSettingsRepository().getMatch("VirtualTopic.#").setAutoDeleteQueues(false); @@ -98,8 +98,8 @@ public class VirtualTopicToFQQNOpenWireTest extends OpenWireTestBase { public void testTwoTopicSubsSameNameAutoVirtualTopicFQQN() throws Exception { Connection connection = null; - SimpleString topic1 = new SimpleString("VirtualTopic.Orders1"); - SimpleString topic2 = new SimpleString("VirtualTopic.Orders2"); + SimpleString topic1 = SimpleString.of("VirtualTopic.Orders1"); + SimpleString topic2 = SimpleString.of("VirtualTopic.Orders2"); this.server.getAddressSettingsRepository().getMatch("VirtualTopic.#").setAutoCreateQueues(true); this.server.getAddressSettingsRepository().getMatch("VirtualTopic.#").setAutoCreateAddresses(true); @@ -151,9 +151,9 @@ public class VirtualTopicToFQQNOpenWireTest extends OpenWireTestBase { public void testAutoVirtualTopicWildcardFQQN() throws Exception { Connection connection = null; - SimpleString topicA = new SimpleString("VirtualTopic.Orders.A"); - SimpleString topicB = new SimpleString("VirtualTopic.Orders.B"); - SimpleString topic = new SimpleString("VirtualTopic.Orders.>"); + SimpleString topicA = SimpleString.of("VirtualTopic.Orders.A"); + SimpleString topicB = SimpleString.of("VirtualTopic.Orders.B"); + SimpleString topic = SimpleString.of("VirtualTopic.Orders.>"); this.server.getAddressSettingsRepository().getMatch("VirtualTopic.#").setAutoCreateQueues(true); this.server.getAddressSettingsRepository().getMatch("VirtualTopic.#").setAutoCreateAddresses(true); @@ -194,9 +194,9 @@ public class VirtualTopicToFQQNOpenWireTest extends OpenWireTestBase { public void testAutoVirtualTopicWildcardStarFQQN() throws Exception { Connection connection = null; - SimpleString topicA = new SimpleString("VirtualTopic.Orders.A"); - SimpleString topicB = new SimpleString("VirtualTopic.Orders.B"); - SimpleString topic = new SimpleString("VirtualTopic.Orders.*"); + SimpleString topicA = SimpleString.of("VirtualTopic.Orders.A"); + SimpleString topicB = SimpleString.of("VirtualTopic.Orders.B"); + SimpleString topic = SimpleString.of("VirtualTopic.Orders.*"); this.server.getAddressSettingsRepository().getMatch("VirtualTopic.#").setAutoCreateQueues(true); this.server.getAddressSettingsRepository().getMatch("VirtualTopic.#").setAutoCreateAddresses(true); @@ -237,7 +237,7 @@ public class VirtualTopicToFQQNOpenWireTest extends OpenWireTestBase { public void testSelectorAwareVT() throws Exception { Connection connection = null; - SimpleString topic = new SimpleString("SVT.Orders.A"); + SimpleString topic = SimpleString.of("SVT.Orders.A"); this.server.getAddressSettingsRepository().getMatch("SVT.#").setAutoCreateQueues(true); this.server.getAddressSettingsRepository().getMatch("SVT.#").setAutoCreateAddresses(true); @@ -273,10 +273,10 @@ public class VirtualTopicToFQQNOpenWireTest extends OpenWireTestBase { // verify C message got dropped - final QueueControl queueControlA = ManagementControlHelper.createQueueControl(topic, SimpleString.toSimpleString("C.A." + topic.toString()), RoutingType.MULTICAST, mbeanServer); + final QueueControl queueControlA = ManagementControlHelper.createQueueControl(topic, SimpleString.of("C.A." + topic.toString()), RoutingType.MULTICAST, mbeanServer); Wait.assertEquals(0, () -> queueControlA.countMessages()); - final QueueControl queueControlB = ManagementControlHelper.createQueueControl(topic, SimpleString.toSimpleString("C.B." + topic.toString()), RoutingType.MULTICAST, mbeanServer); + final QueueControl queueControlB = ManagementControlHelper.createQueueControl(topic, SimpleString.of("C.B." + topic.toString()), RoutingType.MULTICAST, mbeanServer); Wait.assertEquals(0, () -> queueControlB.countMessages()); } finally { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JMSConsumer2Test.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JMSConsumer2Test.java index c8d40371d6..32fd87eb16 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JMSConsumer2Test.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JMSConsumer2Test.java @@ -247,7 +247,7 @@ public class JMSConsumer2Test extends BasicOpenWireTest { assertTrue(gotMessage.await(1, TimeUnit.SECONDS)); // want to ensure the ack has had a chance to get back to the broker - final Queue queueInstance = server.locateQueue(new SimpleString(queueName)); + final Queue queueInstance = server.locateQueue(SimpleString.of(queueName)); Wait.waitFor(new Wait.Condition() { @Override public boolean isSatisfied() throws Exception { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/ProducerAutoCreateQueueTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/ProducerAutoCreateQueueTest.java index 7998651721..5a8c65ad4c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/ProducerAutoCreateQueueTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/ProducerAutoCreateQueueTest.java @@ -54,7 +54,7 @@ public class ProducerAutoCreateQueueTest extends BasicOpenWireTest { Queue trash = session.createQueue("trash"); final MessageProducer producer = session.createProducer(trash); producer.send(session.createTextMessage("foo")); - assertNotNull(server.getPostOffice().getBinding(new SimpleString("trash"))); + assertNotNull(server.getPostOffice().getBinding(SimpleString.of("trash"))); } finally { if (connection != null) { connection.close(); @@ -77,7 +77,7 @@ public class ProducerAutoCreateQueueTest extends BasicOpenWireTest { } } - Wait.assertTrue(() -> server.getAddressInfo(new SimpleString("trash")) != null); + Wait.assertTrue(() -> server.getAddressInfo(SimpleString.of("trash")) != null); Wait.assertEquals(0, server::getTotalMessageCount); } @@ -96,8 +96,8 @@ public class ProducerAutoCreateQueueTest extends BasicOpenWireTest { } } - Wait.assertTrue(() -> server.getAddressInfo(new SimpleString("trash")) != null); - Wait.assertTrue(() -> server.locateQueue(new SimpleString("trash")) != null); + Wait.assertTrue(() -> server.getAddressInfo(SimpleString.of("trash")) != null); + Wait.assertTrue(() -> server.locateQueue(SimpleString.of("trash")) != null); Wait.assertEquals(1, server::getTotalMessageCount); } @@ -110,7 +110,7 @@ public class ProducerAutoCreateQueueTest extends BasicOpenWireTest { Queue trash = session.createQueue("trash"); final MessageProducer producer = session.createProducer(trash); producer.send(session.createTextMessage("foo")); - assertNotNull(server.locateQueue(new SimpleString("trash"))); + assertNotNull(server.locateQueue(SimpleString.of("trash"))); MessageConsumer consumer = session.createConsumer(trash); connection.start(); assertNotNull(consumer.receive(1000)); @@ -120,7 +120,7 @@ public class ProducerAutoCreateQueueTest extends BasicOpenWireTest { } } - SimpleString queueName = SimpleString.toSimpleString("trash"); + SimpleString queueName = SimpleString.of("trash"); Wait.assertTrue(() -> server.locateQueue(queueName) == null); } @@ -134,7 +134,7 @@ public class ProducerAutoCreateQueueTest extends BasicOpenWireTest { Queue trash = session.createQueue("trash"); final MessageProducer producer = session.createProducer(trash); producer.send(session.createTextMessage("foo")); - assertNotNull(server.locateQueue(new SimpleString("trash"))); + assertNotNull(server.locateQueue(SimpleString.of("trash"))); MessageConsumer consumer = session.createConsumer(trash); connection.start(); assertNotNull(consumer.receive(1000)); @@ -144,8 +144,8 @@ public class ProducerAutoCreateQueueTest extends BasicOpenWireTest { } } - Wait.assertTrue(() -> server.locateQueue(new SimpleString("trash")) != null); - Wait.assertTrue(() -> server.getAddressInfo(new SimpleString("trash")) != null); + Wait.assertTrue(() -> server.locateQueue(SimpleString.of("trash")) != null); + Wait.assertTrue(() -> server.getAddressInfo(SimpleString.of("trash")) != null); } @Test diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/cluster/MessageRedistributionTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/cluster/MessageRedistributionTest.java index e51374f4c1..018b99a020 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/cluster/MessageRedistributionTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/cluster/MessageRedistributionTest.java @@ -218,8 +218,8 @@ public class MessageRedistributionTest extends ClusterTestBase { MessageProducer producer = session.createProducer(dest); producer.send(session.createTextMessage("test message")); Message message = mySubscriber.receive(5000); - SimpleString advQueue = new SimpleString("ActiveMQ.Advisory.TempQueue"); - SimpleString advTopic = new SimpleString("ActiveMQ.Advisory.TempTopic"); + SimpleString advQueue = SimpleString.of("ActiveMQ.Advisory.TempQueue"); + SimpleString advTopic = SimpleString.of("ActiveMQ.Advisory.TempTopic"); //we create a consumer on node 2 and assert that the advisory subscription queue is not clustered assertEquals(1, servers[0].getPostOffice().getBindingsForAddress(advQueue).getBindings().size(), ""); assertEquals(1, servers[0].getPostOffice().getBindingsForAddress(advTopic).getBindings().size(), ""); @@ -272,7 +272,7 @@ public class MessageRedistributionTest extends ClusterTestBase { private RemoteQueueBinding getRemoteQueueBinding(ActiveMQServer server) throws Exception { ActiveMQServer remoteServer = server; - Bindings bindings = remoteServer.getPostOffice().getBindingsForAddress(new SimpleString("queues.testaddress")); + Bindings bindings = remoteServer.getPostOffice().getBindingsForAddress(SimpleString.of("queues.testaddress")); Collection bindingSet = bindings.getBindings(); return getRemoteQueueBinding(bindingSet); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/cluster/TemporaryQueueClusterTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/cluster/TemporaryQueueClusterTest.java index 7ffd9a99f2..7d0fb7f8f8 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/cluster/TemporaryQueueClusterTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/cluster/TemporaryQueueClusterTest.java @@ -88,7 +88,7 @@ public class TemporaryQueueClusterTest extends OpenWireJMSClusteredTestBase { prod1.send(msg); - Wait.assertTrue(() -> getServer(1).locateQueue(SimpleString.toSimpleString(QUEUE_NAME)).getMessageCount() == 1, 5000, 100); + Wait.assertTrue(() -> getServer(1).locateQueue(SimpleString.of(QUEUE_NAME)).getMessageCount() == 1, 5000, 100); TextMessage msgReceived = (TextMessage) cons2.receive(5000); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/interop/GeneralInteropTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/interop/GeneralInteropTest.java index aecae1119c..8fb0cc9a9c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/interop/GeneralInteropTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/interop/GeneralInteropTest.java @@ -217,8 +217,8 @@ public class GeneralInteropTest extends BasicOpenWireTest { final String text = "HelloWorld"; final int prefetchSize = 10; - SimpleString dla = new SimpleString("DLA"); - SimpleString dlq = new SimpleString("DLQ1"); + SimpleString dla = SimpleString.of("DLA"); + SimpleString dlq = SimpleString.of("DLQ1"); server.createQueue(new QueueConfiguration(dlq).setAddress(dla).setDurable(false)); server.getAddressSettingsRepository().addMatch(queueName, new AddressSettings().setDeadLetterAddress(dla)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/management/OpenWireDeleteQueueTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/management/OpenWireDeleteQueueTest.java index e95bf6ee57..88c90f6ef0 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/management/OpenWireDeleteQueueTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/management/OpenWireDeleteQueueTest.java @@ -50,7 +50,7 @@ import org.junit.jupiter.api.Test; public class OpenWireDeleteQueueTest extends OpenWireTestBase { private ActiveMQServerControl serverControl; - private SimpleString queueName1 = new SimpleString("queue1"); + private SimpleString queueName1 = SimpleString.of("queue1"); private ConnectionFactory factory; @@ -64,8 +64,8 @@ public class OpenWireDeleteQueueTest extends OpenWireTestBase { @Override protected void configureAddressSettings(Map addressSettingsMap) { - addressSettingsMap.put("#", new AddressSettings().setAutoCreateQueues(false).setAutoCreateAddresses(false).setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ"))); - addressSettingsMap.put(queueName1.toString(), new AddressSettings().setAutoCreateQueues(true).setAutoCreateAddresses(true).setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ"))); + addressSettingsMap.put("#", new AddressSettings().setAutoCreateQueues(false).setAutoCreateAddresses(false).setDeadLetterAddress(SimpleString.of("ActiveMQ.DLQ"))); + addressSettingsMap.put(queueName1.toString(), new AddressSettings().setAutoCreateQueues(true).setAutoCreateAddresses(true).setDeadLetterAddress(SimpleString.of("ActiveMQ.DLQ"))); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/GlobalJournalPagingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/GlobalJournalPagingTest.java index 077306dddd..ebb0e06d65 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/GlobalJournalPagingTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/GlobalJournalPagingTest.java @@ -242,7 +242,7 @@ public class GlobalJournalPagingTest extends JournalPagingTest { assertNull(server.getPagingManager().getPageStore(managementAddress)); - final SimpleString address = SimpleString.toSimpleString("queue"); + final SimpleString address = SimpleString.of("queue"); if (server.locateQueue(address) == null) { @@ -322,7 +322,7 @@ public class GlobalJournalPagingTest extends JournalPagingTest { session.createQueue(new QueueConfiguration(managementAddress)); } - final SimpleString address = SimpleString.toSimpleString("queue"); + final SimpleString address = SimpleString.of("queue"); if (server.locateQueue(address) == null) { @@ -330,7 +330,7 @@ public class GlobalJournalPagingTest extends JournalPagingTest { } try (ClientProducer requestProducer = session.createProducer(managementAddress)) { - final SimpleString replyQueue = new SimpleString(managementAddress + "." + UUID.randomUUID().toString()); + final SimpleString replyQueue = SimpleString.of(managementAddress + "." + UUID.randomUUID().toString()); session.createQueue(new QueueConfiguration(replyQueue).setRoutingType(ActiveMQDefaultConfiguration.getDefaultRoutingType()).setDurable(false).setTemporary(true)); int id = 1000; try (ClientConsumer consumer = session.createConsumer(replyQueue)) { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/JournalPagingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/JournalPagingTest.java index b81fbe960f..5a5808556b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/JournalPagingTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/JournalPagingTest.java @@ -76,7 +76,7 @@ public class JournalPagingTest extends ActiveMQTestBase { protected static final int PAGE_MAX = 100 * 1024; protected static final int PAGE_SIZE = 10 * 1024; static final int MESSAGE_SIZE = 1024; // 1k - static final SimpleString ADDRESS = new SimpleString("SimpleAddress"); + static final SimpleString ADDRESS = SimpleString.of("SimpleAddress"); private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); protected ServerLocator locator; protected ActiveMQServer server; @@ -182,7 +182,7 @@ public class JournalPagingTest extends ActiveMQTestBase { consumer.close(); - consumer = session.createConsumer(ADDRESS, SimpleString.toSimpleString("i=29")); + consumer = session.createConsumer(ADDRESS, SimpleString.of("i=29")); message = consumer.receive(5000); assertNotNull(message); @@ -324,7 +324,7 @@ public class JournalPagingTest extends ActiveMQTestBase { server.start(); - SimpleString queue = new SimpleString("testPurge:" + RandomUtil.randomString()); + SimpleString queue = SimpleString.of("testPurge:" + RandomUtil.randomString()); server.addAddressInfo(new AddressInfo(queue, RoutingType.ANYCAST)); QueueImpl purgeQueue = (QueueImpl) server.createQueue(new QueueConfiguration(queue).setRoutingType(RoutingType.ANYCAST).setMaxConsumers(1).setPurgeOnNoConsumers(true).setAutoCreateAddress(false)); @@ -560,7 +560,7 @@ public class JournalPagingTest extends ActiveMQTestBase { bodyLocal.writeBytes(body); - message.putIntProperty(new SimpleString("id"), i); + message.putIntProperty(SimpleString.of("id"), i); try { producer.send(message); @@ -621,7 +621,7 @@ public class JournalPagingTest extends ActiveMQTestBase { bodyLocal.writeBytes(body); - message.putIntProperty(new SimpleString("id"), i); + message.putIntProperty(SimpleString.of("id"), i); producer.send(message); if (i % 1000 == 0) { @@ -706,7 +706,7 @@ public class JournalPagingTest extends ActiveMQTestBase { bodyLocal.writeBytes(body); - message.putIntProperty(new SimpleString("theid"), i); + message.putIntProperty(SimpleString.of("theid"), i); producer.send(message); if (i % 1000 == 0) { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/MaxMessagesPagingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/MaxMessagesPagingTest.java index bfff37f509..56b40a41de 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/MaxMessagesPagingTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/MaxMessagesPagingTest.java @@ -72,7 +72,7 @@ public class MaxMessagesPagingTest extends ActiveMQTestBase { @Test public void testGlobalMaxMessages() throws Exception { - final SimpleString ADDRESS = new SimpleString("testGlobalMaxMessages"); + final SimpleString ADDRESS = SimpleString.of("testGlobalMaxMessages"); clearDataRecreateServerDirs(); Configuration config = createDefaultInVMConfig(); @@ -183,12 +183,12 @@ public class MaxMessagesPagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(null, null, false, true, true, false, 0); for (int adr = 1; adr <= 2; adr++) { - SimpleString address = new SimpleString(baseAddress + adr); + SimpleString address = SimpleString.of(baseAddress + adr); session.createQueue(new QueueConfiguration(address).setAddress(address)); } for (int adr = 1; adr <= 2; adr++) { - SimpleString address = new SimpleString(baseAddress + adr); + SimpleString address = SimpleString.of(baseAddress + adr); ClientProducer producer = session.createProducer(address); ClientMessage message = null; @@ -249,12 +249,12 @@ public class MaxMessagesPagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(null, null, false, true, true, false, 0); for (int adr = 1; adr <= 2; adr++) { - SimpleString address = new SimpleString(baseAddress + adr); + SimpleString address = SimpleString.of(baseAddress + adr); session.createQueue(new QueueConfiguration(address).setAddress(address)); } for (int adr = 1; adr <= 1; adr++) { - SimpleString address = new SimpleString(baseAddress + adr); + SimpleString address = SimpleString.of(baseAddress + adr); ClientProducer producer = session.createProducer(address); ClientMessage message = null; @@ -304,7 +304,7 @@ public class MaxMessagesPagingTest extends ActiveMQTestBase { ClientSession session = sf.createSession(null, null, false, true, true, false, 0); for (int adr = 0; adr < 11; adr++) { - SimpleString address = new SimpleString(baseAddress + adr); + SimpleString address = SimpleString.of(baseAddress + adr); session.createQueue(new QueueConfiguration(address).setAddress(address)); ClientProducer producer = session.createProducer(address); 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 ee40a9cd01..fa6be87339 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 @@ -173,7 +173,7 @@ public class PageCountSyncOnNonTXTest extends SpawnedTestBase { locator = createNettyNonHALocator(); try { - Queue queue = server.locateQueue(new SimpleString(QUEUE_NAME)); + Queue queue = server.locateQueue(SimpleString.of(QUEUE_NAME)); assertNotNull(queue); 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 a49084ca0e..ea0d001ea5 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 @@ -100,8 +100,8 @@ public class PagingCounterTest extends ActiveMQTestBase { ClientSession session = sf.createSession(); try { - server.addAddressInfo(new AddressInfo(new SimpleString("A1"), RoutingType.ANYCAST)); - Queue queue = server.createQueue(new QueueConfiguration(new SimpleString("A1")).setRoutingType(RoutingType.ANYCAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("A1"), RoutingType.ANYCAST)); + Queue queue = server.createQueue(new QueueConfiguration(SimpleString.of("A1")).setRoutingType(RoutingType.ANYCAST)); PageSubscriptionCounter counter = locateCounter(queue); @@ -131,8 +131,8 @@ public class PagingCounterTest extends ActiveMQTestBase { AtomicInteger errors = new AtomicInteger(0); try { - server.addAddressInfo(new AddressInfo(new SimpleString("A1"), RoutingType.ANYCAST)); - Queue queue = server.createQueue(new QueueConfiguration(new SimpleString("A1")).setRoutingType(RoutingType.ANYCAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("A1"), RoutingType.ANYCAST)); + Queue queue = server.createQueue(new QueueConfiguration(SimpleString.of("A1")).setRoutingType(RoutingType.ANYCAST)); final PageSubscriptionCounter counter = locateCounter(queue); @@ -199,8 +199,8 @@ public class PagingCounterTest extends ActiveMQTestBase { ClientSession session = sf.createSession(); try { - server.addAddressInfo(new AddressInfo(new SimpleString("A1"), RoutingType.ANYCAST)); - Queue queue = server.createQueue(new QueueConfiguration(new SimpleString("A1")).setRoutingType(RoutingType.ANYCAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("A1"), RoutingType.ANYCAST)); + Queue queue = server.createQueue(new QueueConfiguration(SimpleString.of("A1")).setRoutingType(RoutingType.ANYCAST)); final PageSubscriptionCounter counter = locateCounter(queue); @@ -263,8 +263,8 @@ public class PagingCounterTest extends ActiveMQTestBase { ClientSession session = sf.createSession(); try { - server.addAddressInfo(new AddressInfo(new SimpleString("A1"), RoutingType.ANYCAST)); - Queue queue = server.createQueue(new QueueConfiguration(new SimpleString("A1")).setRoutingType(RoutingType.ANYCAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("A1"), RoutingType.ANYCAST)); + Queue queue = server.createQueue(new QueueConfiguration(SimpleString.of("A1")).setRoutingType(RoutingType.ANYCAST)); PageSubscriptionCounter counter = locateCounter(queue); @@ -300,7 +300,7 @@ public class PagingCounterTest extends ActiveMQTestBase { server.start(); - queue = server.locateQueue(new SimpleString("A1")); + queue = server.locateQueue(SimpleString.of("A1")); assertNotNull(queue); @@ -327,8 +327,8 @@ public class PagingCounterTest extends ActiveMQTestBase { try { - server.addAddressInfo(new AddressInfo(new SimpleString("A1"), RoutingType.ANYCAST)); - Queue queue = server.createQueue(new QueueConfiguration(new SimpleString("A1")).setRoutingType(RoutingType.ANYCAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("A1"), RoutingType.ANYCAST)); + Queue queue = server.createQueue(new QueueConfiguration(SimpleString.of("A1")).setRoutingType(RoutingType.ANYCAST)); PageSubscriptionCounter counter = locateCounter(queue); @@ -365,7 +365,7 @@ public class PagingCounterTest extends ActiveMQTestBase { server.start(); - queue = server.locateQueue(new SimpleString("A1")); + queue = server.locateQueue(SimpleString.of("A1")); assertNotNull(queue); @@ -382,8 +382,8 @@ 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 QueueConfiguration(new SimpleString("A1")).setRoutingType(RoutingType.ANYCAST)); + server.addAddressInfo(new AddressInfo(SimpleString.of("A1"), RoutingType.ANYCAST)); + Queue queue = server.createQueue(new QueueConfiguration(SimpleString.of("A1")).setRoutingType(RoutingType.ANYCAST)); PageSubscriptionCounter counter = locateCounter(queue); @@ -411,7 +411,7 @@ public class PagingCounterTest extends ActiveMQTestBase { server.start(); - queue = server.locateQueue(new SimpleString("A1")); + queue = server.locateQueue(SimpleString.of("A1")); assertNotNull(queue); @@ -447,7 +447,7 @@ public class PagingCounterTest extends ActiveMQTestBase { * @throws Exception */ private PageSubscriptionCounter locateCounter(Queue queue) throws Exception { - PageSubscription subscription = server.getPagingManager().getPageStore(new SimpleString("A1")).getCursorProvider().getSubscription(queue.getID()); + PageSubscription subscription = server.getPagingManager().getPageStore(SimpleString.of("A1")).getCursorProvider().getSubscription(queue.getID()); PageSubscriptionCounter counter = subscription.getCounter(); return counter; @@ -457,7 +457,7 @@ public class PagingCounterTest extends ActiveMQTestBase { public void testCommitCounter() throws Exception { Xid xid = newXID(); - Queue queue = server.createQueue(new QueueConfiguration(new SimpleString("A1")).setRoutingType(RoutingType.ANYCAST)); + Queue queue = server.createQueue(new QueueConfiguration(SimpleString.of("A1")).setRoutingType(RoutingType.ANYCAST)); PageSubscriptionCounter counter = locateCounter(queue); @@ -485,7 +485,7 @@ public class PagingCounterTest extends ActiveMQTestBase { server.start(); - queue = server.locateQueue(new SimpleString("A1")); + queue = server.locateQueue(SimpleString.of("A1")); assertNotNull(queue); @@ -498,7 +498,7 @@ public class PagingCounterTest extends ActiveMQTestBase { @Test public void testSendNoRebuild() throws Exception { - Queue queue = server.createQueue(new QueueConfiguration(new SimpleString("A1")).setRoutingType(RoutingType.ANYCAST)); + Queue queue = server.createQueue(new QueueConfiguration(SimpleString.of("A1")).setRoutingType(RoutingType.ANYCAST)); queue.getPagingStore().startPaging(); @@ -522,7 +522,7 @@ public class PagingCounterTest extends ActiveMQTestBase { server.start(); - queue = server.locateQueue(new SimpleString("A1")); + queue = server.locateQueue(SimpleString.of("A1")); assertNotNull(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 87e6fb81ef..7ad0e08845 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 @@ -75,7 +75,7 @@ public class PagingOrderTest extends ActiveMQTestBase { private static final int PAGE_SIZE = 10 * 1024; - static final SimpleString ADDRESS = new SimpleString("TestQueue"); + static final SimpleString ADDRESS = SimpleString.of("TestQueue"); private Connection conn; @@ -119,7 +119,7 @@ public class PagingOrderTest extends ActiveMQTestBase { bodyLocal.writeBytes(body); - message.putIntProperty(new SimpleString("id"), i); + message.putIntProperty(SimpleString.of("id"), i); producer.send(message); if (i % 1000 == 0) { @@ -192,7 +192,7 @@ public class PagingOrderTest extends ActiveMQTestBase { server.addAddressInfo(new AddressInfo(ADDRESS, RoutingType.ANYCAST)); Queue q1 = server.createQueue(new QueueConfiguration(ADDRESS)); - Queue q2 = server.createQueue(new QueueConfiguration(new SimpleString("inactive")).setAddress(ADDRESS).setRoutingType(RoutingType.MULTICAST)); + Queue q2 = server.createQueue(new QueueConfiguration(SimpleString.of("inactive")).setAddress(ADDRESS).setRoutingType(RoutingType.MULTICAST)); ClientProducer producer = session.createProducer(ADDRESS); @@ -242,7 +242,7 @@ public class PagingOrderTest extends ActiveMQTestBase { bodyLocal.writeBytes(body); - message.putIntProperty(new SimpleString("id"), i); + message.putIntProperty(SimpleString.of("id"), i); producer.send(message); if (i % 20 == 0) { @@ -281,7 +281,7 @@ public class PagingOrderTest extends ActiveMQTestBase { q1 = qb.getQueue(); } - if (qb.getQueue().getName().equals(new SimpleString("inactive"))) { + if (qb.getQueue().getName().equals(SimpleString.of("inactive"))) { q2 = qb.getQueue(); } } @@ -326,7 +326,7 @@ public class PagingOrderTest extends ActiveMQTestBase { server.addAddressInfo(new AddressInfo(ADDRESS, RoutingType.ANYCAST)); Queue q1 = server.createQueue(new QueueConfiguration(ADDRESS)); - Queue q2 = server.createQueue(new QueueConfiguration(new SimpleString("inactive")).setAddress(ADDRESS).setRoutingType(RoutingType.MULTICAST)); + Queue q2 = server.createQueue(new QueueConfiguration(SimpleString.of("inactive")).setAddress(ADDRESS).setRoutingType(RoutingType.MULTICAST)); ClientProducer producer = session.createProducer(ADDRESS); @@ -372,7 +372,7 @@ public class PagingOrderTest extends ActiveMQTestBase { bodyLocal.writeBytes(body); - message.putIntProperty(new SimpleString("id"), i); + message.putIntProperty(SimpleString.of("id"), i); producer.send(message); if (i % 20 == 0) { @@ -437,7 +437,7 @@ public class PagingOrderTest extends ActiveMQTestBase { bodyLocal.writeBytes(body); - message.putIntProperty(new SimpleString("id"), i); + message.putIntProperty(SimpleString.of("id"), i); producer.send(message); if (i % 1000 == 0) { @@ -522,7 +522,7 @@ public class PagingOrderTest extends ActiveMQTestBase { bodyLocal.writeBytes(body); - message.putIntProperty(new SimpleString("id"), i); + message.putIntProperty(SimpleString.of("id"), i); producer.send(message); if (i % 1000 == 0) { @@ -621,10 +621,10 @@ public class PagingOrderTest extends ActiveMQTestBase { jmsServer.createTopic(true, "tt", "/topic/TT"); AddressSettings addressSettings = new AddressSettings(); - addressSettings.setDeadLetterAddress(SimpleString.toSimpleString("DLQ")).setExpiryAddress(SimpleString.toSimpleString("DLQ")).setExpiryDelay(-1L).setMaxDeliveryAttempts(5) - .setMaxSizeBytes(1024 * 1024).setPageSizeBytes(1024 * 10).setPageCacheMaxSize(5).setRedeliveryDelay(5).setRedeliveryMultiplier(1L) - .setMaxRedeliveryDelay(1000).setRedistributionDelay(0).setSendToDLAOnNoRoute(false).setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE).setSlowConsumerThreshold(-1) - .setSlowConsumerCheckPeriod(10L).setSlowConsumerPolicy(SlowConsumerPolicy.KILL); + addressSettings.setDeadLetterAddress(SimpleString.of("DLQ")).setExpiryAddress(SimpleString.of("DLQ")).setExpiryDelay(-1L).setMaxDeliveryAttempts(5) + .setMaxSizeBytes(1024 * 1024).setPageSizeBytes(1024 * 10).setPageCacheMaxSize(5).setRedeliveryDelay(5).setRedeliveryMultiplier(1L) + .setMaxRedeliveryDelay(1000).setRedistributionDelay(0).setSendToDLAOnNoRoute(false).setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE).setSlowConsumerThreshold(-1) + .setSlowConsumerCheckPeriod(10L).setSlowConsumerPolicy(SlowConsumerPolicy.KILL); server.getActiveMQServerControl().addAddressSettings("TT", addressSettings.toJSON()); @@ -641,7 +641,7 @@ public class PagingOrderTest extends ActiveMQTestBase { TextMessage txt = sess.createTextMessage("TST"); prod.send(txt); - PagingStore store = server.getPagingManager().getPageStore(new SimpleString("TT")); + PagingStore store = server.getPagingManager().getPageStore(SimpleString.of("TT")); assertEquals(1024 * 1024, store.getMaxSize()); assertEquals(10 * 1024, store.getPageSizeBytes()); @@ -661,7 +661,7 @@ public class PagingOrderTest extends ActiveMQTestBase { assertEquals(10 * 1024, settings.getPageSizeBytes()); assertEquals(AddressFullMessagePolicy.PAGE, settings.getAddressFullMessagePolicy()); - store = server.getPagingManager().getPageStore(new SimpleString("TT")); + store = server.getPagingManager().getPageStore(SimpleString.of("TT")); conn.close(); @@ -683,10 +683,10 @@ public class PagingOrderTest extends ActiveMQTestBase { jmsServer.start(); AddressSettings addressSettings = new AddressSettings(); - addressSettings.setDeadLetterAddress(SimpleString.toSimpleString("DLQ")).setExpiryAddress(SimpleString.toSimpleString("DLQ")).setExpiryDelay(-1L).setMaxDeliveryAttempts(5) - .setMaxSizeBytes(100 * 1024).setPageSizeBytes(1024 * 10).setPageCacheMaxSize(5).setRedeliveryDelay(5).setRedeliveryMultiplier(1L) - .setMaxRedeliveryDelay(1000).setRedistributionDelay(0).setSendToDLAOnNoRoute(false).setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE).setSlowConsumerThreshold(-1) - .setSlowConsumerCheckPeriod(10L).setSlowConsumerPolicy(SlowConsumerPolicy.KILL); + addressSettings.setDeadLetterAddress(SimpleString.of("DLQ")).setExpiryAddress(SimpleString.of("DLQ")).setExpiryDelay(-1L).setMaxDeliveryAttempts(5) + .setMaxSizeBytes(100 * 1024).setPageSizeBytes(1024 * 10).setPageCacheMaxSize(5).setRedeliveryDelay(5).setRedeliveryMultiplier(1L) + .setMaxRedeliveryDelay(1000).setRedistributionDelay(0).setSendToDLAOnNoRoute(false).setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE).setSlowConsumerThreshold(-1) + .setSlowConsumerCheckPeriod(10L).setSlowConsumerPolicy(SlowConsumerPolicy.KILL); server.getActiveMQServerControl().addAddressSettings("Q1", addressSettings.toJSON()); @@ -709,7 +709,7 @@ public class PagingOrderTest extends ActiveMQTestBase { prod.send(bmt); } - PagingStore store = server.getPagingManager().getPageStore(new SimpleString("Q1")); + PagingStore store = server.getPagingManager().getPageStore(SimpleString.of("Q1")); assertEquals(100 * 1024, store.getMaxSize()); assertEquals(10 * 1024, store.getPageSizeBytes()); @@ -731,7 +731,7 @@ public class PagingOrderTest extends ActiveMQTestBase { assertEquals(10 * 1024, settings.getPageSizeBytes()); assertEquals(AddressFullMessagePolicy.PAGE, settings.getAddressFullMessagePolicy()); - store = server.getPagingManager().getPageStore(new SimpleString("Q1")); + store = server.getPagingManager().getPageStore(SimpleString.of("Q1")); assertEquals(100 * 1024, store.getMaxSize()); assertEquals(10 * 1024, store.getPageSizeBytes()); assertEquals(AddressFullMessagePolicy.PAGE, store.getAddressFullMessagePolicy()); 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 73b41883b3..bde54b84c8 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 @@ -43,7 +43,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; public class PagingReceiveTest extends ActiveMQTestBase { - private static final SimpleString ADDRESS = new SimpleString("catalog-service.price.change.bm"); + private static final SimpleString ADDRESS = SimpleString.of("catalog-service.price.change.bm"); private ActiveMQServer server; 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 2a30bdc9b4..2169bfb330 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 @@ -49,7 +49,7 @@ import org.junit.jupiter.api.Test; public class PagingSendTest extends ActiveMQTestBase { - public static final SimpleString ADDRESS = new SimpleString("SimpleAddress"); + public static final SimpleString ADDRESS = SimpleString.of("SimpleAddress"); private ServerLocator locator; @@ -219,7 +219,7 @@ public class PagingSendTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, false); // Create a queue - SimpleString queueAddr = new SimpleString("testQueue"); + SimpleString queueAddr = SimpleString.of("testQueue"); session.createQueue(new QueueConfiguration(queueAddr)); // Set up paging on the queue address @@ -265,7 +265,7 @@ public class PagingSendTest extends ActiveMQTestBase { ClientSession session = sf.createSession(false, false); // Create a queue - SimpleString queueAddr = new SimpleString("testQueue"); + SimpleString queueAddr = SimpleString.of("testQueue"); session.createQueue(new QueueConfiguration(queueAddr)); // Set up paging on the queue address 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 71eb167d6c..fda1623527 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 @@ -48,7 +48,7 @@ public class PagingSyncTest extends ActiveMQTestBase { - static final SimpleString ADDRESS = new SimpleString("TestQueue"); + static final SimpleString ADDRESS = SimpleString.of("TestQueue"); @Test public void testOrder1() throws Throwable { @@ -90,7 +90,7 @@ public class PagingSyncTest extends ActiveMQTestBase { bodyLocal.writeBytes(body); - message.putIntProperty(new SimpleString("id"), i); + message.putIntProperty(SimpleString.of("id"), i); producer.send(message); } 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 8f16641a88..f8d5a6e54e 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 @@ -267,7 +267,7 @@ public class PagingWithFailoverAndCountersTest extends ActiveMQTestBase { e.printStackTrace(); fail(e.getMessage()); } - Queue queue2 = inProcessBackup.getServer().locateQueue(SimpleString.toSimpleString("cons2")); + Queue queue2 = inProcessBackup.getServer().locateQueue(SimpleString.of("cons2")); while (isRunning(1)) { long count = getMessageCount(queue2); @@ -349,7 +349,7 @@ public class PagingWithFailoverAndCountersTest extends ActiveMQTestBase { server.start(); waitForServerToStart(server); - Queue queue = server.locateQueue(SimpleString.toSimpleString("cons2")); + Queue queue = server.locateQueue(SimpleString.of("cons2")); int messageCount = getMessageCount(queue); 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 7942986235..a8d779bded 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 @@ -69,7 +69,7 @@ public class TestDeadlockOnPurgePagingTest extends ActiveMQTestBase { server.start(); String queue = "purgeQueue"; - SimpleString ssQueue = new SimpleString(queue); + SimpleString ssQueue = SimpleString.of(queue); server.addAddressInfo(new AddressInfo(ssQueue, RoutingType.ANYCAST)); QueueImpl purgeQueue = (QueueImpl) server.createQueue(new QueueConfiguration(ssQueue).setRoutingType(RoutingType.ANYCAST).setMaxConsumers(1).setPurgeOnNoConsumers(true).setAutoCreateAddress(false)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/AddressInfoRestartTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/AddressInfoRestartTest.java index 43b455624c..f8fde12b0a 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/AddressInfoRestartTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/AddressInfoRestartTest.java @@ -33,8 +33,8 @@ public class AddressInfoRestartTest extends ActiveMQTestBase { server.start(); - SimpleString address = new SimpleString("test.address"); - SimpleString queue = new SimpleString("test.queue"); + SimpleString address = SimpleString.of("test.address"); + SimpleString queue = SimpleString.of("test.queue"); server.createQueue(new QueueConfiguration(queue).setAddress(address)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/AddressSettingsConfigurationStorageTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/AddressSettingsConfigurationStorageTest.java index 14b5f54d9b..46060901e4 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/AddressSettingsConfigurationStorageTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/AddressSettingsConfigurationStorageTest.java @@ -54,7 +54,7 @@ public class AddressSettingsConfigurationStorageTest extends StorageManagerTestB } protected void addAddress(StorageManager journal1, String address, AddressSettings setting) throws Exception { - SimpleString str = new SimpleString(address); + SimpleString str = SimpleString.of(address); PersistedAddressSettingJSON persistedSetting = new PersistedAddressSettingJSON(str, setting, setting.toJSON()); mapExpectedAddresses.put(str, persistedSetting); journal1.storeAddressSetting(persistedSetting); @@ -66,7 +66,7 @@ public class AddressSettingsConfigurationStorageTest extends StorageManagerTestB AddressSettings setting = new AddressSettings(); - setting = new AddressSettings().setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK).setDeadLetterAddress(new SimpleString("some-test")); + setting = new AddressSettings().setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK).setDeadLetterAddress(SimpleString.of("some-test")); addAddress(journal, "a2", setting); @@ -76,7 +76,7 @@ public class AddressSettingsConfigurationStorageTest extends StorageManagerTestB checkAddresses(journal); - setting = new AddressSettings().setDeadLetterAddress(new SimpleString("new-adddress")); + setting = new AddressSettings().setDeadLetterAddress(SimpleString.of("new-adddress")); // Replacing the first setting addAddress(journal, "a1", setting); 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 b0a835d494..9fe3815646 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 @@ -81,8 +81,8 @@ public class ConfigChangeTest extends ActiveMQTestBase { addressConfigurations.add(addressConfiguration); configuration.setAddressConfigurations(addressConfigurations); server.start(); - assertEquals(RoutingType.MULTICAST, server.getAddressInfo(SimpleString.toSimpleString("myAddress")).getRoutingType()); - assertEquals(RoutingType.MULTICAST, server.locateQueue(SimpleString.toSimpleString("myQueue")).getRoutingType()); + assertEquals(RoutingType.MULTICAST, server.getAddressInfo(SimpleString.of("myAddress")).getRoutingType()); + assertEquals(RoutingType.MULTICAST, server.locateQueue(SimpleString.of("myQueue")).getRoutingType()); //Ensures the queue isnt detroyed by checking message sent before change is consumable after (e.g. no message loss) try (JMSContext context = connectionFactory.createContext()) { @@ -119,7 +119,7 @@ public class ConfigChangeTest extends ActiveMQTestBase { context.createProducer().setProperty("x", "x").send(context.createQueue("myAddress"), "hello"); } - long originalBindingId = server.getPostOffice().getBinding(SimpleString.toSimpleString("myQueue")).getID(); + long originalBindingId = server.getPostOffice().getBinding(SimpleString.of("myQueue")).getID(); server.stop(); @@ -135,7 +135,7 @@ public class ConfigChangeTest extends ActiveMQTestBase { configuration.setAddressConfigurations(addressConfigurations); server.start(); - assertEquals(filter2, server.locateQueue(SimpleString.toSimpleString("myQueue")).getFilter().getFilterString().toString()); + assertEquals(filter2, server.locateQueue(SimpleString.of("myQueue")).getFilter().getFilterString().toString()); //Ensures the queue is not destroyed by checking message sent before change is consumable after (e.g. no message loss) try (JMSContext context = connectionFactory.createContext()) { @@ -143,7 +143,7 @@ public class ConfigChangeTest extends ActiveMQTestBase { assertEquals("hello", ((TextMessage) message).getText()); } - long bindingId = server.getPostOffice().getBinding(SimpleString.toSimpleString("myQueue")).getID(); + long bindingId = server.getPostOffice().getBinding(SimpleString.of("myQueue")).getID(); assertEquals(originalBindingId, bindingId, "Ensure the original queue is not destroyed by checking the binding id is the same"); server.stop(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/DeleteMessagesOnStartupTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/DeleteMessagesOnStartupTest.java index fae767bb4f..4e8941ce64 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/DeleteMessagesOnStartupTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/DeleteMessagesOnStartupTest.java @@ -63,7 +63,7 @@ public class DeleteMessagesOnStartupTest extends StorageManagerTestBase { public void testDeleteMessagesOnStartup() throws Exception { createStorage(); - Queue theQueue = new FakeQueue(new SimpleString("")); + Queue theQueue = new FakeQueue(SimpleString.of("")); HashMap queues = new HashMap<>(); queues.put(100L, theQueue); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/DuplicateCacheTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/DuplicateCacheTest.java index 441fef7cb6..4eb9e1fb09 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/DuplicateCacheTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/DuplicateCacheTest.java @@ -53,7 +53,7 @@ public class DuplicateCacheTest extends StorageManagerTestBase { public void testDuplicate() throws Exception { createStorage(); - DuplicateIDCache cache = DuplicateIDCaches.persistent(new SimpleString("test"), 2000, journal); + DuplicateIDCache cache = DuplicateIDCaches.persistent(SimpleString.of("test"), 2000, journal); TransactionImpl tx = new TransactionImpl(journal); @@ -109,7 +109,7 @@ public class DuplicateCacheTest extends StorageManagerTestBase { public void testDuplicateNonPersistent() throws Exception { createStorage(); - DuplicateIDCache cache = DuplicateIDCaches.inMemory(new SimpleString("test"), 2000); + DuplicateIDCache cache = DuplicateIDCaches.inMemory(SimpleString.of("test"), 2000); TransactionImpl tx = new TransactionImpl(journal); @@ -133,7 +133,7 @@ public class DuplicateCacheTest extends StorageManagerTestBase { @TestTemplate public void testDisabledPersistentCache() throws Exception { createStorage(); - DuplicateIDCache cache = DuplicateIDCaches.persistent(new SimpleString("test"), 0, journal); + DuplicateIDCache cache = DuplicateIDCaches.persistent(SimpleString.of("test"), 0, journal); byte[] bytes = RandomUtil.randomBytes(); // Previously this would throw an ArrayIndexOutOfBoundsException cache.addToCache(bytes); @@ -142,7 +142,7 @@ public class DuplicateCacheTest extends StorageManagerTestBase { @TestTemplate public void testDisabledInMemoryCache() throws Exception { createStorage(); - DuplicateIDCache cache = DuplicateIDCaches.inMemory(new SimpleString("test"), 0); + DuplicateIDCache cache = DuplicateIDCaches.inMemory(SimpleString.of("test"), 0); byte[] bytes = RandomUtil.randomBytes(); // Previously this would throw an ArrayIndexOutOfBoundsException cache.addToCache(bytes); 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 5d782b69b4..c50dc71489 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 @@ -41,8 +41,8 @@ public class QueueConfigRestartTest extends ActiveMQTestBase { server.start(); - SimpleString address = new SimpleString("test.address"); - SimpleString queue = new SimpleString("test.queue"); + SimpleString address = SimpleString.of("test.address"); + SimpleString queue = SimpleString.of("test.queue"); server.createQueue(new QueueConfiguration(queue).setAddress(address).setMaxConsumers(10).setPurgeOnNoConsumers(true)); @@ -63,8 +63,8 @@ public class QueueConfigRestartTest extends ActiveMQTestBase { server.start(); - SimpleString address = new SimpleString("test.address"); - SimpleString queue = new SimpleString("test.queue"); + SimpleString address = SimpleString.of("test.address"); + SimpleString queue = SimpleString.of("test.queue"); server.createQueue(new QueueConfiguration(queue).setAddress(address).setMaxConsumers(10).setPurgeOnNoConsumers(true).setExclusive(true).setLastValue(true)); @@ -85,8 +85,8 @@ public class QueueConfigRestartTest extends ActiveMQTestBase { server.start(); - SimpleString address = new SimpleString("test.address"); - SimpleString queue = new SimpleString("test.queue"); + SimpleString address = SimpleString.of("test.address"); + SimpleString queue = SimpleString.of("test.queue"); server.createQueue(new QueueConfiguration(queue).setAddress(address).setMaxConsumers(10).setPurgeOnNoConsumers(true).setExclusive(true).setLastValue(true)); @@ -108,8 +108,8 @@ public class QueueConfigRestartTest extends ActiveMQTestBase { server.start(); - SimpleString address = new SimpleString("test.address"); - SimpleString queue = new SimpleString("test.queue"); + SimpleString address = SimpleString.of("test.address"); + SimpleString queue = SimpleString.of("test.queue"); server.createQueue(new QueueConfiguration(queue).setAddress(address).setMaxConsumers(10).setPurgeOnNoConsumers(true).setExclusive(true).setConsumersBeforeDispatch(consumersBeforeDispatch)); @@ -131,8 +131,8 @@ public class QueueConfigRestartTest extends ActiveMQTestBase { server.start(); - SimpleString address = new SimpleString("test.address"); - SimpleString queue = new SimpleString("test.queue"); + SimpleString address = SimpleString.of("test.address"); + SimpleString queue = SimpleString.of("test.queue"); server.createQueue(new QueueConfiguration(queue).setAddress(address).setMaxConsumers(10).setPurgeOnNoConsumers(true).setExclusive(true).setDelayBeforeDispatch(delayBeforeDispatch)); @@ -154,13 +154,13 @@ public class QueueConfigRestartTest extends ActiveMQTestBase { server.start(); - SimpleString address = new SimpleString("test.address"); - SimpleString queue = new SimpleString("test.queue"); + SimpleString address = SimpleString.of("test.address"); + SimpleString queue = SimpleString.of("test.queue"); server.createQueue(new QueueConfiguration(queue).setAddress(address).setUser("bob").setMaxConsumers(10).setPurgeOnNoConsumers(true)); QueueBinding queueBinding1 = (QueueBinding)server.getPostOffice().getBinding(queue); - assertEquals(SimpleString.toSimpleString("bob"), queueBinding1.getQueue().getUser()); + assertEquals(SimpleString.of("bob"), queueBinding1.getQueue().getUser()); server.stop(); @@ -176,8 +176,8 @@ public class QueueConfigRestartTest extends ActiveMQTestBase { server.start(); - SimpleString address = new SimpleString("test.address"); - SimpleString queue = new SimpleString("test.queue"); + SimpleString address = SimpleString.of("test.address"); + SimpleString queue = SimpleString.of("test.queue"); server.createQueue(new QueueConfiguration(queue).setAddress(address).setEnabled(true)); @@ -198,8 +198,8 @@ public class QueueConfigRestartTest extends ActiveMQTestBase { server.start(); - SimpleString address = new SimpleString("test.address"); - SimpleString queue = new SimpleString("test.queue"); + SimpleString address = SimpleString.of("test.address"); + SimpleString queue = SimpleString.of("test.queue"); server.createQueue(new QueueConfiguration(queue).setAddress(address).setEnabled(false)); 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 379aee11d5..377166771f 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 @@ -222,7 +222,7 @@ public class SyncSendTest extends ActiveMQTestBase { fail("Messages are being acked too fast! Faster than the disk would be able to sync!"); } - org.apache.activemq.artemis.core.server.Queue serverQueue = server.locateQueue(SimpleString.toSimpleString("queue")); + org.apache.activemq.artemis.core.server.Queue serverQueue = server.locateQueue(SimpleString.of("queue")); Wait.assertEquals(0, serverQueue::getMessageCount); Wait.assertEquals(0, serverQueue::getDeliveringCount); } finally { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/XmlImportExportRbacTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/XmlImportExportRbacTest.java index 1ea69e5253..e9cec03ba2 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/XmlImportExportRbacTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/XmlImportExportRbacTest.java @@ -152,7 +152,7 @@ public class XmlImportExportRbacTest extends ActiveMQTestBase { assertEquals(0L, queue.getMessageCount()); // try again with permission - server.getSecurityRepository().addMatch(SimpleString.toSimpleString(server.getConfiguration().getManagementRbacPrefix()).concat(".queue." + QUEUE_NAME + ".getID").toString(), permissionsOnManagementAddress); // for send to manage address + server.getSecurityRepository().addMatch(SimpleString.of(server.getConfiguration().getManagementRbacPrefix()).concat(".queue." + QUEUE_NAME + ".getID").toString(), permissionsOnManagementAddress); // for send to manage address xmlInputStream = new ByteArrayInputStream(xmlOutputStream.toByteArray()); xmlDataImporter = new XmlDataImporter(); 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 6840430ce8..e4d5a7755c 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 @@ -141,8 +141,8 @@ public class XmlImportExportTest extends ActiveMQTestBase { msg.putStringProperty("myNullStringProperty", null); msg.putStringProperty("myNonAsciiStringProperty", international.toString()); msg.putStringProperty("mySpecialCharacters", special); - msg.putStringProperty(new SimpleString("mySimpleStringProperty"), new SimpleString("mySimpleStringPropertyValue_" + i)); - msg.putStringProperty(new SimpleString("myNullSimpleStringProperty"), (SimpleString) null); + msg.putStringProperty(SimpleString.of("mySimpleStringProperty"), SimpleString.of("mySimpleStringPropertyValue_" + i)); + msg.putStringProperty(SimpleString.of("myNullSimpleStringProperty"), (SimpleString) null); producer.send(msg); } @@ -188,16 +188,16 @@ public class XmlImportExportTest extends ActiveMQTestBase { assertEquals(i, msg.getIntProperty("myIntProperty").intValue()); assertEquals(Long.MAX_VALUE - i, msg.getLongProperty("myLongProperty").longValue()); assertEquals(i, msg.getObjectProperty("myObjectProperty")); - assertTrue(msg.getPropertyNames().contains(SimpleString.toSimpleString("myNullObjectProperty"))); + assertTrue(msg.getPropertyNames().contains(SimpleString.of("myNullObjectProperty"))); assertNull(msg.getObjectProperty("myNullObjectProperty")); assertEquals(Integer.valueOf(i).shortValue(), msg.getShortProperty("myShortProperty").shortValue()); assertEquals("myStringPropertyValue_" + i, msg.getStringProperty("myStringProperty")); - assertTrue(msg.getPropertyNames().contains(SimpleString.toSimpleString("myNullStringProperty"))); + assertTrue(msg.getPropertyNames().contains(SimpleString.of("myNullStringProperty"))); assertNull(msg.getStringProperty("myNullStringProperty")); assertEquals(international.toString(), msg.getStringProperty("myNonAsciiStringProperty")); assertEquals(special, msg.getStringProperty("mySpecialCharacters")); - assertEquals(new SimpleString("mySimpleStringPropertyValue_" + i), msg.getSimpleStringProperty(new SimpleString("mySimpleStringProperty"))); - assertTrue(msg.getPropertyNames().contains(SimpleString.toSimpleString("myNullSimpleStringProperty"))); + assertEquals(SimpleString.of("mySimpleStringPropertyValue_" + i), msg.getSimpleStringProperty(SimpleString.of("mySimpleStringProperty"))); + assertTrue(msg.getPropertyNames().contains(SimpleString.of("myNullSimpleStringProperty"))); assertNull(msg.getSimpleStringProperty("myNullSimpleStringProperty")); } } @@ -463,12 +463,12 @@ public class XmlImportExportTest extends ActiveMQTestBase { xmlInputStream.reset(); xmlDataImporter.process(xmlInputStream, session); - ClientSession.QueueQuery queueQuery = session.queueQuery(new SimpleString("queueName1")); + ClientSession.QueueQuery queueQuery = session.queueQuery(SimpleString.of("queueName1")); assertEquals("addressName1", queueQuery.getAddress().toString()); assertNull(queueQuery.getFilterString()); - queueQuery = session.queueQuery(new SimpleString("queueName2")); + queueQuery = session.queueQuery(SimpleString.of("queueName2")); assertEquals("addressName1", queueQuery.getAddress().toString()); assertEquals("bob", queueQuery.getFilterString().toString()); @@ -1133,7 +1133,7 @@ public class XmlImportExportTest extends ActiveMQTestBase { @TestTemplate public void testRoutingTypes() throws Exception { - SimpleString myAddress = SimpleString.toSimpleString("myAddress"); + SimpleString myAddress = SimpleString.of("myAddress"); ClientSession session = basicSetUp(); EnumSet routingTypes = EnumSet.of(RoutingType.ANYCAST, RoutingType.MULTICAST); @@ -1173,7 +1173,7 @@ public class XmlImportExportTest extends ActiveMQTestBase { @TestTemplate public void testEmptyRoutingTypes() throws Exception { - SimpleString myAddress = SimpleString.toSimpleString("myAddress"); + SimpleString myAddress = SimpleString.of("myAddress"); ClientSession session = basicSetUp(); EnumSet routingTypes = EnumSet.noneOf(RoutingType.class); @@ -1209,10 +1209,10 @@ public class XmlImportExportTest extends ActiveMQTestBase { @TestTemplate public void testImportWrongRoutingType() throws Exception { - SimpleString myAddress = SimpleString.toSimpleString("myAddress"); - SimpleString myQueue = SimpleString.toSimpleString("myQueue"); - SimpleString dla = SimpleString.toSimpleString("DLA"); - SimpleString dlaPrefix = SimpleString.toSimpleString("DLA."); + SimpleString myAddress = SimpleString.of("myAddress"); + SimpleString myQueue = SimpleString.of("myQueue"); + SimpleString dla = SimpleString.of("DLA"); + SimpleString dlaPrefix = SimpleString.of("DLA."); String payload = "myMessagePayload"; server = createServer(true); 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 00fb281aed..d68b387429 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 @@ -62,7 +62,7 @@ public class JournalPendingMessageTest extends AbstractPersistentStatTestSupport @BeforeEach public void setupAddresses() throws Exception { server.getPostOffice() - .addAddressInfo(new AddressInfo(SimpleString.toSimpleString(defaultQueueName), RoutingType.ANYCAST)); + .addAddressInfo(new AddressInfo(SimpleString.of(defaultQueueName), RoutingType.ANYCAST)); server.createQueue(new QueueConfiguration(defaultQueueName).setRoutingType(RoutingType.ANYCAST)); } @@ -494,7 +494,7 @@ public class JournalPendingMessageTest extends AbstractPersistentStatTestSupport protected List getQueues(final String address) throws Exception { final List queues = new ArrayList<>(); - for (Binding binding : server.getPostOffice().getDirectBindings(SimpleString.toSimpleString(address))) { + for (Binding binding : server.getPostOffice().getDirectBindings(SimpleString.of(address))) { if (binding.getType() == BindingType.LOCAL_QUEUE) { LocalQueueBinding queueBinding = (LocalQueueBinding) binding; queues.add(queueBinding.getQueue()); 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 4bdc5955af..80cbb97bb6 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 @@ -189,7 +189,7 @@ public class CorePluginTest extends JMSTestBase { sess.createProducer(queue); conn.close(); - server.destroyQueue(new SimpleString(queue.getQueueName())); + server.destroyQueue(SimpleString.of(queue.getQueueName())); verifier.validatePluginMethodsEquals(2, BEFORE_ADD_ADDRESS, AFTER_ADD_ADDRESS); verifier.validatePluginMethodsEquals(1, BEFORE_CREATE_QUEUE, AFTER_CREATE_QUEUE, BEFORE_DESTROY_QUEUE, @@ -362,12 +362,12 @@ public class CorePluginTest extends JMSTestBase { ClientSession session0 = sf0.createSession(false, true, true); ClientSession session1 = sf1.createSession(false, true, true); - ClientProducer producer0 = session0.createProducer(new SimpleString(testAddress)); + ClientProducer producer0 = session0.createProducer(SimpleString.of(testAddress)); ClientConsumer consumer1 = session1.createConsumer(queueName1); session1.start(); final byte[] bytes = new byte[messageSize]; - final SimpleString propKey = new SimpleString("testkey"); + final SimpleString propKey = SimpleString.of("testkey"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session0.createMessage(true); @@ -406,8 +406,8 @@ public class CorePluginTest extends JMSTestBase { @Test public void testUpdateAddress() throws Exception { - server.addOrUpdateAddressInfo(new AddressInfo(SimpleString.toSimpleString("test"), RoutingType.ANYCAST)); - server.addOrUpdateAddressInfo(new AddressInfo(SimpleString.toSimpleString("test"), RoutingType.MULTICAST)); + server.addOrUpdateAddressInfo(new AddressInfo(SimpleString.of("test"), RoutingType.ANYCAST)); + server.addOrUpdateAddressInfo(new AddressInfo(SimpleString.of("test"), RoutingType.MULTICAST)); verifier.validatePluginMethodsEquals(1, BEFORE_UPDATE_ADDRESS, AFTER_UPDATE_ADDRESS); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/FederationBrokerPluginTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/FederationBrokerPluginTest.java index c6075abfc2..dac67a807b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/FederationBrokerPluginTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/FederationBrokerPluginTest.java @@ -122,7 +122,7 @@ public class FederationBrokerPluginTest extends FederatedTestBase { MessageProducer producer1 = session1.createProducer(topic1); assertTrue(Wait.waitFor(() -> getServer(1).getPostOffice().getBindingsForAddress( - SimpleString.toSimpleString(address)).getBindings().size() == 1, 5000, 500)); + SimpleString.of(address)).getBindings().size() == 1, 5000, 500)); verifier0.validatePluginMethodsEquals(1, 5000, 500, BEFORE_CREATE_FEDERATED_QUEUE_CONSUMER, AFTER_CREATE_FEDERATED_QUEUE_CONSUMER, FEDERATED_ADDRESS_CONDITIONAL_CREATE_CONSUMER); @@ -230,7 +230,7 @@ public class FederationBrokerPluginTest extends FederatedTestBase { MessageProducer producer1 = session1.createProducer(topic1); assertFalse(Wait.waitFor(() -> getServer(1).getPostOffice().getBindingsForAddress( - SimpleString.toSimpleString(address)).getBindings().size() > 0, 2000, 500)); + SimpleString.of(address)).getBindings().size() > 0, 2000, 500)); verifier0.validatePluginMethodsEquals(1, 5000, 500, FEDERATED_ADDRESS_CONDITIONAL_CREATE_CONSUMER); verifier0.validatePluginMethodsEquals(0, 5000, 500, BEFORE_CREATE_FEDERATED_QUEUE_CONSUMER, 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 7e21fffbe8..3fa6012e16 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 @@ -246,7 +246,7 @@ public class MetricsPluginTest extends ActiveMQTestBase { assertEquals(data, message.getBodyBuffer().readString()); session.commit(); // force the ack to be committed - assertTrue(Wait.waitFor(() -> server.locateQueue(SimpleString.toSimpleString(queueName)).getMessagesAcknowledged() == 1, 1000, 100)); + assertTrue(Wait.waitFor(() -> server.locateQueue(SimpleString.of(queueName)).getMessagesAcknowledged() == 1, 1000, 100)); consumer.close(); @@ -275,7 +275,7 @@ public class MetricsPluginTest extends ActiveMQTestBase { ClientMessage message = session.createMessage(true); message.getBodyBuffer().writeString(data); long messageCount = 0; - while (!server.getPagingManager().getPageStore(new SimpleString(addressName)).isPaging()) { + while (!server.getPagingManager().getPageStore(SimpleString.of(addressName)).isPaging()) { producer.send(message); messageCount++; } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/ActiveMQRATestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/ActiveMQRATestBase.java index 45e0703f8a..90875de112 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/ActiveMQRATestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/ActiveMQRATestBase.java @@ -56,7 +56,7 @@ public abstract class ActiveMQRATestBase extends JMSTestBase { protected static final String MDBQUEUE = "mdbQueue"; protected static final String DLQ = "dlqQueue"; protected static final String MDBQUEUEPREFIXED = "mdbQueue"; - protected static final SimpleString MDBQUEUEPREFIXEDSIMPLE = new SimpleString("mdbQueue"); + protected static final SimpleString MDBQUEUEPREFIXEDSIMPLE = SimpleString.of("mdbQueue"); @Override @BeforeEach @@ -69,7 +69,7 @@ public abstract class ActiveMQRATestBase extends JMSTestBase { } protected void setupDLQ(int maxDeliveries) { - AddressSettings settings = new AddressSettings().setDeadLetterAddress(SimpleString.toSimpleString(DLQ)).setMaxDeliveryAttempts(maxDeliveries); + AddressSettings settings = new AddressSettings().setDeadLetterAddress(SimpleString.of(DLQ)).setMaxDeliveryAttempts(maxDeliveries); server.getAddressSettingsRepository().addMatch("#", settings); } 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 8784791b20..bb470699aa 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 @@ -117,7 +117,7 @@ public class ResourceAdapterTest extends ActiveMQRATestBase { public void testQueuePrefixWhenUseJndiIsFalse() throws Exception { final String prefix = "jms.queue."; final String destinationName = "test"; - final SimpleString prefixedDestinationName = SimpleString.toSimpleString(prefix + destinationName); + final SimpleString prefixedDestinationName = SimpleString.of(prefix + destinationName); server.createQueue(new QueueConfiguration(prefixedDestinationName).setRoutingType(RoutingType.ANYCAST).setDurable(false)); ActiveMQResourceAdapter ra = new ActiveMQResourceAdapter(); ra.setConnectorClassName(INVM_CONNECTOR_FACTORY); @@ -147,7 +147,7 @@ public class ResourceAdapterTest extends ActiveMQRATestBase { public void testAutoCreateQueuePrefixWhenUseJndiIsFalse() throws Exception { final String prefix = "jms.queue."; final String destinationName = "autocreatedtest"; - final SimpleString prefixedDestinationName = SimpleString.toSimpleString(prefix + destinationName); + final SimpleString prefixedDestinationName = SimpleString.of(prefix + destinationName); ActiveMQResourceAdapter ra = new ActiveMQResourceAdapter(); ra.setConnectorClassName(INVM_CONNECTOR_FACTORY); ra.start(new BootstrapContext()); @@ -176,7 +176,7 @@ public class ResourceAdapterTest extends ActiveMQRATestBase { public void testTopicPrefixWhenUseJndiIsFalse() throws Exception { final String prefix = "jms.topic."; final String destinationName = "test"; - final SimpleString prefixedDestinationName = SimpleString.toSimpleString(prefix + destinationName); + final SimpleString prefixedDestinationName = SimpleString.of(prefix + destinationName); server.addAddressInfo(new AddressInfo(prefixedDestinationName).addRoutingType(RoutingType.MULTICAST)); ActiveMQResourceAdapter ra = new ActiveMQResourceAdapter(); ra.setConnectorClassName(INVM_CONNECTOR_FACTORY); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/DestroyConsumerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/DestroyConsumerTest.java index a2255755e6..07c78b68ef 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/DestroyConsumerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/DestroyConsumerTest.java @@ -32,7 +32,7 @@ public class DestroyConsumerTest extends ActiveMQTestBase { // ActiveMQServer server = createService(false, false, createDefaultInVMConfig(), new HashMap()); // server.start(); // - // SimpleString queue = new SimpleString("add1"); + // SimpleString queue = SimpleString.of("add1"); // // ClientSessionFactory factory = createInVMFactory(); // 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 cfc0624caf..52907ff85b 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 @@ -99,7 +99,7 @@ public class DirectDeliverTest extends ActiveMQTestBase { session.createQueue(new QueueConfiguration(foo).setRoutingType(RoutingType.ANYCAST)); - Binding binding = server.getPostOffice().getBinding(new SimpleString(foo)); + Binding binding = server.getPostOffice().getBinding(SimpleString.of(foo)); Queue queue = (Queue) binding.getBindable(); 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 42c6690476..5b1a3cc0e1 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 @@ -410,8 +410,8 @@ public class ReconnectTest extends ActiveMQTestBase { ClientSessionFactoryInternal sf = (ClientSessionFactoryInternal) createSessionFactory(locator); ClientSessionInternal session = (ClientSessionInternal)sf.createSession(false, true, true); - SimpleString queueName1 = new SimpleString("my_queue_one"); - SimpleString addressName1 = new SimpleString("my_address_one"); + SimpleString queueName1 = SimpleString.of("my_queue_one"); + SimpleString addressName1 = SimpleString.of("my_address_one"); server.addAddressInfo(new AddressInfo(addressName1, RoutingType.ANYCAST)); server.createQueue(new QueueConfiguration(queueName1).setAddress(addressName1).setRoutingType(RoutingType.ANYCAST)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/compat/HQClientProtocolManagerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/compat/HQClientProtocolManagerTest.java index 0bbdea27b6..ebbe14c25e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/compat/HQClientProtocolManagerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/compat/HQClientProtocolManagerTest.java @@ -66,7 +66,7 @@ public class HQClientProtocolManagerTest extends ActiveMQTestBase { server.start(); //issue a query to make sure session is reconnected. - ClientSession.QueueQuery query = session.queueQuery(new SimpleString("anyvalue")); + ClientSession.QueueQuery query = session.queueQuery(SimpleString.of("anyvalue")); assertFalse(query.isExists()); locator.close(); 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 3ebd56ee55..03960fceb9 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 @@ -139,7 +139,7 @@ public final class ReplicationTest extends ActiveMQTestBase { private ServerLocator locator; private ReplicationManager manager; - private static final SimpleString ADDRESS = new SimpleString("foobar123"); + private static final SimpleString ADDRESS = SimpleString.of("foobar123"); private void setupServer(boolean backup, String... interceptors) throws Exception { this.setupServer(false, backup, null, interceptors); @@ -269,7 +269,7 @@ public final class ReplicationTest extends ActiveMQTestBase { CoreMessage msg = new CoreMessage().initBuffer(1024).setMessageID(1); - SimpleString dummy = new SimpleString("dummy"); + SimpleString dummy = SimpleString.of("dummy"); msg.setAddress(dummy); replicatedJournal.appendAddRecordTransactional(23, 24, (byte) 1, new FakeData()); @@ -300,7 +300,7 @@ public final class ReplicationTest extends ActiveMQTestBase { CoreMessage serverMsg = new CoreMessage(); serverMsg.setMessageID(500); - serverMsg.setAddress(new SimpleString("tttt")); + serverMsg.setAddress(SimpleString.of("tttt")); ActiveMQBuffer buffer = ActiveMQBuffers.dynamicBuffer(100); serverMsg.encodeHeadersAndProperties(buffer.byteBuf()); 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 9ffa39e61f..d1d6fb5bef 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 @@ -239,7 +239,7 @@ public class SharedNothingReplicationFlowControlTest extends ActiveMQTestBase { ClientSession sess = csf.createSession(); sess.createQueue(new QueueConfiguration("flowcontrol").setRoutingType(RoutingType.ANYCAST)); - PagingStore store = liveServer.getPagingManager().getPageStore(SimpleString.toSimpleString("flowcontrol")); + PagingStore store = liveServer.getPagingManager().getPageStore(SimpleString.of("flowcontrol")); store.startPaging(); ClientProducer prod = sess.createProducer("flowcontrol"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/routing/ElasticQueueTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/routing/ElasticQueueTest.java index d74984c06e..5e0b95d3e1 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/routing/ElasticQueueTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/routing/ElasticQueueTest.java @@ -73,7 +73,7 @@ import org.junit.jupiter.api.Timeout; public class ElasticQueueTest extends ActiveMQTestBase { static final String qName = "EQ"; - static final SimpleString qNameSimple = SimpleString.toSimpleString(qName); + static final SimpleString qNameSimple = SimpleString.of(qName); final int base_port = 61616; final Stack workers = new Stack<>(); 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 84e8e89e24..553a07fe32 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 @@ -50,9 +50,9 @@ import org.junit.jupiter.api.Test; public class ScheduledMessageTest extends ActiveMQTestBase { - private final SimpleString atestq = new SimpleString("ascheduledtestq"); + private final SimpleString atestq = SimpleString.of("ascheduledtestq"); - private final SimpleString atestq2 = new SimpleString("ascheduledtestq2"); + private final SimpleString atestq2 = SimpleString.of("ascheduledtestq2"); private Configuration configuration; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/BasicSecurityManagerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/BasicSecurityManagerTest.java index 2d19d717db..fde0cbda1e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/BasicSecurityManagerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/BasicSecurityManagerTest.java @@ -177,9 +177,9 @@ public class BasicSecurityManagerTest extends ActiveMQTestBase { @TestTemplate public void testAuthorizationNegative() throws Exception { - final SimpleString ADDRESS = new SimpleString("address"); - final SimpleString DURABLE_QUEUE = new SimpleString("durableQueue"); - final SimpleString NON_DURABLE_QUEUE = new SimpleString("nonDurableQueue"); + final SimpleString ADDRESS = SimpleString.of("address"); + final SimpleString DURABLE_QUEUE = SimpleString.of("durableQueue"); + final SimpleString NON_DURABLE_QUEUE = SimpleString.of("nonDurableQueue"); ActiveMQServer server = initializeServer(); Set roles = new HashSet<>(); @@ -262,9 +262,9 @@ public class BasicSecurityManagerTest extends ActiveMQTestBase { @TestTemplate public void testAuthorizationPositive() throws Exception { - final SimpleString ADDRESS = new SimpleString("address"); - final SimpleString DURABLE_QUEUE = new SimpleString("durableQueue"); - final SimpleString NON_DURABLE_QUEUE = new SimpleString("nonDurableQueue"); + final SimpleString ADDRESS = SimpleString.of("address"); + final SimpleString DURABLE_QUEUE = SimpleString.of("durableQueue"); + final SimpleString NON_DURABLE_QUEUE = SimpleString.of("nonDurableQueue"); ActiveMQServer server = initializeServer(); Set roles = new HashSet<>(); 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 adf6bb66c4..906f7ddea5 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 @@ -49,7 +49,7 @@ import java.util.Map; public class JMSXUserIDPluginTest extends ActiveMQTestBase { private ActiveMQServer server; - private SimpleString ADDRESS = new SimpleString("TestQueue"); + private SimpleString ADDRESS = SimpleString.of("TestQueue"); @Override @BeforeEach diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/SecurityPerAcceptorJmsTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/SecurityPerAcceptorJmsTest.java index 4ce953dd05..22c3b250a6 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/SecurityPerAcceptorJmsTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/SecurityPerAcceptorJmsTest.java @@ -114,7 +114,7 @@ public class SecurityPerAcceptorJmsTest extends ActiveMQTestBase { @TestTemplate public void testJAASSecurityManagerAuthorizationNegative() throws Exception { - final SimpleString ADDRESS = new SimpleString("address"); + final SimpleString ADDRESS = SimpleString.of("address"); ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager(); ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig().setResolveProtocols(true).addAcceptorConfiguration("netty", "tcp://127.0.0.1:61616?securityDomain=PropertiesLogin").setSecurityEnabled(true), ManagementFactory.getPlatformMBeanServer(), securityManager, false)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/SecurityPerAcceptorTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/SecurityPerAcceptorTest.java index a35485ddc1..fd62e449aa 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/SecurityPerAcceptorTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/SecurityPerAcceptorTest.java @@ -104,9 +104,9 @@ public class SecurityPerAcceptorTest extends ActiveMQTestBase { @TestTemplate public void testJAASSecurityManagerAuthorizationNegative() throws Exception { - final SimpleString ADDRESS = new SimpleString("address"); - final SimpleString DURABLE_QUEUE = new SimpleString("durableQueue"); - final SimpleString NON_DURABLE_QUEUE = new SimpleString("nonDurableQueue"); + final SimpleString ADDRESS = SimpleString.of("address"); + final SimpleString DURABLE_QUEUE = SimpleString.of("durableQueue"); + final SimpleString NON_DURABLE_QUEUE = SimpleString.of("nonDurableQueue"); ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager(); ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig().addAcceptorConfiguration("acceptor", acceptorUrl).setSecurityEnabled(true), ManagementFactory.getPlatformMBeanServer(), securityManager, false)); @@ -190,9 +190,9 @@ public class SecurityPerAcceptorTest extends ActiveMQTestBase { @TestTemplate public void testJAASSecurityManagerAuthorizationPositive() throws Exception { - final SimpleString ADDRESS = new SimpleString("address"); - final SimpleString DURABLE_QUEUE = new SimpleString("durableQueue"); - final SimpleString NON_DURABLE_QUEUE = new SimpleString("nonDurableQueue"); + final SimpleString ADDRESS = SimpleString.of("address"); + final SimpleString DURABLE_QUEUE = SimpleString.of("durableQueue"); + final SimpleString NON_DURABLE_QUEUE = SimpleString.of("nonDurableQueue"); ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager(); ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig().setSecurityEnabled(true).addAcceptorConfiguration("acceptor", acceptorUrl), ManagementFactory.getPlatformMBeanServer(), securityManager, false)); 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 76ff1330f4..dc3669d883 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 @@ -396,9 +396,9 @@ public class SecurityTest extends ActiveMQTestBase { Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); //Add the corresponding addresses to the server - SimpleString address = SimpleString.toSimpleString("test.queue"); + SimpleString address = SimpleString.of("test.queue"); server.addAddressInfo(new AddressInfo(address, RoutingType.ANYCAST)); - SimpleString address2 = SimpleString.toSimpleString("test.topic"); + SimpleString address2 = SimpleString.of("test.topic"); server.addAddressInfo(new AddressInfo(address2, RoutingType.MULTICAST)); //Test queue creation permission @@ -557,9 +557,9 @@ public class SecurityTest extends ActiveMQTestBase { @Test public void testJAASSecurityManagerAuthorizationNegative() throws Exception { - final SimpleString ADDRESS = new SimpleString("address"); - final SimpleString DURABLE_QUEUE = new SimpleString("durableQueue"); - final SimpleString NON_DURABLE_QUEUE = new SimpleString("nonDurableQueue"); + final SimpleString ADDRESS = SimpleString.of("address"); + final SimpleString DURABLE_QUEUE = SimpleString.of("durableQueue"); + final SimpleString NON_DURABLE_QUEUE = SimpleString.of("nonDurableQueue"); ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager("PropertiesLogin"); ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig().setSecurityEnabled(true), ManagementFactory.getPlatformMBeanServer(), securityManager, false)); @@ -661,9 +661,9 @@ public class SecurityTest extends ActiveMQTestBase { } private void internalJAASSecurityManagerAuthorizationSameAddressDifferentQueues(boolean fqqnSyntax) throws Exception { - final SimpleString ADDRESS = new SimpleString("address"); - final SimpleString QUEUE_A = new SimpleString("a"); - final SimpleString QUEUE_B = new SimpleString("b"); + final SimpleString ADDRESS = SimpleString.of("address"); + final SimpleString QUEUE_A = SimpleString.of("a"); + final SimpleString QUEUE_B = SimpleString.of("b"); ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager("PropertiesLogin"); ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig().setSecurityEnabled(true), ManagementFactory.getPlatformMBeanServer(), securityManager, false)); @@ -725,8 +725,8 @@ public class SecurityTest extends ActiveMQTestBase { @Test public void testFallbackConsumerAuthorization() throws Exception { - final SimpleString ADDRESS = new SimpleString("a.c.b"); - final SimpleString QUEUE = new SimpleString("a.c.b"); + final SimpleString ADDRESS = SimpleString.of("a.c.b"); + final SimpleString QUEUE = SimpleString.of("a.c.b"); ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager("PropertiesLogin"); ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig().setSecurityEnabled(true), ManagementFactory.getPlatformMBeanServer(), securityManager, false)); @@ -756,9 +756,9 @@ public class SecurityTest extends ActiveMQTestBase { @Test public void testJAASSecurityManagerFQQNAuthorizationWithJMS() throws Exception { - final SimpleString ADDRESS = new SimpleString("address"); - final SimpleString QUEUE_A = new SimpleString("a"); - final SimpleString QUEUE_B = new SimpleString("b"); + final SimpleString ADDRESS = SimpleString.of("address"); + final SimpleString QUEUE_A = SimpleString.of("a"); + final SimpleString QUEUE_B = SimpleString.of("b"); ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager("PropertiesLogin"); ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig().setSecurityEnabled(true), ManagementFactory.getPlatformMBeanServer(), securityManager, false)); @@ -820,9 +820,9 @@ public class SecurityTest extends ActiveMQTestBase { @Test public void testJAASSecurityManagerAuthorizationNegativeWithCerts() throws Exception { - final SimpleString ADDRESS = new SimpleString("address"); - final SimpleString DURABLE_QUEUE = new SimpleString("durableQueue"); - final SimpleString NON_DURABLE_QUEUE = new SimpleString("nonDurableQueue"); + final SimpleString ADDRESS = SimpleString.of("address"); + final SimpleString DURABLE_QUEUE = SimpleString.of("durableQueue"); + final SimpleString NON_DURABLE_QUEUE = SimpleString.of("nonDurableQueue"); ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager("CertLogin"); ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig().setSecurityEnabled(true), ManagementFactory.getPlatformMBeanServer(), securityManager, false)); @@ -927,9 +927,9 @@ public class SecurityTest extends ActiveMQTestBase { @Test public void testJAASSecurityManagerAuthorizationPositive() throws Exception { - final SimpleString ADDRESS = new SimpleString("address"); - final SimpleString DURABLE_QUEUE = new SimpleString("durableQueue"); - final SimpleString NON_DURABLE_QUEUE = new SimpleString("nonDurableQueue"); + final SimpleString ADDRESS = SimpleString.of("address"); + final SimpleString DURABLE_QUEUE = SimpleString.of("durableQueue"); + final SimpleString NON_DURABLE_QUEUE = SimpleString.of("nonDurableQueue"); ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager("PropertiesLogin"); ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig().setSecurityEnabled(true), ManagementFactory.getPlatformMBeanServer(), securityManager, false)); @@ -1013,9 +1013,9 @@ public class SecurityTest extends ActiveMQTestBase { } protected void testJAASSecurityManagerAuthorizationPositiveWithCerts(String clientAuthPropName) throws Exception { - final SimpleString ADDRESS = new SimpleString("address"); - final SimpleString DURABLE_QUEUE = new SimpleString("durableQueue"); - final SimpleString NON_DURABLE_QUEUE = new SimpleString("nonDurableQueue"); + final SimpleString ADDRESS = SimpleString.of("address"); + final SimpleString DURABLE_QUEUE = SimpleString.of("durableQueue"); + final SimpleString NON_DURABLE_QUEUE = SimpleString.of("nonDurableQueue"); ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager("CertLogin"); ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig().setSecurityEnabled(true), ManagementFactory.getPlatformMBeanServer(), securityManager, false)); @@ -1108,9 +1108,9 @@ public class SecurityTest extends ActiveMQTestBase { @Test public void testJAASSecurityManagerAuthorizationPositiveGuest() throws Exception { - final SimpleString ADDRESS = new SimpleString("address"); - final SimpleString DURABLE_QUEUE = new SimpleString("durableQueue"); - final SimpleString NON_DURABLE_QUEUE = new SimpleString("nonDurableQueue"); + final SimpleString ADDRESS = SimpleString.of("address"); + final SimpleString DURABLE_QUEUE = SimpleString.of("durableQueue"); + final SimpleString NON_DURABLE_QUEUE = SimpleString.of("nonDurableQueue"); ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager("GuestLogin"); ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig().setSecurityEnabled(true), ManagementFactory.getPlatformMBeanServer(), securityManager, false)); @@ -1545,7 +1545,7 @@ public class SecurityTest extends ActiveMQTestBase { cp.send(session.createMessage(false)); session.close(); - Queue binding = (Queue) server.getPostOffice().getBinding(new SimpleString(SecurityTest.queueA)).getBindable(); + Queue binding = (Queue) server.getPostOffice().getBinding(SimpleString.of(SecurityTest.queueA)).getBindable(); assertEquals(0, getMessageCount(binding)); } @@ -1887,7 +1887,7 @@ public class SecurityTest extends ActiveMQTestBase { cp.send(session.createMessage(false)); session.close(); - Queue binding = (Queue) server.getPostOffice().getBinding(new SimpleString(SecurityTest.queueA)).getBindable(); + Queue binding = (Queue) server.getPostOffice().getBinding(SimpleString.of(SecurityTest.queueA)).getBindable(); assertEquals(0, getMessageCount(binding)); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/AddressQueryTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/AddressQueryTest.java index 2b60685a2a..6b97000387 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/AddressQueryTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/AddressQueryTest.java @@ -49,7 +49,7 @@ public class AddressQueryTest extends ActiveMQTestBase { @Test public void testAddressQueryDefaultsOnStaticAddress() throws Exception { - SimpleString addressName = SimpleString.toSimpleString(UUID.randomUUID().toString()); + SimpleString addressName = SimpleString.of(UUID.randomUUID().toString()); server.addAddressInfo(new AddressInfo(addressName)); AddressQueryResult addressQueryResult = server.addressQuery(addressName); assertTrue(addressQueryResult.isExists()); @@ -64,8 +64,8 @@ public class AddressQueryTest extends ActiveMQTestBase { @Test public void testAddressQueryOnStaticAddressWithFQQN() throws Exception { - SimpleString addressName = SimpleString.toSimpleString(UUID.randomUUID().toString()); - SimpleString fqqn = addressName.concat("::").concat(SimpleString.toSimpleString(UUID.randomUUID().toString())); + SimpleString addressName = SimpleString.of(UUID.randomUUID().toString()); + SimpleString fqqn = addressName.concat("::").concat(SimpleString.of(UUID.randomUUID().toString())); server.addAddressInfo(new AddressInfo(fqqn)); assertEquals(addressName, server.addressQuery(addressName).getName()); assertEquals(addressName, server.addressQuery(fqqn).getName()); @@ -73,7 +73,7 @@ public class AddressQueryTest extends ActiveMQTestBase { @Test public void testAddressQueryNonExistentAddress() throws Exception { - SimpleString addressName = SimpleString.toSimpleString(UUID.randomUUID().toString()); + SimpleString addressName = SimpleString.of(UUID.randomUUID().toString()); AddressQueryResult addressQueryResult = server.addressQuery(addressName); assertFalse(addressQueryResult.isExists()); assertEquals(addressName, addressQueryResult.getName()); @@ -81,8 +81,8 @@ public class AddressQueryTest extends ActiveMQTestBase { @Test public void testAddressQueryNonExistentAddressWithFQQN() throws Exception { - SimpleString addressName = SimpleString.toSimpleString(UUID.randomUUID().toString()); - SimpleString fqqn = addressName.concat("::").concat(SimpleString.toSimpleString(UUID.randomUUID().toString())); + SimpleString addressName = SimpleString.of(UUID.randomUUID().toString()); + SimpleString fqqn = addressName.concat("::").concat(SimpleString.of(UUID.randomUUID().toString())); AddressQueryResult addressQueryResult = server.addressQuery(fqqn); assertFalse(addressQueryResult.isExists()); assertEquals(addressName, addressQueryResult.getName()); @@ -90,7 +90,7 @@ public class AddressQueryTest extends ActiveMQTestBase { @Test public void testAddressQueryNonDefaultsOnStaticAddress() throws Exception { - SimpleString addressName = SimpleString.toSimpleString(UUID.randomUUID().toString()); + SimpleString addressName = SimpleString.of(UUID.randomUUID().toString()); server.getAddressSettingsRepository().addMatch(addressName.toString(), new AddressSettings().setAutoCreateAddresses(false).setDefaultMaxConsumers(1).setDefaultPurgeOnNoConsumers(true)); server.addAddressInfo(new AddressInfo(addressName).addRoutingType(RoutingType.ANYCAST)); AddressQueryResult addressQueryResult = server.addressQuery(addressName); @@ -106,7 +106,7 @@ public class AddressQueryTest extends ActiveMQTestBase { @Test public void testAddressQueryDefaultsOnAutoCreatedAddress() throws Exception { - SimpleString addressName = SimpleString.toSimpleString(UUID.randomUUID().toString()); + SimpleString addressName = SimpleString.of(UUID.randomUUID().toString()); server.getAddressSettingsRepository().addMatch(addressName.toString(), new AddressSettings()); ConnectionFactory cf = new ActiveMQConnectionFactory("vm://0"); JMSContext c = cf.createContext(); @@ -124,8 +124,8 @@ public class AddressQueryTest extends ActiveMQTestBase { @Test public void testAddressQueryOnAutoCreatedAddressWithFQQN() throws Exception { - SimpleString addressName = SimpleString.toSimpleString(UUID.randomUUID().toString()); - SimpleString fqqn = addressName.concat("::").concat(SimpleString.toSimpleString(UUID.randomUUID().toString())); + SimpleString addressName = SimpleString.of(UUID.randomUUID().toString()); + SimpleString fqqn = addressName.concat("::").concat(SimpleString.of(UUID.randomUUID().toString())); ConnectionFactory cf = new ActiveMQConnectionFactory("vm://0"); JMSContext c = cf.createContext(); c.createProducer().send(c.createTopic(fqqn.toString()), c.createMessage()); @@ -135,7 +135,7 @@ public class AddressQueryTest extends ActiveMQTestBase { @Test public void testAddressQueryNonDefaultsOnAutoCreatedAddress() throws Exception { - SimpleString addressName = SimpleString.toSimpleString(UUID.randomUUID().toString()); + SimpleString addressName = SimpleString.of(UUID.randomUUID().toString()); server.getAddressSettingsRepository().addMatch(addressName.toString(), new AddressSettings().setAutoCreateAddresses(true).setDefaultMaxConsumers(1).setDefaultPurgeOnNoConsumers(true)); ConnectionFactory cf = new ActiveMQConnectionFactory("vm://0"); JMSContext c = cf.createContext(); 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 161367071c..a25acadee3 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 @@ -46,9 +46,9 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; public class AutoCreateDeadLetterResourcesTest extends ActiveMQTestBase { - public final SimpleString addressA = new SimpleString("addressA"); - public final SimpleString queueA = new SimpleString("queueA"); - public final SimpleString dla = new SimpleString("myDLA"); + public final SimpleString addressA = SimpleString.of("addressA"); + public final SimpleString queueA = SimpleString.of("queueA"); + public final SimpleString dla = SimpleString.of("myDLA"); private ActiveMQServer server; @@ -81,7 +81,7 @@ public class AutoCreateDeadLetterResourcesTest extends ActiveMQTestBase { @Test public void testAutoCreationOfDeadLetterResourcesWithEmptyDLA() throws Exception { - testAutoCreationOfDeadLetterResourcesWithNoDLA(SimpleString.toSimpleString("")); + testAutoCreationOfDeadLetterResourcesWithNoDLA(SimpleString.of("")); } private void testAutoCreationOfDeadLetterResourcesWithNoDLA(SimpleString dla) throws Exception { @@ -235,8 +235,8 @@ public class AutoCreateDeadLetterResourcesTest extends ActiveMQTestBase { @Test public void testMovedMessage() throws Exception { SimpleString dlqName = AddressSettings.DEFAULT_DEAD_LETTER_QUEUE_PREFIX.concat(addressA).concat(AddressSettings.DEFAULT_DEAD_LETTER_QUEUE_SUFFIX); - final SimpleString moveFromAddress = new SimpleString("moveFromAddress"); - final SimpleString moveFromQueue = new SimpleString("moveFromQueue"); + final SimpleString moveFromAddress = SimpleString.of("moveFromAddress"); + final SimpleString moveFromQueue = SimpleString.of("moveFromQueue"); server.createQueue(new QueueConfiguration(moveFromQueue).setAddress(moveFromAddress).setRoutingType(RoutingType.ANYCAST)); server.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setRoutingType(RoutingType.ANYCAST)); 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 3994cf0e97..606f12b3ed 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 @@ -43,9 +43,9 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; public class AutoCreateExpiryResourcesTest extends ActiveMQTestBase { - public final SimpleString addressA = new SimpleString("addressA"); - public final SimpleString queueA = new SimpleString("queueA"); - public final SimpleString expiryAddress = new SimpleString("myExpiry"); + public final SimpleString addressA = SimpleString.of("addressA"); + public final SimpleString queueA = SimpleString.of("queueA"); + public final SimpleString expiryAddress = SimpleString.of("myExpiry"); public final long EXPIRY_DELAY = 100L; private ActiveMQServer server; @@ -79,7 +79,7 @@ public class AutoCreateExpiryResourcesTest extends ActiveMQTestBase { @Test public void testAutoCreationOfExpiryResourcesWithEmptyExpiry() throws Exception { - testAutoCreationOfExpiryResourcesWithNoExpiry(SimpleString.toSimpleString("")); + testAutoCreationOfExpiryResourcesWithNoExpiry(SimpleString.of("")); } private void testAutoCreationOfExpiryResourcesWithNoExpiry(SimpleString expiryAddress) throws Exception { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ConfigurationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ConfigurationTest.java index ab74b2a624..bb508e0f29 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ConfigurationTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ConfigurationTest.java @@ -46,9 +46,9 @@ public class ConfigurationTest extends ActiveMQTestBase { ActiveMQServer server = getActiveMQServer("duplicate-queues.xml"); try { server.start(); - Bindings mytopic_1 = server.getPostOffice().getBindingsForAddress(new SimpleString("mytopic_1")); + Bindings mytopic_1 = server.getPostOffice().getBindingsForAddress(SimpleString.of("mytopic_1")); assertEquals(mytopic_1.getBindings().size(), 0); - Bindings mytopic_2 = server.getPostOffice().getBindingsForAddress(new SimpleString("mytopic_2")); + Bindings mytopic_2 = server.getPostOffice().getBindingsForAddress(SimpleString.of("mytopic_2")); assertEquals(mytopic_2.getBindings().size(), 3); } finally { try { @@ -103,12 +103,12 @@ public class ConfigurationTest extends ActiveMQTestBase { try { server.start(); - Bindings mytopic_1 = server.getPostOffice().getBindingsForAddress(new SimpleString("mytopic_1")); + Bindings mytopic_1 = server.getPostOffice().getBindingsForAddress(SimpleString.of("mytopic_1")); assertEquals(mytopic_1.getBindings().size(), 0); - Bindings mytopic_2 = server.getPostOffice().getBindingsForAddress(new SimpleString("mytopic_2")); + Bindings mytopic_2 = server.getPostOffice().getBindingsForAddress(SimpleString.of("mytopic_2")); assertEquals(mytopic_2.getBindings().size(), 3); - Bindings mytopic_3 = server.getPostOffice().getBindingsForAddress(new SimpleString("mytopic_3")); + Bindings mytopic_3 = server.getPostOffice().getBindingsForAddress(SimpleString.of("mytopic_3")); assertEquals(mytopic_3.getBindings().size(), 2); @@ -121,7 +121,7 @@ public class ConfigurationTest extends ActiveMQTestBase { } Wait.assertTrue(() -> { - Bindings mytopic_31 = server.getPostOffice().getBindingsForAddress(new SimpleString("mytopic_3")); + Bindings mytopic_31 = server.getPostOffice().getBindingsForAddress(SimpleString.of("mytopic_3")); return mytopic_31.getBindings().size() == 3; }); 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 cc0dd52e00..a001475671 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 @@ -54,9 +54,9 @@ public class ExpiryRunnerTest extends ActiveMQTestBase { private ClientSession clientSession; - private final SimpleString qName = new SimpleString("ExpiryRunnerTestQ"); + private final SimpleString qName = SimpleString.of("ExpiryRunnerTestQ"); - private final SimpleString qName2 = new SimpleString("ExpiryRunnerTestQ2"); + private final SimpleString qName2 = SimpleString.of("ExpiryRunnerTestQ2"); private SimpleString expiryQueue; @@ -285,8 +285,8 @@ public class ExpiryRunnerTest extends ActiveMQTestBase { clientSession = sessionFactory.createSession(false, true, true); clientSession.createQueue(new QueueConfiguration(qName).setDurable(false)); - expiryAddress = new SimpleString("EA"); - expiryQueue = new SimpleString("expiryQ"); + expiryAddress = SimpleString.of("EA"); + expiryQueue = SimpleString.of("expiryQ"); AddressSettings addressSettings = new AddressSettings().setExpiryAddress(expiryAddress); server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings); server.getAddressSettingsRepository().addMatch(qName2.toString(), addressSettings); 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 96ec35df30..4d11f748a0 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 @@ -46,9 +46,9 @@ public class LVQRecoveryTest extends ActiveMQTestBase { private ClientSession clientSession; - private final SimpleString address = new SimpleString("LVQTestAddress"); + private final SimpleString address = SimpleString.of("LVQTestAddress"); - private final SimpleString qName1 = new SimpleString("LVQTestQ1"); + private final SimpleString qName1 = SimpleString.of("LVQTestQ1"); private ClientSession clientSessionXa; @@ -61,8 +61,8 @@ public class LVQRecoveryTest extends ActiveMQTestBase { public void testMultipleMessagesAfterRecovery() throws Exception { Xid xid = new XidImpl("bq1".getBytes(), 4, "gtid1".getBytes()); ClientProducer producer = clientSessionXa.createProducer(address); - SimpleString messageId1 = new SimpleString("SMID1"); - SimpleString messageId2 = new SimpleString("SMID2"); + SimpleString messageId1 = SimpleString.of("SMID1"); + SimpleString messageId2 = SimpleString.of("SMID2"); clientSessionXa.start(xid, XAResource.TMNOFLAGS); ClientMessage m1 = createTextMessage(clientSession, "m1"); m1.putStringProperty(Message.HDR_LAST_VALUE_NAME, messageId1); @@ -102,7 +102,7 @@ public class LVQRecoveryTest extends ActiveMQTestBase { ClientProducer producer = clientSession.createProducer(address); ClientConsumer consumer = clientSessionXa.createConsumer(qName1); - SimpleString rh = new SimpleString("SMID1"); + SimpleString rh = SimpleString.of("SMID1"); ClientMessage m1 = createTextMessage(clientSession, "m1"); m1.putStringProperty(Message.HDR_LAST_VALUE_NAME, rh); m1.setDurable(true); 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 fbd938f28d..4337d1b315 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 @@ -63,16 +63,16 @@ public class LVQTest extends ActiveMQTestBase { private ClientSession clientSessionTxSends; - private final SimpleString address = new SimpleString("LVQTestAddress"); + private final SimpleString address = SimpleString.of("LVQTestAddress"); - private final SimpleString qName1 = new SimpleString("LVQTestQ1"); + private final SimpleString qName1 = SimpleString.of("LVQTestQ1"); @Test public void testSimple() throws Exception { ClientProducer producer = clientSession.createProducer(address); ClientConsumer consumer = clientSession.createConsumer(qName1); ClientMessage m1 = createTextMessage(clientSession, "m1"); - SimpleString rh = new SimpleString("SMID1"); + SimpleString rh = SimpleString.of("SMID1"); m1.putStringProperty(Message.HDR_LAST_VALUE_NAME, rh); ClientMessage m2 = createTextMessage(clientSession, "m2"); m2.putStringProperty(Message.HDR_LAST_VALUE_NAME, rh); @@ -97,7 +97,7 @@ public class LVQTest extends ActiveMQTestBase { ClientConsumer consumer = clientSession.createConsumer(EXCLUSIVE_QUEUE); clientSession.start(); ClientMessage m1 = createTextMessage(clientSession, "m1"); - SimpleString rh = new SimpleString("SMID1"); + SimpleString rh = SimpleString.of("SMID1"); m1.putStringProperty(Message.HDR_LAST_VALUE_NAME, rh); ClientMessage m2 = createTextMessage(clientSession, "m2"); m2.putStringProperty(Message.HDR_LAST_VALUE_NAME, rh); @@ -113,7 +113,7 @@ public class LVQTest extends ActiveMQTestBase { public void testSimpleRestart() throws Exception { ClientProducer producer = clientSession.createProducer(address); ClientMessage m1 = createTextMessage(clientSession, "m1"); - SimpleString rh = new SimpleString("SMID1"); + SimpleString rh = SimpleString.of("SMID1"); m1.putStringProperty(Message.HDR_LAST_VALUE_NAME, rh); producer.send(m1); ClientMessage m2 = createTextMessage(clientSession, "m2"); @@ -148,8 +148,8 @@ public class LVQTest extends ActiveMQTestBase { public void testMultipleMessages() throws Exception { ClientProducer producer = clientSession.createProducer(address); ClientConsumer consumer = clientSession.createConsumer(qName1); - SimpleString messageId1 = new SimpleString("SMID1"); - SimpleString messageId2 = new SimpleString("SMID2"); + SimpleString messageId1 = SimpleString.of("SMID1"); + SimpleString messageId2 = SimpleString.of("SMID2"); ClientMessage m1 = createTextMessage(clientSession, "m1"); m1.putStringProperty(Message.HDR_LAST_VALUE_NAME, messageId1); ClientMessage m2 = createTextMessage(clientSession, "m2"); @@ -204,7 +204,7 @@ public class LVQTest extends ActiveMQTestBase { ClientProducer producer = clientSessionTxReceives.createProducer(address); ClientConsumer consumer = clientSessionTxReceives.createConsumer(qName1); - SimpleString messageId1 = new SimpleString("SMID1"); + SimpleString messageId1 = SimpleString.of("SMID1"); ClientMessage m1 = createTextMessage(clientSession, "m1"); m1.putStringProperty(Message.HDR_LAST_VALUE_NAME, messageId1); producer.send(m1); @@ -232,7 +232,7 @@ public class LVQTest extends ActiveMQTestBase { ClientProducer producer = clientSession.createProducer(address); ClientConsumer consumer = clientSession.createConsumer(qName1); ClientMessage m1 = createTextMessage(clientSession, "m1"); - SimpleString rh = new SimpleString("SMID1"); + SimpleString rh = SimpleString.of("SMID1"); m1.putStringProperty(Message.HDR_LAST_VALUE_NAME, rh); ClientMessage m2 = createTextMessage(clientSession, "m2"); m2.putStringProperty(Message.HDR_LAST_VALUE_NAME, rh); @@ -254,7 +254,7 @@ public class LVQTest extends ActiveMQTestBase { ClientProducer producer = clientSession.createProducer(address); ClientConsumer consumer = clientSession.createConsumer(qName1); ClientMessage m1 = createTextMessage(clientSession, "m1"); - SimpleString rh = new SimpleString("SMID1"); + SimpleString rh = SimpleString.of("SMID1"); m1.putStringProperty(Message.HDR_LAST_VALUE_NAME, rh); ClientMessage m2 = createTextMessage(clientSession, "m2"); m2.putStringProperty(Message.HDR_LAST_VALUE_NAME, rh); @@ -279,7 +279,7 @@ public class LVQTest extends ActiveMQTestBase { ClientProducer producer = clientSession.createProducer(address); ClientConsumer consumer = clientSession.createConsumer(qName1); - SimpleString rh = new SimpleString("SMID1"); + SimpleString rh = SimpleString.of("SMID1"); ClientMessage m1 = createTextMessage(clientSession, "m1"); m1.putStringProperty(Message.HDR_LAST_VALUE_NAME, rh); ClientMessage m2 = createTextMessage(clientSession, "m2"); @@ -333,7 +333,7 @@ public class LVQTest extends ActiveMQTestBase { ClientProducer producer = clientSessionTxReceives.createProducer(address); ClientConsumer consumer = clientSessionTxReceives.createConsumer(qName1); ClientMessage m1 = createTextMessage(clientSession, "m1"); - SimpleString rh = new SimpleString("SMID1"); + SimpleString rh = SimpleString.of("SMID1"); m1.putStringProperty(Message.HDR_LAST_VALUE_NAME, rh); ClientMessage m2 = createTextMessage(clientSession, "m2"); m2.putStringProperty(Message.HDR_LAST_VALUE_NAME, rh); @@ -349,8 +349,8 @@ public class LVQTest extends ActiveMQTestBase { @Test public void testMultipleMessagesInTx() throws Exception { ClientProducer producer = clientSessionTxReceives.createProducer(address); - SimpleString messageId1 = new SimpleString("SMID1"); - SimpleString messageId2 = new SimpleString("SMID2"); + SimpleString messageId1 = SimpleString.of("SMID1"); + SimpleString messageId2 = SimpleString.of("SMID2"); ClientMessage m1 = createTextMessage(clientSession, "m1"); m1.putStringProperty(Message.HDR_LAST_VALUE_NAME, messageId1); ClientMessage m2 = createTextMessage(clientSession, "m2"); @@ -382,8 +382,8 @@ public class LVQTest extends ActiveMQTestBase { public void testMultipleMessagesInTxRollback() throws Exception { ClientProducer producer = clientSessionTxReceives.createProducer(address); ClientConsumer consumer = clientSessionTxReceives.createConsumer(qName1); - SimpleString messageId1 = new SimpleString("SMID1"); - SimpleString messageId2 = new SimpleString("SMID2"); + SimpleString messageId1 = SimpleString.of("SMID1"); + SimpleString messageId2 = SimpleString.of("SMID2"); ClientMessage m1 = createTextMessage(clientSession, "m1"); m1.putStringProperty(Message.HDR_LAST_VALUE_NAME, messageId1); ClientMessage m2 = createTextMessage(clientSession, "m2"); @@ -428,7 +428,7 @@ public class LVQTest extends ActiveMQTestBase { public void testSingleTXRollback() throws Exception { ClientProducer producer = clientSessionTxReceives.createProducer(address); ClientConsumer consumer = clientSessionTxReceives.createConsumer(qName1); - SimpleString messageId1 = new SimpleString("SMID1"); + SimpleString messageId1 = SimpleString.of("SMID1"); ClientMessage m1 = createTextMessage(clientSession, "m1"); m1.putStringProperty(Message.HDR_LAST_VALUE_NAME, messageId1); producer.send(m1); @@ -449,7 +449,7 @@ public class LVQTest extends ActiveMQTestBase { ClientProducer producer = clientSessionTxSends.createProducer(address); ClientConsumer consumer = clientSessionTxSends.createConsumer(qName1); clientSessionTxSends.start(); - SimpleString rh = new SimpleString("SMID1"); + SimpleString rh = SimpleString.of("SMID1"); ClientMessage m1 = createTextMessage(clientSession, "m1"); m1.putStringProperty(Message.HDR_LAST_VALUE_NAME, rh); ClientMessage m2 = createTextMessage(clientSession, "m2"); @@ -487,7 +487,7 @@ public class LVQTest extends ActiveMQTestBase { public void testMultipleMessagesPersistedCorrectly() throws Exception { ClientProducer producer = clientSession.createProducer(address); ClientConsumer consumer = clientSession.createConsumer(qName1); - SimpleString rh = new SimpleString("SMID1"); + SimpleString rh = SimpleString.of("SMID1"); ClientMessage m1 = createTextMessage(clientSession, "m1"); m1.putStringProperty(Message.HDR_LAST_VALUE_NAME, rh); m1.setDurable(true); @@ -524,7 +524,7 @@ public class LVQTest extends ActiveMQTestBase { @Test public void testMultipleMessagesPersistedCorrectlyInTx() throws Exception { ClientProducer producer = clientSessionTxSends.createProducer(address); - SimpleString rh = new SimpleString("SMID1"); + SimpleString rh = SimpleString.of("SMID1"); ClientMessage m1 = createTextMessage(clientSession, "m1"); m1.putStringProperty(Message.HDR_LAST_VALUE_NAME, rh); m1.setDurable(true); @@ -566,7 +566,7 @@ public class LVQTest extends ActiveMQTestBase { Queue queue = server.locateQueue(qName1); ClientProducer producer = clientSession.createProducer(address); ClientConsumer consumer = clientSession.createConsumer(qName1); - SimpleString rh = new SimpleString("SMID1"); + SimpleString rh = SimpleString.of("SMID1"); ClientMessage m1 = createTextMessage(clientSession, "m1"); m1.putStringProperty(Message.HDR_LAST_VALUE_NAME, rh); m1.setDurable(true); @@ -626,7 +626,7 @@ public class LVQTest extends ActiveMQTestBase { Queue queue = server.locateQueue(qName1); ClientProducer producer = clientSession.createProducer(address); ClientConsumer consumer = clientSession.createConsumer(qName1); - SimpleString rh = new SimpleString("SMID1"); + SimpleString rh = SimpleString.of("SMID1"); ClientMessage m1 = createTextMessage(clientSession, "m1"); m1.putStringProperty(Message.HDR_LAST_VALUE_NAME, rh); m1.setDurable(true); @@ -652,7 +652,7 @@ public class LVQTest extends ActiveMQTestBase { Queue queue = server.locateQueue(qName1); ClientProducer producer = clientSession.createProducer(address); ClientConsumer consumer = clientSession.createConsumer(qName1); - SimpleString rh = new SimpleString("SMID1"); + SimpleString rh = SimpleString.of("SMID1"); long timeSent = 0; for (int i = 0; i < MESSAGE_COUNT; i++) { ClientMessage m = createTextMessage(clientSession, "m" + i); @@ -681,7 +681,7 @@ public class LVQTest extends ActiveMQTestBase { Queue queue = server.locateQueue(qName1); ClientProducer producer = clientSession.createProducer(address); ClientConsumer consumer = clientSession.createConsumer(qName1); - SimpleString rh = new SimpleString("SMID1"); + SimpleString rh = SimpleString.of("SMID1"); ClientMessage m1 = createTextMessage(clientSession, "m1"); m1.putStringProperty(Message.HDR_LAST_VALUE_NAME, rh); m1.setDurable(true); @@ -707,7 +707,7 @@ public class LVQTest extends ActiveMQTestBase { public void testMultipleAcksPersistedCorrectlyInTx() throws Exception { ClientProducer producer = clientSessionTxReceives.createProducer(address); ClientConsumer consumer = clientSessionTxReceives.createConsumer(qName1); - SimpleString rh = new SimpleString("SMID1"); + SimpleString rh = SimpleString.of("SMID1"); ClientMessage m1 = createTextMessage(clientSession, "m1"); m1.putStringProperty(Message.HDR_LAST_VALUE_NAME, rh); m1.setDurable(true); @@ -763,7 +763,7 @@ public class LVQTest extends ActiveMQTestBase { @Test public void testLargeMessage() throws Exception { ClientProducer producer = clientSessionTxReceives.createProducer(address); - SimpleString rh = new SimpleString("SMID1"); + SimpleString rh = SimpleString.of("SMID1"); for (int i = 0; i < 50; i++) { ClientMessage message = clientSession.createMessage(true); @@ -785,7 +785,7 @@ public class LVQTest extends ActiveMQTestBase { public void testSizeInReplace() throws Exception { ClientProducer producer = clientSession.createProducer(address); ClientMessage m1 = createTextMessage(clientSession, "m1"); - SimpleString rh = new SimpleString("SMID1"); + SimpleString rh = SimpleString.of("SMID1"); m1.putStringProperty(Message.HDR_LAST_VALUE_NAME, rh); ClientMessage m2 = clientSession.createMessage(true); @@ -805,7 +805,7 @@ public class LVQTest extends ActiveMQTestBase { public void testDeleteReference() throws Exception { ClientProducer producer = clientSession.createProducer(address); ClientMessage m1 = createTextMessage(clientSession, "m1"); - SimpleString rh = new SimpleString("SMID1"); + SimpleString rh = SimpleString.of("SMID1"); m1.putStringProperty(Message.HDR_LAST_VALUE_NAME, rh); m1.setBodyInputStream(createFakeLargeStream(2 * 1024)); @@ -837,7 +837,7 @@ public class LVQTest extends ActiveMQTestBase { public void testChangeReferencePriority() throws Exception { ClientProducer producer = clientSession.createProducer(address); ClientMessage m1 = createTextMessage(clientSession, "m1"); - SimpleString rh = new SimpleString("SMID1"); + SimpleString rh = SimpleString.of("SMID1"); m1.putStringProperty(Message.HDR_LAST_VALUE_NAME, rh); Queue queue = server.locateQueue(qName1); 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 9603801d45..cca97a6805 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 @@ -139,7 +139,7 @@ public class PredefinedQueueTest extends ActiveMQTestBase { server.start(); - Bindings bindings = server.getPostOffice().getBindingsForAddress(new SimpleString(testAddress)); + Bindings bindings = server.getPostOffice().getBindingsForAddress(SimpleString.of(testAddress)); assertEquals(2, bindings.getBindings().size()); @@ -151,7 +151,7 @@ public class PredefinedQueueTest extends ActiveMQTestBase { session.start(); - ClientProducer producer = addClientProducer(session.createProducer(new SimpleString(testAddress))); + ClientProducer producer = addClientProducer(session.createProducer(SimpleString.of(testAddress))); ClientConsumer consumer1 = addClientConsumer(session.createConsumer(queueName1)); @@ -159,7 +159,7 @@ public class PredefinedQueueTest extends ActiveMQTestBase { final int numMessages = 10; - final SimpleString propKey = new SimpleString("testkey"); + final SimpleString propKey = SimpleString.of("testkey"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session.createMessage(false); @@ -233,7 +233,7 @@ public class PredefinedQueueTest extends ActiveMQTestBase { session.start(); - ClientProducer producer = session.createProducer(new SimpleString(testAddress)); + ClientProducer producer = session.createProducer(SimpleString.of(testAddress)); ClientConsumer consumer1 = session.createConsumer(queueName1); @@ -243,7 +243,7 @@ public class PredefinedQueueTest extends ActiveMQTestBase { final int numMessages = 10; - final SimpleString propKey = new SimpleString("testkey"); + final SimpleString propKey = SimpleString.of("testkey"); for (int i = 0; i < numMessages; i++) { ClientMessage message = session.createMessage(false); @@ -304,9 +304,9 @@ public class PredefinedQueueTest extends ActiveMQTestBase { ClientSession session = addClientSession(sf.createSession(false, true, true)); - ClientProducer producer = session.createProducer(new SimpleString(testAddress)); + ClientProducer producer = session.createProducer(SimpleString.of(testAddress)); - final SimpleString propKey = new SimpleString("testkey"); + final SimpleString propKey = SimpleString.of("testkey"); final int numMessages = 1; @@ -377,9 +377,9 @@ public class PredefinedQueueTest extends ActiveMQTestBase { ClientSession session = addClientSession(sf.createSession(false, true, true)); - ClientProducer producer = session.createProducer(new SimpleString(testAddress)); + ClientProducer producer = session.createProducer(SimpleString.of(testAddress)); - final SimpleString propKey = new SimpleString("testkey"); + final SimpleString propKey = SimpleString.of("testkey"); final int numMessages = 1; @@ -388,7 +388,7 @@ public class PredefinedQueueTest extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = session.createMessage(true); - message.putStringProperty(new SimpleString("cheese"), new SimpleString("camembert")); + message.putStringProperty(SimpleString.of("cheese"), SimpleString.of("camembert")); message.putIntProperty(propKey, i); @@ -411,7 +411,7 @@ public class PredefinedQueueTest extends ActiveMQTestBase { for (int i = 0; i < numMessages; i++) { ClientMessage message = session.createMessage(true); - message.putStringProperty(new SimpleString("cheese"), new SimpleString("roquefort")); + message.putStringProperty(SimpleString.of("cheese"), SimpleString.of("roquefort")); message.putIntProperty(propKey, i); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/QueueConfigPersistenceTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/QueueConfigPersistenceTest.java index a8d553816f..8aa1c7ee23 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/QueueConfigPersistenceTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/QueueConfigPersistenceTest.java @@ -46,7 +46,7 @@ public class QueueConfigPersistenceTest extends ActiveMQTestBase { for (int i = 0; i < 4; i++) { server.stop(); server.start(); - queue = server.locateQueue(SimpleString.toSimpleString("q1")); + queue = server.locateQueue(SimpleString.of("q1")); assertTrue(queue.isPaused()); } @@ -55,7 +55,7 @@ public class QueueConfigPersistenceTest extends ActiveMQTestBase { for (int i = 0; i < 4; i++) { server.stop(); server.start(); - queue = server.locateQueue(SimpleString.toSimpleString("q1")); + queue = server.locateQueue(SimpleString.of("q1")); assertFalse(queue.isPaused()); } 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 49315686e5..3488456079 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 @@ -52,8 +52,8 @@ public class QueueQueryTest extends ActiveMQTestBase { @Test public void testQueueQueryDefaultsOnStaticQueue() throws Exception { - SimpleString addressName = SimpleString.toSimpleString(UUID.randomUUID().toString()); - SimpleString queueName = SimpleString.toSimpleString(UUID.randomUUID().toString()); + SimpleString addressName = SimpleString.of(UUID.randomUUID().toString()); + SimpleString queueName = SimpleString.of(UUID.randomUUID().toString()); server.createQueue(new QueueConfiguration(queueName).setAddress(addressName)); QueueQueryResult queueQueryResult = server.queueQuery(queueName); assertTrue(queueQueryResult.isExists()); @@ -81,8 +81,8 @@ public class QueueQueryTest extends ActiveMQTestBase { public void testQueueQueryOnStaticQueueWithFQQN() throws Exception { // 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 addressName = SimpleString.of("myAddress"); + SimpleString queueName = SimpleString.of("myQueue"); SimpleString fqqn = addressName.concat("::").concat(queueName); // server.createQueue(fqqn, RoutingType.MULTICAST, fqqn, null, true, false); server.createQueue(new QueueConfiguration(fqqn)); @@ -96,10 +96,10 @@ public class QueueQueryTest extends ActiveMQTestBase { @Test public void testQueueQueryNonDefaultsOnStaticQueue() throws Exception { - SimpleString addressName = SimpleString.toSimpleString(UUID.randomUUID().toString()); - SimpleString queueName = SimpleString.toSimpleString(UUID.randomUUID().toString()); - SimpleString filter = SimpleString.toSimpleString("x = 'y'"); - SimpleString lastValueKey = SimpleString.toSimpleString("myLastValueKey"); + SimpleString addressName = SimpleString.of(UUID.randomUUID().toString()); + SimpleString queueName = SimpleString.of(UUID.randomUUID().toString()); + SimpleString filter = SimpleString.of("x = 'y'"); + SimpleString lastValueKey = SimpleString.of("myLastValueKey"); server.getAddressSettingsRepository().addMatch(addressName.toString(), new AddressSettings() .setAutoCreateAddresses(true) .setDefaultMaxConsumers(1) @@ -137,7 +137,7 @@ public class QueueQueryTest extends ActiveMQTestBase { @Test public void testQueueQueryDefaultsOnAutoCreatedQueue() throws Exception { - SimpleString queueName = SimpleString.toSimpleString(UUID.randomUUID().toString()); + SimpleString queueName = SimpleString.of(UUID.randomUUID().toString()); server.getAddressSettingsRepository().addMatch(queueName.toString(), new AddressSettings()); JMSContext c = new ActiveMQConnectionFactory("vm://0").createContext(); c.createProducer().send(c.createQueue(queueName.toString()), c.createMessage()); @@ -163,8 +163,8 @@ public class QueueQueryTest extends ActiveMQTestBase { @Test public void testQueueQueryOnAutoCreatedQueueWithFQQN() throws Exception { - SimpleString addressName = SimpleString.toSimpleString(UUID.randomUUID().toString()); - SimpleString queueName = SimpleString.toSimpleString(UUID.randomUUID().toString()); + SimpleString addressName = SimpleString.of(UUID.randomUUID().toString()); + SimpleString queueName = SimpleString.of(UUID.randomUUID().toString()); SimpleString fqqn = addressName.concat("::").concat(queueName); try (JMSContext c = new ActiveMQConnectionFactory("vm://0").createContext()) { c.createProducer().send(c.createQueue(fqqn.toString()), c.createMessage()); @@ -184,8 +184,8 @@ public class QueueQueryTest extends ActiveMQTestBase { @Test public void testQueueQueryNonDefaultsOnAutoCreatedQueue() throws Exception { - SimpleString queueName = SimpleString.toSimpleString(UUID.randomUUID().toString()); - SimpleString lastValueKey = SimpleString.toSimpleString("myLastValueKey"); + SimpleString queueName = SimpleString.of(UUID.randomUUID().toString()); + SimpleString lastValueKey = SimpleString.of("myLastValueKey"); server.getAddressSettingsRepository().addMatch(queueName.toString(), new AddressSettings() .setAutoCreateAddresses(true) .setAutoCreateQueues(true) @@ -225,7 +225,7 @@ public class QueueQueryTest extends ActiveMQTestBase { @Test public void testQueueQueryNonExistentQueue() throws Exception { - SimpleString queueName = SimpleString.toSimpleString(UUID.randomUUID().toString()); + SimpleString queueName = SimpleString.of(UUID.randomUUID().toString()); QueueQueryResult queueQueryResult = server.queueQuery(queueName); assertFalse(queueQueryResult.isExists()); assertEquals(queueName, queueQueryResult.getName()); @@ -233,8 +233,8 @@ public class QueueQueryTest extends ActiveMQTestBase { @Test public void testQueueQueryNonExistentQueueWithFQQN() throws Exception { - SimpleString addressName = SimpleString.toSimpleString(UUID.randomUUID().toString()); - SimpleString queueName = SimpleString.toSimpleString(UUID.randomUUID().toString()); + SimpleString addressName = SimpleString.of(UUID.randomUUID().toString()); + SimpleString queueName = SimpleString.of(UUID.randomUUID().toString()); SimpleString fqqn = addressName.concat("::").concat(queueName); QueueQueryResult queueQueryResult = server.queueQuery(fqqn); assertFalse(queueQueryResult.isExists()); 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 eddb55dd25..57e7d79dda 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 @@ -53,7 +53,7 @@ public class ResourceLimitTest extends ActiveMQTestBase { super.setUp(); ResourceLimitSettings resourceLimitSettings = new ResourceLimitSettings(); - resourceLimitSettings.setMatch(SimpleString.toSimpleString("myUser")); + resourceLimitSettings.setMatch(SimpleString.of("myUser")); resourceLimitSettings.setMaxConnections(1); resourceLimitSettings.setMaxQueues(1); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ResourceLimitTestWithCerts.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ResourceLimitTestWithCerts.java index 492b5f0eb6..bf00b8f62c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ResourceLimitTestWithCerts.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ResourceLimitTestWithCerts.java @@ -68,7 +68,7 @@ public class ResourceLimitTestWithCerts extends ActiveMQTestBase { ResourceLimitSettings limit = new ResourceLimitSettings(); limit.setMaxConnections(1); limit.setMaxQueues(1); - limit.setMatch(new SimpleString("first")); + limit.setMatch(SimpleString.of("first")); ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager("CertLogin"); ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig().setSecurityEnabled(true).addResourceLimitSettings(limit), ManagementFactory.getPlatformMBeanServer(), securityManager, false)); 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 9a9e565d2c..924d0ff32a 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 @@ -64,8 +64,8 @@ public class RetroactiveAddressFailoverTest extends FailoverTestBase { ActiveMQServer primary = primaryServer.getServer(); ActiveMQServer backup = backupServer.getServer(); ClientSession session = addClientSession(sf.createSession(true, true)); - final SimpleString queueName = SimpleString.toSimpleString("simpleQueue"); - final SimpleString addressName = SimpleString.toSimpleString("myAddress"); + final SimpleString queueName = SimpleString.of("simpleQueue"); + final SimpleString addressName = SimpleString.of("myAddress"); final SimpleString divertQueue = ResourceNames.getRetroactiveResourceQueueName(internalNamingPrefix, delimiter, addressName, RoutingType.MULTICAST); primary.getAddressSettingsRepository().addMatch(addressName.toString(), new AddressSettings().setRetroactiveMessageCount(MESSAGE_COUNT)); backup.getAddressSettingsRepository().addMatch(addressName.toString(), new AddressSettings().setRetroactiveMessageCount(MESSAGE_COUNT)); 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 9d3283a3f7..ed00c60b9a 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 @@ -111,7 +111,7 @@ public class RetroactiveAddressTest extends ActiveMQTestBase { } private void internalTestRetroactiveResourceCreation(String address, String match) throws Exception { - final SimpleString addressName = SimpleString.toSimpleString(address); + final SimpleString addressName = SimpleString.of(address); final SimpleString divertAddress = ResourceNames.getRetroactiveResourceAddressName(internalNamingPrefix, delimiter, addressName); final SimpleString divertMulticastQueue = ResourceNames.getRetroactiveResourceQueueName(internalNamingPrefix, delimiter, addressName, RoutingType.MULTICAST); final SimpleString divertAnycastQueue = ResourceNames.getRetroactiveResourceQueueName(internalNamingPrefix, delimiter, addressName, RoutingType.ANYCAST); @@ -128,7 +128,7 @@ public class RetroactiveAddressTest extends ActiveMQTestBase { @TestTemplate public void testRetroactiveResourceRemoval() throws Exception { - final SimpleString addressName = SimpleString.toSimpleString("myAddress"); + final SimpleString addressName = SimpleString.of("myAddress"); final SimpleString divertAddress = ResourceNames.getRetroactiveResourceAddressName(internalNamingPrefix, delimiter, addressName); final SimpleString divertMulticastQueue = ResourceNames.getRetroactiveResourceQueueName(internalNamingPrefix, delimiter, addressName, RoutingType.MULTICAST); final SimpleString divertAnycastQueue = ResourceNames.getRetroactiveResourceQueueName(internalNamingPrefix, delimiter, addressName, RoutingType.ANYCAST); @@ -152,8 +152,8 @@ public class RetroactiveAddressTest extends ActiveMQTestBase { public void testRetroactiveAddress() throws Exception { final int COUNT = 15; final int LOOPS = 25; - final SimpleString queueName = SimpleString.toSimpleString("simpleQueue"); - final SimpleString addressName = SimpleString.toSimpleString("myAddress"); + final SimpleString queueName = SimpleString.of("simpleQueue"); + final SimpleString addressName = SimpleString.of("myAddress"); final SimpleString divertQueue = ResourceNames.getRetroactiveResourceQueueName(internalNamingPrefix, delimiter, addressName, RoutingType.MULTICAST); server.getAddressSettingsRepository().addMatch(addressName.toString(), new AddressSettings().setRetroactiveMessageCount(COUNT)); server.addAddressInfo(new AddressInfo(addressName)); @@ -190,8 +190,8 @@ public class RetroactiveAddressTest extends ActiveMQTestBase { @TestTemplate public void testRestart() throws Exception { final String data = "Simple Text " + UUID.randomUUID().toString(); - final SimpleString queueName1 = SimpleString.toSimpleString("simpleQueue1"); - final SimpleString addressName = SimpleString.toSimpleString("myAddress"); + final SimpleString queueName1 = SimpleString.of("simpleQueue1"); + final SimpleString addressName = SimpleString.of("myAddress"); final SimpleString divertMulticastQueue = ResourceNames.getRetroactiveResourceQueueName(internalNamingPrefix, delimiter, addressName, RoutingType.MULTICAST); server.getAddressSettingsRepository().addMatch(addressName.toString(), new AddressSettings().setRetroactiveMessageCount(10)); server.addAddressInfo(new AddressInfo(addressName)); @@ -243,7 +243,7 @@ public class RetroactiveAddressTest extends ActiveMQTestBase { @TestTemplate public void testUpdateAfterRestart() throws Exception { final int COUNT = 10; - final SimpleString addressName = SimpleString.toSimpleString("myAddress"); + final SimpleString addressName = SimpleString.of("myAddress"); final SimpleString divertAnycastQueue = ResourceNames.getRetroactiveResourceQueueName(internalNamingPrefix, delimiter, addressName, RoutingType.ANYCAST); final SimpleString divertMulticastQueue = ResourceNames.getRetroactiveResourceQueueName(internalNamingPrefix, delimiter, addressName, RoutingType.MULTICAST); server.getAddressSettingsRepository().addMatch(addressName.toString(), new AddressSettings().setRetroactiveMessageCount(COUNT)); @@ -263,8 +263,8 @@ public class RetroactiveAddressTest extends ActiveMQTestBase { @TestTemplate public void testMulticast() throws Exception { final String data = "Simple Text " + UUID.randomUUID().toString(); - final SimpleString queueName1 = SimpleString.toSimpleString("simpleQueue1"); - final SimpleString addressName = SimpleString.toSimpleString("myAddress"); + final SimpleString queueName1 = SimpleString.of("simpleQueue1"); + final SimpleString addressName = SimpleString.of("myAddress"); final SimpleString divertQueue = ResourceNames.getRetroactiveResourceQueueName(internalNamingPrefix, delimiter, addressName, RoutingType.MULTICAST); server.getAddressSettingsRepository().addMatch(addressName.toString(), new AddressSettings().setRetroactiveMessageCount(10)); server.addAddressInfo(new AddressInfo(addressName)); @@ -295,7 +295,7 @@ public class RetroactiveAddressTest extends ActiveMQTestBase { @TestTemplate public void testJMSTopicSubscribers() throws Exception { - final SimpleString addressName = SimpleString.toSimpleString("myAddress"); + final SimpleString addressName = SimpleString.of("myAddress"); final int COUNT = 10; final SimpleString divertQueue = ResourceNames.getRetroactiveResourceQueueName(internalNamingPrefix, delimiter, addressName, RoutingType.MULTICAST); server.getAddressSettingsRepository().addMatch(addressName.toString(), new AddressSettings().setRetroactiveMessageCount(COUNT)); @@ -328,7 +328,7 @@ public class RetroactiveAddressTest extends ActiveMQTestBase { @TestTemplate public void testUpdateAddressSettings() throws Exception { final int COUNT = 10; - final SimpleString addressName = SimpleString.toSimpleString("myAddress"); + final SimpleString addressName = SimpleString.of("myAddress"); final SimpleString divertAnycastQueue = ResourceNames.getRetroactiveResourceQueueName(internalNamingPrefix, delimiter, addressName, RoutingType.ANYCAST); final SimpleString divertMulticastQueue = ResourceNames.getRetroactiveResourceQueueName(internalNamingPrefix, delimiter, addressName, RoutingType.MULTICAST); server.getAddressSettingsRepository().addMatch(addressName.toString(), new AddressSettings().setRetroactiveMessageCount(COUNT)); @@ -344,9 +344,9 @@ public class RetroactiveAddressTest extends ActiveMQTestBase { @TestTemplate public void testRoutingTypes() throws Exception { final String data = "Simple Text " + UUID.randomUUID().toString(); - final SimpleString multicastQueue = SimpleString.toSimpleString("multicastQueue"); - final SimpleString anycastQueue = SimpleString.toSimpleString("anycastQueue"); - final SimpleString addressName = SimpleString.toSimpleString("myAddress"); + final SimpleString multicastQueue = SimpleString.of("multicastQueue"); + final SimpleString anycastQueue = SimpleString.of("anycastQueue"); + final SimpleString addressName = SimpleString.of("myAddress"); final SimpleString divertMulticastQueue = ResourceNames.getRetroactiveResourceQueueName(internalNamingPrefix, delimiter, addressName, RoutingType.MULTICAST); final SimpleString divertAnycastQueue = ResourceNames.getRetroactiveResourceQueueName(internalNamingPrefix, delimiter, addressName, RoutingType.ANYCAST); server.getAddressSettingsRepository().addMatch(addressName.toString(), new AddressSettings().setRetroactiveMessageCount(10)); @@ -402,8 +402,8 @@ public class RetroactiveAddressTest extends ActiveMQTestBase { @TestTemplate public void testFilter() throws Exception { - final SimpleString queueName1 = SimpleString.toSimpleString("simpleQueue1"); - final SimpleString addressName = SimpleString.toSimpleString("myAddress"); + final SimpleString queueName1 = SimpleString.of("simpleQueue1"); + final SimpleString addressName = SimpleString.of("myAddress"); final SimpleString divertQueue = ResourceNames.getRetroactiveResourceQueueName(internalNamingPrefix, delimiter, addressName, RoutingType.MULTICAST); server.getAddressSettingsRepository().addMatch(addressName.toString(), new AddressSettings().setRetroactiveMessageCount(10)); server.addAddressInfo(new AddressInfo(addressName)); @@ -435,7 +435,7 @@ public class RetroactiveAddressTest extends ActiveMQTestBase { @TestTemplate public void testAddressSettingOnRetroactiveResource() throws Exception { - final SimpleString addressName = SimpleString.toSimpleString("myAddress"); + final SimpleString addressName = SimpleString.of("myAddress"); final SimpleString divertAddress = ResourceNames.getRetroactiveResourceAddressName(internalNamingPrefix, delimiter, addressName); server.getAddressSettingsRepository().addMatch(addressName.toString(), new AddressSettings().setRetroactiveMessageCount(10)); server.addAddressInfo(new AddressInfo(addressName)); @@ -446,9 +446,9 @@ public class RetroactiveAddressTest extends ActiveMQTestBase { @TestTemplate public void testPaging() throws Exception { - final SimpleString queueName = SimpleString.toSimpleString("simpleQueue"); - final SimpleString randomQueueName = SimpleString.toSimpleString(UUID.randomUUID().toString()); - final SimpleString addressName = SimpleString.toSimpleString("myAddress"); + final SimpleString queueName = SimpleString.of("simpleQueue"); + final SimpleString randomQueueName = SimpleString.of(UUID.randomUUID().toString()); + final SimpleString addressName = SimpleString.of("myAddress"); final SimpleString divertQueue = ResourceNames.getRetroactiveResourceQueueName(internalNamingPrefix, delimiter, addressName, RoutingType.MULTICAST); final int MESSAGE_COUNT = 20; final int MESSAGE_SIZE = 1024; 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 ef30d740ad..bb1d06cb34 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 @@ -52,9 +52,9 @@ public class RingQueueTest extends ActiveMQTestBase { private ActiveMQServer server; - private final SimpleString address = new SimpleString("RingQueueTestAddress"); + private final SimpleString address = SimpleString.of("RingQueueTestAddress"); - private final SimpleString qName = new SimpleString("RingQueueTestQ1"); + private final SimpleString qName = SimpleString.of("RingQueueTestQ1"); @Test public void testSimple() throws Exception { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ScaleDown3NodeTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ScaleDown3NodeTest.java index 85602c08ea..cafb53f523 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ScaleDown3NodeTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ScaleDown3NodeTest.java @@ -131,7 +131,7 @@ public class ScaleDown3NodeTest extends ClusterTestBase { // pause the SnF queue so that when the server tries to redistribute a message it won't actually go across the cluster bridge final String snfAddress = servers[0].getInternalNamingPrefix() + "sf.cluster0." + servers[0].getNodeID().toString(); - Queue snfQueue = ((LocalQueueBinding) servers[2].getPostOffice().getBinding(SimpleString.toSimpleString(snfAddress))).getQueue(); + Queue snfQueue = ((LocalQueueBinding) servers[2].getPostOffice().getBinding(SimpleString.of(snfAddress))).getQueue(); snfQueue.pause(); ClientSession session = sfs[2].createSession(servers[2].getConfiguration().getClusterUser(), servers[2].getConfiguration().getClusterPassword(), false, true, false, false, 0); @@ -179,7 +179,7 @@ public class ScaleDown3NodeTest extends ClusterTestBase { removeConsumer(0); servers[0].stop(); - Queue queueServer2 = ((LocalQueueBinding) servers[2].getPostOffice().getBinding(new SimpleString(queueName1))).getQueue(); + Queue queueServer2 = ((LocalQueueBinding) servers[2].getPostOffice().getBinding(SimpleString.of(queueName1))).getQueue(); Wait.assertEquals(0, queueServer2::getMessageCount); @@ -187,7 +187,7 @@ public class ScaleDown3NodeTest extends ClusterTestBase { addConsumer(0, 1, queueName1, null, true, servers[1].getConfiguration().getClusterUser(), servers[1].getConfiguration().getClusterPassword()); // ensure the message is in queue 1 on node 1 as expected - Queue queueServer1 = ((LocalQueueBinding) servers[1].getPostOffice().getBinding(new SimpleString(queueName1))).getQueue(); + Queue queueServer1 = ((LocalQueueBinding) servers[1].getPostOffice().getBinding(SimpleString.of(queueName1))).getQueue(); Wait.assertEquals(TEST_SIZE, queueServer1::getMessageCount); for (int i = 0; i < TEST_SIZE; i++) { @@ -209,11 +209,11 @@ public class ScaleDown3NodeTest extends ClusterTestBase { assertNull(clientMessage); removeConsumer(0); - Wait.assertTrue(() -> (servers[2].getPostOffice().getBinding(SimpleString.toSimpleString(snfAddress))) == null); - Wait.assertTrue(() -> (servers[1].getPostOffice().getBinding(SimpleString.toSimpleString(snfAddress))) == null); + Wait.assertTrue(() -> (servers[2].getPostOffice().getBinding(SimpleString.of(snfAddress))) == null); + Wait.assertTrue(() -> (servers[1].getPostOffice().getBinding(SimpleString.of(snfAddress))) == null); - assertFalse(servers[1].queueQuery(SimpleString.toSimpleString(snfAddress)).isExists()); - assertFalse(servers[1].addressQuery(SimpleString.toSimpleString(snfAddress)).isExists()); + assertFalse(servers[1].queueQuery(SimpleString.of(snfAddress)).isExists()); + assertFalse(servers[1].addressQuery(SimpleString.of(snfAddress)).isExists()); } @Test @@ -246,7 +246,7 @@ public class ScaleDown3NodeTest extends ClusterTestBase { // pause the SnF queue so that when the server tries to redistribute a message it won't actually go across the cluster bridge String snfAddress = servers[0].getInternalNamingPrefix() + "sf.cluster0." + servers[0].getNodeID().toString(); - Queue snfQueue = ((LocalQueueBinding) servers[2].getPostOffice().getBinding(SimpleString.toSimpleString(snfAddress))).getQueue(); + Queue snfQueue = ((LocalQueueBinding) servers[2].getPostOffice().getBinding(SimpleString.of(snfAddress))).getQueue(); snfQueue.pause(); ClientSession session = sfs[2].createSession(servers[2].getConfiguration().getClusterUser(), servers[2].getConfiguration().getClusterPassword(), false, true, false, false, 0); @@ -272,17 +272,17 @@ public class ScaleDown3NodeTest extends ClusterTestBase { removeConsumer(1); servers[0].stop(); - Wait.assertEquals(0, () -> getMessageCount(((LocalQueueBinding) servers[2].getPostOffice().getBinding(new SimpleString(queueName1))).getQueue()) + - getMessageCount(((LocalQueueBinding) servers[2].getPostOffice().getBinding(new SimpleString(queueName3))).getQueue())); + Wait.assertEquals(0, () -> getMessageCount(((LocalQueueBinding) servers[2].getPostOffice().getBinding(SimpleString.of(queueName1))).getQueue()) + + getMessageCount(((LocalQueueBinding) servers[2].getPostOffice().getBinding(SimpleString.of(queueName3))).getQueue())); - assertEquals(TEST_SIZE, getMessageCount(((LocalQueueBinding) servers[2].getPostOffice().getBinding(new SimpleString(queueName2))).getQueue())); + assertEquals(TEST_SIZE, getMessageCount(((LocalQueueBinding) servers[2].getPostOffice().getBinding(SimpleString.of(queueName2))).getQueue())); // get the messages from queue 1 on node 1 addConsumer(0, 1, queueName1, null, true, servers[1].getConfiguration().getClusterUser(), servers[1].getConfiguration().getClusterPassword()); addConsumer(1, 1, queueName3, null, true, servers[1].getConfiguration().getClusterUser(), servers[1].getConfiguration().getClusterPassword()); - Wait.assertEquals(TEST_SIZE * 2, () -> getMessageCount(((LocalQueueBinding) servers[1].getPostOffice().getBinding(new SimpleString(queueName1))).getQueue()) + - getMessageCount(((LocalQueueBinding) servers[1].getPostOffice().getBinding(new SimpleString(queueName3))).getQueue())); + Wait.assertEquals(TEST_SIZE * 2, () -> getMessageCount(((LocalQueueBinding) servers[1].getPostOffice().getBinding(SimpleString.of(queueName1))).getQueue()) + + getMessageCount(((LocalQueueBinding) servers[1].getPostOffice().getBinding(SimpleString.of(queueName3))).getQueue())); // ensure the message is in queue 1 on node 1 as expected for (int i = 0; i < TEST_SIZE; i++) { 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 fbc73ae3e7..15e1ac8935 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 @@ -176,7 +176,7 @@ public class ScaleDownDirectTest extends ClusterTestBase { AddressSettings defaultSetting = new AddressSettings().setPageSizeBytes(10 * 1024).setMaxSizeBytes(20 * 1024); servers[0].getAddressSettingsRepository().addMatch("#", defaultSetting); - while (!servers[0].getPagingManager().getPageStore(new SimpleString(addressName)).isPaging()) { + while (!servers[0].getPagingManager().getPageStore(SimpleString.of(addressName)).isPaging()) { for (int i = 0; i < CHUNK_SIZE; i++) { Message message = session.createMessage(true); message.getBodyBuffer().writeBytes(new byte[1024]); @@ -228,8 +228,8 @@ public class ScaleDownDirectTest extends ClusterTestBase { removeConsumer(1); // at this point on node 0 there should be 2 messages in testQueue1 and 1 message in testQueue2 - Wait.assertEquals(TEST_SIZE, () -> getMessageCount(((LocalQueueBinding) servers[0].getPostOffice().getBinding(new SimpleString(queueName1))).getQueue())); - Wait.assertEquals(TEST_SIZE - 1, () -> getMessageCount(((LocalQueueBinding) servers[0].getPostOffice().getBinding(new SimpleString(queueName2))).getQueue())); + Wait.assertEquals(TEST_SIZE, () -> getMessageCount(((LocalQueueBinding) servers[0].getPostOffice().getBinding(SimpleString.of(queueName1))).getQueue())); + Wait.assertEquals(TEST_SIZE - 1, () -> getMessageCount(((LocalQueueBinding) servers[0].getPostOffice().getBinding(SimpleString.of(queueName2))).getQueue())); assertEquals(TEST_SIZE, performScaledown()); // trigger scaleDown from node 0 to node 1 @@ -284,9 +284,9 @@ public class ScaleDownDirectTest extends ClusterTestBase { ClientProducer producer2 = session.createProducer(addressName2); producer2.send(session.createMessage(true)); - Wait.assertEquals(1, () -> getMessageCount(((LocalQueueBinding) servers[0].getPostOffice().getBinding(new SimpleString(queueName1))).getQueue())); - Wait.assertEquals(1, () -> getMessageCount(((LocalQueueBinding) servers[0].getPostOffice().getBinding(new SimpleString(queueName2))).getQueue())); - Wait.assertEquals(1, () -> getMessageCount(((LocalQueueBinding) servers[0].getPostOffice().getBinding(new SimpleString(queueName3))).getQueue())); + Wait.assertEquals(1, () -> getMessageCount(((LocalQueueBinding) servers[0].getPostOffice().getBinding(SimpleString.of(queueName1))).getQueue())); + Wait.assertEquals(1, () -> getMessageCount(((LocalQueueBinding) servers[0].getPostOffice().getBinding(SimpleString.of(queueName2))).getQueue())); + Wait.assertEquals(1, () -> getMessageCount(((LocalQueueBinding) servers[0].getPostOffice().getBinding(SimpleString.of(queueName3))).getQueue())); assertEquals(1, performScaledown()); @@ -297,9 +297,9 @@ public class ScaleDownDirectTest extends ClusterTestBase { // trigger scaleDown from node 0 to node 1 servers[0].stop(); - assertNull(servers[1].getPostOffice().getBinding(new SimpleString(queueName1))); - assertEquals(1, getMessageCount(((LocalQueueBinding) servers[1].getPostOffice().getBinding(new SimpleString(queueName2))).getQueue())); - assertNull(servers[1].getPostOffice().getBinding(new SimpleString(queueName3))); + assertNull(servers[1].getPostOffice().getBinding(SimpleString.of(queueName1))); + assertEquals(1, getMessageCount(((LocalQueueBinding) servers[1].getPostOffice().getBinding(SimpleString.of(queueName2))).getQueue())); + assertNull(servers[1].getPostOffice().getBinding(SimpleString.of(queueName3))); } @TestTemplate @@ -330,7 +330,7 @@ public class ScaleDownDirectTest extends ClusterTestBase { send(0, addressName, TEST_SIZE, true, null); // at this point on node 0 there should be 2 messages in testQueue1 - Wait.assertEquals(TEST_SIZE, () -> getMessageCount(((LocalQueueBinding) servers[0].getPostOffice().getBinding(new SimpleString(queueName1))).getQueue())); + Wait.assertEquals(TEST_SIZE, () -> getMessageCount(((LocalQueueBinding) servers[0].getPostOffice().getBinding(SimpleString.of(queueName1))).getQueue())); assertEquals(TEST_SIZE, performScaledown()); // trigger scaleDown from node 0 to node 1 diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ScaleDownRemoveSFTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ScaleDownRemoveSFTest.java index 796477b62a..8e84bb1ba8 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ScaleDownRemoveSFTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ScaleDownRemoveSFTest.java @@ -101,7 +101,7 @@ public class ScaleDownRemoveSFTest extends ClusterTestBase { clientMessage.acknowledge(); consumers[1].getSession().commit(); - assertEquals(TEST_SIZE - 1, getMessageCount(((LocalQueueBinding) servers[0].getPostOffice().getBinding(new SimpleString(queueName1))).getQueue())); + assertEquals(TEST_SIZE - 1, getMessageCount(((LocalQueueBinding) servers[0].getPostOffice().getBinding(SimpleString.of(queueName1))).getQueue())); //check sf queue on server1 exists ClusterConnectionImpl clusterconn1 = (ClusterConnectionImpl) servers[1].getClusterManager().getClusterConnection("cluster0"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ScaleDownTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ScaleDownTest.java index ecc921bfcf..677ff732b5 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ScaleDownTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ScaleDownTest.java @@ -149,8 +149,8 @@ public class ScaleDownTest extends ClusterTestBase { // removeConsumer(1); // at this point on node 0 there should be 2 messages in testQueue1 and 1 message in testQueue2 - assertEquals(TEST_SIZE, getMessageCount(((LocalQueueBinding) servers[0].getPostOffice().getBinding(new SimpleString(queueName1))).getQueue())); - assertEquals(TEST_SIZE - 1, getMessageCount(((LocalQueueBinding) servers[0].getPostOffice().getBinding(new SimpleString(queueName2))).getQueue())); + assertEquals(TEST_SIZE, getMessageCount(((LocalQueueBinding) servers[0].getPostOffice().getBinding(SimpleString.of(queueName1))).getQueue())); + assertEquals(TEST_SIZE - 1, getMessageCount(((LocalQueueBinding) servers[0].getPostOffice().getBinding(SimpleString.of(queueName2))).getQueue())); // trigger scaleDown from node 0 to node 1 servers[0].stop(); @@ -288,9 +288,9 @@ public class ScaleDownTest extends ClusterTestBase { addConsumer(0, 1, queueName1, null); addConsumer(1, 1, queueName2, null); - LocalQueueBinding queue1Binding = ((LocalQueueBinding) servers[0].getPostOffice().getBinding(new SimpleString(queueName1))); - LocalQueueBinding queue2Binding = ((LocalQueueBinding) servers[0].getPostOffice().getBinding(new SimpleString(queueName2))); - LocalQueueBinding sfQueueBinding = ((LocalQueueBinding) servers[0].getPostOffice().getBinding(new SimpleString(sfQueueName))); + LocalQueueBinding queue1Binding = ((LocalQueueBinding) servers[0].getPostOffice().getBinding(SimpleString.of(queueName1))); + LocalQueueBinding queue2Binding = ((LocalQueueBinding) servers[0].getPostOffice().getBinding(SimpleString.of(queueName2))); + LocalQueueBinding sfQueueBinding = ((LocalQueueBinding) servers[0].getPostOffice().getBinding(SimpleString.of(sfQueueName))); long timeout = 5000; long start = System.currentTimeMillis(); @@ -412,7 +412,7 @@ public class ScaleDownTest extends ClusterTestBase { // trigger scaleDown from node 0 to node 1 servers[0].stop(); - assertEquals(((QueueImpl)((LocalQueueBinding) servers[1].getPostOffice().getBinding(new SimpleString(queueName))).getBindable()).getRoutingType(), RoutingType.ANYCAST); + assertEquals(((QueueImpl)((LocalQueueBinding) servers[1].getPostOffice().getBinding(SimpleString.of(queueName))).getBindable()).getRoutingType(), RoutingType.ANYCAST); // get the 1 message from queue 2 addConsumer(0, 1, queueName, null); ClientMessage clientMessage = consumers[0].getConsumer().receive(250); @@ -453,7 +453,7 @@ public class ScaleDownTest extends ClusterTestBase { // trigger scaleDown from node 0 to node 1 servers[0].stop(); - assertEquals(((QueueImpl)((LocalQueueBinding) servers[1].getPostOffice().getBinding(new SimpleString(queueName))).getBindable()).getRoutingType(), RoutingType.ANYCAST); + assertEquals(((QueueImpl)((LocalQueueBinding) servers[1].getPostOffice().getBinding(SimpleString.of(queueName))).getBindable()).getRoutingType(), RoutingType.ANYCAST); // get the 1 message from queue 2 addConsumer(0, 1, queueName, null); ClientMessage clientMessage = consumers[0].getConsumer().receive(250); @@ -476,17 +476,17 @@ public class ScaleDownTest extends ClusterTestBase { // send messages to node 0 sendAMQPMessages(addressName, TEST_SIZE, false); - assertEquals(((QueueImpl)((LocalQueueBinding) servers[0].getPostOffice().getBinding(new SimpleString(queueName1))).getBindable()).getMessageCount(), 2); - assertEquals(((QueueImpl)((LocalQueueBinding) servers[0].getPostOffice().getBinding(new SimpleString(queueName2))).getBindable()).getMessageCount(), 2); + assertEquals(((QueueImpl)((LocalQueueBinding) servers[0].getPostOffice().getBinding(SimpleString.of(queueName1))).getBindable()).getMessageCount(), 2); + assertEquals(((QueueImpl)((LocalQueueBinding) servers[0].getPostOffice().getBinding(SimpleString.of(queueName2))).getBindable()).getMessageCount(), 2); // trigger scaleDown from node 0 to node 1 servers[0].stop(); - assertEquals(((QueueImpl)((LocalQueueBinding) servers[1].getPostOffice().getBinding(new SimpleString(queueName1))).getBindable()).getRoutingType(), RoutingType.MULTICAST); - assertEquals(((QueueImpl)((LocalQueueBinding) servers[1].getPostOffice().getBinding(new SimpleString(queueName2))).getBindable()).getRoutingType(), RoutingType.MULTICAST); + assertEquals(((QueueImpl)((LocalQueueBinding) servers[1].getPostOffice().getBinding(SimpleString.of(queueName1))).getBindable()).getRoutingType(), RoutingType.MULTICAST); + assertEquals(((QueueImpl)((LocalQueueBinding) servers[1].getPostOffice().getBinding(SimpleString.of(queueName2))).getBindable()).getRoutingType(), RoutingType.MULTICAST); - assertEquals(((QueueImpl)((LocalQueueBinding) servers[1].getPostOffice().getBinding(new SimpleString(queueName1))).getBindable()).getMessageCount(), 2); - assertEquals(((QueueImpl)((LocalQueueBinding) servers[1].getPostOffice().getBinding(new SimpleString(queueName2))).getBindable()).getMessageCount(), 2); + assertEquals(((QueueImpl)((LocalQueueBinding) servers[1].getPostOffice().getBinding(SimpleString.of(queueName1))).getBindable()).getMessageCount(), 2); + assertEquals(((QueueImpl)((LocalQueueBinding) servers[1].getPostOffice().getBinding(SimpleString.of(queueName2))).getBindable()).getMessageCount(), 2); // get the 1 message from queue 1 addConsumer(0, 1, queueName1, null); @@ -635,7 +635,7 @@ public class ScaleDownTest extends ClusterTestBase { AddressSettings defaultSetting = new AddressSettings().setPageSizeBytes(10 * 1024).setMaxSizeBytes(20 * 1024); servers[0].getAddressSettingsRepository().addMatch("#", defaultSetting); - while (!servers[0].getPagingManager().getPageStore(new SimpleString(addressName)).isPaging()) { + while (!servers[0].getPagingManager().getPageStore(SimpleString.of(addressName)).isPaging()) { for (int i = 0; i < CHUNK_SIZE; i++) { ClientMessage message = session.createMessage(true); message.getBodyBuffer().writeBytes(new byte[1024]); @@ -673,7 +673,7 @@ public class ScaleDownTest extends ClusterTestBase { AddressSettings defaultSetting = new AddressSettings().setPageSizeBytes(10 * 1024).setMaxSizeBytes(20 * 1024); servers[0].getAddressSettingsRepository().addMatch("#", defaultSetting); - while (!servers[0].getPagingManager().getPageStore(new SimpleString(addressName)).isPaging()) { + while (!servers[0].getPagingManager().getPageStore(SimpleString.of(addressName)).isPaging()) { for (int i = 0; i < CHUNK_SIZE; i++) { ClientMessage message = session.createMessage(true); message.getBodyBuffer().writeBytes(new byte[1024]); @@ -714,9 +714,9 @@ public class ScaleDownTest extends ClusterTestBase { for (int i = 0; i < TEST_SIZE; i++) { Message message = session.createMessage(false); if (i % 2 == 0) - message.putStringProperty(ClusterTestBase.FILTER_PROP, new SimpleString("0")); + message.putStringProperty(ClusterTestBase.FILTER_PROP, SimpleString.of("0")); else - message.putStringProperty(ClusterTestBase.FILTER_PROP, new SimpleString("1")); + message.putStringProperty(ClusterTestBase.FILTER_PROP, SimpleString.of("1")); producer.send(message); } session.commit(); @@ -746,9 +746,9 @@ public class ScaleDownTest extends ClusterTestBase { @TestTemplate public void testScaleDownMessageWithAutoCreatedDLAResources() throws Exception { - final SimpleString dla = new SimpleString("DLA"); - final SimpleString queueName = new SimpleString("q1"); - final SimpleString addressName = new SimpleString("q1"); + final SimpleString dla = SimpleString.of("DLA"); + final SimpleString queueName = SimpleString.of("q1"); + final SimpleString addressName = SimpleString.of("q1"); final String sampleText = "Put me on DLA"; //Set up resources for Auto-created DLAs @@ -807,9 +807,9 @@ public class ScaleDownTest extends ClusterTestBase { @TestTemplate public void testScaleDownPagedMessageWithMultipleAutoCreatedDLAResources() throws Exception { - final SimpleString dla = new SimpleString("DLA"); - final SimpleString qName = new SimpleString("Q"); - final SimpleString adName = new SimpleString("ADDR"); + final SimpleString dla = SimpleString.of("DLA"); + final SimpleString qName = SimpleString.of("Q"); + final SimpleString adName = SimpleString.of("ADDR"); final String sampleText = "Put me on DLQ"; final int messageCount = 10; final int numQueues = 2; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ServerFilterTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ServerFilterTest.java index 0429e3e4f0..78d5066002 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ServerFilterTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ServerFilterTest.java @@ -78,7 +78,7 @@ public class ServerFilterTest extends ActiveMQTestBase { }); } runAfter(executor::shutdownNow); - Wait.assertEquals(threadCount * messageCount, () -> server.getAddressInfo(SimpleString.toSimpleString(address)).getRoutedMessageCount(), 2000, 100); + Wait.assertEquals(threadCount * messageCount, () -> server.getAddressInfo(SimpleString.of(address)).getRoutedMessageCount(), 2000, 100); Wait.assertEquals(threadCount * messageCount, () -> server.locateQueue("A").getMessageCount(), 2000, 100); Wait.assertEquals(threadCount * messageCount, () -> server.locateQueue("B").getMessageCount(), 2000, 100); } 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 fccf589bf5..10f2524680 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 @@ -68,7 +68,7 @@ import org.junit.jupiter.api.extension.ExtendWith; @ExtendWith(ParameterizedTestExtension.class) public class CoreClientOverOneWaySSLTest extends ActiveMQTestBase { - public static final SimpleString QUEUE = new SimpleString("QueueOverSSL"); + public static final SimpleString QUEUE = SimpleString.of("QueueOverSSL"); private boolean generateWarning; private boolean useKeystoreAlias; 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 7eda7347c1..d1f1d0b303 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 @@ -108,7 +108,7 @@ public class CoreClientOverTwoWaySSLTest extends ActiveMQTestBase { CLIENT_SIDE_KEYSTORE = "client-keystore." + suffix; } - public static final SimpleString QUEUE = new SimpleString("QueueOverSSL"); + public static final SimpleString QUEUE = SimpleString.of("QueueOverSSL"); private String storeType; private String storeProvider; 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 1b4efbf7b7..55258d7431 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 @@ -56,7 +56,7 @@ import org.junit.jupiter.api.Test; */ public class DualAuthenticationTest extends ActiveMQTestBase { - public static final SimpleString QUEUE = new SimpleString("QueueOverSSL"); + public static final SimpleString QUEUE = SimpleString.of("QueueOverSSL"); static { String path = System.getProperty("java.security.auth.login.config"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/SslPEMTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/SslPEMTest.java index 8abbbddca5..923898e025 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/SslPEMTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/SslPEMTest.java @@ -118,7 +118,7 @@ public class SslPEMTest extends ActiveMQTestBase { @BeforeEach public void setUp() throws Exception { super.setUp(); - QUEUE = new SimpleString(getName()); + QUEUE = SimpleString.of(getName()); Map params = new HashMap<>(); params.put(TransportConstants.SSL_ENABLED_PROP_NAME, true); 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 1ba41b649e..e229a069a9 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 @@ -61,7 +61,7 @@ public class FQQNStompTest extends StompTestBase { public void setUp() throws Exception { super.setUp(); conn = StompClientConnectionFactory.createClientConnection(uri); - QueueQueryResult result = server.queueQuery(new SimpleString(getQueueName())); + QueueQueryResult result = server.queueQuery(SimpleString.of(getQueueName())); assertTrue(result.isExists()); } @@ -99,9 +99,9 @@ public class FQQNStompTest extends StompTestBase { @TestTemplate public void testReceiveFQQN2() throws Exception { - final SimpleString myAddress = SimpleString.toSimpleString("myAddress"); - final SimpleString q1Name = SimpleString.toSimpleString("q1"); - final SimpleString q2Name = SimpleString.toSimpleString("q2"); + final SimpleString myAddress = SimpleString.of("myAddress"); + final SimpleString q1Name = SimpleString.of("q1"); + final SimpleString q2Name = SimpleString.of("q2"); Queue q1 = server.createQueue(new QueueConfiguration(q1Name).setAddress(myAddress)); Queue q2 = server.createQueue(new QueueConfiguration(q2Name).setAddress(myAddress)); @@ -123,9 +123,9 @@ public class FQQNStompTest extends StompTestBase { @TestTemplate public void testSendFQQNMulticast() throws Exception { - final SimpleString myAddress = SimpleString.toSimpleString("myAddress"); - final SimpleString q1Name = SimpleString.toSimpleString("q1"); - final SimpleString q2Name = SimpleString.toSimpleString("q2"); + final SimpleString myAddress = SimpleString.of("myAddress"); + final SimpleString q1Name = SimpleString.of("q1"); + final SimpleString q2Name = SimpleString.of("q2"); Queue q1 = server.createQueue(new QueueConfiguration(q1Name).setAddress(myAddress)); Queue q2 = server.createQueue(new QueueConfiguration(q2Name).setAddress(myAddress)); @@ -148,9 +148,9 @@ public class FQQNStompTest extends StompTestBase { @TestTemplate public void testSendFQQNAnycast() throws Exception { - final SimpleString myAddress = SimpleString.toSimpleString("myAddress"); - final SimpleString q1Name = SimpleString.toSimpleString("q1"); - final SimpleString q2Name = SimpleString.toSimpleString("q2"); + final SimpleString myAddress = SimpleString.of("myAddress"); + final SimpleString q1Name = SimpleString.of("q1"); + final SimpleString q2Name = SimpleString.of("q2"); Queue q1 = server.createQueue(new QueueConfiguration(q1Name).setAddress(myAddress).setRoutingType(RoutingType.ANYCAST)); Queue q2 = server.createQueue(new QueueConfiguration(q2Name).setAddress(myAddress).setRoutingType(RoutingType.ANYCAST)); @@ -215,8 +215,8 @@ public class FQQNStompTest extends StompTestBase { @TestTemplate public void testAutoCreateOnSendFQQN() throws Exception { - final SimpleString myAddress = SimpleString.toSimpleString("myAddress"); - final SimpleString q1Name = SimpleString.toSimpleString("q1"); + final SimpleString myAddress = SimpleString.of("myAddress"); + final SimpleString q1Name = SimpleString.of("q1"); conn.connect(defUser, defPass); send(conn, myAddress + "\\c\\c" + q1Name, null, "Hello World!"); @@ -249,9 +249,9 @@ public class FQQNStompTest extends StompTestBase { } private void internalTestAutoCreateOnSubscribeFQQN(RoutingType routingType) throws Exception { - final SimpleString myAddress = SimpleString.toSimpleString("myAddress"); - final SimpleString q1Name = SimpleString.toSimpleString("q1"); - final SimpleString q2Name = SimpleString.toSimpleString("q2"); + final SimpleString myAddress = SimpleString.of("myAddress"); + final SimpleString q1Name = SimpleString.of("q1"); + final SimpleString q2Name = SimpleString.of("q2"); StompClientConnection consumer1Connection = StompClientConnectionFactory.createClientConnection(uri); consumer1Connection.connect(defUser, defPass); 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 af4a4d4fe8..3ab02161f2 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 @@ -385,9 +385,9 @@ public class StompTest extends StompTestBase { assertTrue(Math.abs(tnow - tmsg) < 1500); // closing the consumer here should trigger auto-deletion - assertNotNull(server.getPostOffice().getBinding(new SimpleString(queue))); + assertNotNull(server.getPostOffice().getBinding(SimpleString.of(queue))); consumer.close(); - Wait.assertTrue(() -> server.getPostOffice().getBinding(new SimpleString(queue)) == null); + Wait.assertTrue(() -> server.getPostOffice().getBinding(SimpleString.of(queue)) == null); } @TestTemplate @@ -425,11 +425,11 @@ public class StompTest extends StompTestBase { long tmsg = message.getJMSTimestamp(); assertTrue(Math.abs(tnow - tmsg) < 1500); - assertNotNull(server.getAddressInfo(new SimpleString(topic))); + assertNotNull(server.getAddressInfo(SimpleString.of(topic))); // closing the consumer here should trigger auto-deletion of the subscription queue and address consumer.close(); - Wait.assertTrue(() -> server.getAddressInfo(new SimpleString(topic)) == null); + Wait.assertTrue(() -> server.getAddressInfo(SimpleString.of(topic)) == null); } @TestTemplate @@ -832,7 +832,7 @@ public class StompTest extends StompTestBase { @TestTemplate public void testSubscriptionQueueCreatedWhenAutoCreateDisabled() throws Exception { - SimpleString topic = SimpleString.toSimpleString(getTopicPrefix() + getTopicName()); + SimpleString topic = SimpleString.of(getTopicPrefix() + getTopicName()); server.getAddressSettingsRepository().getMatch(topic.toString()).setAutoCreateQueues(false); conn.connect(defUser, defPass); @@ -997,11 +997,11 @@ public class StompTest extends StompTestBase { ClientMessage ignoredMessage = clientSession.createMessage(false); ignoredMessage.putStringProperty("foo-bar", "1234"); - ignoredMessage.getBodyBuffer().writeNullableSimpleString(SimpleString.toSimpleString("Ignored message")); + ignoredMessage.getBodyBuffer().writeNullableSimpleString(SimpleString.of("Ignored message")); ClientMessage realMessage = clientSession.createMessage(false); realMessage.putStringProperty("foo-bar", "zzz"); - realMessage.getBodyBuffer().writeNullableSimpleString(SimpleString.toSimpleString("Real message")); + realMessage.getBodyBuffer().writeNullableSimpleString(SimpleString.of("Real message")); producer.send(ignoredMessage); producer.send(realMessage); @@ -1323,15 +1323,15 @@ public class StompTest extends StompTestBase { assertEquals(getQueuePrefix() + nonExistentQueue, frame.getHeader(Stomp.Headers.Send.DESTINATION)); assertEquals(getName(), frame.getBody()); - assertNotNull(server.getPostOffice().getBinding(new SimpleString(nonExistentQueue))); + assertNotNull(server.getPostOffice().getBinding(SimpleString.of(nonExistentQueue))); - final Queue subscription = ((LocalQueueBinding) server.getPostOffice().getBinding(new SimpleString(nonExistentQueue))).getQueue(); + final Queue subscription = ((LocalQueueBinding) server.getPostOffice().getBinding(SimpleString.of(nonExistentQueue))).getQueue(); Wait.assertEquals(0, subscription::getMessageCount); unsubscribe(conn, null, getQueuePrefix() + nonExistentQueue, true, false); - Wait.assertTrue(() -> server.getPostOffice().getBinding(new SimpleString(nonExistentQueue)) == null); + Wait.assertTrue(() -> server.getPostOffice().getBinding(SimpleString.of(nonExistentQueue)) == null); sendJmsMessage(getName(), ActiveMQJMSClient.createQueue(nonExistentQueue)); @@ -1431,7 +1431,7 @@ public class StompTest extends StompTestBase { conn.disconnect(); Thread.sleep(500); - assertNotNull(server.locateQueue(SimpleString.toSimpleString("myclientid." + getName()))); + assertNotNull(server.locateQueue(SimpleString.of("myclientid." + getName()))); conn.destroy(); conn = StompClientConnectionFactory.createClientConnection(uri); @@ -1441,7 +1441,7 @@ public class StompTest extends StompTestBase { conn.disconnect(); Thread.sleep(500); - Wait.assertTrue(() -> server.locateQueue(SimpleString.toSimpleString("myclientid." + getName())) == null); + Wait.assertTrue(() -> server.locateQueue(SimpleString.of("myclientid." + getName())) == null); } @TestTemplate @@ -1457,7 +1457,7 @@ public class StompTest extends StompTestBase { frame = conn.sendFrame(frame); assertEquals(receipt, frame.getHeader(Stomp.Headers.Response.RECEIPT_ID)); - Wait.assertTrue(() -> server.locateQueue(SimpleString.toSimpleString("myclientid." + durableSubName)) != null); + Wait.assertTrue(() -> server.locateQueue(SimpleString.of("myclientid." + durableSubName)) != null); receipt = UUID.randomUUID().toString(); frame = conn.createFrame(Stomp.Commands.UNSUBSCRIBE).addHeader(Stomp.Headers.Unsubscribe.ID, subId).addHeader(Stomp.Headers.RECEIPT_REQUESTED, receipt); @@ -1468,7 +1468,7 @@ public class StompTest extends StompTestBase { conn.disconnect(); // make sure the durable subscription queue is still there - Wait.assertTrue(() -> server.locateQueue(SimpleString.toSimpleString("myclientid." + durableSubName)) != null); + Wait.assertTrue(() -> server.locateQueue(SimpleString.of("myclientid." + durableSubName)) != null); } @TestTemplate @@ -1478,7 +1478,7 @@ public class StompTest extends StompTestBase { conn.disconnect(); Thread.sleep(500); - assertNotNull(server.locateQueue(SimpleString.toSimpleString("myclientid." + getName()))); + assertNotNull(server.locateQueue(SimpleString.of("myclientid." + getName()))); conn.destroy(); conn = StompClientConnectionFactory.createClientConnection(uri); @@ -1488,7 +1488,7 @@ public class StompTest extends StompTestBase { conn.disconnect(); Thread.sleep(500); - Wait.assertTrue(() -> server.locateQueue(SimpleString.toSimpleString("myclientid." + getName())) == null); + Wait.assertTrue(() -> server.locateQueue(SimpleString.of("myclientid." + getName())) == null); } @TestTemplate @@ -1691,7 +1691,7 @@ public class StompTest extends StompTestBase { assertEquals(uuid, frame.getHeader(Stomp.Headers.Response.RECEIPT_ID)); } - AddressInfo addressInfo = server.getAddressInfo(SimpleString.toSimpleString(ADDRESS)); + AddressInfo addressInfo = server.getAddressInfo(SimpleString.of(ADDRESS)); assertNotNull(addressInfo, "No address was created with the name " + ADDRESS); Set routingTypes = new HashSet<>(); @@ -1724,16 +1724,16 @@ public class StompTest extends StompTestBase { frame = conn.sendFrame(frame); assertEquals(uuid, frame.getHeader(Stomp.Headers.Response.RECEIPT_ID)); - AddressInfo addressInfo = server.getAddressInfo(SimpleString.toSimpleString(ADDRESS)); + AddressInfo addressInfo = server.getAddressInfo(SimpleString.of(ADDRESS)); assertNotNull(addressInfo, "No address was created with the name " + ADDRESS); assertTrue(addressInfo.getRoutingTypes().contains(RoutingType.ANYCAST)); assertFalse(addressInfo.getRoutingTypes().contains(RoutingType.MULTICAST)); - assertNotNull(server.locateQueue(SimpleString.toSimpleString(ADDRESS))); + assertNotNull(server.locateQueue(SimpleString.of(ADDRESS))); // sending a MULTICAST message should alter the address to support MULTICAST frame = send(conn, "/topic/" + ADDRESS, null, "Hello World 1", true); assertFalse(frame.getCommand().equals("ERROR")); - addressInfo = server.getAddressInfo(SimpleString.toSimpleString(ADDRESS)); + addressInfo = server.getAddressInfo(SimpleString.of(ADDRESS)); assertTrue(addressInfo.getRoutingTypes().contains(RoutingType.ANYCAST)); assertTrue(addressInfo.getRoutingTypes().contains(RoutingType.MULTICAST)); @@ -1754,7 +1754,7 @@ public class StompTest extends StompTestBase { unsubscribe(conn, null, "/queue/" + ADDRESS, true, false); - Wait.assertTrue(() -> server.getAddressInfo(SimpleString.toSimpleString(ADDRESS)) == null); + Wait.assertTrue(() -> server.getAddressInfo(SimpleString.of(ADDRESS)) == null); // now subscribe to the address in a MULTICAST way which will create a MULTICAST queue for the subscription uuid = UUID.randomUUID().toString(); @@ -1803,7 +1803,7 @@ public class StompTest extends StompTestBase { frame = conn.sendFrame(frame); assertEquals(uuid, frame.getHeader(Stomp.Headers.Response.RECEIPT_ID)); - AddressInfo addressInfo = server.getAddressInfo(SimpleString.toSimpleString(ADDRESS)); + AddressInfo addressInfo = server.getAddressInfo(SimpleString.of(ADDRESS)); assertNotNull(addressInfo, "No address was created with the name " + ADDRESS); assertTrue(addressInfo.getRoutingTypes().contains(RoutingType.MULTICAST)); assertFalse(addressInfo.getRoutingTypes().contains(RoutingType.ANYCAST)); @@ -1811,10 +1811,10 @@ public class StompTest extends StompTestBase { // sending an ANYCAST message should alter the address to support ANYCAST and create an ANYCAST queue frame = send(conn, "/queue/" + ADDRESS, null, "Hello World 1", true); assertFalse(frame.getCommand().equals("ERROR")); - addressInfo = server.getAddressInfo(SimpleString.toSimpleString(ADDRESS)); + addressInfo = server.getAddressInfo(SimpleString.of(ADDRESS)); assertTrue(addressInfo.getRoutingTypes().contains(RoutingType.ANYCAST)); assertTrue(addressInfo.getRoutingTypes().contains(RoutingType.MULTICAST)); - assertNotNull(server.locateQueue(SimpleString.toSimpleString(ADDRESS))); + assertNotNull(server.locateQueue(SimpleString.of(ADDRESS))); // however, no message should be routed to the MULTICAST queue frame = conn.receiveFrame(100); @@ -1997,8 +1997,8 @@ public class StompTest extends StompTestBase { send(conn, addressA, null, "Hello World!", true, RoutingType.ANYCAST); - Wait.assertTrue(() -> server.locateQueue(SimpleString.toSimpleString(queueA)).getMessageCount() + server.locateQueue(SimpleString.toSimpleString(queueB)).getMessageCount() == 1); - Wait.assertTrue(() -> server.locateQueue(SimpleString.toSimpleString(queueC)).getMessageCount() == 0); + Wait.assertTrue(() -> server.locateQueue(SimpleString.of(queueA)).getMessageCount() + server.locateQueue(SimpleString.of(queueB)).getMessageCount() == 1); + Wait.assertTrue(() -> server.locateQueue(SimpleString.of(queueC)).getMessageCount() == 0); } @TestTemplate @@ -2018,8 +2018,8 @@ public class StompTest extends StompTestBase { send(conn, addressA, null, "Hello World!", true, RoutingType.MULTICAST); - Wait.assertTrue(() -> server.locateQueue(SimpleString.toSimpleString(queueA)).getMessageCount() == 0); - Wait.assertTrue(() -> server.locateQueue(SimpleString.toSimpleString(queueC)).getMessageCount() + server.locateQueue(SimpleString.toSimpleString(queueB)).getMessageCount() == 2); + Wait.assertTrue(() -> server.locateQueue(SimpleString.of(queueA)).getMessageCount() == 0); + Wait.assertTrue(() -> server.locateQueue(SimpleString.of(queueC)).getMessageCount() + server.locateQueue(SimpleString.of(queueB)).getMessageCount() == 2); } @TestTemplate @@ -2041,8 +2041,8 @@ public class StompTest extends StompTestBase { send(conn, addressA, null, "Hello World!", true); - Wait.assertTrue(() -> server.locateQueue(SimpleString.toSimpleString(queueA)).getMessageCount() + server.locateQueue(SimpleString.toSimpleString(queueB)).getMessageCount() == 1); - Wait.assertTrue(() -> server.locateQueue(SimpleString.toSimpleString(queueC)).getMessageCount() + server.locateQueue(SimpleString.toSimpleString(queueD)).getMessageCount() == 2); + Wait.assertTrue(() -> server.locateQueue(SimpleString.of(queueA)).getMessageCount() + server.locateQueue(SimpleString.of(queueB)).getMessageCount() == 1); + Wait.assertTrue(() -> server.locateQueue(SimpleString.of(queueC)).getMessageCount() + server.locateQueue(SimpleString.of(queueD)).getMessageCount() == 2); } @TestTemplate @@ -2050,7 +2050,7 @@ public class StompTest extends StompTestBase { conn.connect(defUser, defPass); String queueName = UUID.randomUUID().toString(); - SimpleString simpleQueueName = SimpleString.toSimpleString(queueName); + SimpleString simpleQueueName = SimpleString.of(queueName); assertNull(server.getAddressInfo(simpleQueueName)); assertNull(server.locateQueue(simpleQueueName)); @@ -2069,7 +2069,7 @@ public class StompTest extends StompTestBase { conn.connect(defUser, defPass); String queueName = UUID.randomUUID().toString(); - SimpleString simpleQueueName = SimpleString.toSimpleString(queueName); + SimpleString simpleQueueName = SimpleString.of(queueName); assertNull(server.getAddressInfo(simpleQueueName)); assertNull(server.locateQueue(simpleQueueName)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestMultiThreaded.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestMultiThreaded.java index 1362a9da7e..7091ffcc2c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestMultiThreaded.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestMultiThreaded.java @@ -34,7 +34,7 @@ import org.junit.jupiter.api.extension.ExtendWith; @ExtendWith(ParameterizedTestExtension.class) public class StompTestMultiThreaded extends StompTestBase { - private static final SimpleString QUEUE = new SimpleString("x"); + private static final SimpleString QUEUE = SimpleString.of("x"); class SomeConsumer extends Thread { 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 7761f8480e..84e3d8bfeb 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 @@ -71,7 +71,7 @@ public class StompWithRejectingInterceptorTest extends StompTestBase { assertEquals(incomingCommands.get(i), IncomingStompFrameRejectInterceptor.interceptedFrames.get(i).getCommand()); } - Wait.assertFalse(() -> server.locateQueue(SimpleString.toSimpleString(getQueuePrefix() + getQueueName())).getMessageCount() > 0, 1000, 100); + Wait.assertFalse(() -> server.locateQueue(SimpleString.of(getQueuePrefix() + getQueueName())).getMessageCount() > 0, 1000, 100); } public static class IncomingStompFrameRejectInterceptor implements StompFrameInterceptor { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v11/StompV11Test.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v11/StompV11Test.java index 137653e576..941c3003f1 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v11/StompV11Test.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v11/StompV11Test.java @@ -1553,7 +1553,7 @@ public class StompV11Test extends StompTestBase { @TestTemplate public void testDurableUnSubscribe() throws Exception { - SimpleString queueName = SimpleString.toSimpleString(CLIENT_ID + "." + getName()); + SimpleString queueName = SimpleString.of(CLIENT_ID + "." + getName()); conn.connect(defUser, defPass, CLIENT_ID); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v12/StompV12Test.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v12/StompV12Test.java index 613e25c297..839b8ac3c0 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v12/StompV12Test.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v12/StompV12Test.java @@ -1601,7 +1601,7 @@ public class StompV12Test extends StompTestBase { unsubscribe(conn, getName(), null, false, true); - SimpleString queueName = SimpleString.toSimpleString(CLIENT_ID + "." + getName()); + SimpleString queueName = SimpleString.of(CLIENT_ID + "." + getName()); Wait.assertTrue(() -> server.locateQueue(queueName) == null); conn.disconnect(); 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 96bb51482f..7c6021069f 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 @@ -97,7 +97,7 @@ public class NettyConnectorWithHTTPUpgradeTest extends ActiveMQTestBase { this.useSSL = useSSL; } - private static final SimpleString QUEUE = new SimpleString("NettyConnectorWithHTTPUpgradeTest"); + private static final SimpleString QUEUE = SimpleString.of("NettyConnectorWithHTTPUpgradeTest"); private static final int HTTP_PORT = 8789; 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 c355da0fc5..82cde843d5 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 @@ -76,7 +76,7 @@ public class BasicXaRecoveryTest extends ActiveMQTestBase { private Configuration configuration; - private final SimpleString atestq = new SimpleString("atestq"); + private final SimpleString atestq = SimpleString.of("atestq"); private ServerLocator locator; @@ -254,7 +254,7 @@ public class BasicXaRecoveryTest extends ActiveMQTestBase { return; Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes()); - SimpleString pageQueue = new SimpleString("pagequeue"); + SimpleString pageQueue = SimpleString.of("pagequeue"); AddressSettings pageAddressSettings = new AddressSettings().setMaxSizeBytes(100 * 1024).setPageSizeBytes(10 * 1024); @@ -331,7 +331,7 @@ public class BasicXaRecoveryTest extends ActiveMQTestBase { public void testRollbackPaging(final boolean restartServer) throws Exception { Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes()); - SimpleString pageQueue = new SimpleString("pagequeue"); + SimpleString pageQueue = SimpleString.of("pagequeue"); AddressSettings pageAddressSettings = new AddressSettings().setMaxSizeBytes(100 * 1024).setPageSizeBytes(10 * 1024); @@ -987,7 +987,7 @@ public class BasicXaRecoveryTest extends ActiveMQTestBase { ClientMessage m8 = createTextMessage("m8"); ClientSession clientSession2 = sessionFactory.createSession(false, true, true); ClientProducer clientProducer2 = clientSession2.createProducer(atestq); - SimpleString anewtestq = new SimpleString("anewtestq"); + SimpleString anewtestq = SimpleString.of("anewtestq"); clientSession.createQueue(new QueueConfiguration(anewtestq)); ClientProducer clientProducer3 = clientSession2.createProducer(anewtestq); clientProducer2.send(m1); @@ -1073,7 +1073,7 @@ public class BasicXaRecoveryTest extends ActiveMQTestBase { ClientMessage m8 = createTextMessage("m8"); ClientSession clientSession2 = sessionFactory.createSession(false, true, true); ClientProducer clientProducer2 = clientSession2.createProducer(atestq); - SimpleString anewtestq = new SimpleString("anewtestq"); + SimpleString anewtestq = SimpleString.of("anewtestq"); clientSession.createQueue(new QueueConfiguration(anewtestq)); ClientProducer clientProducer3 = clientSession2.createProducer(anewtestq); clientProducer2.send(m1); 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 4df6c1035c..ecb5534544 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 @@ -79,7 +79,7 @@ public class BasicXaTest extends ActiveMQTestBase { private Configuration configuration; - private final SimpleString atestq = new SimpleString("BasicXaTestq"); + private final SimpleString atestq = SimpleString.of("BasicXaTestq"); private ServerLocator locator; @@ -732,8 +732,8 @@ public class BasicXaTest extends ActiveMQTestBase { @TestTemplate public void testSimpleJoin() throws Exception { - SimpleString ADDRESS1 = new SimpleString("Address-1"); - SimpleString ADDRESS2 = new SimpleString("Address-2"); + SimpleString ADDRESS1 = SimpleString.of("Address-1"); + SimpleString ADDRESS2 = SimpleString.of("Address-2"); clientSession.createQueue(new QueueConfiguration(ADDRESS1)); clientSession.createQueue(new QueueConfiguration(ADDRESS2)); @@ -806,7 +806,7 @@ public class BasicXaTest extends ActiveMQTestBase { int NUMBER_OF_QUEUES = 10; ClientSession session = null; - SimpleString ADDRESS = new SimpleString("Address"); + SimpleString ADDRESS = SimpleString.of("Address"); ClientSession newJoinSession = null; 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 c25930874f..170c0e8cfe 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 @@ -64,7 +64,7 @@ public class SessionFailureXATest extends ActiveMQTestBase { private Configuration configuration; - private final SimpleString atestq = new SimpleString("BasicXaTestq"); + private final SimpleString atestq = SimpleString.of("BasicXaTestq"); private ServerLocator locator; 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 d2d27d9017..236be72c09 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 @@ -87,7 +87,7 @@ public class XaTimeoutTest extends ActiveMQTestBase { private Configuration configuration; - private final SimpleString atestq = new SimpleString("atestq"); + private final SimpleString atestq = SimpleString.of("atestq"); private ServerLocator locator; diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/ActiveMQServerTestCase.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/ActiveMQServerTestCase.java index 05f7994475..123742119f 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/ActiveMQServerTestCase.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/ActiveMQServerTestCase.java @@ -202,7 +202,7 @@ public abstract class ActiveMQServerTestCase { protected void deployAdministeredObjects() throws Exception { // set DLA and expiry to avoid spamming the log with warnings - getJmsServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setDeadLetterAddress(SimpleString.toSimpleString("DLA")).setExpiryAddress(SimpleString.toSimpleString("Expiry"))); + getJmsServer().getAddressSettingsRepository().addMatch("#", new AddressSettings().setDeadLetterAddress(SimpleString.of("DLA")).setExpiryAddress(SimpleString.of("Expiry"))); createTopic("Topic1"); createTopic("Topic2"); createTopic("Topic3"); @@ -340,7 +340,7 @@ public abstract class ActiveMQServerTestCase { protected boolean assertRemainingMessages(final int expected) throws Exception { String queueName = "Queue1"; - Binding binding = servers.get(0).getActiveMQServer().getPostOffice().getBinding(SimpleString.toSimpleString(queueName)); + Binding binding = servers.get(0).getActiveMQServer().getPostOffice().getBinding(SimpleString.of(queueName)); if (binding != null && binding instanceof LocalQueueBinding) { ((LocalQueueBinding) binding).getQueue().flushExecutor(); } 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 bf2786b425..c42573e6ae 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 @@ -713,7 +713,7 @@ public class MessageProducerTest extends JMSTestCase { @Test public void testSendToQueueOnlyWhenTopicWithSameAddress() throws Exception { - SimpleString addr = SimpleString.toSimpleString("testAddr"); + SimpleString addr = SimpleString.of("testAddr"); EnumSet supportedRoutingTypes = EnumSet.of(RoutingType.ANYCAST, RoutingType.MULTICAST); 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 eca69e4f09..0e5669e8dd 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 @@ -194,7 +194,7 @@ public class SecurityTest extends JMSTestCase { */ @Test public void testLoginValidUserAndPasswordButNotAuthorisedToSend() throws Exception { - SimpleString queueName = SimpleString.toSimpleString("guest.cannot.send"); + SimpleString queueName = SimpleString.of("guest.cannot.send"); if (getJmsServer().locateQueue(queueName) == null) { getJmsServer().createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST)); } @@ -219,7 +219,7 @@ public class SecurityTest extends JMSTestCase { */ @Test public void testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistent() throws Exception { - SimpleString queueName = SimpleString.toSimpleString("guest.cannot.send"); + SimpleString queueName = SimpleString.of("guest.cannot.send"); if (getJmsServer().locateQueue(queueName) == null) { getJmsServer().createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST)); } @@ -265,7 +265,7 @@ public class SecurityTest extends JMSTestCase { */ @Test public void testLoginValidUserAndPasswordButNotAuthorisedToSendNonPersistentJMS2() throws Exception { - SimpleString queueName = SimpleString.toSimpleString("guest.cannot.send"); + SimpleString queueName = SimpleString.of("guest.cannot.send"); if (getJmsServer().locateQueue(queueName) == null) { getJmsServer().createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST)); } @@ -311,7 +311,7 @@ public class SecurityTest extends JMSTestCase { */ @Test public void testLoginValidUserAndPasswordButNotAuthorisedToSendLargeNonPersistent() throws Exception { - SimpleString queueName = SimpleString.toSimpleString("guest.cannot.send"); + SimpleString queueName = SimpleString.of("guest.cannot.send"); if (getJmsServer().locateQueue(queueName) == null) { getJmsServer().createQueue(new QueueConfiguration(queueName).setRoutingType(RoutingType.ANYCAST)); } diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/MessagePropertyConversionTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/MessagePropertyConversionTest.java index b5b2bd7e07..6ed725b7cc 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/MessagePropertyConversionTest.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/MessagePropertyConversionTest.java @@ -148,7 +148,7 @@ public class MessagePropertyConversionTest extends ActiveMQServerTestCase { //pass } try { - producer.setProperty(null, new SimpleString("foo")); + producer.setProperty(null, SimpleString.of("foo")); ProxyAssertSupport.fail("expected IllegalArgumentException"); } catch (IllegalArgumentException e) { //pass diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/LocalTestServer.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/LocalTestServer.java index dcf540205a..fed7ef6f23 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/LocalTestServer.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/LocalTestServer.java @@ -340,7 +340,7 @@ public class LocalTestServer implements Server, Runnable { @Override public List listAllSubscribersForTopic(final String s) throws Exception { - ObjectName objectName = ObjectNameBuilder.DEFAULT.getAddressObjectName(new SimpleString(s)); + ObjectName objectName = ObjectNameBuilder.DEFAULT.getAddressObjectName(SimpleString.of(s)); AddressControl topic = MBeanServerInvocationHandler.newProxyInstance(ManagementFactory.getPlatformMBeanServer(), objectName, AddressControl.class, false); Object[] subInfos = topic.getQueueNames(); List subs = new ArrayList<>(); diff --git a/tests/joram-tests/src/test/java/org/apache/activemq/artemis/common/SpawnedJMSServer.java b/tests/joram-tests/src/test/java/org/apache/activemq/artemis/common/SpawnedJMSServer.java index 78ba059f2a..3859591ee3 100644 --- a/tests/joram-tests/src/test/java/org/apache/activemq/artemis/common/SpawnedJMSServer.java +++ b/tests/joram-tests/src/test/java/org/apache/activemq/artemis/common/SpawnedJMSServer.java @@ -85,7 +85,7 @@ public class SpawnedJMSServer { // disable server persistence since JORAM tests do not restart server server = ActiveMQServers.newActiveMQServer(config, useFiles); // set DLA and expiry to avoid spamming the log with warnings - server.getAddressSettingsRepository().addMatch("#", new AddressSettings().setDeadLetterAddress(SimpleString.toSimpleString("DLA")).setExpiryAddress(SimpleString.toSimpleString("Expiry"))); + server.getAddressSettingsRepository().addMatch("#", new AddressSettings().setDeadLetterAddress(SimpleString.of("DLA")).setExpiryAddress(SimpleString.of("Expiry"))); server.start(); } diff --git a/tests/leak-tests/src/test/java/org/apache/activemq/artemis/tests/leak/CoreClientLeakTest.java b/tests/leak-tests/src/test/java/org/apache/activemq/artemis/tests/leak/CoreClientLeakTest.java index 746e9a6daa..17eba637e7 100644 --- a/tests/leak-tests/src/test/java/org/apache/activemq/artemis/tests/leak/CoreClientLeakTest.java +++ b/tests/leak-tests/src/test/java/org/apache/activemq/artemis/tests/leak/CoreClientLeakTest.java @@ -79,8 +79,8 @@ public class CoreClientLeakTest extends AbstractLeakTest { ServerLocator locator = ActiveMQClient.createServerLocator("tcp://localhost:61616"); SimpleString queue = RandomUtil.randomSimpleString(); SimpleString address = RandomUtil.randomSimpleString(); - SimpleString emptyString = SimpleString.toSimpleString(""); - SimpleString dummyFilter = SimpleString.toSimpleString("dummy=true"); + SimpleString emptyString = SimpleString.of(""); + SimpleString dummyFilter = SimpleString.of("dummy=true"); try (ClientSessionFactory sf = createSessionFactory(locator); 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 4892ff5ef2..c38b70d069 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 @@ -48,7 +48,7 @@ public class MeasurePagingMultiThreadTest extends ActiveMQTestBase { ServerLocator locator = createInVMNonHALocator(); try { final ClientSessionFactory factory = createSessionFactory(locator); - final SimpleString adr = new SimpleString("test-adr"); + final SimpleString adr = SimpleString.of("test-adr"); createDestination(factory, adr); diff --git a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/console/QueuesTest.java b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/console/QueuesTest.java index bb10de1f4f..d01b381bbc 100644 --- a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/console/QueuesTest.java +++ b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/console/QueuesTest.java @@ -143,12 +143,12 @@ public class QueuesTest extends ConsoleTest { final String messageText = "TEST"; final ObjectNameBuilder objectNameBuilder = ObjectNameBuilder.create(null, "0.0.0.0", true); final ObjectName expiryQueueObjectName = objectNameBuilder.getQueueObjectName( - SimpleString.toSimpleString(expiryQueueName), - SimpleString.toSimpleString(expiryQueueName), + SimpleString.of(expiryQueueName), + SimpleString.of(expiryQueueName), RoutingType.ANYCAST); final ObjectName testQueueObjectName = objectNameBuilder.getQueueObjectName( - SimpleString.toSimpleString(queueName), - SimpleString.toSimpleString(queueName), + SimpleString.of(queueName), + SimpleString.of(queueName), RoutingType.ANYCAST); driver.get(webServerUrl + "/console"); diff --git a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/jmxrbac/JmxRBACBrokerSecurityTest.java b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/jmxrbac/JmxRBACBrokerSecurityTest.java index 024ce5c90e..773d7b3afd 100644 --- a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/jmxrbac/JmxRBACBrokerSecurityTest.java +++ b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/jmxrbac/JmxRBACBrokerSecurityTest.java @@ -183,7 +183,7 @@ public class JmxRBACBrokerSecurityTest extends SmokeTestBase { ActiveMQServerControl activeMQServerControl = MBeanServerInvocationHandler.newProxyInstance(mBeanServerConnection, objectNameBuilder.getActiveMQServerObjectName(), ActiveMQServerControl.class, false); activeMQServerControl.createAddress(ADDRESS_TEST, RoutingType.MULTICAST.name()); - AddressControl testAddressControl = MBeanServerInvocationHandler.newProxyInstance(mBeanServerConnection, objectNameBuilder.getAddressObjectName(SimpleString.toSimpleString(ADDRESS_TEST)), AddressControl.class, false); + AddressControl testAddressControl = MBeanServerInvocationHandler.newProxyInstance(mBeanServerConnection, objectNameBuilder.getAddressObjectName(SimpleString.of(ADDRESS_TEST)), AddressControl.class, false); testAddressControl.sendMessage(null, Message.TEXT_TYPE, ADDRESS_TEST, true, null, null); @@ -211,7 +211,7 @@ public class JmxRBACBrokerSecurityTest extends SmokeTestBase { try { MBeanServerConnection mBeanServerConnection = jmxConnector.getMBeanServerConnection(); ObjectNameBuilder objectNameBuilder = ObjectNameBuilder.create(ActiveMQDefaultConfiguration.getDefaultJmxDomain(), BROKER_NAME, true); - AddressControl testAddressControl = MBeanServerInvocationHandler.newProxyInstance(mBeanServerConnection, objectNameBuilder.getAddressObjectName(SimpleString.toSimpleString("TEST")), AddressControl.class, false); + AddressControl testAddressControl = MBeanServerInvocationHandler.newProxyInstance(mBeanServerConnection, objectNameBuilder.getAddressObjectName(SimpleString.of("TEST")), AddressControl.class, false); try { testAddressControl.sendMessage(null, Message.TEXT_TYPE, ADDRESS_TEST, true, null, null); diff --git a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/jmxrbac/JmxRBACTest.java b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/jmxrbac/JmxRBACTest.java index 810f044e7c..7e6d51da45 100644 --- a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/jmxrbac/JmxRBACTest.java +++ b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/jmxrbac/JmxRBACTest.java @@ -183,7 +183,7 @@ public class JmxRBACTest extends SmokeTestBase { ActiveMQServerControl activeMQServerControl = MBeanServerInvocationHandler.newProxyInstance(mBeanServerConnection, objectNameBuilder.getActiveMQServerObjectName(), ActiveMQServerControl.class, false); activeMQServerControl.createAddress(ADDRESS_TEST, RoutingType.MULTICAST.name()); - AddressControl testAddressControl = MBeanServerInvocationHandler.newProxyInstance(mBeanServerConnection, objectNameBuilder.getAddressObjectName(SimpleString.toSimpleString(ADDRESS_TEST)), AddressControl.class, false); + AddressControl testAddressControl = MBeanServerInvocationHandler.newProxyInstance(mBeanServerConnection, objectNameBuilder.getAddressObjectName(SimpleString.of(ADDRESS_TEST)), AddressControl.class, false); testAddressControl.sendMessage(null, Message.TEXT_TYPE, ADDRESS_TEST, true, null, null); @@ -211,7 +211,7 @@ public class JmxRBACTest extends SmokeTestBase { try { MBeanServerConnection mBeanServerConnection = jmxConnector.getMBeanServerConnection(); ObjectNameBuilder objectNameBuilder = ObjectNameBuilder.create(ActiveMQDefaultConfiguration.getDefaultJmxDomain(), BROKER_NAME, true); - AddressControl testAddressControl = MBeanServerInvocationHandler.newProxyInstance(mBeanServerConnection, objectNameBuilder.getAddressObjectName(SimpleString.toSimpleString("TEST")), AddressControl.class, false); + AddressControl testAddressControl = MBeanServerInvocationHandler.newProxyInstance(mBeanServerConnection, objectNameBuilder.getAddressObjectName(SimpleString.of("TEST")), AddressControl.class, false); try { testAddressControl.sendMessage(null, Message.TEXT_TYPE, ADDRESS_TEST, true, null, null); diff --git a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/logging/AuditLoggerResourceTest.java b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/logging/AuditLoggerResourceTest.java index d9ea266fb4..8b1c08019f 100644 --- a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/logging/AuditLoggerResourceTest.java +++ b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/logging/AuditLoggerResourceTest.java @@ -73,7 +73,7 @@ public class AuditLoggerResourceTest extends AuditLoggerTestBase { assertTrue(findLogRecord(getAuditLog(),"successfully created queue:")); serverControl.updateQueue("auditQueue", "ANYCAST", -1, false); final QueueControl queueControl = MBeanServerInvocationHandler.newProxyInstance(mBeanServerConnection, - objectNameBuilder.getQueueObjectName(new SimpleString( "auditAddress"), new SimpleString("auditQueue"), RoutingType.ANYCAST), + objectNameBuilder.getQueueObjectName(SimpleString.of( "auditAddress"), SimpleString.of("auditQueue"), RoutingType.ANYCAST), QueueControl.class, false); assertTrue(findLogRecord(getAuditLog(),"successfully updated queue:")); 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 88af8fd566..cd4421af0e 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 @@ -42,7 +42,7 @@ public class ClientNonDivertedSoakTest extends ActiveMQTestBase { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - private static final SimpleString ADDRESS = new SimpleString("ADD"); + private static final SimpleString ADDRESS = SimpleString.of("ADD"); private static final boolean IS_JOURNAL = false; 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 11e9ff4710..580f8d0a21 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 @@ -44,7 +44,7 @@ public class ClientSoakTest extends ActiveMQTestBase { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - private static final SimpleString ADDRESS = new SimpleString("ADD"); + private static final SimpleString ADDRESS = SimpleString.of("ADD"); private static final SimpleString DIVERTED_AD1 = ClientSoakTest.ADDRESS.concat("-1"); 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 ba74771ffe..1d974bb3bc 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 @@ -39,7 +39,7 @@ import org.junit.jupiter.api.Test; public class SimpleSendReceiveSoakTest extends ActiveMQTestBase { - private static final SimpleString ADDRESS = new SimpleString("ADD"); + private static final SimpleString ADDRESS = SimpleString.of("ADD"); private static final boolean IS_JOURNAL = false; diff --git a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/paging/M_and_M_FactoryTest.java b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/paging/M_and_M_FactoryTest.java index e37c283e34..11cf70feab 100644 --- a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/paging/M_and_M_FactoryTest.java +++ b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/paging/M_and_M_FactoryTest.java @@ -164,7 +164,7 @@ public class M_and_M_FactoryTest extends SoakTestBase { String brokerName = "0.0.0.0"; // configured e.g. in broker.xml element ObjectNameBuilder objectNameBuilder = ObjectNameBuilder.create(ActiveMQDefaultConfiguration.getDefaultJmxDomain(), brokerName, true); - ObjectName queueObjectName = objectNameBuilder.getQueueObjectName(SimpleString.toSimpleString("MMFactory"), SimpleString.toSimpleString("MMConsumer"), RoutingType.MULTICAST); + ObjectName queueObjectName = objectNameBuilder.getQueueObjectName(SimpleString.of("MMFactory"), SimpleString.of("MMConsumer"), RoutingType.MULTICAST); QueueControl queueControl = MBeanServerInvocationHandler.newProxyInstance(mBeanServerConnection, queueObjectName, QueueControl.class, false); final int NUMBER_OF_CONSUMERS = 6; diff --git a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/paging/MegaCleanerPagingTest.java b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/paging/MegaCleanerPagingTest.java index 8f8fa79f66..c3809a2422 100644 --- a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/paging/MegaCleanerPagingTest.java +++ b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/paging/MegaCleanerPagingTest.java @@ -170,7 +170,7 @@ public class MegaCleanerPagingTest extends ActiveMQTestBase { session.commit(); - PagingStoreImpl store = (PagingStoreImpl) server.getPagingManager().getPageStore(SimpleString.toSimpleString(queueName)); + PagingStoreImpl store = (PagingStoreImpl) server.getPagingManager().getPageStore(SimpleString.of(queueName)); store.disableCleanup(); MessageConsumer consumer = session.createConsumer(queue); @@ -227,7 +227,7 @@ public class MegaCleanerPagingTest extends ActiveMQTestBase { session.commit(); - PagingStoreImpl store = (PagingStoreImpl) server.getPagingManager().getPageStore(SimpleString.toSimpleString(queueName)); + PagingStoreImpl store = (PagingStoreImpl) server.getPagingManager().getPageStore(SimpleString.of(queueName)); store.disableCleanup(); MessageConsumer consumer = session.createConsumer(queue); @@ -317,7 +317,7 @@ public class MegaCleanerPagingTest extends ActiveMQTestBase { session.commit(); - PagingStoreImpl store = (PagingStoreImpl) server.getPagingManager().getPageStore(SimpleString.toSimpleString(queueName)); + PagingStoreImpl store = (PagingStoreImpl) server.getPagingManager().getPageStore(SimpleString.of(queueName)); store.disableCleanup(); MessageConsumer consumer = session.createConsumer(queue); 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 a073604d21..d5785e2dc5 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 @@ -46,9 +46,9 @@ import org.junit.jupiter.api.Test; public class MultiThreadConsumerStressTest extends ActiveMQTestBase { - final SimpleString ADDRESS = new SimpleString("SomeAddress"); + final SimpleString ADDRESS = SimpleString.of("SomeAddress"); - final SimpleString QUEUE = new SimpleString("SomeQueue"); + final SimpleString QUEUE = SimpleString.of("SomeQueue"); private ActiveMQServer server; 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 c93ad0d0f6..a322f6f3b5 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 @@ -52,9 +52,9 @@ import org.junit.jupiter.api.Test; public class NIOMultiThreadCompactorStressTest extends ActiveMQTestBase { - final SimpleString ADDRESS = new SimpleString("SomeAddress"); + final SimpleString ADDRESS = SimpleString.of("SomeAddress"); - final SimpleString QUEUE = new SimpleString("SomeQueue"); + final SimpleString QUEUE = SimpleString.of("SomeQueue"); private ActiveMQServer server; @@ -214,13 +214,13 @@ public class NIOMultiThreadCompactorStressTest extends ActiveMQTestBase { setupServer(getJournalType()); drainQueue(numberOfMessagesExpected, QUEUE); - drainQueue(100, new SimpleString("LAZY-QUEUE")); + drainQueue(100, SimpleString.of("LAZY-QUEUE")); server.stop(); setupServer(getJournalType()); drainQueue(0, QUEUE); - drainQueue(0, new SimpleString("LAZY-QUEUE")); + drainQueue(0, SimpleString.of("LAZY-QUEUE")); checkEmptyXID(xid); 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 c8ffa70913..2f9f652a0c 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 @@ -50,7 +50,7 @@ public class MultipleConsumersPageStressTest extends ActiveMQTestBase { private static final int TIME_TO_RUN = 60 * 1000; - private static final SimpleString ADDRESS = new SimpleString("page-adr"); + private static final SimpleString ADDRESS = SimpleString.of("page-adr"); private int numberOfProducers; 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 305acfadc7..0f712e8c2a 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 @@ -64,7 +64,7 @@ public class PageCursorStressTest extends ActiveMQTestBase { - private final SimpleString ADDRESS = new SimpleString("test-add"); + private final SimpleString ADDRESS = SimpleString.of("test-add"); private ActiveMQServer server; @@ -148,7 +148,7 @@ public class PageCursorStressTest extends ActiveMQTestBase { @Override public SimpleString getFilterString() { - return new SimpleString("even=true"); + return SimpleString.of("even=true"); } }); @@ -177,7 +177,7 @@ public class PageCursorStressTest extends ActiveMQTestBase { @Override public SimpleString getFilterString() { - return new SimpleString("even=true"); + return SimpleString.of("even=true"); } }); @@ -792,7 +792,7 @@ public class PageCursorStressTest extends ActiveMQTestBase { */ private PageSubscription createNonPersistentCursor(Filter filter) throws Exception { long id = server.getStorageManager().generateID(); - FakeQueue queue = new FakeQueue(new SimpleString(filter.toString()), id); + FakeQueue queue = new FakeQueue(SimpleString.of(filter.toString()), id); queueList.add(queue); PageSubscription subs = lookupCursorProvider().createSubscription(id, filter, false); 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 76f5f75436..a6a5b57311 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 @@ -62,7 +62,7 @@ public class PageStressTest extends ActiveMQTestBase { ClientSessionFactory factory = createSessionFactory(locator); ClientSession session = addClientSession(factory.createSession(null, null, false, false, true, false, 1024 * NUMBER_OF_MESSAGES)); - SimpleString address = new SimpleString("page-adr"); + SimpleString address = SimpleString.of("page-adr"); session.createQueue(new QueueConfiguration(address)); @@ -148,8 +148,8 @@ public class PageStressTest extends ActiveMQTestBase { session = factory.createSession(false, false, false); - SimpleString address = new SimpleString("page-adr"); - SimpleString[] queue = new SimpleString[]{new SimpleString("queue1"), new SimpleString("queue2")}; + SimpleString address = SimpleString.of("page-adr"); + SimpleString[] queue = new SimpleString[]{SimpleString.of("queue1"), SimpleString.of("queue2")}; session.createQueue(new QueueConfiguration(queue[0]).setAddress(address)); session.createQueue(new QueueConfiguration(queue[1]).setAddress(address)); diff --git a/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/core/server/impl/QueueConcurrentTest.java b/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/core/server/impl/QueueConcurrentTest.java index d7e940a876..1e9ff72bb2 100644 --- a/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/core/server/impl/QueueConcurrentTest.java +++ b/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/core/server/impl/QueueConcurrentTest.java @@ -67,7 +67,7 @@ public class QueueConcurrentTest extends ActiveMQTestBase { @Test public void testConcurrentAddsDeliver() throws Exception { - QueueImpl queue = (QueueImpl) queueFactory.createQueueWith(QueueConfig.builderWith(1, new SimpleString("address1"), new SimpleString("queue1")).durable(false).temporary(false).autoCreated(false).build()); + QueueImpl queue = (QueueImpl) queueFactory.createQueueWith(QueueConfig.builderWith(1, SimpleString.of("address1"), SimpleString.of("queue1")).durable(false).temporary(false).autoCreated(false).build()); FakeConsumer consumer = new FakeConsumer(); diff --git a/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/core/server/impl/QueueImplTest.java b/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/core/server/impl/QueueImplTest.java index e139c3468b..5014921c54 100644 --- a/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/core/server/impl/QueueImplTest.java +++ b/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/core/server/impl/QueueImplTest.java @@ -43,7 +43,7 @@ import org.junit.jupiter.api.Test; public class QueueImplTest extends ActiveMQTestBase { - private static final SimpleString queue1 = new SimpleString("queue1"); + private static final SimpleString queue1 = SimpleString.of("queue1"); private static final long TIMEOUT = 10000; @@ -73,7 +73,7 @@ public class QueueImplTest extends ActiveMQTestBase { @Test public void testScheduledNoConsumer() throws Exception { - QueueImpl queue = new QueueImpl(1, new SimpleString("address1"), new SimpleString("queue1"), null, null, false, true, false, scheduledExecutor, null, null, null, ArtemisExecutor.delegate(executor), null, null); + QueueImpl queue = new QueueImpl(1, SimpleString.of("address1"), SimpleString.of("queue1"), null, null, false, true, false, scheduledExecutor, null, null, null, ArtemisExecutor.delegate(executor), null, null); // Send one scheduled @@ -138,7 +138,7 @@ public class QueueImplTest extends ActiveMQTestBase { @Test public void testScheduled() throws Exception { - QueueImpl queue = new QueueImpl(1, new SimpleString("address1"), new SimpleString("queue1"), null, null, false, true, false, scheduledExecutor, null, null, null, ArtemisExecutor.delegate(executor), null, null); + QueueImpl queue = new QueueImpl(1, SimpleString.of("address1"), SimpleString.of("queue1"), null, null, false, true, false, scheduledExecutor, null, null, null, ArtemisExecutor.delegate(executor), null, null); FakeConsumer consumer = null; @@ -236,7 +236,7 @@ public class QueueImplTest extends ActiveMQTestBase { public void disconnect() { } }; - QueueImpl queue = new QueueImpl(1, new SimpleString("address1"), QueueImplTest.queue1, null, null, false, true, false, scheduledExecutor, null, null, null, + QueueImpl queue = new QueueImpl(1, SimpleString.of("address1"), QueueImplTest.queue1, null, null, false, true, false, scheduledExecutor, null, null, null, ArtemisExecutor.delegate(executor), null, null); MessageReference messageReference = generateReference(queue, 1); queue.addConsumer(consumer); 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 09756fb4f9..8641178049 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 @@ -506,7 +506,7 @@ public class JMSBridgeImplTest extends ActiveMQTestBase { } sourceConn.close(); - SimpleString add = new SimpleString(JMSBridgeImplTest.SOURCE); + SimpleString add = SimpleString.of(JMSBridgeImplTest.SOURCE); QueueControl jmsQueueControl = MBeanServerInvocationHandler.newProxyInstance(ManagementFactory.getPlatformMBeanServer(), ObjectNameBuilder.DEFAULT.getQueueObjectName(add, add, RoutingType.ANYCAST), QueueControl.class, false); assertNotEquals(jmsQueueControl.getDeliveringCount(), numMessages); 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 24ab886124..e7435f1f91 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 @@ -78,7 +78,7 @@ public class MessageImplTest extends ActiveMQTestBase { assertEquals(timestamp, message.getTimestamp()); assertEquals(priority, message.getPriority()); - final SimpleString destination = new SimpleString(RandomUtil.randomString()); + final SimpleString destination = SimpleString.of(RandomUtil.randomString()); final boolean durable2 = RandomUtil.randomBoolean(); final long expiration2 = RandomUtil.randomLong(); final long timestamp2 = RandomUtil.randomLong(); @@ -127,40 +127,40 @@ public class MessageImplTest extends ActiveMQTestBase { for (int j = 0; j < 10; j++) { Message msg = new ClientMessageImpl(); - SimpleString prop1 = new SimpleString("prop1"); + SimpleString prop1 = SimpleString.of("prop1"); boolean val1 = RandomUtil.randomBoolean(); msg.putBooleanProperty(prop1, val1); - SimpleString prop2 = new SimpleString("prop2"); + SimpleString prop2 = SimpleString.of("prop2"); byte val2 = RandomUtil.randomByte(); msg.putByteProperty(prop2, val2); - SimpleString prop3 = new SimpleString("prop3"); + SimpleString prop3 = SimpleString.of("prop3"); byte[] val3 = RandomUtil.randomBytes(); msg.putBytesProperty(prop3, val3); - SimpleString prop4 = new SimpleString("prop4"); + SimpleString prop4 = SimpleString.of("prop4"); double val4 = RandomUtil.randomDouble(); msg.putDoubleProperty(prop4, val4); - SimpleString prop5 = new SimpleString("prop5"); + SimpleString prop5 = SimpleString.of("prop5"); float val5 = RandomUtil.randomFloat(); msg.putFloatProperty(prop5, val5); - SimpleString prop6 = new SimpleString("prop6"); + SimpleString prop6 = SimpleString.of("prop6"); int val6 = RandomUtil.randomInt(); msg.putIntProperty(prop6, val6); - SimpleString prop7 = new SimpleString("prop7"); + SimpleString prop7 = SimpleString.of("prop7"); long val7 = RandomUtil.randomLong(); msg.putLongProperty(prop7, val7); - SimpleString prop8 = new SimpleString("prop8"); + SimpleString prop8 = SimpleString.of("prop8"); short val8 = RandomUtil.randomShort(); msg.putShortProperty(prop8, val8); - SimpleString prop9 = new SimpleString("prop9"); - SimpleString val9 = new SimpleString(RandomUtil.randomString()); + SimpleString prop9 = SimpleString.of("prop9"); + SimpleString val9 = SimpleString.of(RandomUtil.randomString()); msg.putStringProperty(prop9, val9); assertEquals(9, msg.getPropertyNames().size()); @@ -194,7 +194,7 @@ public class MessageImplTest extends ActiveMQTestBase { assertEquals(val8, msg.getObjectProperty(prop8)); assertEquals(val9, msg.getObjectProperty(prop9)); - SimpleString val10 = new SimpleString(RandomUtil.randomString()); + SimpleString val10 = SimpleString.of(RandomUtil.randomString()); // test overwrite msg.putStringProperty(prop9, val10); assertEquals(val10, msg.getObjectProperty(prop9)); @@ -255,7 +255,7 @@ public class MessageImplTest extends ActiveMQTestBase { @Test public void testMessageCopyHeadersAndProperties() { CoreMessage msg1 = new CoreMessage(123, 18); - SimpleString address = new SimpleString("address"); + SimpleString address = SimpleString.of("address"); msg1.setAddress(address); UUID uid = UUIDGenerator.getInstance().generateUUID(); msg1.setUserID(uid); @@ -316,7 +316,7 @@ public class MessageImplTest extends ActiveMQTestBase { final CoreMessage msg = new CoreMessage(123, 18); msg.setMessageID(RandomUtil.randomLong()); - msg.setAddress(new SimpleString("Batatantkashf aksjfh aksfjh askfdjh askjfh ")); + msg.setAddress(SimpleString.of("Batatantkashf aksjfh aksfjh askfdjh askjfh ")); final AtomicInteger errors = new AtomicInteger(0); @@ -419,7 +419,7 @@ public class MessageImplTest extends ActiveMQTestBase { @Test public void testCloseCallBuffer() throws Exception { - SimpleString ADDRESS = new SimpleString("SimpleAddress"); + SimpleString ADDRESS = SimpleString.of("SimpleAddress"); final int messageSize = 1024 * 1024 - 64; diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/message/impl/MessagePropertyTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/message/impl/MessagePropertyTest.java index f1beb4bfc7..48151ebead 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/message/impl/MessagePropertyTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/message/impl/MessagePropertyTest.java @@ -43,7 +43,7 @@ public class MessagePropertyTest extends ActiveMQTestBase { private final int numMessages = 20; private static final String ADDRESS = "anAddress123"; - private static final SimpleString SIMPLE_STRING_KEY = new SimpleString("StringToSimpleString"); + private static final SimpleString SIMPLE_STRING_KEY = SimpleString.of("StringToSimpleString"); @Override @BeforeEach @@ -59,7 +59,7 @@ public class MessagePropertyTest extends ActiveMQTestBase { ClientSession session = sf.createSession(true, true); String filter = null; - session.createAddress(SimpleString.toSimpleString(ADDRESS), RoutingType.MULTICAST, false); + session.createAddress(SimpleString.of(ADDRESS), RoutingType.MULTICAST, false); session.createQueue(new QueueConfiguration(ADDRESS).setRoutingType(RoutingType.MULTICAST).setFilterString(filter)); ClientProducer producer = session.createProducer(ADDRESS); @@ -70,7 +70,7 @@ public class MessagePropertyTest extends ActiveMQTestBase { message.putShortProperty("short", (short) i); message.putByteProperty("byte", (byte) i); message.putFloatProperty("float", floatValue(i)); - message.putStringProperty(SIMPLE_STRING_KEY, new SimpleString(Integer.toString(i))); + message.putStringProperty(SIMPLE_STRING_KEY, SimpleString.of(Integer.toString(i))); message.putBytesProperty("byte[]", byteArray(i)); message.putObjectProperty("null-value", null); producer.send(message); @@ -104,7 +104,7 @@ public class MessagePropertyTest extends ActiveMQTestBase { assertEquals((short) i, message.getShortProperty("short").shortValue()); assertEquals((byte) i, message.getByteProperty("byte").byteValue()); assertEquals(floatValue(i), message.getFloatProperty("float").floatValue(), 0.001); - assertEquals(new SimpleString(Integer.toString(i)), message.getSimpleStringProperty(SIMPLE_STRING_KEY.toString())); + assertEquals(SimpleString.of(Integer.toString(i)), message.getSimpleStringProperty(SIMPLE_STRING_KEY.toString())); assertEqualsByteArrays(byteArray(i), message.getBytesProperty("byte[]")); assertNull(message.getIngressTimestamp()); diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/paging/impl/PageTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/paging/impl/PageTest.java index dd0e19dac3..bf905744db 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/paging/impl/PageTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/paging/impl/PageTest.java @@ -124,7 +124,7 @@ public class PageTest extends ActiveMQTestBase { SequentialFile file = factory.createSequentialFile("00010.page"); - Page page = new Page(new SimpleString("something"), storageManager, factory, file, 10); + Page page = new Page(SimpleString.of("something"), storageManager, factory, file, 10); assertEquals(10, page.getPageId()); @@ -132,7 +132,7 @@ public class PageTest extends ActiveMQTestBase { assertEquals(1, factory.listFiles("page").size()); - SimpleString simpleDestination = new SimpleString("Test"); + SimpleString simpleDestination = SimpleString.of("Test"); final long startMessageID = 1; @@ -143,7 +143,7 @@ public class PageTest extends ActiveMQTestBase { file = factory.createSequentialFile("00010.page"); file.open(); - page = new Page(new SimpleString("something"), storageManager, factory, file, 10); + page = new Page(SimpleString.of("something"), storageManager, factory, file, 10); LinkedList msgs = page.read(storageManager, largeMessages); @@ -160,7 +160,7 @@ public class PageTest extends ActiveMQTestBase { } if (!largeMessages) { - Page tmpPage = new Page(new SimpleString("something"), storageManager, factory, file, 10); + Page tmpPage = new Page(SimpleString.of("something"), storageManager, factory, file, 10); assertEquals(0, tmpPage.read(storageManager, true).size()); assertEquals(numberOfElements, tmpPage.getNumberOfMessages()); } @@ -181,7 +181,7 @@ public class PageTest extends ActiveMQTestBase { SequentialFile file = factory.createSequentialFile("00010.page"); - Page page = new Page(new SimpleString("something"), new NullStorageManager(), factory, file, 10); + Page page = new Page(SimpleString.of("something"), new NullStorageManager(), factory, file, 10); assertEquals(10, page.getPageId()); @@ -189,7 +189,7 @@ public class PageTest extends ActiveMQTestBase { assertEquals(1, factory.listFiles("page").size()); - SimpleString simpleDestination = new SimpleString("Test"); + SimpleString simpleDestination = SimpleString.of("Test"); addPageElements(simpleDestination, page, numberOfElements, 1); @@ -222,7 +222,7 @@ public class PageTest extends ActiveMQTestBase { file = factory.createSequentialFile("00010.page"); file.open(); - Page page1 = new Page(new SimpleString("something"), new NullStorageManager(), factory, file, 10); + Page page1 = new Page(SimpleString.of("something"), new NullStorageManager(), factory, file, 10); LinkedList msgs = page1.read(new NullStorageManager()); @@ -264,7 +264,7 @@ public class PageTest extends ActiveMQTestBase { SequentialFile file = factory.createSequentialFile("00010.page"); - Page page = new Page(new SimpleString("something"), storageManager, factory, file, 10); + Page page = new Page(SimpleString.of("something"), storageManager, factory, file, 10); assertEquals(10, page.getPageId()); @@ -272,7 +272,7 @@ public class PageTest extends ActiveMQTestBase { assertEquals(1, factory.listFiles("page").size()); - SimpleString simpleDestination = new SimpleString("Test"); + SimpleString simpleDestination = SimpleString.of("Test"); final long startMessageID = 1; @@ -284,7 +284,7 @@ public class PageTest extends ActiveMQTestBase { page.close(false, false); file = factory.createSequentialFile("00010.page"); - page = new Page(new SimpleString("something"), storageManager, factory, file, 10); + page = new Page(SimpleString.of("something"), storageManager, factory, file, 10); LinkedList msgs = page.getMessages(); diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/paging/impl/PagingManagerImplTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/paging/impl/PagingManagerImplTest.java index 355330c2b4..c74053a3a6 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/paging/impl/PagingManagerImplTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/paging/impl/PagingManagerImplTest.java @@ -67,9 +67,9 @@ public class PagingManagerImplTest extends ActiveMQTestBase { runAfter(managerImpl::stop); - PagingStore store = managerImpl.getPageStore(new SimpleString("simple-test")); + PagingStore store = managerImpl.getPageStore(SimpleString.of("simple-test")); - ICoreMessage msg = createMessage(1L, new SimpleString("simple-test"), createRandomBuffer(10)); + ICoreMessage msg = createMessage(1L, SimpleString.of("simple-test"), createRandomBuffer(10)); final RoutingContextImpl ctx = new RoutingContextImpl(null); assertFalse(store.page(msg, ctx.getTransaction(), ctx.getContextListing(store.getStoreName()))); diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/paging/impl/PagingStoreImplTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/paging/impl/PagingStoreImplTest.java index f355dcfb02..b314e21060 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/paging/impl/PagingStoreImplTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/paging/impl/PagingStoreImplTest.java @@ -101,7 +101,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase { MessagePersister.registerPersister(AMQPMessagePersister.getInstance()); } - private static final SimpleString destinationTestName = new SimpleString("test"); + private static final SimpleString destinationTestName = SimpleString.of("test"); protected ExecutorService executor; @@ -181,7 +181,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase { ActiveMQBuffer buffer = createRandomBuffer(0, 10); buffers.add(buffer); - SimpleString destination = new SimpleString("test"); + SimpleString destination = SimpleString.of("test"); Message msg = createMessage(1, storeImpl, destination, buffer); @@ -207,7 +207,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase { public void testDepageOnCurrentPage() throws Exception { SequentialFileFactory factory = new FakeSequentialFileFactory(); - SimpleString destination = new SimpleString("test"); + SimpleString destination = SimpleString.of("test"); PagingStoreFactory storeFactory = new FakeStoreFactory(factory); @@ -271,7 +271,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase { public void testRemoveInTheMiddle() throws Exception { SequentialFileFactory factory = new NIOSequentialFileFactory(getTestDirfile(), 1); - SimpleString destination = new SimpleString("test"); + SimpleString destination = SimpleString.of("test"); PagingStoreFactory storeFactory = new FakeStoreFactory(factory); @@ -389,7 +389,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase { public void testRemoveCurrentPage() throws Exception { SequentialFileFactory factory = new NIOSequentialFileFactory(getTestDirfile(), 1); - SimpleString destination = new SimpleString("test"); + SimpleString destination = SimpleString.of("test"); PagingStoreFactory storeFactory = new FakeStoreFactory(factory); @@ -493,7 +493,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase { public void testReadNumberOfMessages() throws Exception { SequentialFileFactory factory = new NIOSequentialFileFactory(getTestDirfile(), 1); - SimpleString destination = new SimpleString("test"); + SimpleString destination = SimpleString.of("test"); PagingStoreFactory storeFactory = new FakeStoreFactory(factory); @@ -540,7 +540,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase { @Test public void testDepageMultiplePages() throws Exception { SequentialFileFactory factory = new NIOSequentialFileFactory(new File(getPageDir()), 1).setDatasync(false); - SimpleString destination = new SimpleString("test"); + SimpleString destination = SimpleString.of("test"); PagingStoreFactory storeFactory = new FakeStoreFactory(factory); @@ -686,7 +686,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase { AddressSettings settings = new AddressSettings().setPageSizeBytes(MAX_SIZE).setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE); - final PagingStore storeImpl = new PagingStoreImpl(PagingStoreImplTest.destinationTestName, null, 100, createMockManager(), createStorageManagerMock(), factory, storeFactory, new SimpleString("test"), settings, getExecutorFactory().getExecutor(), getExecutorFactory().getExecutor(), true); + final PagingStore storeImpl = new PagingStoreImpl(PagingStoreImplTest.destinationTestName, null, 100, createMockManager(), createStorageManagerMock(), factory, storeFactory, SimpleString.of("test"), settings, getExecutorFactory().getExecutor(), getExecutorFactory().getExecutor(), true); storeImpl.start(); @@ -697,7 +697,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase { assertEquals(1, storeImpl.getNumberOfPages()); - final SimpleString destination = new SimpleString("test"); + final SimpleString destination = SimpleString.of("test"); class WriterThread extends Thread { @@ -819,7 +819,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase { fileTmp.close(); } - PagingStore storeImpl2 = new PagingStoreImpl(PagingStoreImplTest.destinationTestName, null, 100, createMockManager(), createStorageManagerMock(), factory, storeFactory, new SimpleString("test"), settings, getExecutorFactory().getExecutor(), getExecutorFactory().getExecutor(), true); + PagingStore storeImpl2 = new PagingStoreImpl(PagingStoreImplTest.destinationTestName, null, 100, createMockManager(), createStorageManagerMock(), factory, storeFactory, SimpleString.of("test"), settings, getExecutorFactory().getExecutor(), getExecutorFactory().getExecutor(), true); storeImpl2.start(); long numberOfPages = storeImpl2.getNumberOfPages(); @@ -890,7 +890,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase { AddressSettings settings = new AddressSettings().setPageSizeBytes(MAX_SIZE).setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE); - final PagingStore storeImpl = new PagingStoreImpl(PagingStoreImplTest.destinationTestName, null, 100, createMockManager(), createStorageManagerMock(), factory, storeFactory, new SimpleString("test"), settings, getExecutorFactory().getExecutor(), getExecutorFactory().getExecutor(), true); + final PagingStore storeImpl = new PagingStoreImpl(PagingStoreImplTest.destinationTestName, null, 100, createMockManager(), createStorageManagerMock(), factory, storeFactory, SimpleString.of("test"), settings, getExecutorFactory().getExecutor(), getExecutorFactory().getExecutor(), true); storeImpl.start(); @@ -923,7 +923,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase { AddressSettings settings = new AddressSettings().setPageSizeBytes(MAX_SIZE).setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE); - final PagingStore store = new PagingStoreImpl(PagingStoreImplTest.destinationTestName, null, 100, createMockManager(), createStorageManagerMock(), factory, storeFactory, new SimpleString("test"), settings, getExecutorFactory().getExecutor(), getExecutorFactory().getExecutor(), false); + final PagingStore store = new PagingStoreImpl(PagingStoreImplTest.destinationTestName, null, 100, createMockManager(), createStorageManagerMock(), factory, storeFactory, SimpleString.of("test"), settings, getExecutorFactory().getExecutor(), getExecutorFactory().getExecutor(), false); store.start(); @@ -934,7 +934,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase { assertEquals(1, store.getNumberOfPages()); - final SimpleString destination = new SimpleString("test"); + final SimpleString destination = SimpleString.of("test"); final long NUMBER_OF_MESSAGES = 10000; @@ -1020,7 +1020,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase { AddressSettings settings = new AddressSettings().setPageSizeBytes(MAX_SIZE).setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE); - final PagingStore storeImpl = new PagingStoreImpl(PagingStoreImplTest.destinationTestName, null, 100, createMockManager(), createStorageManagerMock(), factory, storeFactory, new SimpleString("test"), settings, getExecutorFactory().getExecutor(), getExecutorFactory().getExecutor(), true); + final PagingStore storeImpl = new PagingStoreImpl(PagingStoreImplTest.destinationTestName, null, 100, createMockManager(), createStorageManagerMock(), factory, storeFactory, SimpleString.of("test"), settings, getExecutorFactory().getExecutor(), getExecutorFactory().getExecutor(), true); storeImpl.start(); diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/AddressImplTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/AddressImplTest.java index 6989078d97..815e1eb59d 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/AddressImplTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/AddressImplTest.java @@ -29,8 +29,8 @@ public class AddressImplTest extends ActiveMQTestBase { @Test public void testNoDots() { - SimpleString s1 = new SimpleString("abcde"); - SimpleString s2 = new SimpleString("abcde"); + SimpleString s1 = SimpleString.of("abcde"); + SimpleString s2 = SimpleString.of("abcde"); Address a1 = new AddressImpl(s1); Address a2 = new AddressImpl(s2); assertTrue(a1.matches(a2)); @@ -38,8 +38,8 @@ public class AddressImplTest extends ActiveMQTestBase { @Test public void testDotsSameLength2() { - SimpleString s1 = new SimpleString("a.b"); - SimpleString s2 = new SimpleString("a.b"); + SimpleString s1 = SimpleString.of("a.b"); + SimpleString s2 = SimpleString.of("a.b"); Address a1 = new AddressImpl(s1); Address a2 = new AddressImpl(s2); assertTrue(a1.matches(a2)); @@ -47,8 +47,8 @@ public class AddressImplTest extends ActiveMQTestBase { @Test public void testA() { - SimpleString s1 = new SimpleString("a.b.c"); - SimpleString s2 = new SimpleString("a.b.c.d.e.f.g.h.i.j.k.l.m.n.*"); + SimpleString s1 = SimpleString.of("a.b.c"); + SimpleString s2 = SimpleString.of("a.b.c.d.e.f.g.h.i.j.k.l.m.n.*"); Address a1 = new AddressImpl(s1); Address a2 = new AddressImpl(s2); assertFalse(a1.matches(a2)); @@ -56,9 +56,9 @@ public class AddressImplTest extends ActiveMQTestBase { @Test public void testB() { - SimpleString s1 = new SimpleString("a.b.c.d"); - SimpleString s2 = new SimpleString("a.b.x.e"); - SimpleString s3 = new SimpleString("a.b.c.*"); + SimpleString s1 = SimpleString.of("a.b.c.d"); + SimpleString s2 = SimpleString.of("a.b.x.e"); + SimpleString s3 = SimpleString.of("a.b.c.*"); Address a1 = new AddressImpl(s1); Address a2 = new AddressImpl(s2); Address w = new AddressImpl(s3); @@ -68,9 +68,9 @@ public class AddressImplTest extends ActiveMQTestBase { @Test public void testC() { - SimpleString s1 = new SimpleString("a.b.c.d"); - SimpleString s2 = new SimpleString("a.b.c.x"); - SimpleString s3 = new SimpleString("a.b.*.d"); + SimpleString s1 = SimpleString.of("a.b.c.d"); + SimpleString s2 = SimpleString.of("a.b.c.x"); + SimpleString s3 = SimpleString.of("a.b.*.d"); Address a1 = new AddressImpl(s1); Address a2 = new AddressImpl(s2); Address w = new AddressImpl(s3); @@ -80,9 +80,9 @@ public class AddressImplTest extends ActiveMQTestBase { @Test public void testD() { - SimpleString s1 = new SimpleString("a.b.c.d.e"); - SimpleString s2 = new SimpleString("a.b.c.x.e"); - SimpleString s3 = new SimpleString("a.b.*.d.*"); + SimpleString s1 = SimpleString.of("a.b.c.d.e"); + SimpleString s2 = SimpleString.of("a.b.c.x.e"); + SimpleString s3 = SimpleString.of("a.b.*.d.*"); Address a1 = new AddressImpl(s1); Address a2 = new AddressImpl(s2); Address w = new AddressImpl(s3); @@ -92,9 +92,9 @@ public class AddressImplTest extends ActiveMQTestBase { @Test public void testE() { - SimpleString s1 = new SimpleString("a.b.c.d.e.f"); - SimpleString s2 = new SimpleString("a.b.c.x.e.f"); - SimpleString s3 = new SimpleString("a.b.*.d.*.f"); + SimpleString s1 = SimpleString.of("a.b.c.d.e.f"); + SimpleString s2 = SimpleString.of("a.b.c.x.e.f"); + SimpleString s3 = SimpleString.of("a.b.*.d.*.f"); Address a1 = new AddressImpl(s1); Address a2 = new AddressImpl(s2); Address w = new AddressImpl(s3); @@ -104,9 +104,9 @@ public class AddressImplTest extends ActiveMQTestBase { @Test public void testF() { - SimpleString s1 = new SimpleString("a.b.c.d.e.f"); - SimpleString s2 = new SimpleString("a.b.c.x.e.f"); - SimpleString s3 = new SimpleString("#"); + SimpleString s1 = SimpleString.of("a.b.c.d.e.f"); + SimpleString s2 = SimpleString.of("a.b.c.x.e.f"); + SimpleString s3 = SimpleString.of("#"); Address a1 = new AddressImpl(s1); Address a2 = new AddressImpl(s2); Address w = new AddressImpl(s3); @@ -116,9 +116,9 @@ public class AddressImplTest extends ActiveMQTestBase { @Test public void testG() { - SimpleString s1 = new SimpleString("a.b.c.d.e.f"); - SimpleString s2 = new SimpleString("a.b.c.x.e.f"); - SimpleString s3 = new SimpleString("a.#"); + SimpleString s1 = SimpleString.of("a.b.c.d.e.f"); + SimpleString s2 = SimpleString.of("a.b.c.x.e.f"); + SimpleString s3 = SimpleString.of("a.#"); Address a1 = new AddressImpl(s1); Address a2 = new AddressImpl(s2); Address w = new AddressImpl(s3); @@ -128,9 +128,9 @@ public class AddressImplTest extends ActiveMQTestBase { @Test public void testH() { - SimpleString s1 = new SimpleString("a.b.c.d.e.f"); - SimpleString s2 = new SimpleString("a.b.c.x.e.f"); - SimpleString s3 = new SimpleString("#.b.#"); + SimpleString s1 = SimpleString.of("a.b.c.d.e.f"); + SimpleString s2 = SimpleString.of("a.b.c.x.e.f"); + SimpleString s3 = SimpleString.of("#.b.#"); Address a1 = new AddressImpl(s1); Address a2 = new AddressImpl(s2); Address w = new AddressImpl(s3); @@ -140,9 +140,9 @@ public class AddressImplTest extends ActiveMQTestBase { @Test public void testI() { - SimpleString s1 = new SimpleString("a.b.c.d.e.f"); - SimpleString s2 = new SimpleString("a.b.c.x.e.f"); - SimpleString s3 = new SimpleString("a.#.b.#"); + SimpleString s1 = SimpleString.of("a.b.c.d.e.f"); + SimpleString s2 = SimpleString.of("a.b.c.x.e.f"); + SimpleString s3 = SimpleString.of("a.#.b.#"); Address a1 = new AddressImpl(s1); Address a2 = new AddressImpl(s2); Address w = new AddressImpl(s3); @@ -152,9 +152,9 @@ public class AddressImplTest extends ActiveMQTestBase { @Test public void testJ() { - SimpleString s1 = new SimpleString("a.b.c.d.e.f"); - SimpleString s2 = new SimpleString("a.b.c.x.e.f"); - SimpleString s3 = new SimpleString("a.#.c.d.e.f"); + SimpleString s1 = SimpleString.of("a.b.c.d.e.f"); + SimpleString s2 = SimpleString.of("a.b.c.x.e.f"); + SimpleString s3 = SimpleString.of("a.#.c.d.e.f"); Address a1 = new AddressImpl(s1); Address a2 = new AddressImpl(s2); Address w = new AddressImpl(s3); @@ -164,9 +164,9 @@ public class AddressImplTest extends ActiveMQTestBase { @Test public void testK() { - SimpleString s1 = new SimpleString("a.b.c.d.e.f"); - SimpleString s2 = new SimpleString("a.b.c.d.e.x"); - SimpleString s3 = new SimpleString("a.#.c.d.e.*"); + SimpleString s1 = SimpleString.of("a.b.c.d.e.f"); + SimpleString s2 = SimpleString.of("a.b.c.d.e.x"); + SimpleString s3 = SimpleString.of("a.#.c.d.e.*"); Address a1 = new AddressImpl(s1); Address a2 = new AddressImpl(s2); Address w = new AddressImpl(s3); @@ -176,9 +176,9 @@ public class AddressImplTest extends ActiveMQTestBase { @Test public void testL() { - SimpleString s1 = new SimpleString("a.b.c.d.e.f"); - SimpleString s2 = new SimpleString("a.b.c.d.e.x"); - SimpleString s3 = new SimpleString("a.#.c.d.*.f"); + SimpleString s1 = SimpleString.of("a.b.c.d.e.f"); + SimpleString s2 = SimpleString.of("a.b.c.d.e.x"); + SimpleString s3 = SimpleString.of("a.#.c.d.*.f"); Address a1 = new AddressImpl(s1); Address a2 = new AddressImpl(s2); Address w = new AddressImpl(s3); @@ -188,9 +188,9 @@ public class AddressImplTest extends ActiveMQTestBase { @Test public void testM() { - SimpleString s1 = new SimpleString("a.b.c"); - SimpleString s2 = new SimpleString("a.b.x.e"); - SimpleString s3 = new SimpleString("a.b.c.#"); + SimpleString s1 = SimpleString.of("a.b.c"); + SimpleString s2 = SimpleString.of("a.b.x.e"); + SimpleString s3 = SimpleString.of("a.b.c.#"); Address a1 = new AddressImpl(s1); Address a2 = new AddressImpl(s2); Address w = new AddressImpl(s3); @@ -200,9 +200,9 @@ public class AddressImplTest extends ActiveMQTestBase { @Test public void testN() { - SimpleString s1 = new SimpleString("usd.stock"); - SimpleString s2 = new SimpleString("a.b.x.e"); - SimpleString s3 = new SimpleString("*.stock.#"); + SimpleString s1 = SimpleString.of("usd.stock"); + SimpleString s2 = SimpleString.of("a.b.x.e"); + SimpleString s3 = SimpleString.of("*.stock.#"); Address a1 = new AddressImpl(s1); Address a2 = new AddressImpl(s2); Address w = new AddressImpl(s3); @@ -212,9 +212,9 @@ public class AddressImplTest extends ActiveMQTestBase { @Test public void testO() { - SimpleString s1 = new SimpleString("a.b.c.d"); - SimpleString s2 = new SimpleString("a.b.x.e"); - SimpleString s3 = new SimpleString("a.b.c.*"); + SimpleString s1 = SimpleString.of("a.b.c.d"); + SimpleString s2 = SimpleString.of("a.b.x.e"); + SimpleString s3 = SimpleString.of("a.b.c.*"); Address a1 = new AddressImpl(s1); Address a2 = new AddressImpl(s2); Address w = new AddressImpl(s3); @@ -224,8 +224,8 @@ public class AddressImplTest extends ActiveMQTestBase { @Test public void testP() { - SimpleString s1 = new SimpleString("a.b.c.d"); - SimpleString s3 = new SimpleString("a.b.c#"); + SimpleString s1 = SimpleString.of("a.b.c.d"); + SimpleString s3 = SimpleString.of("a.b.c#"); Address a1 = new AddressImpl(s1); Address w = new AddressImpl(s3); assertFalse(a1.matches(w)); @@ -233,8 +233,8 @@ public class AddressImplTest extends ActiveMQTestBase { @Test public void testQ() { - SimpleString s1 = new SimpleString("a.b.c.d"); - SimpleString s3 = new SimpleString("#a.b.c"); + SimpleString s1 = SimpleString.of("a.b.c.d"); + SimpleString s3 = SimpleString.of("#a.b.c"); Address a1 = new AddressImpl(s1); Address w = new AddressImpl(s3); assertFalse(a1.matches(w)); @@ -242,8 +242,8 @@ public class AddressImplTest extends ActiveMQTestBase { @Test public void testR() { - SimpleString s1 = new SimpleString("a.b.c.d"); - SimpleString s3 = new SimpleString("#*a.b.c"); + SimpleString s1 = SimpleString.of("a.b.c.d"); + SimpleString s3 = SimpleString.of("#*a.b.c"); Address a1 = new AddressImpl(s1); Address w = new AddressImpl(s3); assertFalse(a1.matches(w)); @@ -251,8 +251,8 @@ public class AddressImplTest extends ActiveMQTestBase { @Test public void testS() { - SimpleString s1 = new SimpleString("a.b.c.d"); - SimpleString s3 = new SimpleString("a.b.c*"); + SimpleString s1 = SimpleString.of("a.b.c.d"); + SimpleString s3 = SimpleString.of("a.b.c*"); Address a1 = new AddressImpl(s1); Address w = new AddressImpl(s3); assertFalse(a1.matches(w)); @@ -260,8 +260,8 @@ public class AddressImplTest extends ActiveMQTestBase { @Test public void testT() { - SimpleString s1 = new SimpleString("a.b.c.d"); - SimpleString s3 = new SimpleString("*a.b.c"); + SimpleString s1 = SimpleString.of("a.b.c.d"); + SimpleString s3 = SimpleString.of("*a.b.c"); Address a1 = new AddressImpl(s1); Address w = new AddressImpl(s3); assertFalse(a1.matches(w)); @@ -269,8 +269,8 @@ public class AddressImplTest extends ActiveMQTestBase { @Test public void testU() { - SimpleString s1 = new SimpleString("a.b.c.d"); - SimpleString s3 = new SimpleString("*a.b.c"); + SimpleString s1 = SimpleString.of("a.b.c.d"); + SimpleString s3 = SimpleString.of("*a.b.c"); Address a1 = new AddressImpl(s1); Address w = new AddressImpl(s3); assertFalse(a1.matches(w)); @@ -281,8 +281,8 @@ public class AddressImplTest extends ActiveMQTestBase { */ @Test public void testV() { - final SimpleString s1 = new SimpleString("a.b.d"); - final SimpleString s3 = new SimpleString("a.b.#.d"); + final SimpleString s1 = SimpleString.of("a.b.d"); + final SimpleString s3 = SimpleString.of("a.b.#.d"); final Address a1 = new AddressImpl(s1); final Address w = new AddressImpl(s3); assertTrue(a1.matches(w)); diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/AddressMapUnitTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/AddressMapUnitTest.java index 4ea35ce88c..95b1c1402b 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/AddressMapUnitTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/AddressMapUnitTest.java @@ -36,7 +36,7 @@ public class AddressMapUnitTest { @Test public void testAddGetRemove() throws Exception { - SimpleString a = new SimpleString("a.b.c"); + SimpleString a = SimpleString.of("a.b.c"); assertTrue(isEmpty(a)); @@ -58,7 +58,7 @@ public class AddressMapUnitTest { @Test public void testWildcardAddGet() throws Exception { - SimpleString a = new SimpleString("a.*.c"); + SimpleString a = SimpleString.of("a.*.c"); assertTrue(isEmpty(a)); @@ -76,7 +76,7 @@ public class AddressMapUnitTest { @Test public void testWildcardAllAddGet() throws Exception { - SimpleString a = new SimpleString("a.b.#"); + SimpleString a = SimpleString.of("a.b.#"); assertTrue(isEmpty(a)); @@ -93,8 +93,8 @@ public class AddressMapUnitTest { @Test public void testNoDots() throws Exception { - SimpleString s1 = new SimpleString("abcde"); - SimpleString s2 = new SimpleString("abcde"); + SimpleString s1 = SimpleString.of("abcde"); + SimpleString s2 = SimpleString.of("abcde"); underTest.put(s1, s1); assertEquals(1, countMatchingWildcards(s2)); @@ -102,8 +102,8 @@ public class AddressMapUnitTest { @Test public void testDotsSameLength2() throws Exception { - SimpleString s1 = new SimpleString("a.b"); - SimpleString s2 = new SimpleString("a.b"); + SimpleString s1 = SimpleString.of("a.b"); + SimpleString s2 = SimpleString.of("a.b"); underTest.put(s1, s1); assertEquals(1, countMatchingWildcards(s2)); @@ -111,8 +111,8 @@ public class AddressMapUnitTest { @Test public void testA() throws Exception { - SimpleString s1 = new SimpleString("a.b.c"); - SimpleString s2 = new SimpleString("a.b.c.d.e.f.g.h.i.j.k.l.m.n.*"); + SimpleString s1 = SimpleString.of("a.b.c"); + SimpleString s2 = SimpleString.of("a.b.c.d.e.f.g.h.i.j.k.l.m.n.*"); underTest.put(s1, s1); assertEquals(0, countMatchingWildcards(s2)); @@ -120,9 +120,9 @@ public class AddressMapUnitTest { @Test public void testB() throws Exception { - SimpleString s1 = new SimpleString("a.b.c.d"); - SimpleString s2 = new SimpleString("a.b.x.e"); - SimpleString s3 = new SimpleString("a.b.c.*"); + SimpleString s1 = SimpleString.of("a.b.c.d"); + SimpleString s2 = SimpleString.of("a.b.x.e"); + SimpleString s3 = SimpleString.of("a.b.c.*"); underTest.put(s1, s1); underTest.put(s2, s2); @@ -132,9 +132,9 @@ public class AddressMapUnitTest { @Test public void testC() throws Exception { - SimpleString s1 = new SimpleString("a.b.c.d"); - SimpleString s2 = new SimpleString("a.b.c.x"); - SimpleString s3 = new SimpleString("a.b.*.d"); + SimpleString s1 = SimpleString.of("a.b.c.d"); + SimpleString s2 = SimpleString.of("a.b.c.x"); + SimpleString s3 = SimpleString.of("a.b.*.d"); underTest.put(s1, s1); underTest.put(s2, s2); @@ -144,9 +144,9 @@ public class AddressMapUnitTest { @Test public void testD() throws Exception { - SimpleString s1 = new SimpleString("a.b.c.d.e"); - SimpleString s2 = new SimpleString("a.b.c.x.e"); - SimpleString s3 = new SimpleString("a.b.*.d.*"); + SimpleString s1 = SimpleString.of("a.b.c.d.e"); + SimpleString s2 = SimpleString.of("a.b.c.x.e"); + SimpleString s3 = SimpleString.of("a.b.*.d.*"); Address a1 = new AddressImpl(s1); Address a2 = new AddressImpl(s2); Address w = new AddressImpl(s3); @@ -161,9 +161,9 @@ public class AddressMapUnitTest { @Test public void testE() throws Exception { - SimpleString s1 = new SimpleString("a.b.c.d.e.f"); - SimpleString s2 = new SimpleString("a.b.c.x.e.f"); - SimpleString s3 = new SimpleString("a.b.*.d.*.f"); + SimpleString s1 = SimpleString.of("a.b.c.d.e.f"); + SimpleString s2 = SimpleString.of("a.b.c.x.e.f"); + SimpleString s3 = SimpleString.of("a.b.*.d.*.f"); Address a1 = new AddressImpl(s1); Address a2 = new AddressImpl(s2); Address w = new AddressImpl(s3); @@ -179,9 +179,9 @@ public class AddressMapUnitTest { @Test public void testF() throws Exception { - SimpleString s1 = new SimpleString("a.b.c.d.e.f"); - SimpleString s2 = new SimpleString("a.b.c.x.e.f"); - SimpleString s3 = new SimpleString("#"); + SimpleString s1 = SimpleString.of("a.b.c.d.e.f"); + SimpleString s2 = SimpleString.of("a.b.c.x.e.f"); + SimpleString s3 = SimpleString.of("#"); Address a1 = new AddressImpl(s1); Address a2 = new AddressImpl(s2); Address w = new AddressImpl(s3); @@ -197,9 +197,9 @@ public class AddressMapUnitTest { @Test public void testG() throws Exception { - SimpleString s1 = new SimpleString("a.b.c.d.e.f"); - SimpleString s2 = new SimpleString("a.b.c.x.e.f"); - SimpleString s3 = new SimpleString("a.#"); + SimpleString s1 = SimpleString.of("a.b.c.d.e.f"); + SimpleString s2 = SimpleString.of("a.b.c.x.e.f"); + SimpleString s3 = SimpleString.of("a.#"); Address a1 = new AddressImpl(s1); Address a2 = new AddressImpl(s2); Address w = new AddressImpl(s3); @@ -215,9 +215,9 @@ public class AddressMapUnitTest { @Test public void testH() throws Exception { - SimpleString s1 = new SimpleString("a.b.c.d.e.f"); - SimpleString s2 = new SimpleString("a.b.c.x.e.f"); - SimpleString s3 = new SimpleString("#.b.#"); + SimpleString s1 = SimpleString.of("a.b.c.d.e.f"); + SimpleString s2 = SimpleString.of("a.b.c.x.e.f"); + SimpleString s3 = SimpleString.of("#.b.#"); Address a1 = new AddressImpl(s1); Address a2 = new AddressImpl(s2); Address w = new AddressImpl(s3); @@ -232,9 +232,9 @@ public class AddressMapUnitTest { @Test public void testI() throws Exception { - SimpleString s1 = new SimpleString("a.b.c.d.e.f"); - SimpleString s2 = new SimpleString("a.b.c.x.e.f"); - SimpleString s3 = new SimpleString("a.#.b.#"); + SimpleString s1 = SimpleString.of("a.b.c.d.e.f"); + SimpleString s2 = SimpleString.of("a.b.c.x.e.f"); + SimpleString s3 = SimpleString.of("a.#.b.#"); Address a1 = new AddressImpl(s1); Address a2 = new AddressImpl(s2); Address w = new AddressImpl(s3); @@ -250,9 +250,9 @@ public class AddressMapUnitTest { @Test public void testJ() throws Exception { - SimpleString s1 = new SimpleString("a.b.c.d.e.f"); - SimpleString s2 = new SimpleString("a.b.c.x.e.f"); - SimpleString s3 = new SimpleString("a.#.c.d.e.f"); + SimpleString s1 = SimpleString.of("a.b.c.d.e.f"); + SimpleString s2 = SimpleString.of("a.b.c.x.e.f"); + SimpleString s3 = SimpleString.of("a.#.c.d.e.f"); Address a1 = new AddressImpl(s1); Address a2 = new AddressImpl(s2); Address w = new AddressImpl(s3); @@ -268,9 +268,9 @@ public class AddressMapUnitTest { @Test public void testK() throws Exception { - SimpleString s1 = new SimpleString("a.b.c.d.e.f"); - SimpleString s2 = new SimpleString("a.b.c.d.e.x"); - SimpleString s3 = new SimpleString("a.#.c.d.e.*"); + SimpleString s1 = SimpleString.of("a.b.c.d.e.f"); + SimpleString s2 = SimpleString.of("a.b.c.d.e.x"); + SimpleString s3 = SimpleString.of("a.#.c.d.e.*"); Address a1 = new AddressImpl(s1); Address a2 = new AddressImpl(s2); Address w = new AddressImpl(s3); @@ -286,9 +286,9 @@ public class AddressMapUnitTest { @Test public void testL() throws Exception { - SimpleString s1 = new SimpleString("a.b.c.d.e.f"); - SimpleString s2 = new SimpleString("a.b.c.d.e.x"); - SimpleString s3 = new SimpleString("a.#.c.d.*.f"); + SimpleString s1 = SimpleString.of("a.b.c.d.e.f"); + SimpleString s2 = SimpleString.of("a.b.c.d.e.x"); + SimpleString s3 = SimpleString.of("a.#.c.d.*.f"); Address a1 = new AddressImpl(s1); Address a2 = new AddressImpl(s2); Address w = new AddressImpl(s3); @@ -304,9 +304,9 @@ public class AddressMapUnitTest { @Test public void testM() throws Exception { - SimpleString s1 = new SimpleString("a.b.c"); - SimpleString s2 = new SimpleString("a.b.x.e"); - SimpleString s3 = new SimpleString("a.b.c.#"); + SimpleString s1 = SimpleString.of("a.b.c"); + SimpleString s2 = SimpleString.of("a.b.x.e"); + SimpleString s3 = SimpleString.of("a.b.c.#"); Address a1 = new AddressImpl(s1); Address a2 = new AddressImpl(s2); Address w = new AddressImpl(s3); @@ -322,9 +322,9 @@ public class AddressMapUnitTest { @Test public void testN() throws Exception { - SimpleString s1 = new SimpleString("usd.stock"); - SimpleString s2 = new SimpleString("a.b.x.e"); - SimpleString s3 = new SimpleString("*.stock.#"); + SimpleString s1 = SimpleString.of("usd.stock"); + SimpleString s2 = SimpleString.of("a.b.x.e"); + SimpleString s3 = SimpleString.of("*.stock.#"); Address a1 = new AddressImpl(s1); Address a2 = new AddressImpl(s2); Address w = new AddressImpl(s3); @@ -339,9 +339,9 @@ public class AddressMapUnitTest { @Test public void testO() throws Exception { - SimpleString s1 = new SimpleString("a.b.c.d"); - SimpleString s2 = new SimpleString("a.b.x.e"); - SimpleString s3 = new SimpleString("a.b.c.*"); + SimpleString s1 = SimpleString.of("a.b.c.d"); + SimpleString s2 = SimpleString.of("a.b.x.e"); + SimpleString s3 = SimpleString.of("a.b.c.*"); Address a1 = new AddressImpl(s1); Address a2 = new AddressImpl(s2); Address w = new AddressImpl(s3); @@ -357,8 +357,8 @@ public class AddressMapUnitTest { @Test public void testP() throws Exception { - SimpleString s1 = new SimpleString("a.b.c.d"); - SimpleString s3 = new SimpleString("a.b.c#"); + SimpleString s1 = SimpleString.of("a.b.c.d"); + SimpleString s3 = SimpleString.of("a.b.c#"); Address a1 = new AddressImpl(s1); Address w = new AddressImpl(s3); assertFalse(a1.matches(w)); @@ -371,8 +371,8 @@ public class AddressMapUnitTest { @Test public void testQ() throws Exception { - SimpleString s1 = new SimpleString("a.b.c.d"); - SimpleString s3 = new SimpleString("#a.b.c"); + SimpleString s1 = SimpleString.of("a.b.c.d"); + SimpleString s3 = SimpleString.of("#a.b.c"); Address a1 = new AddressImpl(s1); Address w = new AddressImpl(s3); assertFalse(a1.matches(w)); @@ -384,8 +384,8 @@ public class AddressMapUnitTest { @Test public void testR() throws Exception { - SimpleString s1 = new SimpleString("a.b.c.d"); - SimpleString s3 = new SimpleString("#*a.b.c"); + SimpleString s1 = SimpleString.of("a.b.c.d"); + SimpleString s3 = SimpleString.of("#*a.b.c"); Address a1 = new AddressImpl(s1); Address w = new AddressImpl(s3); assertFalse(a1.matches(w)); @@ -397,8 +397,8 @@ public class AddressMapUnitTest { @Test public void testS() throws Exception { - SimpleString s1 = new SimpleString("a.b.c.d"); - SimpleString s3 = new SimpleString("a.b.c*"); + SimpleString s1 = SimpleString.of("a.b.c.d"); + SimpleString s3 = SimpleString.of("a.b.c*"); Address a1 = new AddressImpl(s1); Address w = new AddressImpl(s3); assertFalse(a1.matches(w)); @@ -410,8 +410,8 @@ public class AddressMapUnitTest { @Test public void testT() throws Exception { - SimpleString s1 = new SimpleString("a.b.c.d"); - SimpleString s3 = new SimpleString("*a.b.c"); + SimpleString s1 = SimpleString.of("a.b.c.d"); + SimpleString s3 = SimpleString.of("*a.b.c"); Address a1 = new AddressImpl(s1); Address w = new AddressImpl(s3); assertFalse(a1.matches(w)); @@ -423,8 +423,8 @@ public class AddressMapUnitTest { @Test public void testU() throws Exception { - SimpleString s1 = new SimpleString("a.b.c.d"); - SimpleString s3 = new SimpleString("*a.b.c"); + SimpleString s1 = SimpleString.of("a.b.c.d"); + SimpleString s3 = SimpleString.of("*a.b.c"); Address a1 = new AddressImpl(s1); Address w = new AddressImpl(s3); assertFalse(a1.matches(w)); @@ -436,8 +436,8 @@ public class AddressMapUnitTest { @Test public void testV() throws Exception { - final SimpleString s1 = new SimpleString("a.b.d"); - final SimpleString s3 = new SimpleString("a.b.#.d"); + final SimpleString s1 = SimpleString.of("a.b.d"); + final SimpleString s3 = SimpleString.of("a.b.#.d"); final Address a1 = new AddressImpl(s1); final Address w = new AddressImpl(s3); assertTrue(a1.matches(w)); @@ -445,15 +445,15 @@ public class AddressMapUnitTest { underTest.put(s1, s1); assertEquals(1, countNonWildcardMatching(s3)); - final SimpleString s2 = new SimpleString("a.b.b.b.b.d"); + final SimpleString s2 = SimpleString.of("a.b.b.b.b.d"); underTest.put(s2, s2); assertEquals(2, countNonWildcardMatching(s3)); } @Test public void testVReverse() throws Exception { - final SimpleString s1 = new SimpleString("a.b.d"); - final SimpleString s3 = new SimpleString("a.b.#.d"); + final SimpleString s1 = SimpleString.of("a.b.d"); + final SimpleString s3 = SimpleString.of("a.b.#.d"); final Address a1 = new AddressImpl(s1); final Address w = new AddressImpl(s3); assertTrue(a1.matches(w)); @@ -466,9 +466,9 @@ public class AddressMapUnitTest { @Test public void testHashNMatch() throws Exception { - SimpleString addressABCF = new SimpleString("a.b.c.f"); - SimpleString addressACF = new SimpleString("a.c.f"); - SimpleString match = new SimpleString("a.#.f"); + SimpleString addressABCF = SimpleString.of("a.b.c.f"); + SimpleString addressACF = SimpleString.of("a.c.f"); + SimpleString match = SimpleString.of("a.#.f"); underTest.put(addressABCF, addressABCF); underTest.put(addressACF, addressACF); @@ -479,10 +479,10 @@ public class AddressMapUnitTest { @Test public void testEndHash() throws Exception { - SimpleString addressAB = new SimpleString("a.b"); - SimpleString addressACF = new SimpleString("a.c.f"); - SimpleString addressABC = new SimpleString("a.b.c"); - SimpleString match = new SimpleString("a.b.#"); + SimpleString addressAB = SimpleString.of("a.b"); + SimpleString addressACF = SimpleString.of("a.c.f"); + SimpleString addressABC = SimpleString.of("a.b.c"); + SimpleString match = SimpleString.of("a.b.#"); underTest.put(addressAB, addressAB); underTest.put(addressACF, addressACF); @@ -496,9 +496,9 @@ public class AddressMapUnitTest { @Test public void testHashEndInMap() throws Exception { - SimpleString addressABHash = new SimpleString("a.b.#"); - SimpleString addressABC = new SimpleString("a.b.c"); - SimpleString match = new SimpleString("a.b"); + SimpleString addressABHash = SimpleString.of("a.b.#"); + SimpleString addressABC = SimpleString.of("a.b.c"); + SimpleString match = SimpleString.of("a.b"); underTest.put(addressABHash, addressABHash); underTest.put(addressABC, addressABC); @@ -529,9 +529,9 @@ public class AddressMapUnitTest { @Test public void testHashEndMatchMap() throws Exception { - SimpleString match = new SimpleString("a.b.#"); - SimpleString addressABC = new SimpleString("a.b.c"); - SimpleString addressAB = new SimpleString("a.b"); + SimpleString match = SimpleString.of("a.b.#"); + SimpleString addressABC = SimpleString.of("a.b.c"); + SimpleString addressAB = SimpleString.of("a.b"); underTest.put(addressAB, addressAB); underTest.put(addressABC, addressABC); @@ -547,11 +547,11 @@ public class AddressMapUnitTest { @Test public void testHashAGet() throws Exception { - SimpleString hashA = new SimpleString("#.a"); + SimpleString hashA = SimpleString.of("#.a"); underTest.put(hashA, hashA); - SimpleString matchA = new SimpleString("a"); - SimpleString matchAB = new SimpleString("a.b"); + SimpleString matchA = SimpleString.of("a"); + SimpleString matchAB = SimpleString.of("a.b"); assertEquals(1, countMatchingWildcards(matchA)); assertEquals(0, countMatchingWildcards(matchAB)); @@ -567,11 +567,11 @@ public class AddressMapUnitTest { @Test public void testStarOne() throws Exception { - SimpleString star = new SimpleString("*"); + SimpleString star = SimpleString.of("*"); underTest.put(star, star); - SimpleString matchA = new SimpleString("a"); - SimpleString matchAB = new SimpleString("a.b"); + SimpleString matchA = SimpleString.of("a"); + SimpleString matchAB = SimpleString.of("a.b"); final AtomicInteger count = new AtomicInteger(); underTest.visitMatchingWildcards(matchA, value -> count.incrementAndGet()); @@ -587,12 +587,12 @@ public class AddressMapUnitTest { @Test public void testHashOne() throws Exception { - SimpleString hash = new SimpleString("#"); + SimpleString hash = SimpleString.of("#"); underTest.put(hash, hash); - SimpleString matchA = new SimpleString("a"); - SimpleString matchAB = new SimpleString("a.b"); - SimpleString matchABC = new SimpleString("a.b.c"); + SimpleString matchA = SimpleString.of("a"); + SimpleString matchAB = SimpleString.of("a.b"); + SimpleString matchABC = SimpleString.of("a.b.c"); final AtomicInteger count = new AtomicInteger(); AddressMapVisitor countCollector = value -> count.incrementAndGet(); @@ -613,26 +613,26 @@ public class AddressMapUnitTest { @Test public void testHashAMatch() throws Exception { - SimpleString a = new SimpleString("a"); + SimpleString a = SimpleString.of("a"); underTest.put(a, a); - assertEquals(1, countNonWildcardMatching(new SimpleString("#.a"))); + assertEquals(1, countNonWildcardMatching(SimpleString.of("#.a"))); - assertEquals(1, countMatchingWildcards(new SimpleString("a"))); + assertEquals(1, countMatchingWildcards(SimpleString.of("a"))); } @Test public void testHashA() throws Exception { - SimpleString hashA = new SimpleString("#.a"); + SimpleString hashA = SimpleString.of("#.a"); underTest.put(hashA, hashA); - assertEquals(1, countMatchingWildcards(new SimpleString("a"))); + assertEquals(1, countMatchingWildcards(SimpleString.of("a"))); - assertEquals(1, countMatchingWildcards(new SimpleString("d.f.c.a"))); + assertEquals(1, countMatchingWildcards(SimpleString.of("d.f.c.a"))); // has to end in 'a', and not being with 'a' - SimpleString abcaS = new SimpleString("a.b.c.a"); + SimpleString abcaS = SimpleString.of("a.b.c.a"); AddressImpl aHashA = new AddressImpl(hashA); AddressImpl aABCA = new AddressImpl(abcaS); assertFalse(aABCA.matches(aHashA)); @@ -640,26 +640,26 @@ public class AddressMapUnitTest { assertEquals(1, countMatchingWildcards(abcaS)); - assertEquals(0, countMatchingWildcards(new SimpleString("a.b"))); + assertEquals(0, countMatchingWildcards(SimpleString.of("a.b"))); - assertEquals(0, countMatchingWildcards(new SimpleString("a.b.c"))); + assertEquals(0, countMatchingWildcards(SimpleString.of("a.b.c"))); - assertEquals(0, countMatchingWildcards(new SimpleString("a.b.c.a.d"))); + assertEquals(0, countMatchingWildcards(SimpleString.of("a.b.c.a.d"))); // will match a.....a - SimpleString AHashA = new SimpleString("a.#.a"); + SimpleString AHashA = SimpleString.of("a.#.a"); underTest.put(AHashA, AHashA); - assertEquals(2, countMatchingWildcards(new SimpleString("a.b.c.a"))); + assertEquals(2, countMatchingWildcards(SimpleString.of("a.b.c.a"))); - assertEquals(0, countNonWildcardMatching(new SimpleString("a.b.c.a"))); + assertEquals(0, countNonWildcardMatching(SimpleString.of("a.b.c.a"))); // only now remove the #.a underTest.remove(hashA, hashA); - assertEquals(1, countMatchingWildcards(new SimpleString("a.b.c.a"))); + assertEquals(1, countMatchingWildcards(SimpleString.of("a.b.c.a"))); - assertEquals(1, countMatchingWildcards(new SimpleString("a.a"))); + assertEquals(1, countMatchingWildcards(SimpleString.of("a.a"))); } @@ -670,28 +670,28 @@ public class AddressMapUnitTest { AddressMapVisitor countCollector = value -> count.incrementAndGet(); // will match a.....a - SimpleString AHashA = new SimpleString("a.#.a"); + SimpleString AHashA = SimpleString.of("a.#.a"); underTest.put(AHashA, AHashA); count.set(0); - underTest.visitMatchingWildcards(new SimpleString("a.b.c.a"), countCollector); + underTest.visitMatchingWildcards(SimpleString.of("a.b.c.a"), countCollector); assertEquals(1, count.get()); count.set(0); - underTest.visitMatchingWildcards(new SimpleString("a.a"), countCollector); + underTest.visitMatchingWildcards(SimpleString.of("a.a"), countCollector); assertEquals(1, count.get()); count.set(0); - underTest.visitMatchingWildcards(new SimpleString("a"), countCollector); + underTest.visitMatchingWildcards(SimpleString.of("a"), countCollector); assertEquals(0, count.get()); } @Test public void testStar() throws Exception { - SimpleString star = new SimpleString("*"); - SimpleString addressA = new SimpleString("a"); - SimpleString addressAB = new SimpleString("a.b"); + SimpleString star = SimpleString.of("*"); + SimpleString addressA = SimpleString.of("a"); + SimpleString addressAB = SimpleString.of("a.b"); underTest.put(star, star); underTest.put(addressAB, addressAB); @@ -705,13 +705,13 @@ public class AddressMapUnitTest { @Test public void testSomeAndAny() throws Exception { - SimpleString star = new SimpleString("test.*.some.#"); + SimpleString star = SimpleString.of("test.*.some.#"); underTest.put(star, star); assertEquals(0, countNonWildcardMatching(star)); assertEquals(1, countMatchingWildcards(star)); - SimpleString addressA = new SimpleString("test.1.some.la"); + SimpleString addressA = SimpleString.of("test.1.some.la"); underTest.put(addressA, addressA); assertEquals(1, countMatchingWildcards(star)); @@ -725,13 +725,13 @@ public class AddressMapUnitTest { @Test public void testAnyAndSome() throws Exception { - SimpleString star = new SimpleString("test.#.some.*"); + SimpleString star = SimpleString.of("test.#.some.*"); underTest.put(star, star); assertEquals(1, countMatchingWildcards(star)); // add another match - SimpleString addressA = new SimpleString("test.1.some.la"); + SimpleString addressA = SimpleString.of("test.1.some.la"); underTest.put(addressA, addressA); assertEquals(1, countMatchingWildcards(star)); @@ -747,22 +747,22 @@ public class AddressMapUnitTest { @Test public void testAnyAndSomeInMap() throws Exception { - SimpleString hashHash = new SimpleString("test.#.some.#"); + SimpleString hashHash = SimpleString.of("test.#.some.#"); underTest.put(hashHash, hashHash); - SimpleString starStar = new SimpleString("test.*.some.*"); + SimpleString starStar = SimpleString.of("test.*.some.*"); underTest.put(starStar, starStar); - SimpleString hashStar = new SimpleString("test.#.A.*"); + SimpleString hashStar = SimpleString.of("test.#.A.*"); underTest.put(hashStar, hashStar); - SimpleString oneHashStar = new SimpleString("test.1.#.T"); + SimpleString oneHashStar = SimpleString.of("test.1.#.T"); underTest.put(oneHashStar, oneHashStar); assertEquals(2, countMatchingWildcards(hashHash)); assertEquals(0, countNonWildcardMatching(hashHash)); - SimpleString reqular = new SimpleString("test.a.b.some"); + SimpleString reqular = SimpleString.of("test.a.b.some"); underTest.put(reqular, reqular); assertEquals(1, countNonWildcardMatching(hashHash)); @@ -774,169 +774,169 @@ public class AddressMapUnitTest { @Test public void testHashAandHashB() throws Exception { - SimpleString hashAhash = new SimpleString("test.#.aaa.#"); + SimpleString hashAhash = SimpleString.of("test.#.aaa.#"); underTest.put(hashAhash, hashAhash); - SimpleString hashBhash = new SimpleString("test.#.bbb.#"); + SimpleString hashBhash = SimpleString.of("test.#.bbb.#"); underTest.put(hashBhash, hashBhash); - assertEquals(2, countMatchingWildcards(SimpleString.toSimpleString("test.aaa.bbb"))); - assertEquals(2, countMatchingWildcards(SimpleString.toSimpleString("test.bbb.aaa"))); + assertEquals(2, countMatchingWildcards(SimpleString.of("test.aaa.bbb"))); + assertEquals(2, countMatchingWildcards(SimpleString.of("test.bbb.aaa"))); - assertEquals(2, countMatchingWildcards(SimpleString.toSimpleString("test.bbb.aaa.ccc"))); - assertEquals(2, countMatchingWildcards(SimpleString.toSimpleString("test.aaa.bbb.ccc"))); + assertEquals(2, countMatchingWildcards(SimpleString.of("test.bbb.aaa.ccc"))); + assertEquals(2, countMatchingWildcards(SimpleString.of("test.aaa.bbb.ccc"))); } @Test public void testHashNoHashNo() throws Exception { - SimpleString hashAhash = new SimpleString("test.#.0.#.168"); + SimpleString hashAhash = SimpleString.of("test.#.0.#.168"); underTest.put(hashAhash, hashAhash); - assertEquals(1, countMatchingWildcards(SimpleString.toSimpleString("test.0.168"))); + assertEquals(1, countMatchingWildcards(SimpleString.of("test.0.168"))); } @Test public void testHashNoHashHashNo() throws Exception { - SimpleString v = new SimpleString("test.#.0.#.168"); + SimpleString v = SimpleString.of("test.#.0.#.168"); underTest.put(v, v); - v = new SimpleString("test.#.0.#"); + v = SimpleString.of("test.#.0.#"); underTest.put(v, v); - v = new SimpleString("test.0.#"); + v = SimpleString.of("test.0.#"); underTest.put(v, v); - assertEquals(3, countMatchingWildcards(SimpleString.toSimpleString("test.0.168"))); + assertEquals(3, countMatchingWildcards(SimpleString.of("test.0.168"))); } @Test public void testHashNoHashNoWithNMatch() throws Exception { for (String s : new String[] {"t.#.0.#", "t.#.1.#", "t.#.2.#", "t.#.3.#", "t.#.1.2.3", "t.0.1.2.3"}) { - SimpleString v = new SimpleString(s); + SimpleString v = SimpleString.of(s); underTest.put(v, v); } - assertEquals(6, countMatchingWildcards(SimpleString.toSimpleString("t.0.1.2.3"))); + assertEquals(6, countMatchingWildcards(SimpleString.of("t.0.1.2.3"))); } @Test public void testSomeMoreHashPlacement() throws Exception { for (String s : new String[] {"t.#.0.#", "t.0.1.#", "t.0.1.2.#", "t.0.1.#.2.3", "t.*.#.1.2.3"}) { - SimpleString v = new SimpleString(s); + SimpleString v = SimpleString.of(s); underTest.put(v, v); } - assertEquals(5, countMatchingWildcards(SimpleString.toSimpleString("t.0.1.2.3"))); - assertEquals(3, countMatchingWildcards(SimpleString.toSimpleString("t.0.1.2.3.4"))); + assertEquals(5, countMatchingWildcards(SimpleString.of("t.0.1.2.3"))); + assertEquals(3, countMatchingWildcards(SimpleString.of("t.0.1.2.3.4"))); } @Test public void testManyEntries() throws Exception { for (int i = 0; i < 10; i++) { - SimpleString star = new SimpleString("test." + i); + SimpleString star = SimpleString.of("test." + i); underTest.put(star, star); } - assertEquals(10, countNonWildcardMatching(new SimpleString("test.*"))); + assertEquals(10, countNonWildcardMatching(SimpleString.of("test.*"))); - assertEquals(10, countNonWildcardMatching(new SimpleString("test.#"))); + assertEquals(10, countNonWildcardMatching(SimpleString.of("test.#"))); - assertEquals(1, countMatchingWildcards(new SimpleString("test.0"))); + assertEquals(1, countMatchingWildcards(SimpleString.of("test.0"))); - underTest.put(new SimpleString("test.#"), new SimpleString("test.#")); - underTest.put(new SimpleString("test.*"), new SimpleString("test.*")); + underTest.put(SimpleString.of("test.#"), SimpleString.of("test.#")); + underTest.put(SimpleString.of("test.*"), SimpleString.of("test.*")); - assertEquals(3, countMatchingWildcards(new SimpleString("test.1"))); + assertEquals(3, countMatchingWildcards(SimpleString.of("test.1"))); - assertEquals(10, countNonWildcardMatching(new SimpleString("test.#"))); + assertEquals(10, countNonWildcardMatching(SimpleString.of("test.#"))); - assertEquals(10, countNonWildcardMatching(new SimpleString("test.*"))); + assertEquals(10, countNonWildcardMatching(SimpleString.of("test.*"))); for (int i = 0; i < 10; i++) { - SimpleString star = new SimpleString("test.a." + i); + SimpleString star = SimpleString.of("test.a." + i); underTest.put(star, star); } - assertEquals(2, countMatchingWildcards(new SimpleString("test.a.0"))); - assertEquals(20, countNonWildcardMatching(new SimpleString("test.#"))); + assertEquals(2, countMatchingWildcards(SimpleString.of("test.a.0"))); + assertEquals(20, countNonWildcardMatching(SimpleString.of("test.#"))); for (int i = 0; i < 10; i++) { - SimpleString star = new SimpleString("test.b." + i); + SimpleString star = SimpleString.of("test.b." + i); underTest.put(star, star); } - assertEquals(10, countNonWildcardMatching(new SimpleString("test.b.*"))); - underTest.remove(new SimpleString("test.#"), new SimpleString("test.#")); + assertEquals(10, countNonWildcardMatching(SimpleString.of("test.b.*"))); + underTest.remove(SimpleString.of("test.#"), SimpleString.of("test.#")); - assertEquals(10, countNonWildcardMatching(new SimpleString("test.b.*"))); - assertEquals(1, countMatchingWildcards(new SimpleString("test.a.0"))); + assertEquals(10, countNonWildcardMatching(SimpleString.of("test.b.*"))); + assertEquals(1, countMatchingWildcards(SimpleString.of("test.a.0"))); for (int i = 0; i < 10; i++) { - SimpleString star = new SimpleString("test.c." + i); + SimpleString star = SimpleString.of("test.c." + i); underTest.put(star, star); } - assertEquals(10, countNonWildcardMatching(new SimpleString("test.c.*"))); + assertEquals(10, countNonWildcardMatching(SimpleString.of("test.c.*"))); - SimpleString testStarStar = new SimpleString("test.*.*"); + SimpleString testStarStar = SimpleString.of("test.*.*"); assertEquals(30, countNonWildcardMatching(testStarStar)); underTest.put(testStarStar, testStarStar); assertEquals(30, countNonWildcardMatching(testStarStar)); assertEquals(1, countMatchingWildcards(testStarStar)); - assertEquals(1, countMatchingWildcards(new SimpleString("test.b.c"))); + assertEquals(1, countMatchingWildcards(SimpleString.of("test.b.c"))); } @Test public void testReset() throws Exception { for (int i = 0; i < 10; i++) { - SimpleString star = new SimpleString("test." + i); + SimpleString star = SimpleString.of("test." + i); underTest.put(star, star); } - assertEquals(0, countMatchingWildcards(new SimpleString("test.*"))); + assertEquals(0, countMatchingWildcards(SimpleString.of("test.*"))); - assertEquals(10, countNonWildcardMatching(new SimpleString("test.*"))); + assertEquals(10, countNonWildcardMatching(SimpleString.of("test.*"))); underTest.reset(); - assertEquals(0, countNonWildcardMatching(new SimpleString("test.*"))); + assertEquals(0, countNonWildcardMatching(SimpleString.of("test.*"))); } @Test public void testRemove() throws Exception { for (int i = 0; i < 10; i++) { - SimpleString star = new SimpleString("test." + i); + SimpleString star = SimpleString.of("test." + i); underTest.put(star, star); } - SimpleString test1 = new SimpleString("test.1"); + SimpleString test1 = SimpleString.of("test.1"); assertEquals(1, countMatchingWildcards(test1)); underTest.remove(test1, test1); assertEquals(0, countMatchingWildcards(test1)); - assertEquals(9, countNonWildcardMatching(new SimpleString("test.*"))); + assertEquals(9, countNonWildcardMatching(SimpleString.of("test.*"))); for (int i = 0; i < 10; i++) { - SimpleString star = new SimpleString("test." + i); + SimpleString star = SimpleString.of("test." + i); underTest.remove(star, star); } - assertEquals(0, countNonWildcardMatching(new SimpleString("test.*"))); + assertEquals(0, countNonWildcardMatching(SimpleString.of("test.*"))); } @Test public void testMax() throws Exception { - underTest.put(new SimpleString("test.#.a"), new SimpleString("test.#.a")); - underTest.put(new SimpleString("test.*.a"), new SimpleString("test.*.a")); - underTest.put(new SimpleString("*.a"), new SimpleString("*.a")); - underTest.put(new SimpleString("#.a"), new SimpleString("#.a")); + underTest.put(SimpleString.of("test.#.a"), SimpleString.of("test.#.a")); + underTest.put(SimpleString.of("test.*.a"), SimpleString.of("test.*.a")); + underTest.put(SimpleString.of("*.a"), SimpleString.of("*.a")); + underTest.put(SimpleString.of("#.a"), SimpleString.of("#.a")); - assertEquals(3, countMatchingWildcards(new SimpleString("test.a"))); - assertEquals(3, countMatchingWildcards(new SimpleString("test.a.a"))); + assertEquals(3, countMatchingWildcards(SimpleString.of("test.a"))); + assertEquals(3, countMatchingWildcards(SimpleString.of("test.a.a"))); } } \ No newline at end of file diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/BindingsImplTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/BindingsImplTest.java index 682d87160f..cb193d8965 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/BindingsImplTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/BindingsImplTest.java @@ -55,7 +55,7 @@ public class BindingsImplTest extends ActiveMQTestBase { @Test public void testGetNextBindingWithLoadBalancingOnDemand() throws Exception { - final FakeRemoteBinding fake = new FakeRemoteBinding(new SimpleString("a")); + final FakeRemoteBinding fake = new FakeRemoteBinding(SimpleString.of("a")); fake.filter = null; // such that it wil match all messages fake.messageLoadBalancingType = MessageLoadBalancingType.ON_DEMAND; final Bindings bind = new BindingsImpl(null, null, new NullStorageManager(1000)); @@ -66,7 +66,7 @@ public class BindingsImplTest extends ActiveMQTestBase { @Test public void testGetNextBindingWithLoadBalancingOff() throws Exception { - final FakeRemoteBinding fake = new FakeRemoteBinding(new SimpleString("a")); + final FakeRemoteBinding fake = new FakeRemoteBinding(SimpleString.of("a")); fake.filter = null; // such that it wil match all messages fake.messageLoadBalancingType = MessageLoadBalancingType.OFF; final Bindings bind = new BindingsImpl(null, null, new NullStorageManager(1000)); @@ -77,7 +77,7 @@ public class BindingsImplTest extends ActiveMQTestBase { @Test public void testGetNextBindingWithLoadBalancingOffWithRedistribution() throws Exception { - final FakeRemoteBinding fake = new FakeRemoteBinding(new SimpleString("a")); + final FakeRemoteBinding fake = new FakeRemoteBinding(SimpleString.of("a")); fake.filter = null; // such that it wil match all messages fake.messageLoadBalancingType = MessageLoadBalancingType.OFF_WITH_REDISTRIBUTION; final Bindings bind = new BindingsImpl(null, null, new NullStorageManager(1000)); @@ -103,12 +103,12 @@ public class BindingsImplTest extends ActiveMQTestBase { } private void internalTest(final boolean route) throws Exception { - final FakeBinding fake = new FakeBinding(new SimpleString("a")); + final FakeBinding fake = new FakeBinding(SimpleString.of("a")); final Bindings bind = new BindingsImpl(null, null, new NullStorageManager(1000)); bind.addBinding(fake); - bind.addBinding(new FakeBinding(new SimpleString("a"))); - bind.addBinding(new FakeBinding(new SimpleString("a"))); + bind.addBinding(new FakeBinding(SimpleString.of("a"))); + bind.addBinding(new FakeBinding(SimpleString.of("a"))); Thread t = new Thread() { @Override @@ -121,7 +121,7 @@ public class BindingsImplTest extends ActiveMQTestBase { } }; - Queue queue = new FakeQueue(new SimpleString("a")); + Queue queue = new FakeQueue(SimpleString.of("a")); t.start(); for (int i = 0; i < 100; i++) { @@ -360,7 +360,7 @@ public class BindingsImplTest extends ActiveMQTestBase { } final SimpleString name; - final SimpleString uniqueName = SimpleString.toSimpleString(UUID.randomUUID().toString()); + final SimpleString uniqueName = SimpleString.of(UUID.randomUUID().toString()); FakeBinding(final SimpleString name) { this.name = name; diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/DuplicateDetectionUnitTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/DuplicateDetectionUnitTest.java index 1bbe1816ea..6fbc5ac09c 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/DuplicateDetectionUnitTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/DuplicateDetectionUnitTest.java @@ -81,7 +81,7 @@ public class DuplicateDetectionUnitTest extends ActiveMQTestBase { try { clearDataRecreateServerDirs(); - SimpleString ADDRESS = new SimpleString("address"); + SimpleString ADDRESS = SimpleString.of("address"); Configuration configuration = createDefaultInVMConfig(); diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/QueueComparatorTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/QueueComparatorTest.java index 00ac5fc798..6c1193f10b 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/QueueComparatorTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/QueueComparatorTest.java @@ -32,11 +32,11 @@ public class QueueComparatorTest { @Test public void testQueueSorting() { - FakeQueue queue1 = new FakeQueue(new SimpleString("1")); + FakeQueue queue1 = new FakeQueue(SimpleString.of("1")); queue1.setMessageCount(1); - FakeQueue queue2 = new FakeQueue(new SimpleString("2")); + FakeQueue queue2 = new FakeQueue(SimpleString.of("2")); queue2.setMessageCount(2); - FakeQueue queue3 = new FakeQueue(new SimpleString("3")); + FakeQueue queue3 = new FakeQueue(SimpleString.of("3")); queue3.setMessageCount(3); List queues = new ArrayList<>(); diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/WildcardAddressManagerPerfTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/WildcardAddressManagerPerfTest.java index 21abcca38c..0d15b03368 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/WildcardAddressManagerPerfTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/WildcardAddressManagerPerfTest.java @@ -72,9 +72,9 @@ public class WildcardAddressManagerPerfTest { } // subscribe as wildcard - ad.addBinding(new BindingFake(SimpleString.toSimpleString("Topic1." + id % partitions + ".>"), SimpleString.toSimpleString("" + id), id)); + ad.addBinding(new BindingFake(SimpleString.of("Topic1." + id % partitions + ".>"), SimpleString.of("" + id), id)); - SimpleString pubAddr = SimpleString.toSimpleString("Topic1." + id % partitions + "." + id ); + SimpleString pubAddr = SimpleString.of("Topic1." + id % partitions + "." + id ); if (id != 0 && id % 1000 == 0) { @@ -109,7 +109,7 @@ public class WildcardAddressManagerPerfTest { final AtomicLong addresses = new AtomicLong(); final AtomicLong bindings = new AtomicLong(); - ad.getAddressMap().visitMatchingWildcards(SimpleString.toSimpleString(">"), new AddressMapVisitor() { + ad.getAddressMap().visitMatchingWildcards(SimpleString.of(">"), new AddressMapVisitor() { @Override public void visit(Bindings value) { addresses.incrementAndGet(); diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/WildcardAddressManagerUnitTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/WildcardAddressManagerUnitTest.java index 66d8745191..109197e446 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/WildcardAddressManagerUnitTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/WildcardAddressManagerUnitTest.java @@ -66,9 +66,9 @@ public class WildcardAddressManagerUnitTest extends ActiveMQTestBase { ad.addBinding(new BindingFake("Topic1", "Topic1")); ad.addBinding(new BindingFake("Topic1", "one")); ad.addBinding(new BindingFake("*", "two")); - ad.removeBinding(SimpleString.toSimpleString("one"), null); + ad.removeBinding(SimpleString.of("one"), null); try { - ad.removeBinding(SimpleString.toSimpleString("two"), null); + ad.removeBinding(SimpleString.of("two"), null); } catch (Throwable e) { // We are not failing the test here as this test is replicating the exact scenario // that was happening under https://issues.jboss.org/browse/HORNETQ-988 @@ -96,9 +96,9 @@ public class WildcardAddressManagerUnitTest extends ActiveMQTestBase { ad.addBinding(new BindingFake("Topic1", "Topic1")); ad.addBinding(new BindingFake("Topic1", "one")); ad.addBinding(new BindingFake("*", "two")); - ad.removeBinding(SimpleString.toSimpleString("Topic1::one"), null); + ad.removeBinding(SimpleString.of("Topic1::one"), null); try { - ad.removeBinding(SimpleString.toSimpleString("*::two"), null); + ad.removeBinding(SimpleString.of("*::two"), null); } catch (Throwable e) { // We are not failing the test here as this test is replicating the exact scenario // that was happening under https://issues.jboss.org/browse/HORNETQ-988 @@ -126,26 +126,26 @@ public class WildcardAddressManagerUnitTest extends ActiveMQTestBase { public void testWildCardAddressRemoval() throws Exception { WildcardAddressManager ad = new WildcardAddressManager(new BindingFactoryFake(), null, null); - ad.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("Queue1.#"), RoutingType.ANYCAST)); - ad.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("Topic1.#"), RoutingType.MULTICAST)); + ad.addAddressInfo(new AddressInfo(SimpleString.of("Queue1.#"), RoutingType.ANYCAST)); + ad.addAddressInfo(new AddressInfo(SimpleString.of("Topic1.#"), RoutingType.MULTICAST)); ad.addBinding(new BindingFake("Topic1.#", "two")); ad.addBinding(new BindingFake("Queue1.#", "one")); //Calling this method will trigger the wildcard to be added to the wildcard map internal //to WildcardAddressManager - assertEquals(1, ad.getBindingsForRoutingAddress(SimpleString.toSimpleString("Topic1.topic")).getBindings().size()); + assertEquals(1, ad.getBindingsForRoutingAddress(SimpleString.of("Topic1.topic")).getBindings().size()); //Remove the address - ad.removeAddressInfo(SimpleString.toSimpleString("Topic1.#")); + ad.removeAddressInfo(SimpleString.of("Topic1.#")); - assertNull(ad.getAddressInfo(SimpleString.toSimpleString("Topic1.#"))); + assertNull(ad.getAddressInfo(SimpleString.of("Topic1.#"))); } @Test public void testWildCardAddRemoveBinding() throws Exception { WildcardAddressManager ad = new WildcardAddressManager(new BindingFactoryFake(), null, null); - SimpleString address = SimpleString.toSimpleString("Queue1.1"); - ad.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("Queue1.#"), RoutingType.ANYCAST)); + SimpleString address = SimpleString.of("Queue1.1"); + ad.addAddressInfo(new AddressInfo(SimpleString.of("Queue1.#"), RoutingType.ANYCAST)); BindingFake bindingFake = new BindingFake("Queue1.#", "one"); assertTrue(ad.addBinding(bindingFake)); @@ -163,7 +163,7 @@ public class WildcardAddressManagerUnitTest extends ActiveMQTestBase { public void testWildCardAddAlreadyExistingBindingShouldThrowException() throws Exception { assertThrows(ActiveMQQueueExistsException.class, () -> { WildcardAddressManager ad = new WildcardAddressManager(new BindingFactoryFake(), null, null); - ad.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("Queue1.#"), RoutingType.ANYCAST)); + ad.addAddressInfo(new AddressInfo(SimpleString.of("Queue1.#"), RoutingType.ANYCAST)); ad.addBinding(new BindingFake("Queue1.#", "one")); ad.addBinding(new BindingFake("Queue1.#", "one")); }); @@ -175,24 +175,24 @@ public class WildcardAddressManagerUnitTest extends ActiveMQTestBase { final WildcardConfiguration configuration = new WildcardConfiguration(); configuration.setAnyWords('>'); WildcardAddressManager ad = new WildcardAddressManager(new BindingFactoryFake(), configuration, null, null); - ad.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("Topic1.>"), RoutingType.MULTICAST)); - ad.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("Topic1.test"), RoutingType.MULTICAST)); + ad.addAddressInfo(new AddressInfo(SimpleString.of("Topic1.>"), RoutingType.MULTICAST)); + ad.addAddressInfo(new AddressInfo(SimpleString.of("Topic1.test"), RoutingType.MULTICAST)); ad.addBinding(new BindingFake("Topic1.>", "one")); - assertEquals(1, ad.getExistingBindingsForRoutingAddress(SimpleString.toSimpleString("Topic1.>")).getBindings().size()); - assertEquals(1, ad.getBindingsForRoutingAddress(SimpleString.toSimpleString("Topic1.test")).getBindings().size()); - assertEquals(0, ad.getDirectBindings(SimpleString.toSimpleString("Topic1.test")).size()); - assertEquals(1, ad.getDirectBindings(SimpleString.toSimpleString("Topic1.>")).size()); + assertEquals(1, ad.getExistingBindingsForRoutingAddress(SimpleString.of("Topic1.>")).getBindings().size()); + assertEquals(1, ad.getBindingsForRoutingAddress(SimpleString.of("Topic1.test")).getBindings().size()); + assertEquals(0, ad.getDirectBindings(SimpleString.of("Topic1.test")).size()); + assertEquals(1, ad.getDirectBindings(SimpleString.of("Topic1.>")).size()); //Remove the address - ad.removeAddressInfo(SimpleString.toSimpleString("Topic1.test")); + ad.removeAddressInfo(SimpleString.of("Topic1.test")); //should still have 1 address and binding assertEquals(1, ad.getAddresses().size()); assertEquals(1, ad.getBindings().count()); - ad.removeBinding(SimpleString.toSimpleString("one"), null); - ad.removeAddressInfo(SimpleString.toSimpleString("Topic1.>")); + ad.removeBinding(SimpleString.of("one"), null); + ad.removeAddressInfo(SimpleString.of("Topic1.>")); assertEquals(0, ad.getAddresses().size()); assertEquals(0, ad.getBindings().count()); @@ -204,82 +204,82 @@ public class WildcardAddressManagerUnitTest extends ActiveMQTestBase { final WildcardConfiguration configuration = new WildcardConfiguration(); configuration.setAnyWords('>'); WildcardAddressManager ad = new WildcardAddressManager(new BindingFactoryFake(), configuration, null, null); - ad.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("Topic1.>"), RoutingType.MULTICAST)); - ad.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("Topic1.test"), RoutingType.MULTICAST)); - ad.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("Topic1.test.test1"), RoutingType.MULTICAST)); - ad.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("Topic1.test.test2"), RoutingType.MULTICAST)); - ad.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("Topic2.>"), RoutingType.MULTICAST)); - ad.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("Topic2.test"), RoutingType.MULTICAST)); + ad.addAddressInfo(new AddressInfo(SimpleString.of("Topic1.>"), RoutingType.MULTICAST)); + ad.addAddressInfo(new AddressInfo(SimpleString.of("Topic1.test"), RoutingType.MULTICAST)); + ad.addAddressInfo(new AddressInfo(SimpleString.of("Topic1.test.test1"), RoutingType.MULTICAST)); + ad.addAddressInfo(new AddressInfo(SimpleString.of("Topic1.test.test2"), RoutingType.MULTICAST)); + ad.addAddressInfo(new AddressInfo(SimpleString.of("Topic2.>"), RoutingType.MULTICAST)); + ad.addAddressInfo(new AddressInfo(SimpleString.of("Topic2.test"), RoutingType.MULTICAST)); ad.addBinding(new BindingFake("Topic1.>", "one")); ad.addBinding(new BindingFake("Topic1.test", "two")); ad.addBinding(new BindingFake("Topic2.test", "three")); - assertEquals(1, ad.getExistingBindingsForRoutingAddress(SimpleString.toSimpleString("Topic1.>")).getBindings().size()); - assertEquals(2, ad.getBindingsForRoutingAddress(SimpleString.toSimpleString("Topic1.test")).getBindings().size()); - assertEquals(1, ad.getBindingsForRoutingAddress(SimpleString.toSimpleString("Topic1.test.test1")).getBindings().size()); - assertEquals(1, ad.getBindingsForRoutingAddress(SimpleString.toSimpleString("Topic1.test.test2")).getBindings().size()); + assertEquals(1, ad.getExistingBindingsForRoutingAddress(SimpleString.of("Topic1.>")).getBindings().size()); + assertEquals(2, ad.getBindingsForRoutingAddress(SimpleString.of("Topic1.test")).getBindings().size()); + assertEquals(1, ad.getBindingsForRoutingAddress(SimpleString.of("Topic1.test.test1")).getBindings().size()); + assertEquals(1, ad.getBindingsForRoutingAddress(SimpleString.of("Topic1.test.test2")).getBindings().size()); - assertEquals(1, ad.getDirectBindings(SimpleString.toSimpleString("Topic1.>")).size()); - assertEquals(1, ad.getDirectBindings(SimpleString.toSimpleString("Topic1.test")).size()); - assertEquals(0, ad.getDirectBindings(SimpleString.toSimpleString("Topic1.test1")).size()); - assertEquals(0, ad.getDirectBindings(SimpleString.toSimpleString("Topic1.test2")).size()); - assertEquals(0, ad.getDirectBindings(SimpleString.toSimpleString("Topic2.>")).size()); - assertEquals(1, ad.getDirectBindings(SimpleString.toSimpleString("Topic2.test")).size()); + assertEquals(1, ad.getDirectBindings(SimpleString.of("Topic1.>")).size()); + assertEquals(1, ad.getDirectBindings(SimpleString.of("Topic1.test")).size()); + assertEquals(0, ad.getDirectBindings(SimpleString.of("Topic1.test1")).size()); + assertEquals(0, ad.getDirectBindings(SimpleString.of("Topic1.test2")).size()); + assertEquals(0, ad.getDirectBindings(SimpleString.of("Topic2.>")).size()); + assertEquals(1, ad.getDirectBindings(SimpleString.of("Topic2.test")).size()); } @Test public void testSingleWordWildCardAddressBindingsForRouting() throws Exception { WildcardAddressManager ad = new WildcardAddressManager(new BindingFactoryFake(), null, null); - ad.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("news.*"), RoutingType.MULTICAST)); - ad.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("news.*.sport"), RoutingType.MULTICAST)); + ad.addAddressInfo(new AddressInfo(SimpleString.of("news.*"), RoutingType.MULTICAST)); + ad.addAddressInfo(new AddressInfo(SimpleString.of("news.*.sport"), RoutingType.MULTICAST)); ad.addBinding(new BindingFake("news.*", "one")); ad.addBinding(new BindingFake("news.*.sport", "two")); - Collection bindings = ad.getBindingsForRoutingAddress(SimpleString.toSimpleString("news.europe")).getBindings(); + Collection bindings = ad.getBindingsForRoutingAddress(SimpleString.of("news.europe")).getBindings(); assertEquals(1, bindings.size()); assertEquals("one", bindings.iterator().next().getUniqueName().toString()); - bindings = ad.getBindingsForRoutingAddress(SimpleString.toSimpleString("news.usa")).getBindings(); + bindings = ad.getBindingsForRoutingAddress(SimpleString.of("news.usa")).getBindings(); assertEquals(1, bindings.size()); assertEquals("one", bindings.iterator().next().getUniqueName().toString()); - bindings = ad.getBindingsForRoutingAddress(SimpleString.toSimpleString("news.europe.sport")).getBindings(); + bindings = ad.getBindingsForRoutingAddress(SimpleString.of("news.europe.sport")).getBindings(); assertEquals(1, bindings.size()); assertEquals("two", bindings.iterator().next().getUniqueName().toString()); - bindings = ad.getBindingsForRoutingAddress(SimpleString.toSimpleString("news.usa.sport")).getBindings(); + bindings = ad.getBindingsForRoutingAddress(SimpleString.of("news.usa.sport")).getBindings(); assertEquals(1, bindings.size()); assertEquals("two", bindings.iterator().next().getUniqueName().toString()); - assertNull(ad.getBindingsForRoutingAddress(SimpleString.toSimpleString("news.europe.fr.sport"))); + assertNull(ad.getBindingsForRoutingAddress(SimpleString.of("news.europe.fr.sport"))); } @Test public void testAnyWordsWildCardAddressBindingsForRouting() throws Exception { WildcardAddressManager ad = new WildcardAddressManager(new BindingFactoryFake(), null, null); - ad.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("news.europe.#"), RoutingType.MULTICAST)); + ad.addAddressInfo(new AddressInfo(SimpleString.of("news.europe.#"), RoutingType.MULTICAST)); ad.addBinding(new BindingFake("news.europe.#", "one")); - assertEquals(1, ad.getBindingsForRoutingAddress(SimpleString.toSimpleString("news.europe")).getBindings().size()); - assertEquals(1, ad.getBindingsForRoutingAddress(SimpleString.toSimpleString("news.europe.sport")).getBindings().size()); - assertEquals(1, ad.getBindingsForRoutingAddress(SimpleString.toSimpleString("news.europe.politics.fr")).getBindings().size()); - assertNull(ad.getBindingsForRoutingAddress(SimpleString.toSimpleString("news.usa"))); - assertNull(ad.getBindingsForRoutingAddress(SimpleString.toSimpleString("europe"))); + assertEquals(1, ad.getBindingsForRoutingAddress(SimpleString.of("news.europe")).getBindings().size()); + assertEquals(1, ad.getBindingsForRoutingAddress(SimpleString.of("news.europe.sport")).getBindings().size()); + assertEquals(1, ad.getBindingsForRoutingAddress(SimpleString.of("news.europe.politics.fr")).getBindings().size()); + assertNull(ad.getBindingsForRoutingAddress(SimpleString.of("news.usa"))); + assertNull(ad.getBindingsForRoutingAddress(SimpleString.of("europe"))); } @Test public void testAnyWordsMultipleWildCardsAddressBindingsForRouting() throws Exception { WildcardAddressManager ad = new WildcardAddressManager(new BindingFactoryFake(), null, null); - ad.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("news.#"), RoutingType.MULTICAST)); - ad.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("news.europe.#"), RoutingType.MULTICAST)); + ad.addAddressInfo(new AddressInfo(SimpleString.of("news.#"), RoutingType.MULTICAST)); + ad.addAddressInfo(new AddressInfo(SimpleString.of("news.europe.#"), RoutingType.MULTICAST)); ad.addBinding(new BindingFake("news.#", "one")); ad.addBinding(new BindingFake("news.europe.#", "two")); - assertEquals(2, ad.getBindingsForRoutingAddress(SimpleString.toSimpleString("news.europe")).getBindings().size()); - assertEquals(2, ad.getBindingsForRoutingAddress(SimpleString.toSimpleString("news.europe.sport")).getBindings().size()); - assertEquals(2, ad.getBindingsForRoutingAddress(SimpleString.toSimpleString("news.europe.politics.fr")).getBindings().size()); + assertEquals(2, ad.getBindingsForRoutingAddress(SimpleString.of("news.europe")).getBindings().size()); + assertEquals(2, ad.getBindingsForRoutingAddress(SimpleString.of("news.europe.sport")).getBindings().size()); + assertEquals(2, ad.getBindingsForRoutingAddress(SimpleString.of("news.europe.politics.fr")).getBindings().size()); - Collection bindings = ad.getBindingsForRoutingAddress(SimpleString.toSimpleString("news.usa")).getBindings(); + Collection bindings = ad.getBindingsForRoutingAddress(SimpleString.of("news.usa")).getBindings(); assertEquals(1, bindings.size()); assertEquals("one", bindings.iterator().next().getUniqueName().toString()); - assertNull(ad.getBindingsForRoutingAddress(SimpleString.toSimpleString("europe"))); + assertNull(ad.getBindingsForRoutingAddress(SimpleString.of("europe"))); } @Test @@ -293,45 +293,45 @@ public class WildcardAddressManagerUnitTest extends ActiveMQTestBase { ad.addBinding(new BindingFake("T.>", "2")); ad.addBinding(new BindingFake("T.>", "3")); - assertEquals(3, ad.getBindingsForRoutingAddress(SimpleString.toSimpleString("T.1")).getBindings().size()); - assertEquals(3, ad.getBindingsForRoutingAddress(SimpleString.toSimpleString("T.2")).getBindings().size()); - assertEquals(3, ad.getBindingsForRoutingAddress(SimpleString.toSimpleString("T.3")).getBindings().size()); + assertEquals(3, ad.getBindingsForRoutingAddress(SimpleString.of("T.1")).getBindings().size()); + assertEquals(3, ad.getBindingsForRoutingAddress(SimpleString.of("T.2")).getBindings().size()); + assertEquals(3, ad.getBindingsForRoutingAddress(SimpleString.of("T.3")).getBindings().size()); - assertEquals(3, ad.getExistingBindingsForRoutingAddress(SimpleString.toSimpleString("T.>")).getBindings().size()); + assertEquals(3, ad.getExistingBindingsForRoutingAddress(SimpleString.of("T.>")).getBindings().size()); ad.addBinding(new BindingFake("T.*", "10")); - assertEquals(1, ad.getExistingBindingsForRoutingAddress(SimpleString.toSimpleString("T.*")).getBindings().size()); + assertEquals(1, ad.getExistingBindingsForRoutingAddress(SimpleString.of("T.*")).getBindings().size()); // wildcard binding should not be added to existing matching wildcards, still 3 - assertEquals(3, ad.getExistingBindingsForRoutingAddress(SimpleString.toSimpleString("T.>")).getBindings().size()); + assertEquals(3, ad.getExistingBindingsForRoutingAddress(SimpleString.of("T.>")).getBindings().size()); - assertEquals(4, ad.getBindingsForRoutingAddress(SimpleString.toSimpleString("T.1")).getBindings().size()); - assertEquals(4, ad.getBindingsForRoutingAddress(SimpleString.toSimpleString("T.2")).getBindings().size()); - assertEquals(4, ad.getBindingsForRoutingAddress(SimpleString.toSimpleString("T.3")).getBindings().size()); + assertEquals(4, ad.getBindingsForRoutingAddress(SimpleString.of("T.1")).getBindings().size()); + assertEquals(4, ad.getBindingsForRoutingAddress(SimpleString.of("T.2")).getBindings().size()); + assertEquals(4, ad.getBindingsForRoutingAddress(SimpleString.of("T.3")).getBindings().size()); ad.addBinding(new BindingFake("T.1.>", "11")); - assertEquals(1, ad.getExistingBindingsForRoutingAddress(SimpleString.toSimpleString("T.1.>")).getBindings().size()); + assertEquals(1, ad.getExistingBindingsForRoutingAddress(SimpleString.of("T.1.>")).getBindings().size()); - assertEquals(5, ad.getBindingsForRoutingAddress(SimpleString.toSimpleString("T.1")).getBindings().size()); - assertEquals(4, ad.getBindingsForRoutingAddress(SimpleString.toSimpleString("T.2")).getBindings().size()); - assertEquals(4, ad.getBindingsForRoutingAddress(SimpleString.toSimpleString("T.3")).getBindings().size()); + assertEquals(5, ad.getBindingsForRoutingAddress(SimpleString.of("T.1")).getBindings().size()); + assertEquals(4, ad.getBindingsForRoutingAddress(SimpleString.of("T.2")).getBindings().size()); + assertEquals(4, ad.getBindingsForRoutingAddress(SimpleString.of("T.3")).getBindings().size()); ad.addBinding(new BindingFake("T.1.2", "12")); - assertEquals(5, ad.getBindingsForRoutingAddress(SimpleString.toSimpleString("T.1.2")).getBindings().size()); + assertEquals(5, ad.getBindingsForRoutingAddress(SimpleString.of("T.1.2")).getBindings().size()); ad.addBinding(new BindingFake("T.1.2.3.4", "13")); - assertEquals(5, ad.getBindingsForRoutingAddress(SimpleString.toSimpleString("T.1.2.3.4")).getBindings().size()); + assertEquals(5, ad.getBindingsForRoutingAddress(SimpleString.of("T.1.2.3.4")).getBindings().size()); ad.addBinding(new BindingFake("T.>.4", "14")); - assertEquals(6, ad.getBindingsForRoutingAddress(SimpleString.toSimpleString("T.1.2.3.4")).getBindings().size()); + assertEquals(6, ad.getBindingsForRoutingAddress(SimpleString.of("T.1.2.3.4")).getBindings().size()); ad.addBinding(new BindingFake("T.1.A.3.4", "15")); - assertEquals(6, ad.getBindingsForRoutingAddress(SimpleString.toSimpleString("T.1.A.3.4")).getBindings().size()); + assertEquals(6, ad.getBindingsForRoutingAddress(SimpleString.of("T.1.A.3.4")).getBindings().size()); } @@ -341,7 +341,7 @@ public class WildcardAddressManagerUnitTest extends ActiveMQTestBase { configuration.setAnyWords('>'); final WildcardAddressManager ad = new WildcardAddressManager(new BindingFactoryFake(), configuration, null, null); - final SimpleString wildCard = SimpleString.toSimpleString("Topic1.>"); + final SimpleString wildCard = SimpleString.of("Topic1.>"); ad.addAddressInfo(new AddressInfo(wildCard, RoutingType.MULTICAST)); AtomicReference oops = new AtomicReference<>(); @@ -358,10 +358,10 @@ public class WildcardAddressManagerUnitTest extends ActiveMQTestBase { // add/remove is externally sync via postOffice synchronized (executorService) { // subscribe as wildcard - ad.addBinding(new BindingFake(SimpleString.toSimpleString("Topic1.>"), SimpleString.toSimpleString("" + id))); + ad.addBinding(new BindingFake(SimpleString.of("Topic1.>"), SimpleString.of("" + id))); } - SimpleString pubAddr = SimpleString.toSimpleString("Topic1." + id ); + SimpleString pubAddr = SimpleString.of("Topic1." + id ); // publish to new address, will create ad.getBindingsForRoutingAddress(pubAddr); @@ -399,7 +399,7 @@ public class WildcardAddressManagerUnitTest extends ActiveMQTestBase { final SimpleString id; BindingFake(String addressParameter, String id) { - this(SimpleString.toSimpleString(addressParameter), SimpleString.toSimpleString(id)); + this(SimpleString.of(addressParameter), SimpleString.of(id)); } BindingFake(SimpleString addressParameter, SimpleString id) { diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/ActiveMQBufferTestBase.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/ActiveMQBufferTestBase.java index 7be76d5822..7d282af061 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/ActiveMQBufferTestBase.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/ActiveMQBufferTestBase.java @@ -83,7 +83,7 @@ public abstract class ActiveMQBufferTestBase extends ActiveMQTestBase { @Test public void testEmptySimpleString() throws Exception { - SimpleString emptySimpleString = new SimpleString(""); + SimpleString emptySimpleString = SimpleString.of(""); SimpleString result = putAndGetNullableSimpleString(emptySimpleString); assertNotNull(result); diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/cluster/impl/RemoteQueueBindImplTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/cluster/impl/RemoteQueueBindImplTest.java index 84ca9f58e6..1efd8de7b0 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/cluster/impl/RemoteQueueBindImplTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/cluster/impl/RemoteQueueBindImplTest.java @@ -43,7 +43,7 @@ public class RemoteQueueBindImplTest extends ActiveMQTestBase { final SimpleString uniqueName = RandomUtil.randomSimpleString(); final SimpleString routingName = RandomUtil.randomSimpleString(); final Long remoteQueueID = RandomUtil.randomLong(); - final SimpleString filterString = new SimpleString("A>B"); + final SimpleString filterString = SimpleString.of("A>B"); final Queue storeAndForwardQueue = new FakeQueue(null); final SimpleString bridgeName = RandomUtil.randomSimpleString(); final int distance = 0; @@ -67,17 +67,17 @@ public class RemoteQueueBindImplTest extends ActiveMQTestBase { @Test public void testAddRemoveConsumer() throws Exception { - testAddRemoveConsumerWithFilter(i -> new SimpleString("B" + i + " SimpleString.of("B" + i + " new SimpleString("B" + 0 + " SimpleString.of("B" + 0 + " new SimpleString(""), 1, 0); + testAddRemoveConsumerWithFilter(i -> SimpleString.of(""), 1, 0); } @Test @@ -92,7 +92,7 @@ public class RemoteQueueBindImplTest extends ActiveMQTestBase { final SimpleString uniqueName = RandomUtil.randomSimpleString(); final SimpleString routingName = RandomUtil.randomSimpleString(); final Long remoteQueueID = RandomUtil.randomLong(); - final SimpleString filterString = new SimpleString("A>B"); + final SimpleString filterString = SimpleString.of("A>B"); final Queue storeAndForwardQueue = new FakeQueue(null); final SimpleString bridgeName = RandomUtil.randomSimpleString(); final int distance = 0; diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/group/impl/SystemPropertyOverrideTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/group/impl/SystemPropertyOverrideTest.java index a23a185cf9..ddb6094739 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/group/impl/SystemPropertyOverrideTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/group/impl/SystemPropertyOverrideTest.java @@ -33,7 +33,7 @@ public class SystemPropertyOverrideTest extends ActiveMQTestBase { System.setProperty(GroupingHandlerConfiguration.GROUP_TIMEOUT_PROP_NAME, groupTimeoutPropertyValue); System.setProperty(GroupingHandlerConfiguration.REAPER_PERIOD_PROP_NAME, reaperPeriodPropertyValue); - GroupingHandlerConfiguration groupingHandlerConfiguration = new GroupingHandlerConfiguration().setName(new SimpleString("test")).setType(GroupingHandlerConfiguration.TYPE.LOCAL).setAddress(new SimpleString("address")); + GroupingHandlerConfiguration groupingHandlerConfiguration = new GroupingHandlerConfiguration().setName(SimpleString.of("test")).setType(GroupingHandlerConfiguration.TYPE.LOCAL).setAddress(SimpleString.of("address")); assertEquals(groupingHandlerConfiguration.getGroupTimeout(), Long.parseLong(groupTimeoutPropertyValue)); assertEquals(groupingHandlerConfiguration.getReaperPeriod(), Long.parseLong(reaperPeriodPropertyValue)); 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 10b9d79a66..e98315b29b 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 @@ -98,13 +98,13 @@ public class QueueImplTest extends ActiveMQTestBase { super.tearDown(); } - private static final SimpleString queue1 = new SimpleString("queue1"); + private static final SimpleString queue1 = SimpleString.of("queue1"); - private static final SimpleString address1 = new SimpleString("address1"); + private static final SimpleString address1 = SimpleString.of("address1"); @Test public void testName() { - final SimpleString name = new SimpleString("oobblle"); + final SimpleString name = SimpleString.of("oobblle"); QueueImpl queue = getNamedQueue(name); @@ -751,13 +751,13 @@ public class QueueImplTest extends ActiveMQTestBase { MessageReference ref1 = generateReference(queue, 1); - ref1.getMessage().putStringProperty(new SimpleString("fruit"), new SimpleString("banana")); + ref1.getMessage().putStringProperty(SimpleString.of("fruit"), SimpleString.of("banana")); queue.addTail(ref1); MessageReference ref2 = generateReference(queue, 2); - ref2.getMessage().putStringProperty(new SimpleString("fruit"), new SimpleString("orange")); + ref2.getMessage().putStringProperty(SimpleString.of("fruit"), SimpleString.of("orange")); queue.addTail(ref2); @@ -787,13 +787,13 @@ public class QueueImplTest extends ActiveMQTestBase { MessageReference ref3 = generateReference(queue, 3); - ref3.getMessage().putStringProperty(new SimpleString("fruit"), new SimpleString("banana")); + ref3.getMessage().putStringProperty(SimpleString.of("fruit"), SimpleString.of("banana")); queue.addTail(ref3); MessageReference ref4 = generateReference(queue, 4); - ref4.getMessage().putStringProperty(new SimpleString("fruit"), new SimpleString("orange")); + ref4.getMessage().putStringProperty(SimpleString.of("fruit"), SimpleString.of("orange")); queue.addTail(ref4); @@ -1113,25 +1113,25 @@ public class QueueImplTest extends ActiveMQTestBase { MessageReference ref1 = generateReference(queue, 1); - ref1.getMessage().putStringProperty(new SimpleString("fruit"), new SimpleString("banana")); + ref1.getMessage().putStringProperty(SimpleString.of("fruit"), SimpleString.of("banana")); queue.addTail(ref1); MessageReference ref2 = generateReference(queue, 2); - ref2.getMessage().putStringProperty(new SimpleString("cheese"), new SimpleString("stilton")); + ref2.getMessage().putStringProperty(SimpleString.of("cheese"), SimpleString.of("stilton")); queue.addTail(ref2); MessageReference ref3 = generateReference(queue, 3); - ref3.getMessage().putStringProperty(new SimpleString("cake"), new SimpleString("sponge")); + ref3.getMessage().putStringProperty(SimpleString.of("cake"), SimpleString.of("sponge")); queue.addTail(ref3); MessageReference ref4 = generateReference(queue, 4); - ref4.getMessage().putStringProperty(new SimpleString("fruit"), new SimpleString("orange")); + ref4.getMessage().putStringProperty(SimpleString.of("fruit"), SimpleString.of("orange")); refs.add(ref4); @@ -1139,13 +1139,13 @@ public class QueueImplTest extends ActiveMQTestBase { MessageReference ref5 = generateReference(queue, 5); - ref5.getMessage().putStringProperty(new SimpleString("fruit"), new SimpleString("apple")); + ref5.getMessage().putStringProperty(SimpleString.of("fruit"), SimpleString.of("apple")); queue.addTail(ref5); MessageReference ref6 = generateReference(queue, 6); - ref6.getMessage().putStringProperty(new SimpleString("fruit"), new SimpleString("orange")); + ref6.getMessage().putStringProperty(SimpleString.of("fruit"), SimpleString.of("orange")); refs.add(ref6); @@ -1425,7 +1425,7 @@ public class QueueImplTest extends ActiveMQTestBase { factory.close(); locator.close(); - Queue queue = ((LocalQueueBinding) server.getPostOffice().getBinding(new SimpleString(MY_QUEUE))).getQueue(); + Queue queue = ((LocalQueueBinding) server.getPostOffice().getBinding(SimpleString.of(MY_QUEUE))).getQueue(); LinkedListIterator totalIterator = queue.browserIterator(); try { @@ -1478,14 +1478,14 @@ public class QueueImplTest extends ActiveMQTestBase { throw new AssertionError(); } }; - final QueueImpl queue = new QueueImpl(1, new SimpleString("address1"), QueueImplTest.queue1, + final QueueImpl queue = new QueueImpl(1, SimpleString.of("address1"), QueueImplTest.queue1, null, null, false, true, false, scheduledExecutor, null, null, null, ArtemisExecutor.delegate(executor), defaultServer, null); queue.addConsumer(groupConsumer); queue.addConsumer(noConsumer); final MessageReference firstMessageReference = generateReference(queue, 1); - final SimpleString groupName = SimpleString.toSimpleString("group"); + final SimpleString groupName = SimpleString.of("group"); firstMessageReference.getMessage().putStringProperty(Message.HDR_GROUP_ID, groupName); final MessageReference secondMessageReference = generateReference(queue, 2); secondMessageReference.getMessage().putStringProperty(Message.HDR_GROUP_ID, groupName);