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 1fc85113ef..6d4abc40fb 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 @@ -207,13 +207,13 @@ public class AMQPSessionCallback implements SessionCallback { public QueueQueryResult queueQuery(String queueName, boolean autoCreate) throws Exception { QueueQueryResult queueQueryResult = serverSession.executeQueueQuery(SimpleString.toSimpleString(queueName)); - if (!queueQueryResult.isExists() && queueQueryResult.isAutoCreateJmsQueues() && autoCreate) { + if (!queueQueryResult.isExists() && queueQueryResult.isAutoCreateQueues() && autoCreate) { try { serverSession.createQueue(new SimpleString(queueName), new SimpleString(queueName), null, false, true); } catch (ActiveMQQueueExistsException e) { // The queue may have been created by another thread in the mean time. Catch and do nothing. } - queueQueryResult = new QueueQueryResult(queueQueryResult.getName(), queueQueryResult.getAddress(), queueQueryResult.isDurable(), queueQueryResult.isTemporary(), queueQueryResult.getFilterString(), queueQueryResult.getConsumerCount(), queueQueryResult.getMessageCount(), queueQueryResult.isAutoCreateJmsQueues(), true); + queueQueryResult = new QueueQueryResult(queueQueryResult.getName(), queueQueryResult.getAddress(), queueQueryResult.isDurable(), queueQueryResult.isTemporary(), queueQueryResult.getFilterString(), queueQueryResult.getConsumerCount(), queueQueryResult.getMessageCount(), queueQueryResult.isAutoCreateQueues(), true, queueQueryResult.isAutoCreated(), queueQueryResult.isDeleteOnNoConsumers(), queueQueryResult.getRoutingType(), queueQueryResult.getMaxConsumers()); } return queueQueryResult; } 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 c04fc0b356..6c373ec311 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 @@ -51,9 +51,13 @@ public class AddressCommandTest extends JMSTestBase { String address = "address"; CreateAddress command = new CreateAddress(); command.setName(address); + command.setRoutingTypes(RoutingType.ANYCAST.toString() + "," + RoutingType.MULTICAST.toString()); command.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error))); checkExecutionPassed(command); - assertNotNull(server.getAddressInfo(new SimpleString(address))); + AddressInfo addressInfo = server.getAddressInfo(new SimpleString(address)); + assertNotNull(addressInfo); + assertTrue(addressInfo.getRoutingTypes().contains(RoutingType.ANYCAST)); + assertTrue(addressInfo.getRoutingTypes().contains(RoutingType.MULTICAST)); } @Test 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 08820784f2..2242cfcf6e 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 @@ -234,7 +234,7 @@ public class SessionTest extends ActiveMQTestBase { ClientSession clientSession = cf.createSession(false, true, true); QueueQuery resp = clientSession.queueQuery(new SimpleString(queueName)); Assert.assertFalse(resp.isExists()); - Assert.assertFalse(resp.isAutoCreateJmsQueues()); + Assert.assertFalse(resp.isAutoCreateQueues()); Assert.assertEquals(null, resp.getAddress()); clientSession.close(); } 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 ba7ddd4ff7..6fda0ac892 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 @@ -57,7 +57,7 @@ public class AnycastRoutingWithClusterTest extends ClusterTestBase { for (int i = 0; i < 3; i++) { createAddressInfo(i, address, RoutingType.ANYCAST, -1, false); setupSessionFactory(i, isNetty()); - createQueue(i, address, queueName, null, false); + createQueue(i, address, queueName, null, false, RoutingType.ANYCAST); addConsumer(i, i, queueName, null); } @@ -118,7 +118,7 @@ public class AnycastRoutingWithClusterTest extends ClusterTestBase { for (int i = 0; i < 3; i++) { createAddressInfo(i, address, RoutingType.ANYCAST, -1, false); setupSessionFactory(i, isNetty()); - createQueue(i, address, queueNamePrefix + i, null, false); + createQueue(i, address, queueNamePrefix + i, null, false, RoutingType.ANYCAST); addConsumer(i, i, queueNamePrefix + i, null); } @@ -184,9 +184,9 @@ public class AnycastRoutingWithClusterTest extends ClusterTestBase { String filter1 = "giraffe"; String filter2 = "platypus"; - createQueue(0, address, queueNamePrefix + 0, filter1, false); - createQueue(1, address, queueNamePrefix + 1, filter1, false); - createQueue(2, address, queueNamePrefix + 2, filter2, false); + createQueue(0, address, queueNamePrefix + 0, filter1, false, RoutingType.ANYCAST); + createQueue(1, address, queueNamePrefix + 1, filter1, false, RoutingType.ANYCAST); + createQueue(2, address, queueNamePrefix + 2, filter2, false, RoutingType.ANYCAST); for (int i = 0; i < 3; i++) { addConsumer(i, i, queueNamePrefix + i, null); 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 49482d85bd..e3a39f201c 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 @@ -492,6 +492,15 @@ public abstract class ClusterTestBase extends ActiveMQTestBase { createQueue(node, address, queueName, filterVal, durable, null, null); } + protected void createQueue(final int node, + final String address, + final String queueName, + final String filterVal, + final boolean durable, + RoutingType routingType) throws Exception { + createQueue(node, address, queueName, filterVal, durable, null, null, routingType); + } + protected void createQueue(final int node, final String address, final String queueName, @@ -499,6 +508,17 @@ public abstract class ClusterTestBase extends ActiveMQTestBase { final boolean durable, final String user, final String password) throws Exception { + createQueue(node, address, queueName, filterVal, durable, user, password, RoutingType.MULTICAST); + } + + protected void createQueue(final int node, + final String address, + final String queueName, + final String filterVal, + final boolean durable, + final String user, + final String password, + RoutingType routingType) throws Exception { ClientSessionFactory sf = sfs[node]; if (sf == null) { @@ -515,7 +535,7 @@ public abstract class ClusterTestBase extends ActiveMQTestBase { log.info("Creating " + queueName + " , address " + address + " on " + servers[node]); - session.createQueue(address, queueName, filterString, durable); + session.createQueue(address, routingType, queueName, filterString, durable); session.close(); } 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 f6ad723a56..dd8b7ce41f 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 @@ -49,6 +49,7 @@ import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionCre import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionReceiveMessage; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionSendMessage; import org.apache.activemq.artemis.core.server.ActiveMQServer; +import org.apache.activemq.artemis.core.server.RoutingType; import org.apache.activemq.artemis.core.server.ServerMessage; import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection; @@ -1052,7 +1053,7 @@ public class InterceptorTest extends ActiveMQTestBase { public void testInterceptorOnURI() throws Exception { locator.close(); - server.createQueue(QUEUE, QUEUE, null, true, false); + server.createQueue(QUEUE, RoutingType.ANYCAST, QUEUE, null, true, false); String uri = "tcp://localhost:61616?incomingInterceptorList=" + Incoming.class.getCanonicalName() + "&outgoingInterceptorList=" + Outgoing.class.getName(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/ActiveMQConnectionFactoryTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/ActiveMQConnectionFactoryTest.java index 37e55c0ca7..7b6f7cfed4 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 @@ -45,6 +45,7 @@ import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServers; +import org.apache.activemq.artemis.core.server.RoutingType; import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger; import org.apache.activemq.artemis.tests.integration.jms.serializables.TestClass1; @@ -243,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); - liveService.createQueue(qaddr, qaddr, null, true, false); + liveService.createQueue(qaddr, RoutingType.ANYCAST, qaddr, null, true, false); //default ok String blackList = null; @@ -316,7 +317,7 @@ public class ActiveMQConnectionFactoryTest extends ActiveMQTestBase { String qname = "SerialTestQueue"; SimpleString qaddr = new SimpleString(qname); - liveService.createQueue(qaddr, qaddr, null, true, false); + liveService.createQueue(qaddr, RoutingType.ANYCAST, qaddr, null, true, false); try { String blackList = null; 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 538260eee0..6f9e9fc624 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 @@ -43,6 +43,7 @@ import org.apache.activemq.artemis.core.registry.JndiBindingRegistry; import org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.NodeManager; +import org.apache.activemq.artemis.core.server.RoutingType; import org.apache.activemq.artemis.core.server.impl.InVMNodeManager; import org.apache.activemq.artemis.jms.client.ActiveMQConnection; import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; @@ -133,7 +134,7 @@ public class JMSFailoverListenerTest extends ActiveMQTestBase { SimpleString jmsQueueName = new SimpleString("myqueue"); - coreSession.createQueue(jmsQueueName, jmsQueueName, null, true); + coreSession.createQueue(jmsQueueName, RoutingType.ANYCAST, jmsQueueName, null, true); Queue queue = sess.createQueue("myqueue"); @@ -206,7 +207,7 @@ public class JMSFailoverListenerTest extends ActiveMQTestBase { SimpleString jmsQueueName = new SimpleString("myqueue"); - coreSessionLive.createQueue(jmsQueueName, jmsQueueName, null, true); + coreSessionLive.createQueue(jmsQueueName, RoutingType.ANYCAST, jmsQueueName, null, true); Queue queue = sessLive.createQueue("myqueue"); 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 92741e7474..da05fae672 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 @@ -39,6 +39,7 @@ import org.apache.activemq.artemis.api.jms.JMSFactoryType; import org.apache.activemq.artemis.core.client.impl.ClientSessionInternal; import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServers; +import org.apache.activemq.artemis.core.server.RoutingType; import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; import org.apache.activemq.artemis.jms.client.ActiveMQSession; import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection; @@ -100,7 +101,7 @@ public class JMSReconnectTest extends ActiveMQTestBase { SimpleString jmsQueueName = new SimpleString("myqueue"); - coreSession.createQueue(jmsQueueName, jmsQueueName, null, true); + coreSession.createQueue(jmsQueueName, RoutingType.ANYCAST, jmsQueueName, null, true); Queue queue = sess.createQueue("myqueue"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java index 193c58ca02..5e02ff8e9a 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java @@ -566,7 +566,7 @@ public class ActiveMQServerControlUsingCoreTest extends ActiveMQServerControlTes @Override public void createAddress(@Parameter(name = "name", desc = "The name of the address") String name, - @Parameter(name = "deliveryMode", desc = "The delivery modes enabled for this address'") Object[] routingTypes) throws Exception { + @Parameter(name = "routingType", desc = "The delivery modes enabled for this address'") Object[] routingTypes) throws Exception { } 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 2829d80412..21b2c6db7f 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 @@ -833,7 +833,7 @@ public class SecurityTest extends ActiveMQTestBase { HierarchicalRepository> securityRepository = server.getSecurityRepository(); ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager(); securityManager.getConfiguration().addUser("auser", "pass"); - Role role = new Role("arole", false, false, true, true, false, false, false, false, false, false); + Role role = new Role("arole", false, false, true, true, false, false, false, false, false, true); Set roles = new HashSet<>(); roles.add(role); securityRepository.addMatch(SecurityTest.addressA, roles); @@ -923,7 +923,7 @@ public class SecurityTest extends ActiveMQTestBase { HierarchicalRepository> securityRepository = server.getSecurityRepository(); ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager(); securityManager.getConfiguration().addUser("auser", "pass"); - Role role = new Role("arole", false, false, false, false, true, true, false, false, false, false); + Role role = new Role("arole", false, false, false, false, true, true, false, false, false, true); Set roles = new HashSet<>(); roles.add(role); securityRepository.addMatch(SecurityTest.addressA, roles); diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/QueueTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/QueueTest.java index f47dfb690f..3f9e548d7a 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/QueueTest.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/QueueTest.java @@ -47,7 +47,7 @@ public class QueueTest extends JMSTestCase { conn.start(); p.send(s.createTextMessage("payload")); - TextMessage m = (TextMessage) c.receive(); + TextMessage m = (TextMessage) c.receive(5000); ProxyAssertSupport.assertEquals("payload", m.getText()); } finally { diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/MessageHeaderTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/MessageHeaderTest.java index 90b4d3e9e5..71bc8a14ed 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/MessageHeaderTest.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/MessageHeaderTest.java @@ -275,7 +275,7 @@ public class MessageHeaderTest extends MessageHeaderTestBase { propNames.add(propName); } - ProxyAssertSupport.assertEquals(9, propNames.size()); + ProxyAssertSupport.assertTrue(propNames.size() >= 9); ProxyAssertSupport.assertTrue(propNames.contains("myBool")); ProxyAssertSupport.assertTrue(propNames.contains("myByte")); diff --git a/tests/joram-tests/src/test/java/org/apache/activemq/artemis/common/AbstractAdmin.java b/tests/joram-tests/src/test/java/org/apache/activemq/artemis/common/AbstractAdmin.java index 8ea78288ac..2ada3bea7e 100644 --- a/tests/joram-tests/src/test/java/org/apache/activemq/artemis/common/AbstractAdmin.java +++ b/tests/joram-tests/src/test/java/org/apache/activemq/artemis/common/AbstractAdmin.java @@ -34,6 +34,7 @@ import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.api.core.management.ManagementHelper; import org.apache.activemq.artemis.api.core.management.ResourceNames; import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory; +import org.apache.activemq.artemis.core.server.RoutingType; import org.apache.activemq.artemis.tests.util.SpawnedVMSupport; import org.objectweb.jtests.jms.admin.Admin; @@ -119,7 +120,7 @@ public class AbstractAdmin implements Admin { public void createQueue(final String name) { Boolean result; try { - invokeSyncOperation(ResourceNames.BROKER, "createQueue", name, name); + invokeSyncOperation(ResourceNames.BROKER, "createQueue", name, RoutingType.ANYCAST.toString(), name, null, true, ActiveMQDefaultConfiguration.getDefaultMaxQueueConsumers(), ActiveMQDefaultConfiguration.getDefaultDeleteQueueOnNoConsumers(), true); } catch (Exception e) { throw new IllegalStateException(e); }