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 d9ee1c69d4..d06ff8edd7 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 @@ -20,6 +20,14 @@ import org.apache.activemq.artemis.api.core.SimpleString; public class CompositeAddress { + public static SimpleString toFullQN(SimpleString address, SimpleString qName) { + return address.concat(SEPARATOR).concat(qName); + } + + public static String toFullQN(String address, String qName) { + return address + SEPARATOR + qName; + } + public static String SEPARATOR = "::"; private final String address; private final String queueName; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/ProtonFullQualifiedNameTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/ProtonFullQualifiedNameTest.java index aa2528a965..22ba64dfc2 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/ProtonFullQualifiedNameTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/ProtonFullQualifiedNameTest.java @@ -29,7 +29,7 @@ import org.apache.activemq.artemis.core.postoffice.Bindings; import org.apache.activemq.artemis.core.postoffice.impl.LocalQueueBinding; import org.apache.activemq.artemis.core.server.QueueQueryResult; import org.apache.activemq.artemis.core.settings.impl.AddressSettings; -import org.apache.activemq.artemis.tests.util.FQQN; +import org.apache.activemq.artemis.utils.CompositeAddress; import org.apache.qpid.jms.JmsConnectionFactory; import org.junit.After; import org.junit.Before; @@ -122,9 +122,9 @@ public class ProtonFullQualifiedNameTest extends ProtonTestBase { System.out.println("checking binidng " + b.getUniqueName() + " " + ((LocalQueueBinding)b).getQueue().getDeliveringMessages()); SimpleString qName = b.getUniqueName(); //do FQQN query - QueueQueryResult result = server.queueQuery(FQQN.toFullQN(multicastAddress, qName)); + QueueQueryResult result = server.queueQuery(CompositeAddress.toFullQN(multicastAddress, qName)); assertTrue(result.isExists()); - assertEquals(result.getName(), FQQN.toFullQN(multicastAddress, qName)); + assertEquals(result.getName(), CompositeAddress.toFullQN(multicastAddress, qName)); //do qname query result = server.queueQuery(qName); assertTrue(result.isExists()); @@ -146,9 +146,9 @@ public class ProtonFullQualifiedNameTest extends ProtonTestBase { connection.start(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - Queue q1 = session.createQueue(FQQN.toFullQN(anycastAddress, anycastQ1).toString()); - Queue q2 = session.createQueue(FQQN.toFullQN(anycastAddress, anycastQ2).toString()); - Queue q3 = session.createQueue(FQQN.toFullQN(anycastAddress, anycastQ3).toString()); + Queue q1 = session.createQueue(CompositeAddress.toFullQN(anycastAddress, anycastQ1).toString()); + Queue q2 = session.createQueue(CompositeAddress.toFullQN(anycastAddress, anycastQ2).toString()); + Queue q3 = session.createQueue(CompositeAddress.toFullQN(anycastAddress, anycastQ3).toString()); //send 3 messages to anycastAddress ClientSessionFactory cf = createSessionFactory(locator); @@ -171,10 +171,10 @@ public class ProtonFullQualifiedNameTest extends ProtonTestBase { //queues are empty now for (SimpleString q : new SimpleString[]{anycastQ1, anycastQ2, anycastQ3}) { //FQQN query - QueueQueryResult query = server.queueQuery(FQQN.toFullQN(anycastAddress, q)); + QueueQueryResult query = server.queueQuery(CompositeAddress.toFullQN(anycastAddress, q)); assertTrue(query.isExists()); assertEquals(anycastAddress, query.getAddress()); - assertEquals(FQQN.toFullQN(anycastAddress, q), query.getName()); + assertEquals(CompositeAddress.toFullQN(anycastAddress, q), query.getName()); assertEquals(0, query.getMessageCount()); //try query again using qName query = server.queueQuery(q); @@ -195,7 +195,7 @@ public class ProtonFullQualifiedNameTest extends ProtonTestBase { Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); //::queue ok! - String specialName = FQQN.toFullQN(new SimpleString(""), anycastQ1).toString(); + String specialName = CompositeAddress.toFullQN(new SimpleString(""), anycastQ1).toString(); Queue q1 = session.createQueue(specialName); ClientSessionFactory cf = createSessionFactory(locator); @@ -210,7 +210,7 @@ public class ProtonFullQualifiedNameTest extends ProtonTestBase { assertNotNull(consumer1.receive(2000)); //queue:: - specialName = FQQN.toFullQN(anycastQ1, new SimpleString("")).toString(); + specialName = CompositeAddress.toFullQN(anycastQ1, new SimpleString("")).toString(); q1 = session.createQueue(specialName); try { session.createConsumer(q1); @@ -220,7 +220,7 @@ public class ProtonFullQualifiedNameTest extends ProtonTestBase { } //:: - specialName = FQQN.toFullQN(new SimpleString(""), new SimpleString("")).toString(); + specialName = CompositeAddress.toFullQN(new SimpleString(""), new SimpleString("")).toString(); q1 = session.createQueue(specialName); try { session.createConsumer(q1); 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 866b4a0721..44be8054d8 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 @@ -39,7 +39,6 @@ import org.apache.activemq.artemis.core.postoffice.Binding; import org.apache.activemq.artemis.core.postoffice.Bindings; import org.apache.activemq.artemis.core.postoffice.impl.LocalQueueBinding; import org.apache.activemq.artemis.core.server.QueueQueryResult; -import org.apache.activemq.artemis.tests.util.FQQN; import org.apache.activemq.artemis.utils.CompositeAddress; import org.junit.Test; import org.junit.runner.RunWith; @@ -114,9 +113,9 @@ public class FQQNOpenWireTest extends OpenWireTestBase { System.out.println("checking binidng " + b.getUniqueName() + " " + ((LocalQueueBinding)b).getQueue().getDeliveringMessages()); SimpleString qName = b.getUniqueName(); //do FQQN query - QueueQueryResult result = server.queueQuery(FQQN.toFullQN(multicastAddress, qName)); + QueueQueryResult result = server.queueQuery(CompositeAddress.toFullQN(multicastAddress, qName)); assertTrue(result.isExists()); - assertEquals(result.getName(), FQQN.toFullQN(multicastAddress, qName)); + assertEquals(result.getName(), CompositeAddress.toFullQN(multicastAddress, qName)); //do qname query result = server.queueQuery(qName); assertTrue(result.isExists()); @@ -141,9 +140,9 @@ public class FQQNOpenWireTest extends OpenWireTestBase { connection.start(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - Queue q1 = session.createQueue(FQQN.toFullQN(anycastAddress, anycastQ1).toString()); - Queue q2 = session.createQueue(FQQN.toFullQN(anycastAddress, anycastQ2).toString()); - Queue q3 = session.createQueue(FQQN.toFullQN(anycastAddress, anycastQ3).toString()); + Queue q1 = session.createQueue(CompositeAddress.toFullQN(anycastAddress, anycastQ1).toString()); + Queue q2 = session.createQueue(CompositeAddress.toFullQN(anycastAddress, anycastQ2).toString()); + Queue q3 = session.createQueue(CompositeAddress.toFullQN(anycastAddress, anycastQ3).toString()); //send 3 messages to anycastAddress locator = createNonHALocator(true); @@ -168,10 +167,10 @@ public class FQQNOpenWireTest extends OpenWireTestBase { //queues are empty now for (SimpleString q : new SimpleString[]{anycastQ1, anycastQ2, anycastQ3}) { //FQQN query - QueueQueryResult query = server.queueQuery(FQQN.toFullQN(anycastAddress, q)); + QueueQueryResult query = server.queueQuery(CompositeAddress.toFullQN(anycastAddress, q)); assertTrue(query.isExists()); assertEquals(anycastAddress, query.getAddress()); - assertEquals(FQQN.toFullQN(anycastAddress, q), query.getName()); + assertEquals(CompositeAddress.toFullQN(anycastAddress, q), query.getName()); assertEquals(0, query.getMessageCount()); //try query again using qName query = server.queueQuery(q); @@ -209,7 +208,7 @@ public class FQQNOpenWireTest extends OpenWireTestBase { producer.send(message); - Destination destinationFQN = session.createQueue(FQQN.toFullQN(durableQueue, durableQueue).toString()); + Destination destinationFQN = session.createQueue(CompositeAddress.toFullQN(durableQueue, durableQueue).toString()); MessageConsumer messageConsumer = session.createConsumer(destinationFQN); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/FQQN.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/FQQN.java deleted file mode 100644 index 50839c591e..0000000000 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/FQQN.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.activemq.artemis.tests.util; - -import org.apache.activemq.artemis.api.core.SimpleString; -import org.apache.activemq.artemis.utils.CompositeAddress; - -public final class FQQN { - - public static SimpleString toFullQN(SimpleString address, SimpleString qName) { - return address.concat(CompositeAddress.SEPARATOR).concat(qName); - } - - public static String toFullQN(String address, String qName) { - return address + CompositeAddress.SEPARATOR + qName; - } -}